@jingyi0605/codingns 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/assets/TerminalPage-CVG1cGAJ.js +55 -0
- package/dist/public/assets/index-BUPByQPG.css +1 -0
- package/dist/public/assets/index-D1CwTkI2.js +106 -0
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.js +51 -7
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +4 -1
- package/dist/server/modules/sessions/session-history-service.js +152 -35
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.js +4 -0
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/ws/ws-server.js +55 -3
- package/dist/server/ws/ws-server.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +4 -1
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +65 -6
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +36 -5
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +56 -7
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +32 -5
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +33 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +1 -0
- package/package.json +5 -2
- package/scripts/postinstall.mjs +211 -0
- package/dist/public/assets/TerminalPage-Dj_VDew3.js +0 -54
- package/dist/public/assets/index-C1GZV2wq.js +0 -106
- package/dist/public/assets/index-DU7f8NaZ.css +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-CVG1cGAJ.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var B0=Object.defineProperty;var U0=(e,t,n)=>t in e?B0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ze=(e,t,n)=>U0(e,typeof t!="symbol"?t+"":t,n);function db(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const c=Object.getOwnPropertyDescriptor(s,o);c&&Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function To(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cd={exports:{}},Ga={},jd={exports:{}},Ct={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react.production.min.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var Mg;function z0(){if(Mg)return Ct;Mg=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function x(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,S={};function N(z,le,P){this.props=z,this.context=le,this.refs=S,this.updater=P||b}N.prototype.isReactComponent={},N.prototype.setState=function(z,le){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,le,"setState")},N.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function T(){}T.prototype=N.prototype;function _(z,le,P){this.props=z,this.context=le,this.refs=S,this.updater=P||b}var R=_.prototype=new T;R.constructor=_,C(R,N.prototype),R.isPureReactComponent=!0;var G=Array.isArray,q=Object.prototype.hasOwnProperty,F={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function D(z,le,P){var ve,je={},Se=null,De=null;if(le!=null)for(ve in le.ref!==void 0&&(De=le.ref),le.key!==void 0&&(Se=""+le.key),le)q.call(le,ve)&&!M.hasOwnProperty(ve)&&(je[ve]=le[ve]);var Re=arguments.length-2;if(Re===1)je.children=P;else if(1<Re){for(var We=Array(Re),ct=0;ct<Re;ct++)We[ct]=arguments[ct+2];je.children=We}if(z&&z.defaultProps)for(ve in Re=z.defaultProps,Re)je[ve]===void 0&&(je[ve]=Re[ve]);return{$$typeof:e,type:z,key:Se,ref:De,props:je,_owner:F.current}}function U(z,le){return{$$typeof:e,type:z.type,key:le,ref:z.ref,props:z.props,_owner:z._owner}}function E(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function H(z){var le={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(P){return le[P]})}var ee=/\/+/g;function ne(z,le){return typeof z=="object"&&z!==null&&z.key!=null?H(""+z.key):le.toString(36)}function ae(z,le,P,ve,je){var Se=typeof z;(Se==="undefined"||Se==="boolean")&&(z=null);var De=!1;if(z===null)De=!0;else switch(Se){case"string":case"number":De=!0;break;case"object":switch(z.$$typeof){case e:case t:De=!0}}if(De)return De=z,je=je(De),z=ve===""?"."+ne(De,0):ve,G(je)?(P="",z!=null&&(P=z.replace(ee,"$&/")+"/"),ae(je,le,P,"",function(ct){return ct})):je!=null&&(E(je)&&(je=U(je,P+(!je.key||De&&De.key===je.key?"":(""+je.key).replace(ee,"$&/")+"/")+z)),le.push(je)),1;if(De=0,ve=ve===""?".":ve+":",G(z))for(var Re=0;Re<z.length;Re++){Se=z[Re];var We=ve+ne(Se,Re);De+=ae(Se,le,P,We,je)}else if(We=x(z),typeof We=="function")for(z=We.call(z),Re=0;!(Se=z.next()).done;)Se=Se.value,We=ve+ne(Se,Re++),De+=ae(Se,le,P,We,je);else if(Se==="object")throw le=String(z),Error("Objects are not valid as a React child (found: "+(le==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":le)+"). If you meant to render a collection of children, use an array instead.");return De}function te(z,le,P){if(z==null)return z;var ve=[],je=0;return ae(z,ve,"","",function(Se){return le.call(P,Se,je++)}),ve}function ye(z){if(z._status===-1){var le=z._result;le=le(),le.then(function(P){(z._status===0||z._status===-1)&&(z._status=1,z._result=P)},function(P){(z._status===0||z._status===-1)&&(z._status=2,z._result=P)}),z._status===-1&&(z._status=0,z._result=le)}if(z._status===1)return z._result.default;throw z._result}var J={current:null},K={transition:null},ue={ReactCurrentDispatcher:J,ReactCurrentBatchConfig:K,ReactCurrentOwner:F};function A(){throw Error("act(...) is not supported in production builds of React.")}return Ct.Children={map:te,forEach:function(z,le,P){te(z,function(){le.apply(this,arguments)},P)},count:function(z){var le=0;return te(z,function(){le++}),le},toArray:function(z){return te(z,function(le){return le})||[]},only:function(z){if(!E(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},Ct.Component=N,Ct.Fragment=n,Ct.Profiler=o,Ct.PureComponent=_,Ct.StrictMode=s,Ct.Suspense=m,Ct.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ue,Ct.act=A,Ct.cloneElement=function(z,le,P){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var ve=C({},z.props),je=z.key,Se=z.ref,De=z._owner;if(le!=null){if(le.ref!==void 0&&(Se=le.ref,De=F.current),le.key!==void 0&&(je=""+le.key),z.type&&z.type.defaultProps)var Re=z.type.defaultProps;for(We in le)q.call(le,We)&&!M.hasOwnProperty(We)&&(ve[We]=le[We]===void 0&&Re!==void 0?Re[We]:le[We])}var We=arguments.length-2;if(We===1)ve.children=P;else if(1<We){Re=Array(We);for(var ct=0;ct<We;ct++)Re[ct]=arguments[ct+2];ve.children=Re}return{$$typeof:e,type:z.type,key:je,ref:Se,props:ve,_owner:De}},Ct.createContext=function(z){return z={$$typeof:l,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:c,_context:z},z.Consumer=z},Ct.createElement=D,Ct.createFactory=function(z){var le=D.bind(null,z);return le.type=z,le},Ct.createRef=function(){return{current:null}},Ct.forwardRef=function(z){return{$$typeof:d,render:z}},Ct.isValidElement=E,Ct.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:ye}},Ct.memo=function(z,le){return{$$typeof:p,type:z,compare:le===void 0?null:le}},Ct.startTransition=function(z){var le=K.transition;K.transition={};try{z()}finally{K.transition=le}},Ct.unstable_act=A,Ct.useCallback=function(z,le){return J.current.useCallback(z,le)},Ct.useContext=function(z){return J.current.useContext(z)},Ct.useDebugValue=function(){},Ct.useDeferredValue=function(z){return J.current.useDeferredValue(z)},Ct.useEffect=function(z,le){return J.current.useEffect(z,le)},Ct.useId=function(){return J.current.useId()},Ct.useImperativeHandle=function(z,le,P){return J.current.useImperativeHandle(z,le,P)},Ct.useInsertionEffect=function(z,le){return J.current.useInsertionEffect(z,le)},Ct.useLayoutEffect=function(z,le){return J.current.useLayoutEffect(z,le)},Ct.useMemo=function(z,le){return J.current.useMemo(z,le)},Ct.useReducer=function(z,le,P){return J.current.useReducer(z,le,P)},Ct.useRef=function(z){return J.current.useRef(z)},Ct.useState=function(z){return J.current.useState(z)},Ct.useSyncExternalStore=function(z,le,P){return J.current.useSyncExternalStore(z,le,P)},Ct.useTransition=function(){return J.current.useTransition()},Ct.version="18.3.1",Ct}var Ag;function df(){return Ag||(Ag=1,jd.exports=z0()),jd.exports}/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-jsx-runtime.production.min.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var Lg;function W0(){if(Lg)return Ga;Lg=1;var e=df(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(d,m,p){var y,g={},x=null,b=null;p!==void 0&&(x=""+p),m.key!==void 0&&(x=""+m.key),m.ref!==void 0&&(b=m.ref);for(y in m)s.call(m,y)&&!c.hasOwnProperty(y)&&(g[y]=m[y]);if(d&&d.defaultProps)for(y in m=d.defaultProps,m)g[y]===void 0&&(g[y]=m[y]);return{$$typeof:t,type:d,key:x,ref:b,props:g,_owner:o.current}}return Ga.Fragment=n,Ga.jsx=l,Ga.jsxs=l,Ga}var Ig;function H0(){return Ig||(Ig=1,Cd.exports=W0()),Cd.exports}var i=H0(),Ul={},Nd={exports:{}},ir={},Td={exports:{}},Pd={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.min.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var Dg;function $0(){return Dg||(Dg=1,(function(e){function t(K,ue){var A=K.length;K.push(ue);e:for(;0<A;){var z=A-1>>>1,le=K[z];if(0<o(le,ue))K[z]=ue,K[A]=le,A=z;else break e}}function n(K){return K.length===0?null:K[0]}function s(K){if(K.length===0)return null;var ue=K[0],A=K.pop();if(A!==ue){K[0]=A;e:for(var z=0,le=K.length,P=le>>>1;z<P;){var ve=2*(z+1)-1,je=K[ve],Se=ve+1,De=K[Se];if(0>o(je,A))Se<le&&0>o(De,je)?(K[z]=De,K[Se]=A,z=Se):(K[z]=je,K[ve]=A,z=ve);else if(Se<le&&0>o(De,A))K[z]=De,K[Se]=A,z=Se;else break e}}return ue}function o(K,ue){var A=K.sortIndex-ue.sortIndex;return A!==0?A:K.id-ue.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var m=[],p=[],y=1,g=null,x=3,b=!1,C=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function R(K){for(var ue=n(p);ue!==null;){if(ue.callback===null)s(p);else if(ue.startTime<=K)s(p),ue.sortIndex=ue.expirationTime,t(m,ue);else break;ue=n(p)}}function G(K){if(S=!1,R(K),!C)if(n(m)!==null)C=!0,ye(q);else{var ue=n(p);ue!==null&&J(G,ue.startTime-K)}}function q(K,ue){C=!1,S&&(S=!1,T(D),D=-1),b=!0;var A=x;try{for(R(ue),g=n(m);g!==null&&(!(g.expirationTime>ue)||K&&!H());){var z=g.callback;if(typeof z=="function"){g.callback=null,x=g.priorityLevel;var le=z(g.expirationTime<=ue);ue=e.unstable_now(),typeof le=="function"?g.callback=le:g===n(m)&&s(m),R(ue)}else s(m);g=n(m)}if(g!==null)var P=!0;else{var ve=n(p);ve!==null&&J(G,ve.startTime-ue),P=!1}return P}finally{g=null,x=A,b=!1}}var F=!1,M=null,D=-1,U=5,E=-1;function H(){return!(e.unstable_now()-E<U)}function ee(){if(M!==null){var K=e.unstable_now();E=K;var ue=!0;try{ue=M(!0,K)}finally{ue?ne():(F=!1,M=null)}}else F=!1}var ne;if(typeof _=="function")ne=function(){_(ee)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,te=ae.port2;ae.port1.onmessage=ee,ne=function(){te.postMessage(null)}}else ne=function(){N(ee,0)};function ye(K){M=K,F||(F=!0,ne())}function J(K,ue){D=N(function(){K(e.unstable_now())},ue)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(K){K.callback=null},e.unstable_continueExecution=function(){C||b||(C=!0,ye(q))},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return n(m)},e.unstable_next=function(K){switch(x){case 1:case 2:case 3:var ue=3;break;default:ue=x}var A=x;x=ue;try{return K()}finally{x=A}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(K,ue){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var A=x;x=K;try{return ue()}finally{x=A}},e.unstable_scheduleCallback=function(K,ue,A){var z=e.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?z+A:z):A=z,K){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=A+le,K={id:y++,callback:ue,priorityLevel:K,startTime:A,expirationTime:le,sortIndex:-1},A>z?(K.sortIndex=A,t(p,K),n(m)===null&&K===n(p)&&(S?(T(D),D=-1):S=!0,J(G,A-z))):(K.sortIndex=le,t(m,K),C||b||(C=!0,ye(q))),K},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(K){var ue=x;return function(){var A=x;x=ue;try{return K.apply(this,arguments)}finally{x=A}}}})(Pd)),Pd}var _g;function q0(){return _g||(_g=1,Td.exports=$0()),Td.exports}/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var Fg;function V0(){if(Fg)return ir;Fg=1;var e=df(),t=q0();function n(r){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+r+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function c(r,a){l(r,a),l(r+"Capture",a)}function l(r,a){for(o[r]=a,r=0;r<a.length;r++)s.add(a[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,p=/^[: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]*$/,y={},g={};function x(r){return m.call(g,r)?!0:m.call(y,r)?!1:p.test(r)?g[r]=!0:(y[r]=!0,!1)}function b(r,a,u,f){if(u!==null&&u.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return f?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function C(r,a,u,f){if(a===null||typeof a>"u"||b(r,a,u,f))return!0;if(f)return!1;if(u!==null)switch(u.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function S(r,a,u,f,v,k,j){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=u,this.propertyName=r,this.type=a,this.sanitizeURL=k,this.removeEmptyString=j}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){N[r]=new S(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var a=r[0];N[a]=new S(a,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){N[r]=new S(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){N[r]=new S(r,2,!1,r,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(r){N[r]=new S(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){N[r]=new S(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){N[r]=new S(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){N[r]=new S(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){N[r]=new S(r,5,!1,r.toLowerCase(),null,!1,!1)});var T=/[\-:]([a-z])/g;function _(r){return r[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(r){var a=r.replace(T,_);N[a]=new S(a,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var a=r.replace(T,_);N[a]=new S(a,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var a=r.replace(T,_);N[a]=new S(a,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){N[r]=new S(r,1,!1,r.toLowerCase(),null,!1,!1)}),N.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){N[r]=new S(r,1,!1,r.toLowerCase(),null,!0,!0)});function R(r,a,u,f){var v=N.hasOwnProperty(a)?N[a]:null;(v!==null?v.type!==0:f||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(C(a,u,v,f)&&(u=null),f||v===null?x(a)&&(u===null?r.removeAttribute(a):r.setAttribute(a,""+u)):v.mustUseProperty?r[v.propertyName]=u===null?v.type===3?!1:"":u:(a=v.attributeName,f=v.attributeNamespace,u===null?r.removeAttribute(a):(v=v.type,u=v===3||v===4&&u===!0?"":""+u,f?r.setAttributeNS(f,a,u):r.setAttribute(a,u))))}var G=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,q=Symbol.for("react.element"),F=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),H=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),ye=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),K=Symbol.iterator;function ue(r){return r===null||typeof r!="object"?null:(r=K&&r[K]||r["@@iterator"],typeof r=="function"?r:null)}var A=Object.assign,z;function le(r){if(z===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);z=a&&a[1]||""}return`
|
|
35
|
+
`+z+r}var P=!1;function ve(r,a){if(!r||P)return"";P=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(he){var f=he}Reflect.construct(r,[],a)}else{try{a.call()}catch(he){f=he}r.call(a.prototype)}else{try{throw Error()}catch(he){f=he}r()}}catch(he){if(he&&f&&typeof he.stack=="string"){for(var v=he.stack.split(`
|
|
36
|
+
`),k=f.stack.split(`
|
|
37
|
+
`),j=v.length-1,B=k.length-1;1<=j&&0<=B&&v[j]!==k[B];)B--;for(;1<=j&&0<=B;j--,B--)if(v[j]!==k[B]){if(j!==1||B!==1)do if(j--,B--,0>B||v[j]!==k[B]){var V=`
|
|
38
|
+
`+v[j].replace(" at new "," at ");return r.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",r.displayName)),V}while(1<=j&&0<=B);break}}}finally{P=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?le(r):""}function je(r){switch(r.tag){case 5:return le(r.type);case 16:return le("Lazy");case 13:return le("Suspense");case 19:return le("SuspenseList");case 0:case 2:case 15:return r=ve(r.type,!1),r;case 11:return r=ve(r.type.render,!1),r;case 1:return r=ve(r.type,!0),r;default:return""}}function Se(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case M:return"Fragment";case F:return"Portal";case U:return"Profiler";case D:return"StrictMode";case ne:return"Suspense";case ae:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case H:return(r.displayName||"Context")+".Consumer";case E:return(r._context.displayName||"Context")+".Provider";case ee:var a=r.render;return r=r.displayName,r||(r=a.displayName||a.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case te:return a=r.displayName||null,a!==null?a:Se(r.type)||"Memo";case ye:a=r._payload,r=r._init;try{return Se(r(a))}catch{}}return null}function De(r){var a=r.type;switch(r.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=a.render,r=r.displayName||r.name||"",a.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Se(a);case 8:return a===D?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Re(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function We(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ct(r){var a=We(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,a),f=""+r[a];if(!r.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var v=u.get,k=u.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return v.call(this)},set:function(j){f=""+j,k.call(this,j)}}),Object.defineProperty(r,a,{enumerable:u.enumerable}),{getValue:function(){return f},setValue:function(j){f=""+j},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function Tt(r){r._valueTracker||(r._valueTracker=ct(r))}function qe(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var u=a.getValue(),f="";return r&&(f=We(r)?r.checked?"true":"false":r.value),r=f,r!==u?(a.setValue(r),!0):!1}function ft(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Ue(r,a){var u=a.checked;return A({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function Ht(r,a){var u=a.defaultValue==null?"":a.defaultValue,f=a.checked!=null?a.checked:a.defaultChecked;u=Re(a.value!=null?a.value:u),r._wrapperState={initialChecked:f,initialValue:u,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function vt(r,a){a=a.checked,a!=null&&R(r,"checked",a,!1)}function Ge(r,a){vt(r,a);var u=Re(a.value),f=a.type;if(u!=null)f==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(f==="submit"||f==="reset"){r.removeAttribute("value");return}a.hasOwnProperty("value")?Rt(r,a.type,u):a.hasOwnProperty("defaultValue")&&Rt(r,a.type,Re(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(r.defaultChecked=!!a.defaultChecked)}function yt(r,a,u){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var f=a.type;if(!(f!=="submit"&&f!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+r._wrapperState.initialValue,u||a===r.value||(r.value=a),r.defaultValue=a}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Rt(r,a,u){(a!=="number"||ft(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var zt=Array.isArray;function gt(r,a,u,f){if(r=r.options,a){a={};for(var v=0;v<u.length;v++)a["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=a.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&f&&(r[u].defaultSelected=!0)}else{for(u=""+Re(u),a=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,f&&(r[v].defaultSelected=!0);return}a!==null||r[v].disabled||(a=r[v])}a!==null&&(a.selected=!0)}}function Mt(r,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return A({},a,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Vt(r,a){var u=a.value;if(u==null){if(u=a.children,a=a.defaultValue,u!=null){if(a!=null)throw Error(n(92));if(zt(u)){if(1<u.length)throw Error(n(93));u=u[0]}a=u}a==null&&(a=""),u=a}r._wrapperState={initialValue:Re(u)}}function bt(r,a){var u=Re(a.value),f=Re(a.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),a.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),f!=null&&(r.defaultValue=""+f)}function It(r){var a=r.textContent;a===r._wrapperState.initialValue&&a!==""&&a!==null&&(r.value=a)}function de(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function xe(r,a){return r==null||r==="http://www.w3.org/1999/xhtml"?de(a):r==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var _e,Ve=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,u,f,v){MSApp.execUnsafeLocalFunction(function(){return r(a,u,f,v)})}:r})(function(r,a){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=a;else{for(_e=_e||document.createElement("div"),_e.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=_e.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;a.firstChild;)r.appendChild(a.firstChild)}});function Qe(r,a){if(a){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=a;return}}r.textContent=a}var dt={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},At=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(r){At.forEach(function(a){a=a+r.charAt(0).toUpperCase()+r.substring(1),dt[a]=dt[r]})});function at(r,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||dt.hasOwnProperty(r)&&dt[r]?(""+a).trim():a+"px"}function be(r,a){r=r.style;for(var u in a)if(a.hasOwnProperty(u)){var f=u.indexOf("--")===0,v=at(u,a[u],f);u==="float"&&(u="cssFloat"),f?r.setProperty(u,v):r[u]=v}}var W=A({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 Pe(r,a){if(a){if(W[r]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function nt(r,a){if(r.indexOf("-")===-1)return typeof a.is=="string";switch(r){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 ot=null;function Pt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ot=null,St=null,Jt=null;function Gt(r){if(r=Aa(r)){if(typeof Ot!="function")throw Error(n(280));var a=r.stateNode;a&&(a=tl(a),Ot(r.stateNode,r.type,a))}}function nn(r){St?Jt?Jt.push(r):Jt=[r]:St=r}function vn(){if(St){var r=St,a=Jt;if(Jt=St=null,Gt(r),a)for(r=0;r<a.length;r++)Gt(a[r])}}function Pn(r,a){return r(a)}function mn(){}var an=!1;function Ln(r,a,u){if(an)return r(a,u);an=!0;try{return Pn(r,a,u)}finally{an=!1,(St!==null||Jt!==null)&&(mn(),vn())}}function re(r,a){var u=r.stateNode;if(u===null)return null;var f=tl(u);if(f===null)return null;u=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,a,typeof u));return u}var I=!1;if(d)try{var $={};Object.defineProperty($,"passive",{get:function(){I=!0}}),window.addEventListener("test",$,$),window.removeEventListener("test",$,$)}catch{I=!1}function L(r,a,u,f,v,k,j,B,V){var he=Array.prototype.slice.call(arguments,3);try{a.apply(u,he)}catch(Te){this.onError(Te)}}var X=!1,ce=null,ke=!1,Fe=null,Ne={onError:function(r){X=!0,ce=r}};function Me(r,a,u,f,v,k,j,B,V){X=!1,ce=null,L.apply(Ne,arguments)}function Ie(r,a,u,f,v,k,j,B,V){if(Me.apply(this,arguments),X){if(X){var he=ce;X=!1,ce=null}else throw Error(n(198));ke||(ke=!0,Fe=he)}}function O(r){var a=r,u=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(u=a.return),r=a.return;while(r)}return a.tag===3?u:null}function me(r){if(r.tag===13){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function ie(r){if(O(r)!==r)throw Error(n(188))}function Be(r){var a=r.alternate;if(!a){if(a=O(r),a===null)throw Error(n(188));return a!==r?null:r}for(var u=r,f=a;;){var v=u.return;if(v===null)break;var k=v.alternate;if(k===null){if(f=v.return,f!==null){u=f;continue}break}if(v.child===k.child){for(k=v.child;k;){if(k===u)return ie(v),r;if(k===f)return ie(v),a;k=k.sibling}throw Error(n(188))}if(u.return!==f.return)u=v,f=k;else{for(var j=!1,B=v.child;B;){if(B===u){j=!0,u=v,f=k;break}if(B===f){j=!0,f=v,u=k;break}B=B.sibling}if(!j){for(B=k.child;B;){if(B===u){j=!0,u=k,f=v;break}if(B===f){j=!0,f=k,u=v;break}B=B.sibling}if(!j)throw Error(n(189))}}if(u.alternate!==f)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:a}function Oe(r){return r=Be(r),r!==null?He(r):null}function He(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var a=He(r);if(a!==null)return a;r=r.sibling}return null}var ut=t.unstable_scheduleCallback,un=t.unstable_cancelCallback,In=t.unstable_shouldYield,on=t.unstable_requestPaint,kt=t.unstable_now,Sr=t.unstable_getCurrentPriorityLevel,Yn=t.unstable_ImmediatePriority,Xn=t.unstable_UserBlockingPriority,Jn=t.unstable_NormalPriority,Y=t.unstable_LowPriority,we=t.unstable_IdlePriority,pe=null,lt=null;function mt(r){if(lt&&typeof lt.onCommitFiberRoot=="function")try{lt.onCommitFiberRoot(pe,r,void 0,(r.current.flags&128)===128)}catch{}}var ze=Math.clz32?Math.clz32:ur,Wt=Math.log,Bt=Math.LN2;function ur(r){return r>>>=0,r===0?32:31-(Wt(r)/Bt|0)|0}var dn=64,qi=4194304;function Vi(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Gi(r,a){var u=r.pendingLanes;if(u===0)return 0;var f=0,v=r.suspendedLanes,k=r.pingedLanes,j=u&268435455;if(j!==0){var B=j&~v;B!==0?f=Vi(B):(k&=j,k!==0&&(f=Vi(k)))}else j=u&~v,j!==0?f=Vi(j):k!==0&&(f=Vi(k));if(f===0)return 0;if(a!==0&&a!==f&&(a&v)===0&&(v=f&-f,k=a&-a,v>=k||v===16&&(k&4194240)!==0))return a;if((f&4)!==0&&(f|=u&16),a=r.entangledLanes,a!==0)for(r=r.entanglements,a&=f;0<a;)u=31-ze(a),v=1<<u,f|=r[u],a&=~v;return f}function js(r,a){switch(r){case 1:case 2:case 4:return a+250;case 8:case 16:case 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 a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qc(r,a){for(var u=r.suspendedLanes,f=r.pingedLanes,v=r.expirationTimes,k=r.pendingLanes;0<k;){var j=31-ze(k),B=1<<j,V=v[j];V===-1?((B&u)===0||(B&f)!==0)&&(v[j]=js(B,a)):V<=a&&(r.expiredLanes|=B),k&=~B}}function Ns(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Oo(){var r=dn;return dn<<=1,(dn&4194240)===0&&(dn=64),r}function ga(r){for(var a=[],u=0;31>u;u++)a.push(r);return a}function vi(r,a,u){r.pendingLanes|=a,a!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,a=31-ze(a),r[a]=u}function Bo(r,a){var u=r.pendingLanes&~a;r.pendingLanes=a,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=a,r.mutableReadLanes&=a,r.entangledLanes&=a,a=r.entanglements;var f=r.eventTimes;for(r=r.expirationTimes;0<u;){var v=31-ze(u),k=1<<v;a[v]=0,f[v]=-1,r[v]=-1,u&=~k}}function Ts(r,a){var u=r.entangledLanes|=a;for(r=r.entanglements;u;){var f=31-ze(u),v=1<<f;v&a|r[f]&a&&(r[f]|=a),u&=~v}}var _t=0;function ya(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Q,fe,Xe,pt,$t,Wn=!1,Cr=[],jr=null,dr=null,xt=null,hn=new Map,Br=new Map,Nr=[],Uo="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function va(r,a){switch(r){case"focusin":case"focusout":jr=null;break;case"dragenter":case"dragleave":dr=null;break;case"mouseover":case"mouseout":xt=null;break;case"pointerover":case"pointerout":hn.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Br.delete(a.pointerId)}}function Ki(r,a,u,f,v,k){return r===null||r.nativeEvent!==k?(r={blockedOn:a,domEventName:u,eventSystemFlags:f,nativeEvent:k,targetContainers:[v]},a!==null&&(a=Aa(a),a!==null&&fe(a)),r):(r.eventSystemFlags|=f,a=r.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),r)}function lC(r,a,u,f,v){switch(a){case"focusin":return jr=Ki(jr,r,a,u,f,v),!0;case"dragenter":return dr=Ki(dr,r,a,u,f,v),!0;case"mouseover":return xt=Ki(xt,r,a,u,f,v),!0;case"pointerover":var k=v.pointerId;return hn.set(k,Ki(hn.get(k)||null,r,a,u,f,v)),!0;case"gotpointercapture":return k=v.pointerId,Br.set(k,Ki(Br.get(k)||null,r,a,u,f,v)),!0}return!1}function pm(r){var a=Qi(r.target);if(a!==null){var u=O(a);if(u!==null){if(a=u.tag,a===13){if(a=me(u),a!==null){r.blockedOn=a,$t(r.priority,function(){Xe(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function zo(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var u=Xc(r.domEventName,r.eventSystemFlags,a[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var f=new u.constructor(u.type,u);ot=f,u.target.dispatchEvent(f),ot=null}else return a=Aa(u),a!==null&&fe(a),r.blockedOn=u,!1;a.shift()}return!0}function gm(r,a,u){zo(r)&&u.delete(a)}function cC(){Wn=!1,jr!==null&&zo(jr)&&(jr=null),dr!==null&&zo(dr)&&(dr=null),xt!==null&&zo(xt)&&(xt=null),hn.forEach(gm),Br.forEach(gm)}function wa(r,a){r.blockedOn===a&&(r.blockedOn=null,Wn||(Wn=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,cC)))}function ba(r){function a(v){return wa(v,r)}if(0<Cr.length){wa(Cr[0],r);for(var u=1;u<Cr.length;u++){var f=Cr[u];f.blockedOn===r&&(f.blockedOn=null)}}for(jr!==null&&wa(jr,r),dr!==null&&wa(dr,r),xt!==null&&wa(xt,r),hn.forEach(a),Br.forEach(a),u=0;u<Nr.length;u++)f=Nr[u],f.blockedOn===r&&(f.blockedOn=null);for(;0<Nr.length&&(u=Nr[0],u.blockedOn===null);)pm(u),u.blockedOn===null&&Nr.shift()}var Ps=G.ReactCurrentBatchConfig,Wo=!0;function uC(r,a,u,f){var v=_t,k=Ps.transition;Ps.transition=null;try{_t=1,Yc(r,a,u,f)}finally{_t=v,Ps.transition=k}}function dC(r,a,u,f){var v=_t,k=Ps.transition;Ps.transition=null;try{_t=4,Yc(r,a,u,f)}finally{_t=v,Ps.transition=k}}function Yc(r,a,u,f){if(Wo){var v=Xc(r,a,u,f);if(v===null)mu(r,a,f,Ho,u),va(r,f);else if(lC(v,r,a,u,f))f.stopPropagation();else if(va(r,f),a&4&&-1<Uo.indexOf(r)){for(;v!==null;){var k=Aa(v);if(k!==null&&Q(k),k=Xc(r,a,u,f),k===null&&mu(r,a,f,Ho,u),k===v)break;v=k}v!==null&&f.stopPropagation()}else mu(r,a,f,null,u)}}var Ho=null;function Xc(r,a,u,f){if(Ho=null,r=Pt(f),r=Qi(r),r!==null)if(a=O(r),a===null)r=null;else if(u=a.tag,u===13){if(r=me(a),r!==null)return r;r=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null);return Ho=r,null}function ym(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Sr()){case Yn:return 1;case Xn:return 4;case Jn:case Y:return 16;case we:return 536870912;default:return 16}default:return 16}}var wi=null,Jc=null,$o=null;function vm(){if($o)return $o;var r,a=Jc,u=a.length,f,v="value"in wi?wi.value:wi.textContent,k=v.length;for(r=0;r<u&&a[r]===v[r];r++);var j=u-r;for(f=1;f<=j&&a[u-f]===v[k-f];f++);return $o=v.slice(r,1<f?1-f:void 0)}function qo(r){var a=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&a===13&&(r=13)):r=a,r===10&&(r=13),32<=r||r===13?r:0}function Vo(){return!0}function wm(){return!1}function hr(r){function a(u,f,v,k,j){this._reactName=u,this._targetInst=v,this.type=f,this.nativeEvent=k,this.target=j,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(u=r[B],this[B]=u?u(k):k[B]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Vo:wm,this.isPropagationStopped=wm,this}return A(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Vo)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Vo)},persist:function(){},isPersistent:Vo}),a}var Es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zc=hr(Es),xa=A({},Es,{view:0,detail:0}),hC=hr(xa),eu,tu,ka,Go=A({},xa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ru,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==ka&&(ka&&r.type==="mousemove"?(eu=r.screenX-ka.screenX,tu=r.screenY-ka.screenY):tu=eu=0,ka=r),eu)},movementY:function(r){return"movementY"in r?r.movementY:tu}}),bm=hr(Go),fC=A({},Go,{dataTransfer:0}),mC=hr(fC),pC=A({},xa,{relatedTarget:0}),nu=hr(pC),gC=A({},Es,{animationName:0,elapsedTime:0,pseudoElement:0}),yC=hr(gC),vC=A({},Es,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),wC=hr(vC),bC=A({},Es,{data:0}),xm=hr(bC),xC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kC={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},SC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function CC(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=SC[r])?!!a[r]:!1}function ru(){return CC}var jC=A({},xa,{key:function(r){if(r.key){var a=xC[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=qo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?kC[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ru,charCode:function(r){return r.type==="keypress"?qo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?qo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),NC=hr(jC),TC=A({},Go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),km=hr(TC),PC=A({},xa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ru}),EC=hr(PC),RC=A({},Es,{propertyName:0,elapsedTime:0,pseudoElement:0}),MC=hr(RC),AC=A({},Go,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),LC=hr(AC),IC=[9,13,27,32],iu=d&&"CompositionEvent"in window,Sa=null;d&&"documentMode"in document&&(Sa=document.documentMode);var DC=d&&"TextEvent"in window&&!Sa,Sm=d&&(!iu||Sa&&8<Sa&&11>=Sa),Cm=" ",jm=!1;function Nm(r,a){switch(r){case"keyup":return IC.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tm(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Rs=!1;function _C(r,a){switch(r){case"compositionend":return Tm(a);case"keypress":return a.which!==32?null:(jm=!0,Cm);case"textInput":return r=a.data,r===Cm&&jm?null:r;default:return null}}function FC(r,a){if(Rs)return r==="compositionend"||!iu&&Nm(r,a)?(r=vm(),$o=Jc=wi=null,Rs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Sm&&a.locale!=="ko"?null:a.data;default:return null}}var OC={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Pm(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!OC[r.type]:a==="textarea"}function Em(r,a,u,f){nn(f),a=Jo(a,"onChange"),0<a.length&&(u=new Zc("onChange","change",null,u,f),r.push({event:u,listeners:a}))}var Ca=null,ja=null;function BC(r){Gm(r,0)}function Ko(r){var a=Ds(r);if(qe(a))return r}function UC(r,a){if(r==="change")return a}var Rm=!1;if(d){var su;if(d){var au="oninput"in document;if(!au){var Mm=document.createElement("div");Mm.setAttribute("oninput","return;"),au=typeof Mm.oninput=="function"}su=au}else su=!1;Rm=su&&(!document.documentMode||9<document.documentMode)}function Am(){Ca&&(Ca.detachEvent("onpropertychange",Lm),ja=Ca=null)}function Lm(r){if(r.propertyName==="value"&&Ko(ja)){var a=[];Em(a,ja,r,Pt(r)),Ln(BC,a)}}function zC(r,a,u){r==="focusin"?(Am(),Ca=a,ja=u,Ca.attachEvent("onpropertychange",Lm)):r==="focusout"&&Am()}function WC(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Ko(ja)}function HC(r,a){if(r==="click")return Ko(a)}function $C(r,a){if(r==="input"||r==="change")return Ko(a)}function qC(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var Ur=typeof Object.is=="function"?Object.is:qC;function Na(r,a){if(Ur(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var u=Object.keys(r),f=Object.keys(a);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var v=u[f];if(!m.call(a,v)||!Ur(r[v],a[v]))return!1}return!0}function Im(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Dm(r,a){var u=Im(r);r=0;for(var f;u;){if(u.nodeType===3){if(f=r+u.textContent.length,r<=a&&f>=a)return{node:u,offset:a-r};r=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Im(u)}}function _m(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?_m(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function Fm(){for(var r=window,a=ft();a instanceof r.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)r=a.contentWindow;else break;a=ft(r.document)}return a}function ou(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a&&(a==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||a==="textarea"||r.contentEditable==="true")}function VC(r){var a=Fm(),u=r.focusedElem,f=r.selectionRange;if(a!==u&&u&&u.ownerDocument&&_m(u.ownerDocument.documentElement,u)){if(f!==null&&ou(u)){if(a=f.start,r=f.end,r===void 0&&(r=a),"selectionStart"in u)u.selectionStart=a,u.selectionEnd=Math.min(r,u.value.length);else if(r=(a=u.ownerDocument||document)&&a.defaultView||window,r.getSelection){r=r.getSelection();var v=u.textContent.length,k=Math.min(f.start,v);f=f.end===void 0?k:Math.min(f.end,v),!r.extend&&k>f&&(v=f,f=k,k=v),v=Dm(u,k);var j=Dm(u,f);v&&j&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==j.node||r.focusOffset!==j.offset)&&(a=a.createRange(),a.setStart(v.node,v.offset),r.removeAllRanges(),k>f?(r.addRange(a),r.extend(j.node,j.offset)):(a.setEnd(j.node,j.offset),r.addRange(a)))}}for(a=[],r=u;r=r.parentNode;)r.nodeType===1&&a.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<a.length;u++)r=a[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var GC=d&&"documentMode"in document&&11>=document.documentMode,Ms=null,lu=null,Ta=null,cu=!1;function Om(r,a,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;cu||Ms==null||Ms!==ft(f)||(f=Ms,"selectionStart"in f&&ou(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ta&&Na(Ta,f)||(Ta=f,f=Jo(lu,"onSelect"),0<f.length&&(a=new Zc("onSelect","select",null,a,u),r.push({event:a,listeners:f}),a.target=Ms)))}function Qo(r,a){var u={};return u[r.toLowerCase()]=a.toLowerCase(),u["Webkit"+r]="webkit"+a,u["Moz"+r]="moz"+a,u}var As={animationend:Qo("Animation","AnimationEnd"),animationiteration:Qo("Animation","AnimationIteration"),animationstart:Qo("Animation","AnimationStart"),transitionend:Qo("Transition","TransitionEnd")},uu={},Bm={};d&&(Bm=document.createElement("div").style,"AnimationEvent"in window||(delete As.animationend.animation,delete As.animationiteration.animation,delete As.animationstart.animation),"TransitionEvent"in window||delete As.transitionend.transition);function Yo(r){if(uu[r])return uu[r];if(!As[r])return r;var a=As[r],u;for(u in a)if(a.hasOwnProperty(u)&&u in Bm)return uu[r]=a[u];return r}var Um=Yo("animationend"),zm=Yo("animationiteration"),Wm=Yo("animationstart"),Hm=Yo("transitionend"),$m=new Map,qm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function bi(r,a){$m.set(r,a),c(a,[r])}for(var du=0;du<qm.length;du++){var hu=qm[du],KC=hu.toLowerCase(),QC=hu[0].toUpperCase()+hu.slice(1);bi(KC,"on"+QC)}bi(Um,"onAnimationEnd"),bi(zm,"onAnimationIteration"),bi(Wm,"onAnimationStart"),bi("dblclick","onDoubleClick"),bi("focusin","onFocus"),bi("focusout","onBlur"),bi(Hm,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),YC=new Set("cancel close invalid load scroll toggle".split(" ").concat(Pa));function Vm(r,a,u){var f=r.type||"unknown-event";r.currentTarget=u,Ie(f,a,void 0,r),r.currentTarget=null}function Gm(r,a){a=(a&4)!==0;for(var u=0;u<r.length;u++){var f=r[u],v=f.event;f=f.listeners;e:{var k=void 0;if(a)for(var j=f.length-1;0<=j;j--){var B=f[j],V=B.instance,he=B.currentTarget;if(B=B.listener,V!==k&&v.isPropagationStopped())break e;Vm(v,B,he),k=V}else for(j=0;j<f.length;j++){if(B=f[j],V=B.instance,he=B.currentTarget,B=B.listener,V!==k&&v.isPropagationStopped())break e;Vm(v,B,he),k=V}}}if(ke)throw r=Fe,ke=!1,Fe=null,r}function Yt(r,a){var u=a[bu];u===void 0&&(u=a[bu]=new Set);var f=r+"__bubble";u.has(f)||(Km(a,r,2,!1),u.add(f))}function fu(r,a,u){var f=0;a&&(f|=4),Km(u,r,f,a)}var Xo="_reactListening"+Math.random().toString(36).slice(2);function Ea(r){if(!r[Xo]){r[Xo]=!0,s.forEach(function(u){u!=="selectionchange"&&(YC.has(u)||fu(u,!1,r),fu(u,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[Xo]||(a[Xo]=!0,fu("selectionchange",!1,a))}}function Km(r,a,u,f){switch(ym(a)){case 1:var v=uC;break;case 4:v=dC;break;default:v=Yc}u=v.bind(null,a,u,r),v=void 0,!I||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),f?v!==void 0?r.addEventListener(a,u,{capture:!0,passive:v}):r.addEventListener(a,u,!0):v!==void 0?r.addEventListener(a,u,{passive:v}):r.addEventListener(a,u,!1)}function mu(r,a,u,f,v){var k=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var j=f.tag;if(j===3||j===4){var B=f.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(j===4)for(j=f.return;j!==null;){var V=j.tag;if((V===3||V===4)&&(V=j.stateNode.containerInfo,V===v||V.nodeType===8&&V.parentNode===v))return;j=j.return}for(;B!==null;){if(j=Qi(B),j===null)return;if(V=j.tag,V===5||V===6){f=k=j;continue e}B=B.parentNode}}f=f.return}Ln(function(){var he=k,Te=Pt(u),Ee=[];e:{var Ce=$m.get(r);if(Ce!==void 0){var $e=Zc,Ye=r;switch(r){case"keypress":if(qo(u)===0)break e;case"keydown":case"keyup":$e=NC;break;case"focusin":Ye="focus",$e=nu;break;case"focusout":Ye="blur",$e=nu;break;case"beforeblur":case"afterblur":$e=nu;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$e=bm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$e=mC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$e=EC;break;case Um:case zm:case Wm:$e=yC;break;case Hm:$e=MC;break;case"scroll":$e=hC;break;case"wheel":$e=LC;break;case"copy":case"cut":case"paste":$e=wC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$e=km}var Je=(a&4)!==0,fn=!Je&&r==="scroll",se=Je?Ce!==null?Ce+"Capture":null:Ce;Je=[];for(var Z=he,oe;Z!==null;){oe=Z;var Le=oe.stateNode;if(oe.tag===5&&Le!==null&&(oe=Le,se!==null&&(Le=re(Z,se),Le!=null&&Je.push(Ra(Z,Le,oe)))),fn)break;Z=Z.return}0<Je.length&&(Ce=new $e(Ce,Ye,null,u,Te),Ee.push({event:Ce,listeners:Je}))}}if((a&7)===0){e:{if(Ce=r==="mouseover"||r==="pointerover",$e=r==="mouseout"||r==="pointerout",Ce&&u!==ot&&(Ye=u.relatedTarget||u.fromElement)&&(Qi(Ye)||Ye[oi]))break e;if(($e||Ce)&&(Ce=Te.window===Te?Te:(Ce=Te.ownerDocument)?Ce.defaultView||Ce.parentWindow:window,$e?(Ye=u.relatedTarget||u.toElement,$e=he,Ye=Ye?Qi(Ye):null,Ye!==null&&(fn=O(Ye),Ye!==fn||Ye.tag!==5&&Ye.tag!==6)&&(Ye=null)):($e=null,Ye=he),$e!==Ye)){if(Je=bm,Le="onMouseLeave",se="onMouseEnter",Z="mouse",(r==="pointerout"||r==="pointerover")&&(Je=km,Le="onPointerLeave",se="onPointerEnter",Z="pointer"),fn=$e==null?Ce:Ds($e),oe=Ye==null?Ce:Ds(Ye),Ce=new Je(Le,Z+"leave",$e,u,Te),Ce.target=fn,Ce.relatedTarget=oe,Le=null,Qi(Te)===he&&(Je=new Je(se,Z+"enter",Ye,u,Te),Je.target=oe,Je.relatedTarget=fn,Le=Je),fn=Le,$e&&Ye)t:{for(Je=$e,se=Ye,Z=0,oe=Je;oe;oe=Ls(oe))Z++;for(oe=0,Le=se;Le;Le=Ls(Le))oe++;for(;0<Z-oe;)Je=Ls(Je),Z--;for(;0<oe-Z;)se=Ls(se),oe--;for(;Z--;){if(Je===se||se!==null&&Je===se.alternate)break t;Je=Ls(Je),se=Ls(se)}Je=null}else Je=null;$e!==null&&Qm(Ee,Ce,$e,Je,!1),Ye!==null&&fn!==null&&Qm(Ee,fn,Ye,Je,!0)}}e:{if(Ce=he?Ds(he):window,$e=Ce.nodeName&&Ce.nodeName.toLowerCase(),$e==="select"||$e==="input"&&Ce.type==="file")var tt=UC;else if(Pm(Ce))if(Rm)tt=$C;else{tt=WC;var rt=zC}else($e=Ce.nodeName)&&$e.toLowerCase()==="input"&&(Ce.type==="checkbox"||Ce.type==="radio")&&(tt=HC);if(tt&&(tt=tt(r,he))){Em(Ee,tt,u,Te);break e}rt&&rt(r,Ce,he),r==="focusout"&&(rt=Ce._wrapperState)&&rt.controlled&&Ce.type==="number"&&Rt(Ce,"number",Ce.value)}switch(rt=he?Ds(he):window,r){case"focusin":(Pm(rt)||rt.contentEditable==="true")&&(Ms=rt,lu=he,Ta=null);break;case"focusout":Ta=lu=Ms=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,Om(Ee,u,Te);break;case"selectionchange":if(GC)break;case"keydown":case"keyup":Om(Ee,u,Te)}var it;if(iu)e:{switch(r){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else Rs?Nm(r,u)&&(ht="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(ht="onCompositionStart");ht&&(Sm&&u.locale!=="ko"&&(Rs||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&Rs&&(it=vm()):(wi=Te,Jc="value"in wi?wi.value:wi.textContent,Rs=!0)),rt=Jo(he,ht),0<rt.length&&(ht=new xm(ht,r,null,u,Te),Ee.push({event:ht,listeners:rt}),it?ht.data=it:(it=Tm(u),it!==null&&(ht.data=it)))),(it=DC?_C(r,u):FC(r,u))&&(he=Jo(he,"onBeforeInput"),0<he.length&&(Te=new xm("onBeforeInput","beforeinput",null,u,Te),Ee.push({event:Te,listeners:he}),Te.data=it))}Gm(Ee,a)})}function Ra(r,a,u){return{instance:r,listener:a,currentTarget:u}}function Jo(r,a){for(var u=a+"Capture",f=[];r!==null;){var v=r,k=v.stateNode;v.tag===5&&k!==null&&(v=k,k=re(r,u),k!=null&&f.unshift(Ra(r,k,v)),k=re(r,a),k!=null&&f.push(Ra(r,k,v))),r=r.return}return f}function Ls(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Qm(r,a,u,f,v){for(var k=a._reactName,j=[];u!==null&&u!==f;){var B=u,V=B.alternate,he=B.stateNode;if(V!==null&&V===f)break;B.tag===5&&he!==null&&(B=he,v?(V=re(u,k),V!=null&&j.unshift(Ra(u,V,B))):v||(V=re(u,k),V!=null&&j.push(Ra(u,V,B)))),u=u.return}j.length!==0&&r.push({event:a,listeners:j})}var XC=/\r\n?/g,JC=/\u0000|\uFFFD/g;function Ym(r){return(typeof r=="string"?r:""+r).replace(XC,`
|
|
39
|
+
`).replace(JC,"")}function Zo(r,a,u){if(a=Ym(a),Ym(r)!==a&&u)throw Error(n(425))}function el(){}var pu=null,gu=null;function yu(r,a){return r==="textarea"||r==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var vu=typeof setTimeout=="function"?setTimeout:void 0,ZC=typeof clearTimeout=="function"?clearTimeout:void 0,Xm=typeof Promise=="function"?Promise:void 0,e0=typeof queueMicrotask=="function"?queueMicrotask:typeof Xm<"u"?function(r){return Xm.resolve(null).then(r).catch(t0)}:vu;function t0(r){setTimeout(function(){throw r})}function wu(r,a){var u=a,f=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"){if(f===0){r.removeChild(v),ba(a);return}f--}else u!=="$"&&u!=="$?"&&u!=="$!"||f++;u=v}while(u);ba(a)}function xi(r){for(;r!=null;r=r.nextSibling){var a=r.nodeType;if(a===1||a===3)break;if(a===8){if(a=r.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return r}function Jm(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(a===0)return r;a--}else u==="/$"&&a++}r=r.previousSibling}return null}var Is=Math.random().toString(36).slice(2),Xr="__reactFiber$"+Is,Ma="__reactProps$"+Is,oi="__reactContainer$"+Is,bu="__reactEvents$"+Is,n0="__reactListeners$"+Is,r0="__reactHandles$"+Is;function Qi(r){var a=r[Xr];if(a)return a;for(var u=r.parentNode;u;){if(a=u[oi]||u[Xr]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(r=Jm(r);r!==null;){if(u=r[Xr])return u;r=Jm(r)}return a}r=u,u=r.parentNode}return null}function Aa(r){return r=r[Xr]||r[oi],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Ds(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function tl(r){return r[Ma]||null}var xu=[],_s=-1;function ki(r){return{current:r}}function Xt(r){0>_s||(r.current=xu[_s],xu[_s]=null,_s--)}function Kt(r,a){_s++,xu[_s]=r.current,r.current=a}var Si={},Dn=ki(Si),Zn=ki(!1),Yi=Si;function Fs(r,a){var u=r.type.contextTypes;if(!u)return Si;var f=r.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===a)return f.__reactInternalMemoizedMaskedChildContext;var v={},k;for(k in u)v[k]=a[k];return f&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=a,r.__reactInternalMemoizedMaskedChildContext=v),v}function er(r){return r=r.childContextTypes,r!=null}function nl(){Xt(Zn),Xt(Dn)}function Zm(r,a,u){if(Dn.current!==Si)throw Error(n(168));Kt(Dn,a),Kt(Zn,u)}function ep(r,a,u){var f=r.stateNode;if(a=a.childContextTypes,typeof f.getChildContext!="function")return u;f=f.getChildContext();for(var v in f)if(!(v in a))throw Error(n(108,De(r)||"Unknown",v));return A({},u,f)}function rl(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Si,Yi=Dn.current,Kt(Dn,r),Kt(Zn,Zn.current),!0}function tp(r,a,u){var f=r.stateNode;if(!f)throw Error(n(169));u?(r=ep(r,a,Yi),f.__reactInternalMemoizedMergedChildContext=r,Xt(Zn),Xt(Dn),Kt(Dn,r)):Xt(Zn),Kt(Zn,u)}var li=null,il=!1,ku=!1;function np(r){li===null?li=[r]:li.push(r)}function i0(r){il=!0,np(r)}function Ci(){if(!ku&&li!==null){ku=!0;var r=0,a=_t;try{var u=li;for(_t=1;r<u.length;r++){var f=u[r];do f=f(!0);while(f!==null)}li=null,il=!1}catch(v){throw li!==null&&(li=li.slice(r+1)),ut(Yn,Ci),v}finally{_t=a,ku=!1}}return null}var Os=[],Bs=0,sl=null,al=0,Tr=[],Pr=0,Xi=null,ci=1,ui="";function Ji(r,a){Os[Bs++]=al,Os[Bs++]=sl,sl=r,al=a}function rp(r,a,u){Tr[Pr++]=ci,Tr[Pr++]=ui,Tr[Pr++]=Xi,Xi=r;var f=ci;r=ui;var v=32-ze(f)-1;f&=~(1<<v),u+=1;var k=32-ze(a)+v;if(30<k){var j=v-v%5;k=(f&(1<<j)-1).toString(32),f>>=j,v-=j,ci=1<<32-ze(a)+v|u<<v|f,ui=k+r}else ci=1<<k|u<<v|f,ui=r}function Su(r){r.return!==null&&(Ji(r,1),rp(r,1,0))}function Cu(r){for(;r===sl;)sl=Os[--Bs],Os[Bs]=null,al=Os[--Bs],Os[Bs]=null;for(;r===Xi;)Xi=Tr[--Pr],Tr[Pr]=null,ui=Tr[--Pr],Tr[Pr]=null,ci=Tr[--Pr],Tr[Pr]=null}var fr=null,mr=null,Zt=!1,zr=null;function ip(r,a){var u=Ar(5,null,null,0);u.elementType="DELETED",u.stateNode=a,u.return=r,a=r.deletions,a===null?(r.deletions=[u],r.flags|=16):a.push(u)}function sp(r,a){switch(r.tag){case 5:var u=r.type;return a=a.nodeType!==1||u.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(r.stateNode=a,fr=r,mr=xi(a.firstChild),!0):!1;case 6:return a=r.pendingProps===""||a.nodeType!==3?null:a,a!==null?(r.stateNode=a,fr=r,mr=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(u=Xi!==null?{id:ci,overflow:ui}:null,r.memoizedState={dehydrated:a,treeContext:u,retryLane:1073741824},u=Ar(18,null,null,0),u.stateNode=a,u.return=r,r.child=u,fr=r,mr=null,!0):!1;default:return!1}}function ju(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Nu(r){if(Zt){var a=mr;if(a){var u=a;if(!sp(r,a)){if(ju(r))throw Error(n(418));a=xi(u.nextSibling);var f=fr;a&&sp(r,a)?ip(f,u):(r.flags=r.flags&-4097|2,Zt=!1,fr=r)}}else{if(ju(r))throw Error(n(418));r.flags=r.flags&-4097|2,Zt=!1,fr=r}}}function ap(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;fr=r}function ol(r){if(r!==fr)return!1;if(!Zt)return ap(r),Zt=!0,!1;var a;if((a=r.tag!==3)&&!(a=r.tag!==5)&&(a=r.type,a=a!=="head"&&a!=="body"&&!yu(r.type,r.memoizedProps)),a&&(a=mr)){if(ju(r))throw op(),Error(n(418));for(;a;)ip(r,a),a=xi(a.nextSibling)}if(ap(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,a=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(a===0){mr=xi(r.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}r=r.nextSibling}mr=null}}else mr=fr?xi(r.stateNode.nextSibling):null;return!0}function op(){for(var r=mr;r;)r=xi(r.nextSibling)}function Us(){mr=fr=null,Zt=!1}function Tu(r){zr===null?zr=[r]:zr.push(r)}var s0=G.ReactCurrentBatchConfig;function La(r,a,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var f=u.stateNode}if(!f)throw Error(n(147,r));var v=f,k=""+r;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===k?a.ref:(a=function(j){var B=v.refs;j===null?delete B[k]:B[k]=j},a._stringRef=k,a)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function ll(r,a){throw r=Object.prototype.toString.call(a),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r))}function lp(r){var a=r._init;return a(r._payload)}function cp(r){function a(se,Z){if(r){var oe=se.deletions;oe===null?(se.deletions=[Z],se.flags|=16):oe.push(Z)}}function u(se,Z){if(!r)return null;for(;Z!==null;)a(se,Z),Z=Z.sibling;return null}function f(se,Z){for(se=new Map;Z!==null;)Z.key!==null?se.set(Z.key,Z):se.set(Z.index,Z),Z=Z.sibling;return se}function v(se,Z){return se=Ai(se,Z),se.index=0,se.sibling=null,se}function k(se,Z,oe){return se.index=oe,r?(oe=se.alternate,oe!==null?(oe=oe.index,oe<Z?(se.flags|=2,Z):oe):(se.flags|=2,Z)):(se.flags|=1048576,Z)}function j(se){return r&&se.alternate===null&&(se.flags|=2),se}function B(se,Z,oe,Le){return Z===null||Z.tag!==6?(Z=vd(oe,se.mode,Le),Z.return=se,Z):(Z=v(Z,oe),Z.return=se,Z)}function V(se,Z,oe,Le){var tt=oe.type;return tt===M?Te(se,Z,oe.props.children,Le,oe.key):Z!==null&&(Z.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===ye&&lp(tt)===Z.type)?(Le=v(Z,oe.props),Le.ref=La(se,Z,oe),Le.return=se,Le):(Le=Al(oe.type,oe.key,oe.props,null,se.mode,Le),Le.ref=La(se,Z,oe),Le.return=se,Le)}function he(se,Z,oe,Le){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==oe.containerInfo||Z.stateNode.implementation!==oe.implementation?(Z=wd(oe,se.mode,Le),Z.return=se,Z):(Z=v(Z,oe.children||[]),Z.return=se,Z)}function Te(se,Z,oe,Le,tt){return Z===null||Z.tag!==7?(Z=as(oe,se.mode,Le,tt),Z.return=se,Z):(Z=v(Z,oe),Z.return=se,Z)}function Ee(se,Z,oe){if(typeof Z=="string"&&Z!==""||typeof Z=="number")return Z=vd(""+Z,se.mode,oe),Z.return=se,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case q:return oe=Al(Z.type,Z.key,Z.props,null,se.mode,oe),oe.ref=La(se,null,Z),oe.return=se,oe;case F:return Z=wd(Z,se.mode,oe),Z.return=se,Z;case ye:var Le=Z._init;return Ee(se,Le(Z._payload),oe)}if(zt(Z)||ue(Z))return Z=as(Z,se.mode,oe,null),Z.return=se,Z;ll(se,Z)}return null}function Ce(se,Z,oe,Le){var tt=Z!==null?Z.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return tt!==null?null:B(se,Z,""+oe,Le);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case q:return oe.key===tt?V(se,Z,oe,Le):null;case F:return oe.key===tt?he(se,Z,oe,Le):null;case ye:return tt=oe._init,Ce(se,Z,tt(oe._payload),Le)}if(zt(oe)||ue(oe))return tt!==null?null:Te(se,Z,oe,Le,null);ll(se,oe)}return null}function $e(se,Z,oe,Le,tt){if(typeof Le=="string"&&Le!==""||typeof Le=="number")return se=se.get(oe)||null,B(Z,se,""+Le,tt);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case q:return se=se.get(Le.key===null?oe:Le.key)||null,V(Z,se,Le,tt);case F:return se=se.get(Le.key===null?oe:Le.key)||null,he(Z,se,Le,tt);case ye:var rt=Le._init;return $e(se,Z,oe,rt(Le._payload),tt)}if(zt(Le)||ue(Le))return se=se.get(oe)||null,Te(Z,se,Le,tt,null);ll(Z,Le)}return null}function Ye(se,Z,oe,Le){for(var tt=null,rt=null,it=Z,ht=Z=0,Tn=null;it!==null&&ht<oe.length;ht++){it.index>ht?(Tn=it,it=null):Tn=it.sibling;var Ft=Ce(se,it,oe[ht],Le);if(Ft===null){it===null&&(it=Tn);break}r&&it&&Ft.alternate===null&&a(se,it),Z=k(Ft,Z,ht),rt===null?tt=Ft:rt.sibling=Ft,rt=Ft,it=Tn}if(ht===oe.length)return u(se,it),Zt&&Ji(se,ht),tt;if(it===null){for(;ht<oe.length;ht++)it=Ee(se,oe[ht],Le),it!==null&&(Z=k(it,Z,ht),rt===null?tt=it:rt.sibling=it,rt=it);return Zt&&Ji(se,ht),tt}for(it=f(se,it);ht<oe.length;ht++)Tn=$e(it,se,ht,oe[ht],Le),Tn!==null&&(r&&Tn.alternate!==null&&it.delete(Tn.key===null?ht:Tn.key),Z=k(Tn,Z,ht),rt===null?tt=Tn:rt.sibling=Tn,rt=Tn);return r&&it.forEach(function(Li){return a(se,Li)}),Zt&&Ji(se,ht),tt}function Je(se,Z,oe,Le){var tt=ue(oe);if(typeof tt!="function")throw Error(n(150));if(oe=tt.call(oe),oe==null)throw Error(n(151));for(var rt=tt=null,it=Z,ht=Z=0,Tn=null,Ft=oe.next();it!==null&&!Ft.done;ht++,Ft=oe.next()){it.index>ht?(Tn=it,it=null):Tn=it.sibling;var Li=Ce(se,it,Ft.value,Le);if(Li===null){it===null&&(it=Tn);break}r&&it&&Li.alternate===null&&a(se,it),Z=k(Li,Z,ht),rt===null?tt=Li:rt.sibling=Li,rt=Li,it=Tn}if(Ft.done)return u(se,it),Zt&&Ji(se,ht),tt;if(it===null){for(;!Ft.done;ht++,Ft=oe.next())Ft=Ee(se,Ft.value,Le),Ft!==null&&(Z=k(Ft,Z,ht),rt===null?tt=Ft:rt.sibling=Ft,rt=Ft);return Zt&&Ji(se,ht),tt}for(it=f(se,it);!Ft.done;ht++,Ft=oe.next())Ft=$e(it,se,ht,Ft.value,Le),Ft!==null&&(r&&Ft.alternate!==null&&it.delete(Ft.key===null?ht:Ft.key),Z=k(Ft,Z,ht),rt===null?tt=Ft:rt.sibling=Ft,rt=Ft);return r&&it.forEach(function(O0){return a(se,O0)}),Zt&&Ji(se,ht),tt}function fn(se,Z,oe,Le){if(typeof oe=="object"&&oe!==null&&oe.type===M&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case q:e:{for(var tt=oe.key,rt=Z;rt!==null;){if(rt.key===tt){if(tt=oe.type,tt===M){if(rt.tag===7){u(se,rt.sibling),Z=v(rt,oe.props.children),Z.return=se,se=Z;break e}}else if(rt.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===ye&&lp(tt)===rt.type){u(se,rt.sibling),Z=v(rt,oe.props),Z.ref=La(se,rt,oe),Z.return=se,se=Z;break e}u(se,rt);break}else a(se,rt);rt=rt.sibling}oe.type===M?(Z=as(oe.props.children,se.mode,Le,oe.key),Z.return=se,se=Z):(Le=Al(oe.type,oe.key,oe.props,null,se.mode,Le),Le.ref=La(se,Z,oe),Le.return=se,se=Le)}return j(se);case F:e:{for(rt=oe.key;Z!==null;){if(Z.key===rt)if(Z.tag===4&&Z.stateNode.containerInfo===oe.containerInfo&&Z.stateNode.implementation===oe.implementation){u(se,Z.sibling),Z=v(Z,oe.children||[]),Z.return=se,se=Z;break e}else{u(se,Z);break}else a(se,Z);Z=Z.sibling}Z=wd(oe,se.mode,Le),Z.return=se,se=Z}return j(se);case ye:return rt=oe._init,fn(se,Z,rt(oe._payload),Le)}if(zt(oe))return Ye(se,Z,oe,Le);if(ue(oe))return Je(se,Z,oe,Le);ll(se,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,Z!==null&&Z.tag===6?(u(se,Z.sibling),Z=v(Z,oe),Z.return=se,se=Z):(u(se,Z),Z=vd(oe,se.mode,Le),Z.return=se,se=Z),j(se)):u(se,Z)}return fn}var zs=cp(!0),up=cp(!1),cl=ki(null),ul=null,Ws=null,Pu=null;function Eu(){Pu=Ws=ul=null}function Ru(r){var a=cl.current;Xt(cl),r._currentValue=a}function Mu(r,a,u){for(;r!==null;){var f=r.alternate;if((r.childLanes&a)!==a?(r.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),r===u)break;r=r.return}}function Hs(r,a){ul=r,Pu=Ws=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&a)!==0&&(tr=!0),r.firstContext=null)}function Er(r){var a=r._currentValue;if(Pu!==r)if(r={context:r,memoizedValue:a,next:null},Ws===null){if(ul===null)throw Error(n(308));Ws=r,ul.dependencies={lanes:0,firstContext:r}}else Ws=Ws.next=r;return a}var Zi=null;function Au(r){Zi===null?Zi=[r]:Zi.push(r)}function dp(r,a,u,f){var v=a.interleaved;return v===null?(u.next=u,Au(a)):(u.next=v.next,v.next=u),a.interleaved=u,di(r,f)}function di(r,a){r.lanes|=a;var u=r.alternate;for(u!==null&&(u.lanes|=a),u=r,r=r.return;r!==null;)r.childLanes|=a,u=r.alternate,u!==null&&(u.childLanes|=a),u=r,r=r.return;return u.tag===3?u.stateNode:null}var ji=!1;function Lu(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hp(r,a){r=r.updateQueue,a.updateQueue===r&&(a.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function hi(r,a){return{eventTime:r,lane:a,tag:0,payload:null,callback:null,next:null}}function Ni(r,a,u){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(Dt&2)!==0){var v=f.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),f.pending=a,di(r,u)}return v=f.interleaved,v===null?(a.next=a,Au(f)):(a.next=v.next,v.next=a),f.interleaved=a,di(r,u)}function dl(r,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194240)!==0)){var f=a.lanes;f&=r.pendingLanes,u|=f,a.lanes=u,Ts(r,u)}}function fp(r,a){var u=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var v=null,k=null;if(u=u.firstBaseUpdate,u!==null){do{var j={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};k===null?v=k=j:k=k.next=j,u=u.next}while(u!==null);k===null?v=k=a:k=k.next=a}else v=k=a;u={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:k,shared:f.shared,effects:f.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=a:r.next=a,u.lastBaseUpdate=a}function hl(r,a,u,f){var v=r.updateQueue;ji=!1;var k=v.firstBaseUpdate,j=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var V=B,he=V.next;V.next=null,j===null?k=he:j.next=he,j=V;var Te=r.alternate;Te!==null&&(Te=Te.updateQueue,B=Te.lastBaseUpdate,B!==j&&(B===null?Te.firstBaseUpdate=he:B.next=he,Te.lastBaseUpdate=V))}if(k!==null){var Ee=v.baseState;j=0,Te=he=V=null,B=k;do{var Ce=B.lane,$e=B.eventTime;if((f&Ce)===Ce){Te!==null&&(Te=Te.next={eventTime:$e,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Ye=r,Je=B;switch(Ce=a,$e=u,Je.tag){case 1:if(Ye=Je.payload,typeof Ye=="function"){Ee=Ye.call($e,Ee,Ce);break e}Ee=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=Je.payload,Ce=typeof Ye=="function"?Ye.call($e,Ee,Ce):Ye,Ce==null)break e;Ee=A({},Ee,Ce);break e;case 2:ji=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,Ce=v.effects,Ce===null?v.effects=[B]:Ce.push(B))}else $e={eventTime:$e,lane:Ce,tag:B.tag,payload:B.payload,callback:B.callback,next:null},Te===null?(he=Te=$e,V=Ee):Te=Te.next=$e,j|=Ce;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;Ce=B,B=Ce.next,Ce.next=null,v.lastBaseUpdate=Ce,v.shared.pending=null}}while(!0);if(Te===null&&(V=Ee),v.baseState=V,v.firstBaseUpdate=he,v.lastBaseUpdate=Te,a=v.shared.interleaved,a!==null){v=a;do j|=v.lane,v=v.next;while(v!==a)}else k===null&&(v.shared.lanes=0);ns|=j,r.lanes=j,r.memoizedState=Ee}}function mp(r,a,u){if(r=a.effects,a.effects=null,r!==null)for(a=0;a<r.length;a++){var f=r[a],v=f.callback;if(v!==null){if(f.callback=null,f=u,typeof v!="function")throw Error(n(191,v));v.call(f)}}}var Ia={},Jr=ki(Ia),Da=ki(Ia),_a=ki(Ia);function es(r){if(r===Ia)throw Error(n(174));return r}function Iu(r,a){switch(Kt(_a,a),Kt(Da,r),Kt(Jr,Ia),r=a.nodeType,r){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:xe(null,"");break;default:r=r===8?a.parentNode:a,a=r.namespaceURI||null,r=r.tagName,a=xe(a,r)}Xt(Jr),Kt(Jr,a)}function $s(){Xt(Jr),Xt(Da),Xt(_a)}function pp(r){es(_a.current);var a=es(Jr.current),u=xe(a,r.type);a!==u&&(Kt(Da,r),Kt(Jr,u))}function Du(r){Da.current===r&&(Xt(Jr),Xt(Da))}var rn=ki(0);function fl(r){for(var a=r;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var _u=[];function Fu(){for(var r=0;r<_u.length;r++)_u[r]._workInProgressVersionPrimary=null;_u.length=0}var ml=G.ReactCurrentDispatcher,Ou=G.ReactCurrentBatchConfig,ts=0,sn=null,wn=null,jn=null,pl=!1,Fa=!1,Oa=0,a0=0;function _n(){throw Error(n(321))}function Bu(r,a){if(a===null)return!1;for(var u=0;u<a.length&&u<r.length;u++)if(!Ur(r[u],a[u]))return!1;return!0}function Uu(r,a,u,f,v,k){if(ts=k,sn=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,ml.current=r===null||r.memoizedState===null?u0:d0,r=u(f,v),Fa){k=0;do{if(Fa=!1,Oa=0,25<=k)throw Error(n(301));k+=1,jn=wn=null,a.updateQueue=null,ml.current=h0,r=u(f,v)}while(Fa)}if(ml.current=vl,a=wn!==null&&wn.next!==null,ts=0,jn=wn=sn=null,pl=!1,a)throw Error(n(300));return r}function zu(){var r=Oa!==0;return Oa=0,r}function Zr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?sn.memoizedState=jn=r:jn=jn.next=r,jn}function Rr(){if(wn===null){var r=sn.alternate;r=r!==null?r.memoizedState:null}else r=wn.next;var a=jn===null?sn.memoizedState:jn.next;if(a!==null)jn=a,wn=r;else{if(r===null)throw Error(n(310));wn=r,r={memoizedState:wn.memoizedState,baseState:wn.baseState,baseQueue:wn.baseQueue,queue:wn.queue,next:null},jn===null?sn.memoizedState=jn=r:jn=jn.next=r}return jn}function Ba(r,a){return typeof a=="function"?a(r):a}function Wu(r){var a=Rr(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var f=wn,v=f.baseQueue,k=u.pending;if(k!==null){if(v!==null){var j=v.next;v.next=k.next,k.next=j}f.baseQueue=v=k,u.pending=null}if(v!==null){k=v.next,f=f.baseState;var B=j=null,V=null,he=k;do{var Te=he.lane;if((ts&Te)===Te)V!==null&&(V=V.next={lane:0,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),f=he.hasEagerState?he.eagerState:r(f,he.action);else{var Ee={lane:Te,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};V===null?(B=V=Ee,j=f):V=V.next=Ee,sn.lanes|=Te,ns|=Te}he=he.next}while(he!==null&&he!==k);V===null?j=f:V.next=B,Ur(f,a.memoizedState)||(tr=!0),a.memoizedState=f,a.baseState=j,a.baseQueue=V,u.lastRenderedState=f}if(r=u.interleaved,r!==null){v=r;do k=v.lane,sn.lanes|=k,ns|=k,v=v.next;while(v!==r)}else v===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function Hu(r){var a=Rr(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var f=u.dispatch,v=u.pending,k=a.memoizedState;if(v!==null){u.pending=null;var j=v=v.next;do k=r(k,j.action),j=j.next;while(j!==v);Ur(k,a.memoizedState)||(tr=!0),a.memoizedState=k,a.baseQueue===null&&(a.baseState=k),u.lastRenderedState=k}return[k,f]}function gp(){}function yp(r,a){var u=sn,f=Rr(),v=a(),k=!Ur(f.memoizedState,v);if(k&&(f.memoizedState=v,tr=!0),f=f.queue,$u(bp.bind(null,u,f,r),[r]),f.getSnapshot!==a||k||jn!==null&&jn.memoizedState.tag&1){if(u.flags|=2048,Ua(9,wp.bind(null,u,f,v,a),void 0,null),Nn===null)throw Error(n(349));(ts&30)!==0||vp(u,a,v)}return v}function vp(r,a,u){r.flags|=16384,r={getSnapshot:a,value:u},a=sn.updateQueue,a===null?(a={lastEffect:null,stores:null},sn.updateQueue=a,a.stores=[r]):(u=a.stores,u===null?a.stores=[r]:u.push(r))}function wp(r,a,u,f){a.value=u,a.getSnapshot=f,xp(a)&&kp(r)}function bp(r,a,u){return u(function(){xp(a)&&kp(r)})}function xp(r){var a=r.getSnapshot;r=r.value;try{var u=a();return!Ur(r,u)}catch{return!0}}function kp(r){var a=di(r,1);a!==null&&qr(a,r,1,-1)}function Sp(r){var a=Zr();return typeof r=="function"&&(r=r()),a.memoizedState=a.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ba,lastRenderedState:r},a.queue=r,r=r.dispatch=c0.bind(null,sn,r),[a.memoizedState,r]}function Ua(r,a,u,f){return r={tag:r,create:a,destroy:u,deps:f,next:null},a=sn.updateQueue,a===null?(a={lastEffect:null,stores:null},sn.updateQueue=a,a.lastEffect=r.next=r):(u=a.lastEffect,u===null?a.lastEffect=r.next=r:(f=u.next,u.next=r,r.next=f,a.lastEffect=r)),r}function Cp(){return Rr().memoizedState}function gl(r,a,u,f){var v=Zr();sn.flags|=r,v.memoizedState=Ua(1|a,u,void 0,f===void 0?null:f)}function yl(r,a,u,f){var v=Rr();f=f===void 0?null:f;var k=void 0;if(wn!==null){var j=wn.memoizedState;if(k=j.destroy,f!==null&&Bu(f,j.deps)){v.memoizedState=Ua(a,u,k,f);return}}sn.flags|=r,v.memoizedState=Ua(1|a,u,k,f)}function jp(r,a){return gl(8390656,8,r,a)}function $u(r,a){return yl(2048,8,r,a)}function Np(r,a){return yl(4,2,r,a)}function Tp(r,a){return yl(4,4,r,a)}function Pp(r,a){if(typeof a=="function")return r=r(),a(r),function(){a(null)};if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function Ep(r,a,u){return u=u!=null?u.concat([r]):null,yl(4,4,Pp.bind(null,a,r),u)}function qu(){}function Rp(r,a){var u=Rr();a=a===void 0?null:a;var f=u.memoizedState;return f!==null&&a!==null&&Bu(a,f[1])?f[0]:(u.memoizedState=[r,a],r)}function Mp(r,a){var u=Rr();a=a===void 0?null:a;var f=u.memoizedState;return f!==null&&a!==null&&Bu(a,f[1])?f[0]:(r=r(),u.memoizedState=[r,a],r)}function Ap(r,a,u){return(ts&21)===0?(r.baseState&&(r.baseState=!1,tr=!0),r.memoizedState=u):(Ur(u,a)||(u=Oo(),sn.lanes|=u,ns|=u,r.baseState=!0),a)}function o0(r,a){var u=_t;_t=u!==0&&4>u?u:4,r(!0);var f=Ou.transition;Ou.transition={};try{r(!1),a()}finally{_t=u,Ou.transition=f}}function Lp(){return Rr().memoizedState}function l0(r,a,u){var f=Ri(r);if(u={lane:f,action:u,hasEagerState:!1,eagerState:null,next:null},Ip(r))Dp(a,u);else if(u=dp(r,a,u,f),u!==null){var v=$n();qr(u,r,f,v),_p(u,a,f)}}function c0(r,a,u){var f=Ri(r),v={lane:f,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ip(r))Dp(a,v);else{var k=r.alternate;if(r.lanes===0&&(k===null||k.lanes===0)&&(k=a.lastRenderedReducer,k!==null))try{var j=a.lastRenderedState,B=k(j,u);if(v.hasEagerState=!0,v.eagerState=B,Ur(B,j)){var V=a.interleaved;V===null?(v.next=v,Au(a)):(v.next=V.next,V.next=v),a.interleaved=v;return}}catch{}finally{}u=dp(r,a,v,f),u!==null&&(v=$n(),qr(u,r,f,v),_p(u,a,f))}}function Ip(r){var a=r.alternate;return r===sn||a!==null&&a===sn}function Dp(r,a){Fa=pl=!0;var u=r.pending;u===null?a.next=a:(a.next=u.next,u.next=a),r.pending=a}function _p(r,a,u){if((u&4194240)!==0){var f=a.lanes;f&=r.pendingLanes,u|=f,a.lanes=u,Ts(r,u)}}var vl={readContext:Er,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},u0={readContext:Er,useCallback:function(r,a){return Zr().memoizedState=[r,a===void 0?null:a],r},useContext:Er,useEffect:jp,useImperativeHandle:function(r,a,u){return u=u!=null?u.concat([r]):null,gl(4194308,4,Pp.bind(null,a,r),u)},useLayoutEffect:function(r,a){return gl(4194308,4,r,a)},useInsertionEffect:function(r,a){return gl(4,2,r,a)},useMemo:function(r,a){var u=Zr();return a=a===void 0?null:a,r=r(),u.memoizedState=[r,a],r},useReducer:function(r,a,u){var f=Zr();return a=u!==void 0?u(a):a,f.memoizedState=f.baseState=a,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:a},f.queue=r,r=r.dispatch=l0.bind(null,sn,r),[f.memoizedState,r]},useRef:function(r){var a=Zr();return r={current:r},a.memoizedState=r},useState:Sp,useDebugValue:qu,useDeferredValue:function(r){return Zr().memoizedState=r},useTransition:function(){var r=Sp(!1),a=r[0];return r=o0.bind(null,r[1]),Zr().memoizedState=r,[a,r]},useMutableSource:function(){},useSyncExternalStore:function(r,a,u){var f=sn,v=Zr();if(Zt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=a(),Nn===null)throw Error(n(349));(ts&30)!==0||vp(f,a,u)}v.memoizedState=u;var k={value:u,getSnapshot:a};return v.queue=k,jp(bp.bind(null,f,k,r),[r]),f.flags|=2048,Ua(9,wp.bind(null,f,k,u,a),void 0,null),u},useId:function(){var r=Zr(),a=Nn.identifierPrefix;if(Zt){var u=ui,f=ci;u=(f&~(1<<32-ze(f)-1)).toString(32)+u,a=":"+a+"R"+u,u=Oa++,0<u&&(a+="H"+u.toString(32)),a+=":"}else u=a0++,a=":"+a+"r"+u.toString(32)+":";return r.memoizedState=a},unstable_isNewReconciler:!1},d0={readContext:Er,useCallback:Rp,useContext:Er,useEffect:$u,useImperativeHandle:Ep,useInsertionEffect:Np,useLayoutEffect:Tp,useMemo:Mp,useReducer:Wu,useRef:Cp,useState:function(){return Wu(Ba)},useDebugValue:qu,useDeferredValue:function(r){var a=Rr();return Ap(a,wn.memoizedState,r)},useTransition:function(){var r=Wu(Ba)[0],a=Rr().memoizedState;return[r,a]},useMutableSource:gp,useSyncExternalStore:yp,useId:Lp,unstable_isNewReconciler:!1},h0={readContext:Er,useCallback:Rp,useContext:Er,useEffect:$u,useImperativeHandle:Ep,useInsertionEffect:Np,useLayoutEffect:Tp,useMemo:Mp,useReducer:Hu,useRef:Cp,useState:function(){return Hu(Ba)},useDebugValue:qu,useDeferredValue:function(r){var a=Rr();return wn===null?a.memoizedState=r:Ap(a,wn.memoizedState,r)},useTransition:function(){var r=Hu(Ba)[0],a=Rr().memoizedState;return[r,a]},useMutableSource:gp,useSyncExternalStore:yp,useId:Lp,unstable_isNewReconciler:!1};function Wr(r,a){if(r&&r.defaultProps){a=A({},a),r=r.defaultProps;for(var u in r)a[u]===void 0&&(a[u]=r[u]);return a}return a}function Vu(r,a,u,f){a=r.memoizedState,u=u(f,a),u=u==null?a:A({},a,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var wl={isMounted:function(r){return(r=r._reactInternals)?O(r)===r:!1},enqueueSetState:function(r,a,u){r=r._reactInternals;var f=$n(),v=Ri(r),k=hi(f,v);k.payload=a,u!=null&&(k.callback=u),a=Ni(r,k,v),a!==null&&(qr(a,r,v,f),dl(a,r,v))},enqueueReplaceState:function(r,a,u){r=r._reactInternals;var f=$n(),v=Ri(r),k=hi(f,v);k.tag=1,k.payload=a,u!=null&&(k.callback=u),a=Ni(r,k,v),a!==null&&(qr(a,r,v,f),dl(a,r,v))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var u=$n(),f=Ri(r),v=hi(u,f);v.tag=2,a!=null&&(v.callback=a),a=Ni(r,v,f),a!==null&&(qr(a,r,f,u),dl(a,r,f))}};function Fp(r,a,u,f,v,k,j){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,k,j):a.prototype&&a.prototype.isPureReactComponent?!Na(u,f)||!Na(v,k):!0}function Op(r,a,u){var f=!1,v=Si,k=a.contextType;return typeof k=="object"&&k!==null?k=Er(k):(v=er(a)?Yi:Dn.current,f=a.contextTypes,k=(f=f!=null)?Fs(r,v):Si),a=new a(u,k),r.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=wl,r.stateNode=a,a._reactInternals=r,f&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=k),a}function Bp(r,a,u,f){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,f),a.state!==r&&wl.enqueueReplaceState(a,a.state,null)}function Gu(r,a,u,f){var v=r.stateNode;v.props=u,v.state=r.memoizedState,v.refs={},Lu(r);var k=a.contextType;typeof k=="object"&&k!==null?v.context=Er(k):(k=er(a)?Yi:Dn.current,v.context=Fs(r,k)),v.state=r.memoizedState,k=a.getDerivedStateFromProps,typeof k=="function"&&(Vu(r,a,k,u),v.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(a=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),a!==v.state&&wl.enqueueReplaceState(v,v.state,null),hl(r,u,v,f),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function qs(r,a){try{var u="",f=a;do u+=je(f),f=f.return;while(f);var v=u}catch(k){v=`
|
|
40
|
+
Error generating stack: `+k.message+`
|
|
41
|
+
`+k.stack}return{value:r,source:a,stack:v,digest:null}}function Ku(r,a,u){return{value:r,source:null,stack:u??null,digest:a??null}}function Qu(r,a){try{console.error(a.value)}catch(u){setTimeout(function(){throw u})}}var f0=typeof WeakMap=="function"?WeakMap:Map;function Up(r,a,u){u=hi(-1,u),u.tag=3,u.payload={element:null};var f=a.value;return u.callback=function(){Nl||(Nl=!0,ud=f),Qu(r,a)},u}function zp(r,a,u){u=hi(-1,u),u.tag=3;var f=r.type.getDerivedStateFromError;if(typeof f=="function"){var v=a.value;u.payload=function(){return f(v)},u.callback=function(){Qu(r,a)}}var k=r.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(u.callback=function(){Qu(r,a),typeof f!="function"&&(Pi===null?Pi=new Set([this]):Pi.add(this));var j=a.stack;this.componentDidCatch(a.value,{componentStack:j!==null?j:""})}),u}function Wp(r,a,u){var f=r.pingCache;if(f===null){f=r.pingCache=new f0;var v=new Set;f.set(a,v)}else v=f.get(a),v===void 0&&(v=new Set,f.set(a,v));v.has(u)||(v.add(u),r=T0.bind(null,r,a,u),a.then(r,r))}function Hp(r){do{var a;if((a=r.tag===13)&&(a=r.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return r;r=r.return}while(r!==null);return null}function $p(r,a,u,f,v){return(r.mode&1)===0?(r===a?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(a=hi(-1,1),a.tag=2,Ni(u,a,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var m0=G.ReactCurrentOwner,tr=!1;function Hn(r,a,u,f){a.child=r===null?up(a,null,u,f):zs(a,r.child,u,f)}function qp(r,a,u,f,v){u=u.render;var k=a.ref;return Hs(a,v),f=Uu(r,a,u,f,k,v),u=zu(),r!==null&&!tr?(a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~v,fi(r,a,v)):(Zt&&u&&Su(a),a.flags|=1,Hn(r,a,f,v),a.child)}function Vp(r,a,u,f,v){if(r===null){var k=u.type;return typeof k=="function"&&!yd(k)&&k.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(a.tag=15,a.type=k,Gp(r,a,k,f,v)):(r=Al(u.type,null,f,a,a.mode,v),r.ref=a.ref,r.return=a,a.child=r)}if(k=r.child,(r.lanes&v)===0){var j=k.memoizedProps;if(u=u.compare,u=u!==null?u:Na,u(j,f)&&r.ref===a.ref)return fi(r,a,v)}return a.flags|=1,r=Ai(k,f),r.ref=a.ref,r.return=a,a.child=r}function Gp(r,a,u,f,v){if(r!==null){var k=r.memoizedProps;if(Na(k,f)&&r.ref===a.ref)if(tr=!1,a.pendingProps=f=k,(r.lanes&v)!==0)(r.flags&131072)!==0&&(tr=!0);else return a.lanes=r.lanes,fi(r,a,v)}return Yu(r,a,u,f,v)}function Kp(r,a,u){var f=a.pendingProps,v=f.children,k=r!==null?r.memoizedState:null;if(f.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Kt(Gs,pr),pr|=u;else{if((u&1073741824)===0)return r=k!==null?k.baseLanes|u:u,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:r,cachePool:null,transitions:null},a.updateQueue=null,Kt(Gs,pr),pr|=r,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=k!==null?k.baseLanes:u,Kt(Gs,pr),pr|=f}else k!==null?(f=k.baseLanes|u,a.memoizedState=null):f=u,Kt(Gs,pr),pr|=f;return Hn(r,a,v,u),a.child}function Qp(r,a){var u=a.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(a.flags|=512,a.flags|=2097152)}function Yu(r,a,u,f,v){var k=er(u)?Yi:Dn.current;return k=Fs(a,k),Hs(a,v),u=Uu(r,a,u,f,k,v),f=zu(),r!==null&&!tr?(a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~v,fi(r,a,v)):(Zt&&f&&Su(a),a.flags|=1,Hn(r,a,u,v),a.child)}function Yp(r,a,u,f,v){if(er(u)){var k=!0;rl(a)}else k=!1;if(Hs(a,v),a.stateNode===null)xl(r,a),Op(a,u,f),Gu(a,u,f,v),f=!0;else if(r===null){var j=a.stateNode,B=a.memoizedProps;j.props=B;var V=j.context,he=u.contextType;typeof he=="object"&&he!==null?he=Er(he):(he=er(u)?Yi:Dn.current,he=Fs(a,he));var Te=u.getDerivedStateFromProps,Ee=typeof Te=="function"||typeof j.getSnapshotBeforeUpdate=="function";Ee||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(B!==f||V!==he)&&Bp(a,j,f,he),ji=!1;var Ce=a.memoizedState;j.state=Ce,hl(a,f,j,v),V=a.memoizedState,B!==f||Ce!==V||Zn.current||ji?(typeof Te=="function"&&(Vu(a,u,Te,f),V=a.memoizedState),(B=ji||Fp(a,u,B,f,Ce,V,he))?(Ee||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(a.flags|=4194308)):(typeof j.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=V),j.props=f,j.state=V,j.context=he,f=B):(typeof j.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{j=a.stateNode,hp(r,a),B=a.memoizedProps,he=a.type===a.elementType?B:Wr(a.type,B),j.props=he,Ee=a.pendingProps,Ce=j.context,V=u.contextType,typeof V=="object"&&V!==null?V=Er(V):(V=er(u)?Yi:Dn.current,V=Fs(a,V));var $e=u.getDerivedStateFromProps;(Te=typeof $e=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(B!==Ee||Ce!==V)&&Bp(a,j,f,V),ji=!1,Ce=a.memoizedState,j.state=Ce,hl(a,f,j,v);var Ye=a.memoizedState;B!==Ee||Ce!==Ye||Zn.current||ji?(typeof $e=="function"&&(Vu(a,u,$e,f),Ye=a.memoizedState),(he=ji||Fp(a,u,he,f,Ce,Ye,V)||!1)?(Te||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(f,Ye,V),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(f,Ye,V)),typeof j.componentDidUpdate=="function"&&(a.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof j.componentDidUpdate!="function"||B===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=Ye),j.props=f,j.state=Ye,j.context=V,f=he):(typeof j.componentDidUpdate!="function"||B===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=1024),f=!1)}return Xu(r,a,u,f,k,v)}function Xu(r,a,u,f,v,k){Qp(r,a);var j=(a.flags&128)!==0;if(!f&&!j)return v&&tp(a,u,!1),fi(r,a,k);f=a.stateNode,m0.current=a;var B=j&&typeof u.getDerivedStateFromError!="function"?null:f.render();return a.flags|=1,r!==null&&j?(a.child=zs(a,r.child,null,k),a.child=zs(a,null,B,k)):Hn(r,a,B,k),a.memoizedState=f.state,v&&tp(a,u,!0),a.child}function Xp(r){var a=r.stateNode;a.pendingContext?Zm(r,a.pendingContext,a.pendingContext!==a.context):a.context&&Zm(r,a.context,!1),Iu(r,a.containerInfo)}function Jp(r,a,u,f,v){return Us(),Tu(v),a.flags|=256,Hn(r,a,u,f),a.child}var Ju={dehydrated:null,treeContext:null,retryLane:0};function Zu(r){return{baseLanes:r,cachePool:null,transitions:null}}function Zp(r,a,u){var f=a.pendingProps,v=rn.current,k=!1,j=(a.flags&128)!==0,B;if((B=j)||(B=r!==null&&r.memoizedState===null?!1:(v&2)!==0),B?(k=!0,a.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),Kt(rn,v&1),r===null)return Nu(a),r=a.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((a.mode&1)===0?a.lanes=1:r.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(j=f.children,r=f.fallback,k?(f=a.mode,k=a.child,j={mode:"hidden",children:j},(f&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=j):k=Ll(j,f,0,null),r=as(r,f,u,null),k.return=a,r.return=a,k.sibling=r,a.child=k,a.child.memoizedState=Zu(u),a.memoizedState=Ju,r):ed(a,j));if(v=r.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return p0(r,a,j,f,B,v,u);if(k){k=f.fallback,j=a.mode,v=r.child,B=v.sibling;var V={mode:"hidden",children:f.children};return(j&1)===0&&a.child!==v?(f=a.child,f.childLanes=0,f.pendingProps=V,a.deletions=null):(f=Ai(v,V),f.subtreeFlags=v.subtreeFlags&14680064),B!==null?k=Ai(B,k):(k=as(k,j,u,null),k.flags|=2),k.return=a,f.return=a,f.sibling=k,a.child=f,f=k,k=a.child,j=r.child.memoizedState,j=j===null?Zu(u):{baseLanes:j.baseLanes|u,cachePool:null,transitions:j.transitions},k.memoizedState=j,k.childLanes=r.childLanes&~u,a.memoizedState=Ju,f}return k=r.child,r=k.sibling,f=Ai(k,{mode:"visible",children:f.children}),(a.mode&1)===0&&(f.lanes=u),f.return=a,f.sibling=null,r!==null&&(u=a.deletions,u===null?(a.deletions=[r],a.flags|=16):u.push(r)),a.child=f,a.memoizedState=null,f}function ed(r,a){return a=Ll({mode:"visible",children:a},r.mode,0,null),a.return=r,r.child=a}function bl(r,a,u,f){return f!==null&&Tu(f),zs(a,r.child,null,u),r=ed(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function p0(r,a,u,f,v,k,j){if(u)return a.flags&256?(a.flags&=-257,f=Ku(Error(n(422))),bl(r,a,j,f)):a.memoizedState!==null?(a.child=r.child,a.flags|=128,null):(k=f.fallback,v=a.mode,f=Ll({mode:"visible",children:f.children},v,0,null),k=as(k,v,j,null),k.flags|=2,f.return=a,k.return=a,f.sibling=k,a.child=f,(a.mode&1)!==0&&zs(a,r.child,null,j),a.child.memoizedState=Zu(j),a.memoizedState=Ju,k);if((a.mode&1)===0)return bl(r,a,j,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var B=f.dgst;return f=B,k=Error(n(419)),f=Ku(k,f,void 0),bl(r,a,j,f)}if(B=(j&r.childLanes)!==0,tr||B){if(f=Nn,f!==null){switch(j&-j){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(f.suspendedLanes|j))!==0?0:v,v!==0&&v!==k.retryLane&&(k.retryLane=v,di(r,v),qr(f,r,v,-1))}return gd(),f=Ku(Error(n(421))),bl(r,a,j,f)}return v.data==="$?"?(a.flags|=128,a.child=r.child,a=P0.bind(null,r),v._reactRetry=a,null):(r=k.treeContext,mr=xi(v.nextSibling),fr=a,Zt=!0,zr=null,r!==null&&(Tr[Pr++]=ci,Tr[Pr++]=ui,Tr[Pr++]=Xi,ci=r.id,ui=r.overflow,Xi=a),a=ed(a,f.children),a.flags|=4096,a)}function eg(r,a,u){r.lanes|=a;var f=r.alternate;f!==null&&(f.lanes|=a),Mu(r.return,a,u)}function td(r,a,u,f,v){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:v}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=u,k.tailMode=v)}function tg(r,a,u){var f=a.pendingProps,v=f.revealOrder,k=f.tail;if(Hn(r,a,f.children,u),f=rn.current,(f&2)!==0)f=f&1|2,a.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&eg(r,u,a);else if(r.tag===19)eg(r,u,a);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}f&=1}if(Kt(rn,f),(a.mode&1)===0)a.memoizedState=null;else switch(v){case"forwards":for(u=a.child,v=null;u!==null;)r=u.alternate,r!==null&&fl(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=a.child,a.child=null):(v=u.sibling,u.sibling=null),td(a,!1,v,u,k);break;case"backwards":for(u=null,v=a.child,a.child=null;v!==null;){if(r=v.alternate,r!==null&&fl(r)===null){a.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}td(a,!0,u,null,k);break;case"together":td(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function xl(r,a){(a.mode&1)===0&&r!==null&&(r.alternate=null,a.alternate=null,a.flags|=2)}function fi(r,a,u){if(r!==null&&(a.dependencies=r.dependencies),ns|=a.lanes,(u&a.childLanes)===0)return null;if(r!==null&&a.child!==r.child)throw Error(n(153));if(a.child!==null){for(r=a.child,u=Ai(r,r.pendingProps),a.child=u,u.return=a;r.sibling!==null;)r=r.sibling,u=u.sibling=Ai(r,r.pendingProps),u.return=a;u.sibling=null}return a.child}function g0(r,a,u){switch(a.tag){case 3:Xp(a),Us();break;case 5:pp(a);break;case 1:er(a.type)&&rl(a);break;case 4:Iu(a,a.stateNode.containerInfo);break;case 10:var f=a.type._context,v=a.memoizedProps.value;Kt(cl,f._currentValue),f._currentValue=v;break;case 13:if(f=a.memoizedState,f!==null)return f.dehydrated!==null?(Kt(rn,rn.current&1),a.flags|=128,null):(u&a.child.childLanes)!==0?Zp(r,a,u):(Kt(rn,rn.current&1),r=fi(r,a,u),r!==null?r.sibling:null);Kt(rn,rn.current&1);break;case 19:if(f=(u&a.childLanes)!==0,(r.flags&128)!==0){if(f)return tg(r,a,u);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Kt(rn,rn.current),f)break;return null;case 22:case 23:return a.lanes=0,Kp(r,a,u)}return fi(r,a,u)}var ng,nd,rg,ig;ng=function(r,a){for(var u=a.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},nd=function(){},rg=function(r,a,u,f){var v=r.memoizedProps;if(v!==f){r=a.stateNode,es(Jr.current);var k=null;switch(u){case"input":v=Ue(r,v),f=Ue(r,f),k=[];break;case"select":v=A({},v,{value:void 0}),f=A({},f,{value:void 0}),k=[];break;case"textarea":v=Mt(r,v),f=Mt(r,f),k=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(r.onclick=el)}Pe(u,f);var j;u=null;for(he in v)if(!f.hasOwnProperty(he)&&v.hasOwnProperty(he)&&v[he]!=null)if(he==="style"){var B=v[he];for(j in B)B.hasOwnProperty(j)&&(u||(u={}),u[j]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(o.hasOwnProperty(he)?k||(k=[]):(k=k||[]).push(he,null));for(he in f){var V=f[he];if(B=v!=null?v[he]:void 0,f.hasOwnProperty(he)&&V!==B&&(V!=null||B!=null))if(he==="style")if(B){for(j in B)!B.hasOwnProperty(j)||V&&V.hasOwnProperty(j)||(u||(u={}),u[j]="");for(j in V)V.hasOwnProperty(j)&&B[j]!==V[j]&&(u||(u={}),u[j]=V[j])}else u||(k||(k=[]),k.push(he,u)),u=V;else he==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,B=B?B.__html:void 0,V!=null&&B!==V&&(k=k||[]).push(he,V)):he==="children"?typeof V!="string"&&typeof V!="number"||(k=k||[]).push(he,""+V):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(o.hasOwnProperty(he)?(V!=null&&he==="onScroll"&&Yt("scroll",r),k||B===V||(k=[])):(k=k||[]).push(he,V))}u&&(k=k||[]).push("style",u);var he=k;(a.updateQueue=he)&&(a.flags|=4)}},ig=function(r,a,u,f){u!==f&&(a.flags|=4)};function za(r,a){if(!Zt)switch(r.tailMode){case"hidden":a=r.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function Fn(r){var a=r.alternate!==null&&r.alternate.child===r.child,u=0,f=0;if(a)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=f,r.childLanes=u,a}function y0(r,a,u){var f=a.pendingProps;switch(Cu(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fn(a),null;case 1:return er(a.type)&&nl(),Fn(a),null;case 3:return f=a.stateNode,$s(),Xt(Zn),Xt(Dn),Fu(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(r===null||r.child===null)&&(ol(a)?a.flags|=4:r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,zr!==null&&(fd(zr),zr=null))),nd(r,a),Fn(a),null;case 5:Du(a);var v=es(_a.current);if(u=a.type,r!==null&&a.stateNode!=null)rg(r,a,u,f,v),r.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!f){if(a.stateNode===null)throw Error(n(166));return Fn(a),null}if(r=es(Jr.current),ol(a)){f=a.stateNode,u=a.type;var k=a.memoizedProps;switch(f[Xr]=a,f[Ma]=k,r=(a.mode&1)!==0,u){case"dialog":Yt("cancel",f),Yt("close",f);break;case"iframe":case"object":case"embed":Yt("load",f);break;case"video":case"audio":for(v=0;v<Pa.length;v++)Yt(Pa[v],f);break;case"source":Yt("error",f);break;case"img":case"image":case"link":Yt("error",f),Yt("load",f);break;case"details":Yt("toggle",f);break;case"input":Ht(f,k),Yt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!k.multiple},Yt("invalid",f);break;case"textarea":Vt(f,k),Yt("invalid",f)}Pe(u,k),v=null;for(var j in k)if(k.hasOwnProperty(j)){var B=k[j];j==="children"?typeof B=="string"?f.textContent!==B&&(k.suppressHydrationWarning!==!0&&Zo(f.textContent,B,r),v=["children",B]):typeof B=="number"&&f.textContent!==""+B&&(k.suppressHydrationWarning!==!0&&Zo(f.textContent,B,r),v=["children",""+B]):o.hasOwnProperty(j)&&B!=null&&j==="onScroll"&&Yt("scroll",f)}switch(u){case"input":Tt(f),yt(f,k,!0);break;case"textarea":Tt(f),It(f);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(f.onclick=el)}f=v,a.updateQueue=f,f!==null&&(a.flags|=4)}else{j=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=de(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=j.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof f.is=="string"?r=j.createElement(u,{is:f.is}):(r=j.createElement(u),u==="select"&&(j=r,f.multiple?j.multiple=!0:f.size&&(j.size=f.size))):r=j.createElementNS(r,u),r[Xr]=a,r[Ma]=f,ng(r,a,!1,!1),a.stateNode=r;e:{switch(j=nt(u,f),u){case"dialog":Yt("cancel",r),Yt("close",r),v=f;break;case"iframe":case"object":case"embed":Yt("load",r),v=f;break;case"video":case"audio":for(v=0;v<Pa.length;v++)Yt(Pa[v],r);v=f;break;case"source":Yt("error",r),v=f;break;case"img":case"image":case"link":Yt("error",r),Yt("load",r),v=f;break;case"details":Yt("toggle",r),v=f;break;case"input":Ht(r,f),v=Ue(r,f),Yt("invalid",r);break;case"option":v=f;break;case"select":r._wrapperState={wasMultiple:!!f.multiple},v=A({},f,{value:void 0}),Yt("invalid",r);break;case"textarea":Vt(r,f),v=Mt(r,f),Yt("invalid",r);break;default:v=f}Pe(u,v),B=v;for(k in B)if(B.hasOwnProperty(k)){var V=B[k];k==="style"?be(r,V):k==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,V!=null&&Ve(r,V)):k==="children"?typeof V=="string"?(u!=="textarea"||V!=="")&&Qe(r,V):typeof V=="number"&&Qe(r,""+V):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(o.hasOwnProperty(k)?V!=null&&k==="onScroll"&&Yt("scroll",r):V!=null&&R(r,k,V,j))}switch(u){case"input":Tt(r),yt(r,f,!1);break;case"textarea":Tt(r),It(r);break;case"option":f.value!=null&&r.setAttribute("value",""+Re(f.value));break;case"select":r.multiple=!!f.multiple,k=f.value,k!=null?gt(r,!!f.multiple,k,!1):f.defaultValue!=null&>(r,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=el)}switch(u){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return Fn(a),null;case 6:if(r&&a.stateNode!=null)ig(r,a,r.memoizedProps,f);else{if(typeof f!="string"&&a.stateNode===null)throw Error(n(166));if(u=es(_a.current),es(Jr.current),ol(a)){if(f=a.stateNode,u=a.memoizedProps,f[Xr]=a,(k=f.nodeValue!==u)&&(r=fr,r!==null))switch(r.tag){case 3:Zo(f.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Zo(f.nodeValue,u,(r.mode&1)!==0)}k&&(a.flags|=4)}else f=(u.nodeType===9?u:u.ownerDocument).createTextNode(f),f[Xr]=a,a.stateNode=f}return Fn(a),null;case 13:if(Xt(rn),f=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Zt&&mr!==null&&(a.mode&1)!==0&&(a.flags&128)===0)op(),Us(),a.flags|=98560,k=!1;else if(k=ol(a),f!==null&&f.dehydrated!==null){if(r===null){if(!k)throw Error(n(318));if(k=a.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[Xr]=a}else Us(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Fn(a),k=!1}else zr!==null&&(fd(zr),zr=null),k=!0;if(!k)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=u,a):(f=f!==null,f!==(r!==null&&r.memoizedState!==null)&&f&&(a.child.flags|=8192,(a.mode&1)!==0&&(r===null||(rn.current&1)!==0?bn===0&&(bn=3):gd())),a.updateQueue!==null&&(a.flags|=4),Fn(a),null);case 4:return $s(),nd(r,a),r===null&&Ea(a.stateNode.containerInfo),Fn(a),null;case 10:return Ru(a.type._context),Fn(a),null;case 17:return er(a.type)&&nl(),Fn(a),null;case 19:if(Xt(rn),k=a.memoizedState,k===null)return Fn(a),null;if(f=(a.flags&128)!==0,j=k.rendering,j===null)if(f)za(k,!1);else{if(bn!==0||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(j=fl(r),j!==null){for(a.flags|=128,za(k,!1),f=j.updateQueue,f!==null&&(a.updateQueue=f,a.flags|=4),a.subtreeFlags=0,f=u,u=a.child;u!==null;)k=u,r=f,k.flags&=14680066,j=k.alternate,j===null?(k.childLanes=0,k.lanes=r,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=j.childLanes,k.lanes=j.lanes,k.child=j.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=j.memoizedProps,k.memoizedState=j.memoizedState,k.updateQueue=j.updateQueue,k.type=j.type,r=j.dependencies,k.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return Kt(rn,rn.current&1|2),a.child}r=r.sibling}k.tail!==null&&kt()>Ks&&(a.flags|=128,f=!0,za(k,!1),a.lanes=4194304)}else{if(!f)if(r=fl(j),r!==null){if(a.flags|=128,f=!0,u=r.updateQueue,u!==null&&(a.updateQueue=u,a.flags|=4),za(k,!0),k.tail===null&&k.tailMode==="hidden"&&!j.alternate&&!Zt)return Fn(a),null}else 2*kt()-k.renderingStartTime>Ks&&u!==1073741824&&(a.flags|=128,f=!0,za(k,!1),a.lanes=4194304);k.isBackwards?(j.sibling=a.child,a.child=j):(u=k.last,u!==null?u.sibling=j:a.child=j,k.last=j)}return k.tail!==null?(a=k.tail,k.rendering=a,k.tail=a.sibling,k.renderingStartTime=kt(),a.sibling=null,u=rn.current,Kt(rn,f?u&1|2:u&1),a):(Fn(a),null);case 22:case 23:return pd(),f=a.memoizedState!==null,r!==null&&r.memoizedState!==null!==f&&(a.flags|=8192),f&&(a.mode&1)!==0?(pr&1073741824)!==0&&(Fn(a),a.subtreeFlags&6&&(a.flags|=8192)):Fn(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function v0(r,a){switch(Cu(a),a.tag){case 1:return er(a.type)&&nl(),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return $s(),Xt(Zn),Xt(Dn),Fu(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 5:return Du(a),null;case 13:if(Xt(rn),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Us()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return Xt(rn),null;case 4:return $s(),null;case 10:return Ru(a.type._context),null;case 22:case 23:return pd(),null;case 24:return null;default:return null}}var kl=!1,On=!1,w0=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function Vs(r,a){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(f){ln(r,a,f)}else u.current=null}function rd(r,a,u){try{u()}catch(f){ln(r,a,f)}}var sg=!1;function b0(r,a){if(pu=Wo,r=Fm(),ou(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var v=f.anchorOffset,k=f.focusNode;f=f.focusOffset;try{u.nodeType,k.nodeType}catch{u=null;break e}var j=0,B=-1,V=-1,he=0,Te=0,Ee=r,Ce=null;t:for(;;){for(var $e;Ee!==u||v!==0&&Ee.nodeType!==3||(B=j+v),Ee!==k||f!==0&&Ee.nodeType!==3||(V=j+f),Ee.nodeType===3&&(j+=Ee.nodeValue.length),($e=Ee.firstChild)!==null;)Ce=Ee,Ee=$e;for(;;){if(Ee===r)break t;if(Ce===u&&++he===v&&(B=j),Ce===k&&++Te===f&&(V=j),($e=Ee.nextSibling)!==null)break;Ee=Ce,Ce=Ee.parentNode}Ee=$e}u=B===-1||V===-1?null:{start:B,end:V}}else u=null}u=u||{start:0,end:0}}else u=null;for(gu={focusedElem:r,selectionRange:u},Wo=!1,Ke=a;Ke!==null;)if(a=Ke,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,Ke=r;else for(;Ke!==null;){a=Ke;try{var Ye=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Ye!==null){var Je=Ye.memoizedProps,fn=Ye.memoizedState,se=a.stateNode,Z=se.getSnapshotBeforeUpdate(a.elementType===a.type?Je:Wr(a.type,Je),fn);se.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:var oe=a.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Le){ln(a,a.return,Le)}if(r=a.sibling,r!==null){r.return=a.return,Ke=r;break}Ke=a.return}return Ye=sg,sg=!1,Ye}function Wa(r,a,u){var f=a.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&r)===r){var k=v.destroy;v.destroy=void 0,k!==void 0&&rd(a,u,k)}v=v.next}while(v!==f)}}function Sl(r,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var u=a=a.next;do{if((u.tag&r)===r){var f=u.create;u.destroy=f()}u=u.next}while(u!==a)}}function id(r){var a=r.ref;if(a!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof a=="function"?a(r):a.current=r}}function ag(r){var a=r.alternate;a!==null&&(r.alternate=null,ag(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&(delete a[Xr],delete a[Ma],delete a[bu],delete a[n0],delete a[r0])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function og(r){return r.tag===5||r.tag===3||r.tag===4}function lg(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||og(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function sd(r,a,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,a?u.nodeType===8?u.parentNode.insertBefore(r,a):u.insertBefore(r,a):(u.nodeType===8?(a=u.parentNode,a.insertBefore(r,u)):(a=u,a.appendChild(r)),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=el));else if(f!==4&&(r=r.child,r!==null))for(sd(r,a,u),r=r.sibling;r!==null;)sd(r,a,u),r=r.sibling}function ad(r,a,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,a?u.insertBefore(r,a):u.appendChild(r);else if(f!==4&&(r=r.child,r!==null))for(ad(r,a,u),r=r.sibling;r!==null;)ad(r,a,u),r=r.sibling}var En=null,Hr=!1;function Ti(r,a,u){for(u=u.child;u!==null;)cg(r,a,u),u=u.sibling}function cg(r,a,u){if(lt&&typeof lt.onCommitFiberUnmount=="function")try{lt.onCommitFiberUnmount(pe,u)}catch{}switch(u.tag){case 5:On||Vs(u,a);case 6:var f=En,v=Hr;En=null,Ti(r,a,u),En=f,Hr=v,En!==null&&(Hr?(r=En,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):En.removeChild(u.stateNode));break;case 18:En!==null&&(Hr?(r=En,u=u.stateNode,r.nodeType===8?wu(r.parentNode,u):r.nodeType===1&&wu(r,u),ba(r)):wu(En,u.stateNode));break;case 4:f=En,v=Hr,En=u.stateNode.containerInfo,Hr=!0,Ti(r,a,u),En=f,Hr=v;break;case 0:case 11:case 14:case 15:if(!On&&(f=u.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var k=v,j=k.destroy;k=k.tag,j!==void 0&&((k&2)!==0||(k&4)!==0)&&rd(u,a,j),v=v.next}while(v!==f)}Ti(r,a,u);break;case 1:if(!On&&(Vs(u,a),f=u.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=u.memoizedProps,f.state=u.memoizedState,f.componentWillUnmount()}catch(B){ln(u,a,B)}Ti(r,a,u);break;case 21:Ti(r,a,u);break;case 22:u.mode&1?(On=(f=On)||u.memoizedState!==null,Ti(r,a,u),On=f):Ti(r,a,u);break;default:Ti(r,a,u)}}function ug(r){var a=r.updateQueue;if(a!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new w0),a.forEach(function(f){var v=E0.bind(null,r,f);u.has(f)||(u.add(f),f.then(v,v))})}}function $r(r,a){var u=a.deletions;if(u!==null)for(var f=0;f<u.length;f++){var v=u[f];try{var k=r,j=a,B=j;e:for(;B!==null;){switch(B.tag){case 5:En=B.stateNode,Hr=!1;break e;case 3:En=B.stateNode.containerInfo,Hr=!0;break e;case 4:En=B.stateNode.containerInfo,Hr=!0;break e}B=B.return}if(En===null)throw Error(n(160));cg(k,j,v),En=null,Hr=!1;var V=v.alternate;V!==null&&(V.return=null),v.return=null}catch(he){ln(v,a,he)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)dg(a,r),a=a.sibling}function dg(r,a){var u=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if($r(a,r),ei(r),f&4){try{Wa(3,r,r.return),Sl(3,r)}catch(Je){ln(r,r.return,Je)}try{Wa(5,r,r.return)}catch(Je){ln(r,r.return,Je)}}break;case 1:$r(a,r),ei(r),f&512&&u!==null&&Vs(u,u.return);break;case 5:if($r(a,r),ei(r),f&512&&u!==null&&Vs(u,u.return),r.flags&32){var v=r.stateNode;try{Qe(v,"")}catch(Je){ln(r,r.return,Je)}}if(f&4&&(v=r.stateNode,v!=null)){var k=r.memoizedProps,j=u!==null?u.memoizedProps:k,B=r.type,V=r.updateQueue;if(r.updateQueue=null,V!==null)try{B==="input"&&k.type==="radio"&&k.name!=null&&vt(v,k),nt(B,j);var he=nt(B,k);for(j=0;j<V.length;j+=2){var Te=V[j],Ee=V[j+1];Te==="style"?be(v,Ee):Te==="dangerouslySetInnerHTML"?Ve(v,Ee):Te==="children"?Qe(v,Ee):R(v,Te,Ee,he)}switch(B){case"input":Ge(v,k);break;case"textarea":bt(v,k);break;case"select":var Ce=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!k.multiple;var $e=k.value;$e!=null?gt(v,!!k.multiple,$e,!1):Ce!==!!k.multiple&&(k.defaultValue!=null?gt(v,!!k.multiple,k.defaultValue,!0):gt(v,!!k.multiple,k.multiple?[]:"",!1))}v[Ma]=k}catch(Je){ln(r,r.return,Je)}}break;case 6:if($r(a,r),ei(r),f&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,k=r.memoizedProps;try{v.nodeValue=k}catch(Je){ln(r,r.return,Je)}}break;case 3:if($r(a,r),ei(r),f&4&&u!==null&&u.memoizedState.isDehydrated)try{ba(a.containerInfo)}catch(Je){ln(r,r.return,Je)}break;case 4:$r(a,r),ei(r);break;case 13:$r(a,r),ei(r),v=r.child,v.flags&8192&&(k=v.memoizedState!==null,v.stateNode.isHidden=k,!k||v.alternate!==null&&v.alternate.memoizedState!==null||(cd=kt())),f&4&&ug(r);break;case 22:if(Te=u!==null&&u.memoizedState!==null,r.mode&1?(On=(he=On)||Te,$r(a,r),On=he):$r(a,r),ei(r),f&8192){if(he=r.memoizedState!==null,(r.stateNode.isHidden=he)&&!Te&&(r.mode&1)!==0)for(Ke=r,Te=r.child;Te!==null;){for(Ee=Ke=Te;Ke!==null;){switch(Ce=Ke,$e=Ce.child,Ce.tag){case 0:case 11:case 14:case 15:Wa(4,Ce,Ce.return);break;case 1:Vs(Ce,Ce.return);var Ye=Ce.stateNode;if(typeof Ye.componentWillUnmount=="function"){f=Ce,u=Ce.return;try{a=f,Ye.props=a.memoizedProps,Ye.state=a.memoizedState,Ye.componentWillUnmount()}catch(Je){ln(f,u,Je)}}break;case 5:Vs(Ce,Ce.return);break;case 22:if(Ce.memoizedState!==null){mg(Ee);continue}}$e!==null?($e.return=Ce,Ke=$e):mg(Ee)}Te=Te.sibling}e:for(Te=null,Ee=r;;){if(Ee.tag===5){if(Te===null){Te=Ee;try{v=Ee.stateNode,he?(k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(B=Ee.stateNode,V=Ee.memoizedProps.style,j=V!=null&&V.hasOwnProperty("display")?V.display:null,B.style.display=at("display",j))}catch(Je){ln(r,r.return,Je)}}}else if(Ee.tag===6){if(Te===null)try{Ee.stateNode.nodeValue=he?"":Ee.memoizedProps}catch(Je){ln(r,r.return,Je)}}else if((Ee.tag!==22&&Ee.tag!==23||Ee.memoizedState===null||Ee===r)&&Ee.child!==null){Ee.child.return=Ee,Ee=Ee.child;continue}if(Ee===r)break e;for(;Ee.sibling===null;){if(Ee.return===null||Ee.return===r)break e;Te===Ee&&(Te=null),Ee=Ee.return}Te===Ee&&(Te=null),Ee.sibling.return=Ee.return,Ee=Ee.sibling}}break;case 19:$r(a,r),ei(r),f&4&&ug(r);break;case 21:break;default:$r(a,r),ei(r)}}function ei(r){var a=r.flags;if(a&2){try{e:{for(var u=r.return;u!==null;){if(og(u)){var f=u;break e}u=u.return}throw Error(n(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(Qe(v,""),f.flags&=-33);var k=lg(r);ad(r,k,v);break;case 3:case 4:var j=f.stateNode.containerInfo,B=lg(r);sd(r,B,j);break;default:throw Error(n(161))}}catch(V){ln(r,r.return,V)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function x0(r,a,u){Ke=r,hg(r)}function hg(r,a,u){for(var f=(r.mode&1)!==0;Ke!==null;){var v=Ke,k=v.child;if(v.tag===22&&f){var j=v.memoizedState!==null||kl;if(!j){var B=v.alternate,V=B!==null&&B.memoizedState!==null||On;B=kl;var he=On;if(kl=j,(On=V)&&!he)for(Ke=v;Ke!==null;)j=Ke,V=j.child,j.tag===22&&j.memoizedState!==null?pg(v):V!==null?(V.return=j,Ke=V):pg(v);for(;k!==null;)Ke=k,hg(k),k=k.sibling;Ke=v,kl=B,On=he}fg(r)}else(v.subtreeFlags&8772)!==0&&k!==null?(k.return=v,Ke=k):fg(r)}}function fg(r){for(;Ke!==null;){var a=Ke;if((a.flags&8772)!==0){var u=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:On||Sl(5,a);break;case 1:var f=a.stateNode;if(a.flags&4&&!On)if(u===null)f.componentDidMount();else{var v=a.elementType===a.type?u.memoizedProps:Wr(a.type,u.memoizedProps);f.componentDidUpdate(v,u.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var k=a.updateQueue;k!==null&&mp(a,k,f);break;case 3:var j=a.updateQueue;if(j!==null){if(u=null,a.child!==null)switch(a.child.tag){case 5:u=a.child.stateNode;break;case 1:u=a.child.stateNode}mp(a,j,u)}break;case 5:var B=a.stateNode;if(u===null&&a.flags&4){u=B;var V=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":V.autoFocus&&u.focus();break;case"img":V.src&&(u.src=V.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var he=a.alternate;if(he!==null){var Te=he.memoizedState;if(Te!==null){var Ee=Te.dehydrated;Ee!==null&&ba(Ee)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}On||a.flags&512&&id(a)}catch(Ce){ln(a,a.return,Ce)}}if(a===r){Ke=null;break}if(u=a.sibling,u!==null){u.return=a.return,Ke=u;break}Ke=a.return}}function mg(r){for(;Ke!==null;){var a=Ke;if(a===r){Ke=null;break}var u=a.sibling;if(u!==null){u.return=a.return,Ke=u;break}Ke=a.return}}function pg(r){for(;Ke!==null;){var a=Ke;try{switch(a.tag){case 0:case 11:case 15:var u=a.return;try{Sl(4,a)}catch(V){ln(a,u,V)}break;case 1:var f=a.stateNode;if(typeof f.componentDidMount=="function"){var v=a.return;try{f.componentDidMount()}catch(V){ln(a,v,V)}}var k=a.return;try{id(a)}catch(V){ln(a,k,V)}break;case 5:var j=a.return;try{id(a)}catch(V){ln(a,j,V)}}}catch(V){ln(a,a.return,V)}if(a===r){Ke=null;break}var B=a.sibling;if(B!==null){B.return=a.return,Ke=B;break}Ke=a.return}}var k0=Math.ceil,Cl=G.ReactCurrentDispatcher,od=G.ReactCurrentOwner,Mr=G.ReactCurrentBatchConfig,Dt=0,Nn=null,pn=null,Rn=0,pr=0,Gs=ki(0),bn=0,Ha=null,ns=0,jl=0,ld=0,$a=null,nr=null,cd=0,Ks=1/0,mi=null,Nl=!1,ud=null,Pi=null,Tl=!1,Ei=null,Pl=0,qa=0,dd=null,El=-1,Rl=0;function $n(){return(Dt&6)!==0?kt():El!==-1?El:El=kt()}function Ri(r){return(r.mode&1)===0?1:(Dt&2)!==0&&Rn!==0?Rn&-Rn:s0.transition!==null?(Rl===0&&(Rl=Oo()),Rl):(r=_t,r!==0||(r=window.event,r=r===void 0?16:ym(r.type)),r)}function qr(r,a,u,f){if(50<qa)throw qa=0,dd=null,Error(n(185));vi(r,u,f),((Dt&2)===0||r!==Nn)&&(r===Nn&&((Dt&2)===0&&(jl|=u),bn===4&&Mi(r,Rn)),rr(r,f),u===1&&Dt===0&&(a.mode&1)===0&&(Ks=kt()+500,il&&Ci()))}function rr(r,a){var u=r.callbackNode;Qc(r,a);var f=Gi(r,r===Nn?Rn:0);if(f===0)u!==null&&un(u),r.callbackNode=null,r.callbackPriority=0;else if(a=f&-f,r.callbackPriority!==a){if(u!=null&&un(u),a===1)r.tag===0?i0(yg.bind(null,r)):np(yg.bind(null,r)),e0(function(){(Dt&6)===0&&Ci()}),u=null;else{switch(ya(f)){case 1:u=Yn;break;case 4:u=Xn;break;case 16:u=Jn;break;case 536870912:u=we;break;default:u=Jn}u=jg(u,gg.bind(null,r))}r.callbackPriority=a,r.callbackNode=u}}function gg(r,a){if(El=-1,Rl=0,(Dt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(Qs()&&r.callbackNode!==u)return null;var f=Gi(r,r===Nn?Rn:0);if(f===0)return null;if((f&30)!==0||(f&r.expiredLanes)!==0||a)a=Ml(r,f);else{a=f;var v=Dt;Dt|=2;var k=wg();(Nn!==r||Rn!==a)&&(mi=null,Ks=kt()+500,is(r,a));do try{j0();break}catch(B){vg(r,B)}while(!0);Eu(),Cl.current=k,Dt=v,pn!==null?a=0:(Nn=null,Rn=0,a=bn)}if(a!==0){if(a===2&&(v=Ns(r),v!==0&&(f=v,a=hd(r,v))),a===1)throw u=Ha,is(r,0),Mi(r,f),rr(r,kt()),u;if(a===6)Mi(r,f);else{if(v=r.current.alternate,(f&30)===0&&!S0(v)&&(a=Ml(r,f),a===2&&(k=Ns(r),k!==0&&(f=k,a=hd(r,k))),a===1))throw u=Ha,is(r,0),Mi(r,f),rr(r,kt()),u;switch(r.finishedWork=v,r.finishedLanes=f,a){case 0:case 1:throw Error(n(345));case 2:ss(r,nr,mi);break;case 3:if(Mi(r,f),(f&130023424)===f&&(a=cd+500-kt(),10<a)){if(Gi(r,0)!==0)break;if(v=r.suspendedLanes,(v&f)!==f){$n(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=vu(ss.bind(null,r,nr,mi),a);break}ss(r,nr,mi);break;case 4:if(Mi(r,f),(f&4194240)===f)break;for(a=r.eventTimes,v=-1;0<f;){var j=31-ze(f);k=1<<j,j=a[j],j>v&&(v=j),f&=~k}if(f=v,f=kt()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*k0(f/1960))-f,10<f){r.timeoutHandle=vu(ss.bind(null,r,nr,mi),f);break}ss(r,nr,mi);break;case 5:ss(r,nr,mi);break;default:throw Error(n(329))}}}return rr(r,kt()),r.callbackNode===u?gg.bind(null,r):null}function hd(r,a){var u=$a;return r.current.memoizedState.isDehydrated&&(is(r,a).flags|=256),r=Ml(r,a),r!==2&&(a=nr,nr=u,a!==null&&fd(a)),r}function fd(r){nr===null?nr=r:nr.push.apply(nr,r)}function S0(r){for(var a=r;;){if(a.flags&16384){var u=a.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var f=0;f<u.length;f++){var v=u[f],k=v.getSnapshot;v=v.value;try{if(!Ur(k(),v))return!1}catch{return!1}}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Mi(r,a){for(a&=~ld,a&=~jl,r.suspendedLanes|=a,r.pingedLanes&=~a,r=r.expirationTimes;0<a;){var u=31-ze(a),f=1<<u;r[u]=-1,a&=~f}}function yg(r){if((Dt&6)!==0)throw Error(n(327));Qs();var a=Gi(r,0);if((a&1)===0)return rr(r,kt()),null;var u=Ml(r,a);if(r.tag!==0&&u===2){var f=Ns(r);f!==0&&(a=f,u=hd(r,f))}if(u===1)throw u=Ha,is(r,0),Mi(r,a),rr(r,kt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=a,ss(r,nr,mi),rr(r,kt()),null}function md(r,a){var u=Dt;Dt|=1;try{return r(a)}finally{Dt=u,Dt===0&&(Ks=kt()+500,il&&Ci())}}function rs(r){Ei!==null&&Ei.tag===0&&(Dt&6)===0&&Qs();var a=Dt;Dt|=1;var u=Mr.transition,f=_t;try{if(Mr.transition=null,_t=1,r)return r()}finally{_t=f,Mr.transition=u,Dt=a,(Dt&6)===0&&Ci()}}function pd(){pr=Gs.current,Xt(Gs)}function is(r,a){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,ZC(u)),pn!==null)for(u=pn.return;u!==null;){var f=u;switch(Cu(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&nl();break;case 3:$s(),Xt(Zn),Xt(Dn),Fu();break;case 5:Du(f);break;case 4:$s();break;case 13:Xt(rn);break;case 19:Xt(rn);break;case 10:Ru(f.type._context);break;case 22:case 23:pd()}u=u.return}if(Nn=r,pn=r=Ai(r.current,null),Rn=pr=a,bn=0,Ha=null,ld=jl=ns=0,nr=$a=null,Zi!==null){for(a=0;a<Zi.length;a++)if(u=Zi[a],f=u.interleaved,f!==null){u.interleaved=null;var v=f.next,k=u.pending;if(k!==null){var j=k.next;k.next=v,f.next=j}u.pending=f}Zi=null}return r}function vg(r,a){do{var u=pn;try{if(Eu(),ml.current=vl,pl){for(var f=sn.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}pl=!1}if(ts=0,jn=wn=sn=null,Fa=!1,Oa=0,od.current=null,u===null||u.return===null){bn=1,Ha=a,pn=null;break}e:{var k=r,j=u.return,B=u,V=a;if(a=Rn,B.flags|=32768,V!==null&&typeof V=="object"&&typeof V.then=="function"){var he=V,Te=B,Ee=Te.tag;if((Te.mode&1)===0&&(Ee===0||Ee===11||Ee===15)){var Ce=Te.alternate;Ce?(Te.updateQueue=Ce.updateQueue,Te.memoizedState=Ce.memoizedState,Te.lanes=Ce.lanes):(Te.updateQueue=null,Te.memoizedState=null)}var $e=Hp(j);if($e!==null){$e.flags&=-257,$p($e,j,B,k,a),$e.mode&1&&Wp(k,he,a),a=$e,V=he;var Ye=a.updateQueue;if(Ye===null){var Je=new Set;Je.add(V),a.updateQueue=Je}else Ye.add(V);break e}else{if((a&1)===0){Wp(k,he,a),gd();break e}V=Error(n(426))}}else if(Zt&&B.mode&1){var fn=Hp(j);if(fn!==null){(fn.flags&65536)===0&&(fn.flags|=256),$p(fn,j,B,k,a),Tu(qs(V,B));break e}}k=V=qs(V,B),bn!==4&&(bn=2),$a===null?$a=[k]:$a.push(k),k=j;do{switch(k.tag){case 3:k.flags|=65536,a&=-a,k.lanes|=a;var se=Up(k,V,a);fp(k,se);break e;case 1:B=V;var Z=k.type,oe=k.stateNode;if((k.flags&128)===0&&(typeof Z.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Pi===null||!Pi.has(oe)))){k.flags|=65536,a&=-a,k.lanes|=a;var Le=zp(k,B,a);fp(k,Le);break e}}k=k.return}while(k!==null)}xg(u)}catch(tt){a=tt,pn===u&&u!==null&&(pn=u=u.return);continue}break}while(!0)}function wg(){var r=Cl.current;return Cl.current=vl,r===null?vl:r}function gd(){(bn===0||bn===3||bn===2)&&(bn=4),Nn===null||(ns&268435455)===0&&(jl&268435455)===0||Mi(Nn,Rn)}function Ml(r,a){var u=Dt;Dt|=2;var f=wg();(Nn!==r||Rn!==a)&&(mi=null,is(r,a));do try{C0();break}catch(v){vg(r,v)}while(!0);if(Eu(),Dt=u,Cl.current=f,pn!==null)throw Error(n(261));return Nn=null,Rn=0,bn}function C0(){for(;pn!==null;)bg(pn)}function j0(){for(;pn!==null&&!In();)bg(pn)}function bg(r){var a=Cg(r.alternate,r,pr);r.memoizedProps=r.pendingProps,a===null?xg(r):pn=a,od.current=null}function xg(r){var a=r;do{var u=a.alternate;if(r=a.return,(a.flags&32768)===0){if(u=y0(u,a,pr),u!==null){pn=u;return}}else{if(u=v0(u,a),u!==null){u.flags&=32767,pn=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{bn=6,pn=null;return}}if(a=a.sibling,a!==null){pn=a;return}pn=a=r}while(a!==null);bn===0&&(bn=5)}function ss(r,a,u){var f=_t,v=Mr.transition;try{Mr.transition=null,_t=1,N0(r,a,u,f)}finally{Mr.transition=v,_t=f}return null}function N0(r,a,u,f){do Qs();while(Ei!==null);if((Dt&6)!==0)throw Error(n(327));u=r.finishedWork;var v=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var k=u.lanes|u.childLanes;if(Bo(r,k),r===Nn&&(pn=Nn=null,Rn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Tl||(Tl=!0,jg(Jn,function(){return Qs(),null})),k=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||k){k=Mr.transition,Mr.transition=null;var j=_t;_t=1;var B=Dt;Dt|=4,od.current=null,b0(r,u),dg(u,r),VC(gu),Wo=!!pu,gu=pu=null,r.current=u,x0(u),on(),Dt=B,_t=j,Mr.transition=k}else r.current=u;if(Tl&&(Tl=!1,Ei=r,Pl=v),k=r.pendingLanes,k===0&&(Pi=null),mt(u.stateNode),rr(r,kt()),a!==null)for(f=r.onRecoverableError,u=0;u<a.length;u++)v=a[u],f(v.value,{componentStack:v.stack,digest:v.digest});if(Nl)throw Nl=!1,r=ud,ud=null,r;return(Pl&1)!==0&&r.tag!==0&&Qs(),k=r.pendingLanes,(k&1)!==0?r===dd?qa++:(qa=0,dd=r):qa=0,Ci(),null}function Qs(){if(Ei!==null){var r=ya(Pl),a=Mr.transition,u=_t;try{if(Mr.transition=null,_t=16>r?16:r,Ei===null)var f=!1;else{if(r=Ei,Ei=null,Pl=0,(Dt&6)!==0)throw Error(n(331));var v=Dt;for(Dt|=4,Ke=r.current;Ke!==null;){var k=Ke,j=k.child;if((Ke.flags&16)!==0){var B=k.deletions;if(B!==null){for(var V=0;V<B.length;V++){var he=B[V];for(Ke=he;Ke!==null;){var Te=Ke;switch(Te.tag){case 0:case 11:case 15:Wa(8,Te,k)}var Ee=Te.child;if(Ee!==null)Ee.return=Te,Ke=Ee;else for(;Ke!==null;){Te=Ke;var Ce=Te.sibling,$e=Te.return;if(ag(Te),Te===he){Ke=null;break}if(Ce!==null){Ce.return=$e,Ke=Ce;break}Ke=$e}}}var Ye=k.alternate;if(Ye!==null){var Je=Ye.child;if(Je!==null){Ye.child=null;do{var fn=Je.sibling;Je.sibling=null,Je=fn}while(Je!==null)}}Ke=k}}if((k.subtreeFlags&2064)!==0&&j!==null)j.return=k,Ke=j;else e:for(;Ke!==null;){if(k=Ke,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Wa(9,k,k.return)}var se=k.sibling;if(se!==null){se.return=k.return,Ke=se;break e}Ke=k.return}}var Z=r.current;for(Ke=Z;Ke!==null;){j=Ke;var oe=j.child;if((j.subtreeFlags&2064)!==0&&oe!==null)oe.return=j,Ke=oe;else e:for(j=Z;Ke!==null;){if(B=Ke,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:Sl(9,B)}}catch(tt){ln(B,B.return,tt)}if(B===j){Ke=null;break e}var Le=B.sibling;if(Le!==null){Le.return=B.return,Ke=Le;break e}Ke=B.return}}if(Dt=v,Ci(),lt&&typeof lt.onPostCommitFiberRoot=="function")try{lt.onPostCommitFiberRoot(pe,r)}catch{}f=!0}return f}finally{_t=u,Mr.transition=a}}return!1}function kg(r,a,u){a=qs(u,a),a=Up(r,a,1),r=Ni(r,a,1),a=$n(),r!==null&&(vi(r,1,a),rr(r,a))}function ln(r,a,u){if(r.tag===3)kg(r,r,u);else for(;a!==null;){if(a.tag===3){kg(a,r,u);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Pi===null||!Pi.has(f))){r=qs(u,r),r=zp(a,r,1),a=Ni(a,r,1),r=$n(),a!==null&&(vi(a,1,r),rr(a,r));break}}a=a.return}}function T0(r,a,u){var f=r.pingCache;f!==null&&f.delete(a),a=$n(),r.pingedLanes|=r.suspendedLanes&u,Nn===r&&(Rn&u)===u&&(bn===4||bn===3&&(Rn&130023424)===Rn&&500>kt()-cd?is(r,0):ld|=u),rr(r,a)}function Sg(r,a){a===0&&((r.mode&1)===0?a=1:(a=qi,qi<<=1,(qi&130023424)===0&&(qi=4194304)));var u=$n();r=di(r,a),r!==null&&(vi(r,a,u),rr(r,u))}function P0(r){var a=r.memoizedState,u=0;a!==null&&(u=a.retryLane),Sg(r,u)}function E0(r,a){var u=0;switch(r.tag){case 13:var f=r.stateNode,v=r.memoizedState;v!==null&&(u=v.retryLane);break;case 19:f=r.stateNode;break;default:throw Error(n(314))}f!==null&&f.delete(a),Sg(r,u)}var Cg;Cg=function(r,a,u){if(r!==null)if(r.memoizedProps!==a.pendingProps||Zn.current)tr=!0;else{if((r.lanes&u)===0&&(a.flags&128)===0)return tr=!1,g0(r,a,u);tr=(r.flags&131072)!==0}else tr=!1,Zt&&(a.flags&1048576)!==0&&rp(a,al,a.index);switch(a.lanes=0,a.tag){case 2:var f=a.type;xl(r,a),r=a.pendingProps;var v=Fs(a,Dn.current);Hs(a,u),v=Uu(null,a,f,r,v,u);var k=zu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,er(f)?(k=!0,rl(a)):k=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Lu(a),v.updater=wl,a.stateNode=v,v._reactInternals=a,Gu(a,f,r,u),a=Xu(null,a,f,!0,k,u)):(a.tag=0,Zt&&k&&Su(a),Hn(null,a,v,u),a=a.child),a;case 16:f=a.elementType;e:{switch(xl(r,a),r=a.pendingProps,v=f._init,f=v(f._payload),a.type=f,v=a.tag=M0(f),r=Wr(f,r),v){case 0:a=Yu(null,a,f,r,u);break e;case 1:a=Yp(null,a,f,r,u);break e;case 11:a=qp(null,a,f,r,u);break e;case 14:a=Vp(null,a,f,Wr(f.type,r),u);break e}throw Error(n(306,f,""))}return a;case 0:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:Wr(f,v),Yu(r,a,f,v,u);case 1:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:Wr(f,v),Yp(r,a,f,v,u);case 3:e:{if(Xp(a),r===null)throw Error(n(387));f=a.pendingProps,k=a.memoizedState,v=k.element,hp(r,a),hl(a,f,null,u);var j=a.memoizedState;if(f=j.element,k.isDehydrated)if(k={element:f,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},a.updateQueue.baseState=k,a.memoizedState=k,a.flags&256){v=qs(Error(n(423)),a),a=Jp(r,a,f,u,v);break e}else if(f!==v){v=qs(Error(n(424)),a),a=Jp(r,a,f,u,v);break e}else for(mr=xi(a.stateNode.containerInfo.firstChild),fr=a,Zt=!0,zr=null,u=up(a,null,f,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Us(),f===v){a=fi(r,a,u);break e}Hn(r,a,f,u)}a=a.child}return a;case 5:return pp(a),r===null&&Nu(a),f=a.type,v=a.pendingProps,k=r!==null?r.memoizedProps:null,j=v.children,yu(f,v)?j=null:k!==null&&yu(f,k)&&(a.flags|=32),Qp(r,a),Hn(r,a,j,u),a.child;case 6:return r===null&&Nu(a),null;case 13:return Zp(r,a,u);case 4:return Iu(a,a.stateNode.containerInfo),f=a.pendingProps,r===null?a.child=zs(a,null,f,u):Hn(r,a,f,u),a.child;case 11:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:Wr(f,v),qp(r,a,f,v,u);case 7:return Hn(r,a,a.pendingProps,u),a.child;case 8:return Hn(r,a,a.pendingProps.children,u),a.child;case 12:return Hn(r,a,a.pendingProps.children,u),a.child;case 10:e:{if(f=a.type._context,v=a.pendingProps,k=a.memoizedProps,j=v.value,Kt(cl,f._currentValue),f._currentValue=j,k!==null)if(Ur(k.value,j)){if(k.children===v.children&&!Zn.current){a=fi(r,a,u);break e}}else for(k=a.child,k!==null&&(k.return=a);k!==null;){var B=k.dependencies;if(B!==null){j=k.child;for(var V=B.firstContext;V!==null;){if(V.context===f){if(k.tag===1){V=hi(-1,u&-u),V.tag=2;var he=k.updateQueue;if(he!==null){he=he.shared;var Te=he.pending;Te===null?V.next=V:(V.next=Te.next,Te.next=V),he.pending=V}}k.lanes|=u,V=k.alternate,V!==null&&(V.lanes|=u),Mu(k.return,u,a),B.lanes|=u;break}V=V.next}}else if(k.tag===10)j=k.type===a.type?null:k.child;else if(k.tag===18){if(j=k.return,j===null)throw Error(n(341));j.lanes|=u,B=j.alternate,B!==null&&(B.lanes|=u),Mu(j,u,a),j=k.sibling}else j=k.child;if(j!==null)j.return=k;else for(j=k;j!==null;){if(j===a){j=null;break}if(k=j.sibling,k!==null){k.return=j.return,j=k;break}j=j.return}k=j}Hn(r,a,v.children,u),a=a.child}return a;case 9:return v=a.type,f=a.pendingProps.children,Hs(a,u),v=Er(v),f=f(v),a.flags|=1,Hn(r,a,f,u),a.child;case 14:return f=a.type,v=Wr(f,a.pendingProps),v=Wr(f.type,v),Vp(r,a,f,v,u);case 15:return Gp(r,a,a.type,a.pendingProps,u);case 17:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:Wr(f,v),xl(r,a),a.tag=1,er(f)?(r=!0,rl(a)):r=!1,Hs(a,u),Op(a,f,v),Gu(a,f,v,u),Xu(null,a,f,!0,r,u);case 19:return tg(r,a,u);case 22:return Kp(r,a,u)}throw Error(n(156,a.tag))};function jg(r,a){return ut(r,a)}function R0(r,a,u,f){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ar(r,a,u,f){return new R0(r,a,u,f)}function yd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function M0(r){if(typeof r=="function")return yd(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ee)return 11;if(r===te)return 14}return 2}function Ai(r,a){var u=r.alternate;return u===null?(u=Ar(r.tag,a,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=a,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,a=r.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function Al(r,a,u,f,v,k){var j=2;if(f=r,typeof r=="function")yd(r)&&(j=1);else if(typeof r=="string")j=5;else e:switch(r){case M:return as(u.children,v,k,a);case D:j=8,v|=8;break;case U:return r=Ar(12,u,a,v|2),r.elementType=U,r.lanes=k,r;case ne:return r=Ar(13,u,a,v),r.elementType=ne,r.lanes=k,r;case ae:return r=Ar(19,u,a,v),r.elementType=ae,r.lanes=k,r;case J:return Ll(u,v,k,a);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case E:j=10;break e;case H:j=9;break e;case ee:j=11;break e;case te:j=14;break e;case ye:j=16,f=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return a=Ar(j,u,a,v),a.elementType=r,a.type=f,a.lanes=k,a}function as(r,a,u,f){return r=Ar(7,r,f,a),r.lanes=u,r}function Ll(r,a,u,f){return r=Ar(22,r,f,a),r.elementType=J,r.lanes=u,r.stateNode={isHidden:!1},r}function vd(r,a,u){return r=Ar(6,r,null,a),r.lanes=u,r}function wd(r,a,u){return a=Ar(4,r.children!==null?r.children:[],r.key,a),a.lanes=u,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}function A0(r,a,u,f,v){this.tag=a,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ga(0),this.expirationTimes=ga(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ga(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function bd(r,a,u,f,v,k,j,B,V){return r=new A0(r,a,u,B,V),a===1?(a=1,k===!0&&(a|=8)):a=0,k=Ar(3,null,null,a),r.current=k,k.stateNode=r,k.memoizedState={element:f,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lu(k),r}function L0(r,a,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:F,key:f==null?null:""+f,children:r,containerInfo:a,implementation:u}}function Ng(r){if(!r)return Si;r=r._reactInternals;e:{if(O(r)!==r||r.tag!==1)throw Error(n(170));var a=r;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(er(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(er(u))return ep(r,u,a)}return a}function Tg(r,a,u,f,v,k,j,B,V){return r=bd(u,f,!0,r,v,k,j,B,V),r.context=Ng(null),u=r.current,f=$n(),v=Ri(u),k=hi(f,v),k.callback=a??null,Ni(u,k,v),r.current.lanes=v,vi(r,v,f),rr(r,f),r}function Il(r,a,u,f){var v=a.current,k=$n(),j=Ri(v);return u=Ng(u),a.context===null?a.context=u:a.pendingContext=u,a=hi(k,j),a.payload={element:r},f=f===void 0?null:f,f!==null&&(a.callback=f),r=Ni(v,a,j),r!==null&&(qr(r,v,j,k),dl(r,v,j)),j}function Dl(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Pg(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<a?u:a}}function xd(r,a){Pg(r,a),(r=r.alternate)&&Pg(r,a)}function I0(){return null}var Eg=typeof reportError=="function"?reportError:function(r){console.error(r)};function kd(r){this._internalRoot=r}_l.prototype.render=kd.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(n(409));Il(r,a,null,null)},_l.prototype.unmount=kd.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;rs(function(){Il(null,r,null,null)}),a[oi]=null}};function _l(r){this._internalRoot=r}_l.prototype.unstable_scheduleHydration=function(r){if(r){var a=pt();r={blockedOn:null,target:r,priority:a};for(var u=0;u<Nr.length&&a!==0&&a<Nr[u].priority;u++);Nr.splice(u,0,r),u===0&&pm(r)}};function Sd(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Fl(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Rg(){}function D0(r,a,u,f,v){if(v){if(typeof f=="function"){var k=f;f=function(){var he=Dl(j);k.call(he)}}var j=Tg(a,f,r,0,null,!1,!1,"",Rg);return r._reactRootContainer=j,r[oi]=j.current,Ea(r.nodeType===8?r.parentNode:r),rs(),j}for(;v=r.lastChild;)r.removeChild(v);if(typeof f=="function"){var B=f;f=function(){var he=Dl(V);B.call(he)}}var V=bd(r,0,!1,null,null,!1,!1,"",Rg);return r._reactRootContainer=V,r[oi]=V.current,Ea(r.nodeType===8?r.parentNode:r),rs(function(){Il(a,V,u,f)}),V}function Ol(r,a,u,f,v){var k=u._reactRootContainer;if(k){var j=k;if(typeof v=="function"){var B=v;v=function(){var V=Dl(j);B.call(V)}}Il(a,j,r,v)}else j=D0(u,a,r,v,f);return Dl(j)}Q=function(r){switch(r.tag){case 3:var a=r.stateNode;if(a.current.memoizedState.isDehydrated){var u=Vi(a.pendingLanes);u!==0&&(Ts(a,u|1),rr(a,kt()),(Dt&6)===0&&(Ks=kt()+500,Ci()))}break;case 13:rs(function(){var f=di(r,1);if(f!==null){var v=$n();qr(f,r,1,v)}}),xd(r,1)}},fe=function(r){if(r.tag===13){var a=di(r,134217728);if(a!==null){var u=$n();qr(a,r,134217728,u)}xd(r,134217728)}},Xe=function(r){if(r.tag===13){var a=Ri(r),u=di(r,a);if(u!==null){var f=$n();qr(u,r,a,f)}xd(r,a)}},pt=function(){return _t},$t=function(r,a){var u=_t;try{return _t=r,a()}finally{_t=u}},Ot=function(r,a,u){switch(a){case"input":if(Ge(r,u),a=u.name,u.type==="radio"&&a!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<u.length;a++){var f=u[a];if(f!==r&&f.form===r.form){var v=tl(f);if(!v)throw Error(n(90));qe(f),Ge(f,v)}}}break;case"textarea":bt(r,u);break;case"select":a=u.value,a!=null&>(r,!!u.multiple,a,!1)}},Pn=md,mn=rs;var _0={usingClientEntryPoint:!1,Events:[Aa,Ds,tl,nn,vn,md]},Va={findFiberByHostInstance:Qi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},F0={bundleType:Va.bundleType,version:Va.version,rendererPackageName:Va.rendererPackageName,rendererConfig:Va.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:G.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Oe(r),r===null?null:r.stateNode},findFiberByHostInstance:Va.findFiberByHostInstance||I0,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{pe=Bl.inject(F0),lt=Bl}catch{}}return ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_0,ir.createPortal=function(r,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Sd(a))throw Error(n(200));return L0(r,a,null,u)},ir.createRoot=function(r,a){if(!Sd(r))throw Error(n(299));var u=!1,f="",v=Eg;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onRecoverableError!==void 0&&(v=a.onRecoverableError)),a=bd(r,1,!1,null,null,u,!1,f,v),r[oi]=a.current,Ea(r.nodeType===8?r.parentNode:r),new kd(a)},ir.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var a=r._reactInternals;if(a===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Oe(a),r=r===null?null:r.stateNode,r},ir.flushSync=function(r){return rs(r)},ir.hydrate=function(r,a,u){if(!Fl(a))throw Error(n(200));return Ol(null,r,a,!0,u)},ir.hydrateRoot=function(r,a,u){if(!Sd(r))throw Error(n(405));var f=u!=null&&u.hydratedSources||null,v=!1,k="",j=Eg;if(u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(k=u.identifierPrefix),u.onRecoverableError!==void 0&&(j=u.onRecoverableError)),a=Tg(a,null,r,1,u??null,v,!1,k,j),r[oi]=a.current,Ea(r),f)for(r=0;r<f.length;r++)u=f[r],v=u._getVersion,v=v(u._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[u,v]:a.mutableSourceEagerHydrationData.push(u,v);return new _l(a)},ir.render=function(r,a,u){if(!Fl(a))throw Error(n(200));return Ol(null,r,a,!1,u)},ir.unmountComponentAtNode=function(r){if(!Fl(r))throw Error(n(40));return r._reactRootContainer?(rs(function(){Ol(null,null,r,!1,function(){r._reactRootContainer=null,r[oi]=null})}),!0):!1},ir.unstable_batchedUpdates=md,ir.unstable_renderSubtreeIntoContainer=function(r,a,u,f){if(!Fl(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Ol(r,a,u,!1,f)},ir.version="18.3.1-next-f1338f8080-20240426",ir}var Og;function hb(){if(Og)return Nd.exports;Og=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Nd.exports=V0(),Nd.exports}var Bg;function G0(){if(Bg)return Ul;Bg=1;var e=hb();return Ul.createRoot=e.createRoot,Ul.hydrateRoot=e.hydrateRoot,Ul}var K0=G0();const Q0=To(K0);var w=df();const Y0=To(w),X0=db({__proto__:null,default:Y0},[w]);function J0(e){return e==="http:"||e==="https:"}function pi(e){const t=e.trim();if(!t)throw new Error("EMPTY_SERVER_URL");const n=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(t)?t:`http://${t}`,s=new URL(n);if(!J0(s.protocol))throw new Error("INVALID_SERVER_PROTOCOL");s.hash="",s.search="";const o=s.pathname.replace(/\/+$/,"");return`${s.origin}${o==="/"?"":o}`}const ra="codingns.auth.remembered-login";function hf(){return typeof window<"u"&&typeof window.localStorage<"u"}function Z0(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function fb(){if(!hf())return null;const e=window.localStorage.getItem(ra);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.username!="string"||typeof t.password!="string"||typeof t.serverBaseUrl!="string")return window.localStorage.removeItem(ra),null;const n=t.username.trim(),s=t.password,o=pi(t.serverBaseUrl);return!n||!s?(window.localStorage.removeItem(ra),null):{username:n,password:s,serverBaseUrl:o}}catch{return window.localStorage.removeItem(ra),null}}function mb(e){if(!hf())return;const t={username:e.username.trim(),password:e.password,serverBaseUrl:pi(e.serverBaseUrl)};window.localStorage.setItem(ra,JSON.stringify(t))}function e1(e){const t=fb();t&&mb({...t,serverBaseUrl:e})}function t1(){hf()&&window.localStorage.removeItem(ra)}function pb(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function gb(){var c,l;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,n=((c=t==null?void 0:t.platform)==null?void 0:c.toLowerCase())??((l=navigator.platform)==null?void 0:l.toLowerCase())??"",s=`${n} ${e}`,o=n.includes("mac")&&navigator.maxTouchPoints>1;return s.includes("android")?"android":s.includes("iphone")||s.includes("ipad")||s.includes("ipod")||o?"ios":s.includes("mac")?"macos":s.includes("win")?"windows":s.includes("linux")?"linux":"unknown"}function n1(e){var t;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:typeof window<"u"&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:typeof document<"u"&&Number.isFinite((t=document.documentElement)==null?void 0:t.clientWidth)&&document.documentElement.clientWidth>0?document.documentElement.clientWidth:1280}function r1(e){const t=n1(e);return t<768?"compact":t<1024?"medium":"expanded"}function i1(e){const t=gb();return e==="desktop"?{osFamily:t,windowControlsStyle:t==="macos"?"traffic-lights":t==="windows"?"windows":"none",prefersDesktopChrome:!0,prefersOverlayTitlebar:t==="macos",prefersSystemFontStack:!0}:{osFamily:t,windowControlsStyle:"none",prefersDesktopChrome:!1,prefersOverlayTitlebar:!1,prefersSystemFontStack:!0}}function wr(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function Vr(e,t){return yb(e,t)}async function yb(e,t){if(!pb())return wr("当前运行环境不支持桌面壳能力。");try{return{ok:!0,value:await window.__TAURI_INTERNALS__.invoke(e,t)}}catch(n){return{ok:!1,errorCode:"SHELL_BRIDGE_ERROR",detail:n instanceof Error?n.message:"桌面壳调用失败。"}}}function s1(e){switch(e){case"selection":return 10;case"action":return[12];case"gesture":return[10,18,10];case"success":return[16,30,20];case"warning":return[20,36,18];case"error":return[24,40,24,40,20];default:return 10}}function vb(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function wb(e){if(vb())try{navigator.vibrate(s1(e))}catch{return}}async function bb(e,t){if(typeof window>"u"||typeof Notification>"u")return wr("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return wr("系统通知权限未授予。");const n=new Notification(e,{body:t});return n.onerror=()=>{},{ok:!0}}catch(n){return{ok:!1,errorCode:"NOTIFICATION_FAILED",detail:n instanceof Error?n.message:"系统通知发送失败。"}}}class a1{constructor(){Ze(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(wr("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,n){return bb(t,n)}writeClipboardText(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(wr("当前不是桌面端运行环境。"))}}class o1{constructor(){Ze(this,"supported",vb())}trigger(t){return wb(t)}}class l1{constructor(){Ze(this,"supported",!0)}openExternal(t){return Vr("open_external",{url:t})}async showNotification(t,n){const s=await bb(t,n);return s.ok?s:Vr("show_notification",{title:t,body:n})}writeClipboardText(t){return Vr("copy_text",{text:t})}setWindowState(t){return Vr("set_window_state",{state:t})}readDesktopConfig(){return Vr("read_desktop_config")}writeDesktopConfig(t){return Vr("write_desktop_config",{patch:t})}getRuntimeInfo(){return Vr("get_runtime_info")}checkForUpdate(t){return Vr("check_for_update",{channel:t})}async installUpdate(t){const n=await Vr("install_update",{manifest:t});return n.ok?n.value??{ok:!0}:{ok:!1,errorCode:n.errorCode,detail:n.detail}}rollbackToPreviousVersion(){return Vr("rollback_to_previous_version")}pickDirectory(){return Vr("pick_directory")}}class c1{constructor(){Ze(this,"supported",!0)}async trigger(t){(await yb("perform_haptic_feedback",{kind:t})).ok||await wb(t)}}function xb(){if(!pb())return"web";const e=gb();return e==="ios"?"ios":e==="android"?"android":"desktop"}function si(e={}){const t=xb(),n=r1(e.viewportWidth),s=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:s||n!=="expanded",isNativeMobile:s,viewportClass:n,ui:i1(t),bridge:t==="desktop"?new l1:new a1,haptics:s?new c1:new o1}}const Eh="codingns.client.runtime-config";function ff(e){return e==="desktop"||e==="ios"||e==="android"}function kb(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function u1(){return typeof navigator>"u"?"zh-CN":kb(navigator.language)}function d1(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function Sb(){return typeof window<"u"&&typeof window.localStorage<"u"}function h1(){if(!Sb())return null;const e=window.localStorage.getItem(Eh);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(Eh),null}}function Cb(e){Sb()&&window.localStorage.setItem(Eh,JSON.stringify(e))}function f1(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function m1(e){if(!e)return null;try{return pi(e)}catch{return null}}function mf(e){if(e==="web"){const t=m1(f1());if(t)return t}return pi("http://127.0.0.1:3002")}function p1(e){return{platform:e,hostBaseUrl:mf(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:u1(),defaultPermissionMode:"default"}}function Rh(e,t){if(!t)return e;const n=t.platform??e.platform;return{...e,...t,hostBaseUrl:ff(n)?t.hostBaseUrl?pi(t.hostBaseUrl):e.hostBaseUrl:mf(n),platform:n,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:kb(t.language??e.language),defaultPermissionMode:d1(t.defaultPermissionMode??e.defaultPermissionMode)}}async function g1(){const e=si(),t=p1(e.platform),n=h1();let s=null;if(e.isDesktop){const c=await e.bridge.readDesktopConfig();c.ok&&c.value&&(s=c.value)}const o=Rh(Rh(t,n),s);return Cb(o),o}async function y1(e,t){const n=Rh(e,t);Cb(n),e1(n.hostBaseUrl);const s=si();return s.isDesktop&&await s.bridge.writeDesktopConfig(n),n}function v1(){const e=xb();return{platform:e,hostBaseUrl:mf(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:"zh-CN",defaultPermissionMode:"default"}}class w1{constructor(){Ze(this,"state",v1());Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state)}hydrate(t){this.state=t,this.emit()}async initialize(){const t=await g1();return this.hydrate(t),t}async update(t){const n=await y1(this.state,t);return this.hydrate(n),n}emit(){for(const t of this.listeners)t()}}const cn=new w1;function Ic(e){return w.useSyncExternalStore(cn.subscribe,()=>e(cn.getState()))}async function b1(){const e=si();return await cn.initialize(),{platform:e.platform}}var Mn=hb();const x1=To(Mn),k1=db({__proto__:null,default:x1},[Mn]);/**
|
|
42
|
+
* @remix-run/router v1.23.2
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Remix Software Inc.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
48
|
+
*
|
|
49
|
+
* @license MIT
|
|
50
|
+
*/function tn(){return tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},tn.apply(this,arguments)}var yn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(yn||(yn={}));const Ug="popstate";function S1(e){e===void 0&&(e={});function t(s,o){let{pathname:c,search:l,hash:d}=s.location;return vo("",{pathname:c,search:l,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(s,o){return typeof o=="string"?o:Po(o)}return j1(t,n,null,e)}function Et(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function C1(){return Math.random().toString(36).substr(2,8)}function zg(e,t){return{usr:e.state,key:e.key,idx:t}}function vo(e,t,n,s){return n===void 0&&(n=null),tn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Wi(t):t,{state:n,key:t&&t.key||s||C1()})}function Po(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Wi(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function j1(e,t,n,s){s===void 0&&(s={});let{window:o=document.defaultView,v5Compat:c=!1}=s,l=o.history,d=yn.Pop,m=null,p=y();p==null&&(p=0,l.replaceState(tn({},l.state,{idx:p}),""));function y(){return(l.state||{idx:null}).idx}function g(){d=yn.Pop;let N=y(),T=N==null?null:N-p;p=N,m&&m({action:d,location:S.location,delta:T})}function x(N,T){d=yn.Push;let _=vo(S.location,N,T);p=y()+1;let R=zg(_,p),G=S.createHref(_);try{l.pushState(R,"",G)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;o.location.assign(G)}c&&m&&m({action:d,location:S.location,delta:1})}function b(N,T){d=yn.Replace;let _=vo(S.location,N,T);p=y();let R=zg(_,p),G=S.createHref(_);l.replaceState(R,"",G),c&&m&&m({action:d,location:S.location,delta:0})}function C(N){let T=o.location.origin!=="null"?o.location.origin:o.location.href,_=typeof N=="string"?N:Po(N);return _=_.replace(/ $/,"%20"),Et(T,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,T)}let S={get action(){return d},get location(){return e(o,l)},listen(N){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(Ug,g),m=N,()=>{o.removeEventListener(Ug,g),m=null}},createHref(N){return t(o,N)},createURL:C,encodeLocation(N){let T=C(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:x,replace:b,go(N){return l.go(N)}};return S}var Ut;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ut||(Ut={}));const N1=new Set(["lazy","caseSensitive","path","id","index","children"]);function T1(e){return e.index===!0}function wc(e,t,n,s){return n===void 0&&(n=[]),s===void 0&&(s={}),e.map((o,c)=>{let l=[...n,String(c)],d=typeof o.id=="string"?o.id:l.join("-");if(Et(o.index!==!0||!o.children,"Cannot specify children on an index route"),Et(!s[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),T1(o)){let m=tn({},o,t(o),{id:d});return s[d]=m,m}else{let m=tn({},o,t(o),{id:d,children:void 0});return s[d]=m,o.children&&(m.children=wc(o.children,t,l,s)),m}})}function fs(e,t,n){return n===void 0&&(n="/"),lc(e,t,n,!1)}function lc(e,t,n,s){let o=typeof t=="string"?Wi(t):t,c=Eo(o.pathname||"/",n);if(c==null)return null;let l=jb(e);E1(l);let d=null;for(let m=0;d==null&&m<l.length;++m){let p=U1(c);d=O1(l[m],p,s)}return d}function P1(e,t){let{route:n,pathname:s,params:o}=e;return{id:n.id,pathname:s,params:o,data:t[n.id],handle:n.handle}}function jb(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let o=(c,l,d)=>{let m={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:l,route:c};m.relativePath.startsWith("/")&&(Et(m.relativePath.startsWith(s),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(s.length));let p=zi([s,m.relativePath]),y=n.concat(m);c.children&&c.children.length>0&&(Et(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),jb(c.children,t,y,p)),!(c.path==null&&!c.index)&&t.push({path:p,score:_1(p,c.index),routesMeta:y})};return e.forEach((c,l)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,l);else for(let m of Nb(c.path))o(c,l,m)}),t}function Nb(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,o=n.endsWith("?"),c=n.replace(/\?$/,"");if(s.length===0)return o?[c,""]:[c];let l=Nb(s.join("/")),d=[];return d.push(...l.map(m=>m===""?c:[c,m].join("/"))),o&&d.push(...l),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function E1(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:F1(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const R1=/^:[\w-]+$/,M1=3,A1=2,L1=1,I1=10,D1=-2,Wg=e=>e==="*";function _1(e,t){let n=e.split("/"),s=n.length;return n.some(Wg)&&(s+=D1),t&&(s+=A1),n.filter(o=>!Wg(o)).reduce((o,c)=>o+(R1.test(c)?M1:c===""?L1:I1),s)}function F1(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function O1(e,t,n){n===void 0&&(n=!1);let{routesMeta:s}=e,o={},c="/",l=[];for(let d=0;d<s.length;++d){let m=s[d],p=d===s.length-1,y=c==="/"?t:t.slice(c.length)||"/",g=kn({path:m.relativePath,caseSensitive:m.caseSensitive,end:p},y),x=m.route;if(!g&&p&&n&&!s[s.length-1].route.index&&(g=kn({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(o,g.params),l.push({params:o,pathname:zi([c,g.pathname]),pathnameBase:$1(zi([c,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(c=zi([c,g.pathnameBase]))}return l}function kn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=B1(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let c=o[0],l=c.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:s.reduce((p,y,g)=>{let{paramName:x,isOptional:b}=y;if(x==="*"){let S=d[g]||"";l=c.slice(0,c.length-S.length).replace(/(.)\/+$/,"$1")}const C=d[g];return b&&!C?p[x]=void 0:p[x]=(C||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:l,pattern:e}}function B1(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),vs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,d,m)=>(s.push({paramName:d,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function U1(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return vs(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Eo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}const z1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,W1=e=>z1.test(e);function H1(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Wi(e):e,c;if(n)if(W1(n))c=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),vs(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?c=Hg(n.substring(1),"/"):c=Hg(n,t)}else c=t;return{pathname:c,search:q1(s),hash:V1(o)}}function Hg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Ed(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Tb(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function pf(e,t){let n=Tb(e);return t?n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function gf(e,t,n,s){s===void 0&&(s=!1);let o;typeof e=="string"?o=Wi(e):(o=tn({},e),Et(!o.pathname||!o.pathname.includes("?"),Ed("?","pathname","search",o)),Et(!o.pathname||!o.pathname.includes("#"),Ed("#","pathname","hash",o)),Et(!o.search||!o.search.includes("#"),Ed("#","search","hash",o)));let c=e===""||o.pathname==="",l=c?"/":o.pathname,d;if(l==null)d=n;else{let g=t.length-1;if(!s&&l.startsWith("..")){let x=l.split("/");for(;x[0]==="..";)x.shift(),g-=1;o.pathname=x.join("/")}d=g>=0?t[g]:"/"}let m=H1(o,d),p=l&&l!=="/"&&l.endsWith("/"),y=(c||l===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(p||y)&&(m.pathname+="/"),m}const zi=e=>e.join("/").replace(/\/\/+/g,"/"),$1=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),q1=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,V1=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class bc{constructor(t,n,s,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}}function wo(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Pb=["post","put","patch","delete"],G1=new Set(Pb),K1=["get",...Pb],Q1=new Set(K1),Y1=new Set([301,302,303,307,308]),X1=new Set([307,308]),Rd={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},J1={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ka={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},yf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Z1=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Eb="remix-router-transitions";function ej(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",s=!n;Et(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let I=e.detectErrorBoundary;o=$=>({hasErrorBoundary:I($)})}else o=Z1;let c={},l=wc(e.routes,o,void 0,c),d,m=e.basename||"/",p=e.dataStrategy||ij,y=e.patchRoutesOnNavigation,g=tn({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),x=null,b=new Set,C=null,S=null,N=null,T=e.hydrationData!=null,_=fs(l,e.history.location,m),R=!1,G=null;if(_==null&&!y){let I=ar(404,{pathname:e.history.location.pathname}),{matches:$,route:L}=ey(l);_=$,G={[L.id]:I}}_&&!e.hydrationData&&mn(_,l,e.history.location.pathname).active&&(_=null);let q;if(_)if(_.some(I=>I.route.lazy))q=!1;else if(!_.some(I=>I.route.loader))q=!0;else if(g.v7_partialHydration){let I=e.hydrationData?e.hydrationData.loaderData:null,$=e.hydrationData?e.hydrationData.errors:null;if($){let L=_.findIndex(X=>$[X.route.id]!==void 0);q=_.slice(0,L+1).every(X=>!Ah(X.route,I,$))}else q=_.every(L=>!Ah(L.route,I,$))}else q=e.hydrationData!=null;else if(q=!1,_=[],g.v7_partialHydration){let I=mn(null,l,e.history.location.pathname);I.active&&I.matches&&(R=!0,_=I.matches)}let F,M={historyAction:e.history.action,location:e.history.location,matches:_,initialized:q,navigation:Rd,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||G,fetchers:new Map,blockers:new Map},D=yn.Pop,U=!1,E,H=!1,ee=new Map,ne=null,ae=!1,te=!1,ye=[],J=new Set,K=new Map,ue=0,A=-1,z=new Map,le=new Set,P=new Map,ve=new Map,je=new Set,Se=new Map,De=new Map,Re;function We(){if(x=e.history.listen(I=>{let{action:$,location:L,delta:X}=I;if(Re){Re(),Re=void 0;return}vs(De.size===0||X!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ce=Ot({currentLocation:M.location,nextLocation:L,historyAction:$});if(ce&&X!=null){let ke=new Promise(Fe=>{Re=Fe});e.history.go(X*-1),Pt(ce,{state:"blocked",location:L,proceed(){Pt(ce,{state:"proceeding",proceed:void 0,reset:void 0,location:L}),ke.then(()=>e.history.go(X))},reset(){let Fe=new Map(M.blockers);Fe.set(ce,Ka),qe({blockers:Fe})}});return}return vt($,L)}),n){vj(t,ee);let I=()=>wj(t,ee);t.addEventListener("pagehide",I),ne=()=>t.removeEventListener("pagehide",I)}return M.initialized||vt(yn.Pop,M.location,{initialHydration:!0}),F}function ct(){x&&x(),ne&&ne(),b.clear(),E&&E.abort(),M.fetchers.forEach((I,$)=>dt($)),M.blockers.forEach((I,$)=>ot($))}function Tt(I){return b.add(I),()=>b.delete(I)}function qe(I,$){$===void 0&&($={}),M=tn({},M,I);let L=[],X=[];g.v7_fetcherPersist&&M.fetchers.forEach((ce,ke)=>{ce.state==="idle"&&(je.has(ke)?X.push(ke):L.push(ke))}),je.forEach(ce=>{!M.fetchers.has(ce)&&!K.has(ce)&&X.push(ce)}),[...b].forEach(ce=>ce(M,{deletedFetchers:X,viewTransitionOpts:$.viewTransitionOpts,flushSync:$.flushSync===!0})),g.v7_fetcherPersist?(L.forEach(ce=>M.fetchers.delete(ce)),X.forEach(ce=>dt(ce))):X.forEach(ce=>je.delete(ce))}function ft(I,$,L){var X,ce;let{flushSync:ke}=L===void 0?{}:L,Fe=M.actionData!=null&&M.navigation.formMethod!=null&&Kr(M.navigation.formMethod)&&M.navigation.state==="loading"&&((X=I.state)==null?void 0:X._isRedirect)!==!0,Ne;$.actionData?Object.keys($.actionData).length>0?Ne=$.actionData:Ne=null:Fe?Ne=M.actionData:Ne=null;let Me=$.loaderData?Jg(M.loaderData,$.loaderData,$.matches||[],$.errors):M.loaderData,Ie=M.blockers;Ie.size>0&&(Ie=new Map(Ie),Ie.forEach((ie,Be)=>Ie.set(Be,Ka)));let O=U===!0||M.navigation.formMethod!=null&&Kr(M.navigation.formMethod)&&((ce=I.state)==null?void 0:ce._isRedirect)!==!0;d&&(l=d,d=void 0),ae||D===yn.Pop||(D===yn.Push?e.history.push(I,I.state):D===yn.Replace&&e.history.replace(I,I.state));let me;if(D===yn.Pop){let ie=ee.get(M.location.pathname);ie&&ie.has(I.pathname)?me={currentLocation:M.location,nextLocation:I}:ee.has(I.pathname)&&(me={currentLocation:I,nextLocation:M.location})}else if(H){let ie=ee.get(M.location.pathname);ie?ie.add(I.pathname):(ie=new Set([I.pathname]),ee.set(M.location.pathname,ie)),me={currentLocation:M.location,nextLocation:I}}qe(tn({},$,{actionData:Ne,loaderData:Me,historyAction:D,location:I,initialized:!0,navigation:Rd,revalidation:"idle",restoreScrollPosition:Pn(I,$.matches||M.matches),preventScrollReset:O,blockers:Ie}),{viewTransitionOpts:me,flushSync:ke===!0}),D=yn.Pop,U=!1,H=!1,ae=!1,te=!1,ye=[]}async function Ue(I,$){if(typeof I=="number"){e.history.go(I);return}let L=Mh(M.location,M.matches,m,g.v7_prependBasename,I,g.v7_relativeSplatPath,$==null?void 0:$.fromRouteId,$==null?void 0:$.relative),{path:X,submission:ce,error:ke}=$g(g.v7_normalizeFormMethod,!1,L,$),Fe=M.location,Ne=vo(M.location,X,$&&$.state);Ne=tn({},Ne,e.history.encodeLocation(Ne));let Me=$&&$.replace!=null?$.replace:void 0,Ie=yn.Push;Me===!0?Ie=yn.Replace:Me===!1||ce!=null&&Kr(ce.formMethod)&&ce.formAction===M.location.pathname+M.location.search&&(Ie=yn.Replace);let O=$&&"preventScrollReset"in $?$.preventScrollReset===!0:void 0,me=($&&$.flushSync)===!0,ie=Ot({currentLocation:Fe,nextLocation:Ne,historyAction:Ie});if(ie){Pt(ie,{state:"blocked",location:Ne,proceed(){Pt(ie,{state:"proceeding",proceed:void 0,reset:void 0,location:Ne}),Ue(I,$)},reset(){let Be=new Map(M.blockers);Be.set(ie,Ka),qe({blockers:Be})}});return}return await vt(Ie,Ne,{submission:ce,pendingError:ke,preventScrollReset:O,replace:$&&$.replace,enableViewTransition:$&&$.viewTransition,flushSync:me})}function Ht(){if(xe(),qe({revalidation:"loading"}),M.navigation.state!=="submitting"){if(M.navigation.state==="idle"){vt(M.historyAction,M.location,{startUninterruptedRevalidation:!0});return}vt(D||M.historyAction,M.navigation.location,{overrideNavigation:M.navigation,enableViewTransition:H===!0})}}async function vt(I,$,L){E&&E.abort(),E=null,D=I,ae=(L&&L.startUninterruptedRevalidation)===!0,vn(M.location,M.matches),U=(L&&L.preventScrollReset)===!0,H=(L&&L.enableViewTransition)===!0;let X=d||l,ce=L&&L.overrideNavigation,ke=L!=null&&L.initialHydration&&M.matches&&M.matches.length>0&&!R?M.matches:fs(X,$,m),Fe=(L&&L.flushSync)===!0;if(ke&&M.initialized&&!te&&uj(M.location,$)&&!(L&&L.submission&&Kr(L.submission.formMethod))){ft($,{matches:ke},{flushSync:Fe});return}let Ne=mn(ke,X,$.pathname);if(Ne.active&&Ne.matches&&(ke=Ne.matches),!ke){let{error:Oe,notFoundMatches:He,route:ut}=St($.pathname);ft($,{matches:He,loaderData:{},errors:{[ut.id]:Oe}},{flushSync:Fe});return}E=new AbortController;let Me=Ys(e.history,$,E.signal,L&&L.submission),Ie;if(L&&L.pendingError)Ie=[ms(ke).route.id,{type:Ut.error,error:L.pendingError}];else if(L&&L.submission&&Kr(L.submission.formMethod)){let Oe=await Ge(Me,$,L.submission,ke,Ne.active,{replace:L.replace,flushSync:Fe});if(Oe.shortCircuited)return;if(Oe.pendingActionResult){let[He,ut]=Oe.pendingActionResult;if(br(ut)&&wo(ut.error)&&ut.error.status===404){E=null,ft($,{matches:Oe.matches,loaderData:{},errors:{[He]:ut.error}});return}}ke=Oe.matches||ke,Ie=Oe.pendingActionResult,ce=Md($,L.submission),Fe=!1,Ne.active=!1,Me=Ys(e.history,Me.url,Me.signal)}let{shortCircuited:O,matches:me,loaderData:ie,errors:Be}=await yt(Me,$,ke,Ne.active,ce,L&&L.submission,L&&L.fetcherSubmission,L&&L.replace,L&&L.initialHydration===!0,Fe,Ie);O||(E=null,ft($,tn({matches:me||ke},Zg(Ie),{loaderData:ie,errors:Be})))}async function Ge(I,$,L,X,ce,ke){ke===void 0&&(ke={}),xe();let Fe=gj($,L);if(qe({navigation:Fe},{flushSync:ke.flushSync===!0}),ce){let Ie=await an(X,$.pathname,I.signal);if(Ie.type==="aborted")return{shortCircuited:!0};if(Ie.type==="error"){let O=ms(Ie.partialMatches).route.id;return{matches:Ie.partialMatches,pendingActionResult:[O,{type:Ut.error,error:Ie.error}]}}else if(Ie.matches)X=Ie.matches;else{let{notFoundMatches:O,error:me,route:ie}=St($.pathname);return{matches:O,pendingActionResult:[ie.id,{type:Ut.error,error:me}]}}}let Ne,Me=so(X,$);if(!Me.route.action&&!Me.route.lazy)Ne={type:Ut.error,error:ar(405,{method:I.method,pathname:$.pathname,routeId:Me.route.id})};else if(Ne=(await It("action",M,I,[Me],X,null))[Me.route.id],I.signal.aborted)return{shortCircuited:!0};if(gs(Ne)){let Ie;return ke&&ke.replace!=null?Ie=ke.replace:Ie=Qg(Ne.response.headers.get("Location"),new URL(I.url),m,e.history)===M.location.pathname+M.location.search,await bt(I,Ne,!0,{submission:L,replace:Ie}),{shortCircuited:!0}}if(Bi(Ne))throw ar(400,{type:"defer-action"});if(br(Ne)){let Ie=ms(X,Me.route.id);return(ke&&ke.replace)!==!0&&(D=yn.Push),{matches:X,pendingActionResult:[Ie.route.id,Ne]}}return{matches:X,pendingActionResult:[Me.route.id,Ne]}}async function yt(I,$,L,X,ce,ke,Fe,Ne,Me,Ie,O){let me=ce||Md($,ke),ie=ke||Fe||ny(me),Be=!ae&&(!g.v7_partialHydration||!Me);if(X){if(Be){let pe=Rt(O);qe(tn({navigation:me},pe!==void 0?{actionData:pe}:{}),{flushSync:Ie})}let we=await an(L,$.pathname,I.signal);if(we.type==="aborted")return{shortCircuited:!0};if(we.type==="error"){let pe=ms(we.partialMatches).route.id;return{matches:we.partialMatches,loaderData:{},errors:{[pe]:we.error}}}else if(we.matches)L=we.matches;else{let{error:pe,notFoundMatches:lt,route:mt}=St($.pathname);return{matches:lt,loaderData:{},errors:{[mt.id]:pe}}}}let Oe=d||l,[He,ut]=Vg(e.history,M,L,ie,$,g.v7_partialHydration&&Me===!0,g.v7_skipActionErrorRevalidation,te,ye,J,je,P,le,Oe,m,O);if(Jt(we=>!(L&&L.some(pe=>pe.route.id===we))||He&&He.some(pe=>pe.route.id===we)),A=++ue,He.length===0&&ut.length===0){let we=W();return ft($,tn({matches:L,loaderData:{},errors:O&&br(O[1])?{[O[0]]:O[1].error}:null},Zg(O),we?{fetchers:new Map(M.fetchers)}:{}),{flushSync:Ie}),{shortCircuited:!0}}if(Be){let we={};if(!X){we.navigation=me;let pe=Rt(O);pe!==void 0&&(we.actionData=pe)}ut.length>0&&(we.fetchers=zt(ut)),qe(we,{flushSync:Ie})}ut.forEach(we=>{at(we.key),we.controller&&K.set(we.key,we.controller)});let un=()=>ut.forEach(we=>at(we.key));E&&E.signal.addEventListener("abort",un);let{loaderResults:In,fetcherResults:on}=await de(M,L,He,ut,I);if(I.signal.aborted)return{shortCircuited:!0};E&&E.signal.removeEventListener("abort",un),ut.forEach(we=>K.delete(we.key));let kt=zl(In);if(kt)return await bt(I,kt.result,!0,{replace:Ne}),{shortCircuited:!0};if(kt=zl(on),kt)return le.add(kt.key),await bt(I,kt.result,!0,{replace:Ne}),{shortCircuited:!0};let{loaderData:Sr,errors:Yn}=Xg(M,L,In,O,ut,on,Se);Se.forEach((we,pe)=>{we.subscribe(lt=>{(lt||we.done)&&Se.delete(pe)})}),g.v7_partialHydration&&Me&&M.errors&&(Yn=tn({},M.errors,Yn));let Xn=W(),Jn=Pe(A),Y=Xn||Jn||ut.length>0;return tn({matches:L,loaderData:Sr,errors:Yn},Y?{fetchers:new Map(M.fetchers)}:{})}function Rt(I){if(I&&!br(I[1]))return{[I[0]]:I[1].data};if(M.actionData)return Object.keys(M.actionData).length===0?null:M.actionData}function zt(I){return I.forEach($=>{let L=M.fetchers.get($.key),X=Qa(void 0,L?L.data:void 0);M.fetchers.set($.key,X)}),new Map(M.fetchers)}function gt(I,$,L,X){if(s)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");at(I);let ce=(X&&X.flushSync)===!0,ke=d||l,Fe=Mh(M.location,M.matches,m,g.v7_prependBasename,L,g.v7_relativeSplatPath,$,X==null?void 0:X.relative),Ne=fs(ke,Fe,m),Me=mn(Ne,ke,Fe);if(Me.active&&Me.matches&&(Ne=Me.matches),!Ne){Ve(I,$,ar(404,{pathname:Fe}),{flushSync:ce});return}let{path:Ie,submission:O,error:me}=$g(g.v7_normalizeFormMethod,!0,Fe,X);if(me){Ve(I,$,me,{flushSync:ce});return}let ie=so(Ne,Ie),Be=(X&&X.preventScrollReset)===!0;if(O&&Kr(O.formMethod)){Mt(I,$,Ie,ie,Ne,Me.active,ce,Be,O);return}P.set(I,{routeId:$,path:Ie}),Vt(I,$,Ie,ie,Ne,Me.active,ce,Be,O)}async function Mt(I,$,L,X,ce,ke,Fe,Ne,Me){xe(),P.delete(I);function Ie(ze){if(!ze.route.action&&!ze.route.lazy){let Wt=ar(405,{method:Me.formMethod,pathname:L,routeId:$});return Ve(I,$,Wt,{flushSync:Fe}),!0}return!1}if(!ke&&Ie(X))return;let O=M.fetchers.get(I);_e(I,yj(Me,O),{flushSync:Fe});let me=new AbortController,ie=Ys(e.history,L,me.signal,Me);if(ke){let ze=await an(ce,new URL(ie.url).pathname,ie.signal,I);if(ze.type==="aborted")return;if(ze.type==="error"){Ve(I,$,ze.error,{flushSync:Fe});return}else if(ze.matches){if(ce=ze.matches,X=so(ce,L),Ie(X))return}else{Ve(I,$,ar(404,{pathname:L}),{flushSync:Fe});return}}K.set(I,me);let Be=ue,He=(await It("action",M,ie,[X],ce,I))[X.route.id];if(ie.signal.aborted){K.get(I)===me&&K.delete(I);return}if(g.v7_fetcherPersist&&je.has(I)){if(gs(He)||br(He)){_e(I,_i(void 0));return}}else{if(gs(He))if(K.delete(I),A>Be){_e(I,_i(void 0));return}else return le.add(I),_e(I,Qa(Me)),bt(ie,He,!1,{fetcherSubmission:Me,preventScrollReset:Ne});if(br(He)){Ve(I,$,He.error);return}}if(Bi(He))throw ar(400,{type:"defer-action"});let ut=M.navigation.location||M.location,un=Ys(e.history,ut,me.signal),In=d||l,on=M.navigation.state!=="idle"?fs(In,M.navigation.location,m):M.matches;Et(on,"Didn't find any matches after fetcher action");let kt=++ue;z.set(I,kt);let Sr=Qa(Me,He.data);M.fetchers.set(I,Sr);let[Yn,Xn]=Vg(e.history,M,on,Me,ut,!1,g.v7_skipActionErrorRevalidation,te,ye,J,je,P,le,In,m,[X.route.id,He]);Xn.filter(ze=>ze.key!==I).forEach(ze=>{let Wt=ze.key,Bt=M.fetchers.get(Wt),ur=Qa(void 0,Bt?Bt.data:void 0);M.fetchers.set(Wt,ur),at(Wt),ze.controller&&K.set(Wt,ze.controller)}),qe({fetchers:new Map(M.fetchers)});let Jn=()=>Xn.forEach(ze=>at(ze.key));me.signal.addEventListener("abort",Jn);let{loaderResults:Y,fetcherResults:we}=await de(M,on,Yn,Xn,un);if(me.signal.aborted)return;me.signal.removeEventListener("abort",Jn),z.delete(I),K.delete(I),Xn.forEach(ze=>K.delete(ze.key));let pe=zl(Y);if(pe)return bt(un,pe.result,!1,{preventScrollReset:Ne});if(pe=zl(we),pe)return le.add(pe.key),bt(un,pe.result,!1,{preventScrollReset:Ne});let{loaderData:lt,errors:mt}=Xg(M,on,Y,void 0,Xn,we,Se);if(M.fetchers.has(I)){let ze=_i(He.data);M.fetchers.set(I,ze)}Pe(kt),M.navigation.state==="loading"&&kt>A?(Et(D,"Expected pending action"),E&&E.abort(),ft(M.navigation.location,{matches:on,loaderData:lt,errors:mt,fetchers:new Map(M.fetchers)})):(qe({errors:mt,loaderData:Jg(M.loaderData,lt,on,mt),fetchers:new Map(M.fetchers)}),te=!1)}async function Vt(I,$,L,X,ce,ke,Fe,Ne,Me){let Ie=M.fetchers.get(I);_e(I,Qa(Me,Ie?Ie.data:void 0),{flushSync:Fe});let O=new AbortController,me=Ys(e.history,L,O.signal);if(ke){let He=await an(ce,new URL(me.url).pathname,me.signal,I);if(He.type==="aborted")return;if(He.type==="error"){Ve(I,$,He.error,{flushSync:Fe});return}else if(He.matches)ce=He.matches,X=so(ce,L);else{Ve(I,$,ar(404,{pathname:L}),{flushSync:Fe});return}}K.set(I,O);let ie=ue,Oe=(await It("loader",M,me,[X],ce,I))[X.route.id];if(Bi(Oe)&&(Oe=await vf(Oe,me.signal,!0)||Oe),K.get(I)===O&&K.delete(I),!me.signal.aborted){if(je.has(I)){_e(I,_i(void 0));return}if(gs(Oe))if(A>ie){_e(I,_i(void 0));return}else{le.add(I),await bt(me,Oe,!1,{preventScrollReset:Ne});return}if(br(Oe)){Ve(I,$,Oe.error);return}Et(!Bi(Oe),"Unhandled fetcher deferred data"),_e(I,_i(Oe.data))}}async function bt(I,$,L,X){let{submission:ce,fetcherSubmission:ke,preventScrollReset:Fe,replace:Ne}=X===void 0?{}:X;$.response.headers.has("X-Remix-Revalidate")&&(te=!0);let Me=$.response.headers.get("Location");Et(Me,"Expected a Location header on the redirect Response"),Me=Qg(Me,new URL(I.url),m,e.history);let Ie=vo(M.location,Me,{_isRedirect:!0});if(n){let He=!1;if($.response.headers.has("X-Remix-Reload-Document"))He=!0;else if(yf.test(Me)){const ut=e.history.createURL(Me);He=ut.origin!==t.location.origin||Eo(ut.pathname,m)==null}if(He){Ne?t.location.replace(Me):t.location.assign(Me);return}}E=null;let O=Ne===!0||$.response.headers.has("X-Remix-Replace")?yn.Replace:yn.Push,{formMethod:me,formAction:ie,formEncType:Be}=M.navigation;!ce&&!ke&&me&&ie&&Be&&(ce=ny(M.navigation));let Oe=ce||ke;if(X1.has($.response.status)&&Oe&&Kr(Oe.formMethod))await vt(O,Ie,{submission:tn({},Oe,{formAction:Me}),preventScrollReset:Fe||U,enableViewTransition:L?H:void 0});else{let He=Md(Ie,ce);await vt(O,Ie,{overrideNavigation:He,fetcherSubmission:ke,preventScrollReset:Fe||U,enableViewTransition:L?H:void 0})}}async function It(I,$,L,X,ce,ke){let Fe,Ne={};try{Fe=await sj(p,I,$,L,X,ce,ke,c,o)}catch(Me){return X.forEach(Ie=>{Ne[Ie.route.id]={type:Ut.error,error:Me}}),Ne}for(let[Me,Ie]of Object.entries(Fe))if(dj(Ie)){let O=Ie.result;Ne[Me]={type:Ut.redirect,response:lj(O,L,Me,ce,m,g.v7_relativeSplatPath)}}else Ne[Me]=await oj(Ie);return Ne}async function de(I,$,L,X,ce){let ke=I.matches,Fe=It("loader",I,ce,L,$,null),Ne=Promise.all(X.map(async O=>{if(O.matches&&O.match&&O.controller){let ie=(await It("loader",I,Ys(e.history,O.path,O.controller.signal),[O.match],O.matches,O.key))[O.match.route.id];return{[O.key]:ie}}else return Promise.resolve({[O.key]:{type:Ut.error,error:ar(404,{pathname:O.path})}})})),Me=await Fe,Ie=(await Ne).reduce((O,me)=>Object.assign(O,me),{});return await Promise.all([mj($,Me,ce.signal,ke,I.loaderData),pj($,Ie,X)]),{loaderResults:Me,fetcherResults:Ie}}function xe(){te=!0,ye.push(...Jt()),P.forEach((I,$)=>{K.has($)&&J.add($),at($)})}function _e(I,$,L){L===void 0&&(L={}),M.fetchers.set(I,$),qe({fetchers:new Map(M.fetchers)},{flushSync:(L&&L.flushSync)===!0})}function Ve(I,$,L,X){X===void 0&&(X={});let ce=ms(M.matches,$);dt(I),qe({errors:{[ce.route.id]:L},fetchers:new Map(M.fetchers)},{flushSync:(X&&X.flushSync)===!0})}function Qe(I){return ve.set(I,(ve.get(I)||0)+1),je.has(I)&&je.delete(I),M.fetchers.get(I)||J1}function dt(I){let $=M.fetchers.get(I);K.has(I)&&!($&&$.state==="loading"&&z.has(I))&&at(I),P.delete(I),z.delete(I),le.delete(I),g.v7_fetcherPersist&&je.delete(I),J.delete(I),M.fetchers.delete(I)}function At(I){let $=(ve.get(I)||0)-1;$<=0?(ve.delete(I),je.add(I),g.v7_fetcherPersist||dt(I)):ve.set(I,$),qe({fetchers:new Map(M.fetchers)})}function at(I){let $=K.get(I);$&&($.abort(),K.delete(I))}function be(I){for(let $ of I){let L=Qe($),X=_i(L.data);M.fetchers.set($,X)}}function W(){let I=[],$=!1;for(let L of le){let X=M.fetchers.get(L);Et(X,"Expected fetcher: "+L),X.state==="loading"&&(le.delete(L),I.push(L),$=!0)}return be(I),$}function Pe(I){let $=[];for(let[L,X]of z)if(X<I){let ce=M.fetchers.get(L);Et(ce,"Expected fetcher: "+L),ce.state==="loading"&&(at(L),z.delete(L),$.push(L))}return be($),$.length>0}function nt(I,$){let L=M.blockers.get(I)||Ka;return De.get(I)!==$&&De.set(I,$),L}function ot(I){M.blockers.delete(I),De.delete(I)}function Pt(I,$){let L=M.blockers.get(I)||Ka;Et(L.state==="unblocked"&&$.state==="blocked"||L.state==="blocked"&&$.state==="blocked"||L.state==="blocked"&&$.state==="proceeding"||L.state==="blocked"&&$.state==="unblocked"||L.state==="proceeding"&&$.state==="unblocked","Invalid blocker state transition: "+L.state+" -> "+$.state);let X=new Map(M.blockers);X.set(I,$),qe({blockers:X})}function Ot(I){let{currentLocation:$,nextLocation:L,historyAction:X}=I;if(De.size===0)return;De.size>1&&vs(!1,"A router only supports one blocker at a time");let ce=Array.from(De.entries()),[ke,Fe]=ce[ce.length-1],Ne=M.blockers.get(ke);if(!(Ne&&Ne.state==="proceeding")&&Fe({currentLocation:$,nextLocation:L,historyAction:X}))return ke}function St(I){let $=ar(404,{pathname:I}),L=d||l,{matches:X,route:ce}=ey(L);return Jt(),{notFoundMatches:X,route:ce,error:$}}function Jt(I){let $=[];return Se.forEach((L,X)=>{(!I||I(X))&&(L.cancel(),$.push(X),Se.delete(X))}),$}function Gt(I,$,L){if(C=I,N=$,S=L||null,!T&&M.navigation===Rd){T=!0;let X=Pn(M.location,M.matches);X!=null&&qe({restoreScrollPosition:X})}return()=>{C=null,N=null,S=null}}function nn(I,$){return S&&S(I,$.map(X=>P1(X,M.loaderData)))||I.key}function vn(I,$){if(C&&N){let L=nn(I,$);C[L]=N()}}function Pn(I,$){if(C){let L=nn(I,$),X=C[L];if(typeof X=="number")return X}return null}function mn(I,$,L){if(y)if(I){if(Object.keys(I[0].params).length>0)return{active:!0,matches:lc($,L,m,!0)}}else return{active:!0,matches:lc($,L,m,!0)||[]};return{active:!1,matches:null}}async function an(I,$,L,X){if(!y)return{type:"success",matches:I};let ce=I;for(;;){let ke=d==null,Fe=d||l,Ne=c;try{await y({signal:L,path:$,matches:ce,fetcherKey:X,patch:(O,me)=>{L.aborted||Kg(O,me,Fe,Ne,o)}})}catch(O){return{type:"error",error:O,partialMatches:ce}}finally{ke&&!L.aborted&&(l=[...l])}if(L.aborted)return{type:"aborted"};let Me=fs(Fe,$,m);if(Me)return{type:"success",matches:Me};let Ie=lc(Fe,$,m,!0);if(!Ie||ce.length===Ie.length&&ce.every((O,me)=>O.route.id===Ie[me].route.id))return{type:"success",matches:null};ce=Ie}}function Ln(I){c={},d=wc(I,o,void 0,c)}function re(I,$){let L=d==null;Kg(I,$,d||l,c,o),L&&(l=[...l],qe({}))}return F={get basename(){return m},get future(){return g},get state(){return M},get routes(){return l},get window(){return t},initialize:We,subscribe:Tt,enableScrollRestoration:Gt,navigate:Ue,fetch:gt,revalidate:Ht,createHref:I=>e.history.createHref(I),encodeLocation:I=>e.history.encodeLocation(I),getFetcher:Qe,deleteFetcher:At,dispose:ct,getBlocker:nt,deleteBlocker:ot,patchRoutes:re,_internalFetchControllers:K,_internalActiveDeferreds:Se,_internalSetRoutes:Ln},F}function tj(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Mh(e,t,n,s,o,c,l,d){let m,p;if(l){m=[];for(let g of t)if(m.push(g),g.route.id===l){p=g;break}}else m=t,p=t[t.length-1];let y=gf(o||".",pf(m,c),Eo(e.pathname,n)||e.pathname,d==="path");if(o==null&&(y.search=e.search,y.hash=e.hash),(o==null||o===""||o===".")&&p){let g=wf(y.search);if(p.route.index&&!g)y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index";else if(!p.route.index&&g){let x=new URLSearchParams(y.search),b=x.getAll("index");x.delete("index"),b.filter(S=>S).forEach(S=>x.append("index",S));let C=x.toString();y.search=C?"?"+C:""}}return s&&n!=="/"&&(y.pathname=y.pathname==="/"?n:zi([n,y.pathname])),Po(y)}function $g(e,t,n,s){if(!s||!tj(s))return{path:n};if(s.formMethod&&!fj(s.formMethod))return{path:n,error:ar(405,{method:s.formMethod})};let o=()=>({path:n,error:ar(400,{type:"invalid-body"})}),c=s.formMethod||"get",l=e?c.toUpperCase():c.toLowerCase(),d=Ab(n);if(s.body!==void 0){if(s.formEncType==="text/plain"){if(!Kr(l))return o();let x=typeof s.body=="string"?s.body:s.body instanceof FormData||s.body instanceof URLSearchParams?Array.from(s.body.entries()).reduce((b,C)=>{let[S,N]=C;return""+b+S+"="+N+`
|
|
51
|
+
`},""):String(s.body);return{path:n,submission:{formMethod:l,formAction:d,formEncType:s.formEncType,formData:void 0,json:void 0,text:x}}}else if(s.formEncType==="application/json"){if(!Kr(l))return o();try{let x=typeof s.body=="string"?JSON.parse(s.body):s.body;return{path:n,submission:{formMethod:l,formAction:d,formEncType:s.formEncType,formData:void 0,json:x,text:void 0}}}catch{return o()}}}Et(typeof FormData=="function","FormData is not available in this environment");let m,p;if(s.formData)m=Lh(s.formData),p=s.formData;else if(s.body instanceof FormData)m=Lh(s.body),p=s.body;else if(s.body instanceof URLSearchParams)m=s.body,p=Yg(m);else if(s.body==null)m=new URLSearchParams,p=new FormData;else try{m=new URLSearchParams(s.body),p=Yg(m)}catch{return o()}let y={formMethod:l,formAction:d,formEncType:s&&s.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(Kr(y.formMethod))return{path:n,submission:y};let g=Wi(n);return t&&g.search&&wf(g.search)&&m.append("index",""),g.search="?"+m,{path:Po(g),submission:y}}function qg(e,t,n){n===void 0&&(n=!1);let s=e.findIndex(o=>o.route.id===t);return s>=0?e.slice(0,n?s+1:s):e}function Vg(e,t,n,s,o,c,l,d,m,p,y,g,x,b,C,S){let N=S?br(S[1])?S[1].error:S[1].data:void 0,T=e.createURL(t.location),_=e.createURL(o),R=n;c&&t.errors?R=qg(n,Object.keys(t.errors)[0],!0):S&&br(S[1])&&(R=qg(n,S[0]));let G=S?S[1].statusCode:void 0,q=l&&G&&G>=400,F=R.filter((D,U)=>{let{route:E}=D;if(E.lazy)return!0;if(E.loader==null)return!1;if(c)return Ah(E,t.loaderData,t.errors);if(nj(t.loaderData,t.matches[U],D)||m.some(ne=>ne===D.route.id))return!0;let H=t.matches[U],ee=D;return Gg(D,tn({currentUrl:T,currentParams:H.params,nextUrl:_,nextParams:ee.params},s,{actionResult:N,actionStatus:G,defaultShouldRevalidate:q?!1:d||T.pathname+T.search===_.pathname+_.search||T.search!==_.search||Rb(H,ee)}))}),M=[];return g.forEach((D,U)=>{if(c||!n.some(ae=>ae.route.id===D.routeId)||y.has(U))return;let E=fs(b,D.path,C);if(!E){M.push({key:U,routeId:D.routeId,path:D.path,matches:null,match:null,controller:null});return}let H=t.fetchers.get(U),ee=so(E,D.path),ne=!1;x.has(U)?ne=!1:p.has(U)?(p.delete(U),ne=!0):H&&H.state!=="idle"&&H.data===void 0?ne=d:ne=Gg(ee,tn({currentUrl:T,currentParams:t.matches[t.matches.length-1].params,nextUrl:_,nextParams:n[n.length-1].params},s,{actionResult:N,actionStatus:G,defaultShouldRevalidate:q?!1:d})),ne&&M.push({key:U,routeId:D.routeId,path:D.path,matches:E,match:ee,controller:new AbortController})}),[F,M]}function Ah(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let s=t!=null&&t[e.id]!==void 0,o=n!=null&&n[e.id]!==void 0;return!s&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!s&&!o}function nj(e,t,n){let s=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return s||o}function Rb(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Gg(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Kg(e,t,n,s,o){var c;let l;if(e){let p=s[e];Et(p,"No route found to patch children into: routeId = "+e),p.children||(p.children=[]),l=p.children}else l=n;let d=t.filter(p=>!l.some(y=>Mb(p,y))),m=wc(d,o,[e||"_","patch",String(((c=l)==null?void 0:c.length)||"0")],s);l.push(...m)}function Mb(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,s)=>{var o;return(o=t.children)==null?void 0:o.some(c=>Mb(n,c))}):!1}async function rj(e,t,n){if(!e.lazy)return;let s=await e.lazy();if(!e.lazy)return;let o=n[e.id];Et(o,"No route found in manifest");let c={};for(let l in s){let m=o[l]!==void 0&&l!=="hasErrorBoundary";vs(!m,'Route "'+o.id+'" has a static property "'+l+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+l+'" will be ignored.')),!m&&!N1.has(l)&&(c[l]=s[l])}Object.assign(o,c),Object.assign(o,tn({},t(o),{lazy:void 0}))}async function ij(e){let{matches:t}=e,n=t.filter(o=>o.shouldLoad);return(await Promise.all(n.map(o=>o.resolve()))).reduce((o,c,l)=>Object.assign(o,{[n[l].route.id]:c}),{})}async function sj(e,t,n,s,o,c,l,d,m,p){let y=c.map(b=>b.route.lazy?rj(b.route,m,d):void 0),g=c.map((b,C)=>{let S=y[C],N=o.some(_=>_.route.id===b.route.id);return tn({},b,{shouldLoad:N,resolve:async _=>(_&&s.method==="GET"&&(b.route.lazy||b.route.loader)&&(N=!0),N?aj(t,s,b,S,_,p):Promise.resolve({type:Ut.data,result:void 0}))})}),x=await e({matches:g,request:s,params:c[0].params,fetcherKey:l,context:p});try{await Promise.all(y)}catch{}return x}async function aj(e,t,n,s,o,c){let l,d,m=p=>{let y,g=new Promise((C,S)=>y=S);d=()=>y(),t.signal.addEventListener("abort",d);let x=C=>typeof p!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):p({request:t,params:n.params,context:c},...C!==void 0?[C]:[]),b=(async()=>{try{return{type:"data",result:await(o?o(S=>x(S)):x())}}catch(C){return{type:"error",result:C}}})();return Promise.race([b,g])};try{let p=n.route[e];if(s)if(p){let y,[g]=await Promise.all([m(p).catch(x=>{y=x}),s]);if(y!==void 0)throw y;l=g}else if(await s,p=n.route[e],p)l=await m(p);else if(e==="action"){let y=new URL(t.url),g=y.pathname+y.search;throw ar(405,{method:t.method,pathname:g,routeId:n.route.id})}else return{type:Ut.data,result:void 0};else if(p)l=await m(p);else{let y=new URL(t.url),g=y.pathname+y.search;throw ar(404,{pathname:g})}Et(l.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(p){return{type:Ut.error,result:p}}finally{d&&t.signal.removeEventListener("abort",d)}return l}async function oj(e){let{result:t,type:n}=e;if(Lb(t)){let g;try{let x=t.headers.get("Content-Type");x&&/\bapplication\/json\b/.test(x)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(x){return{type:Ut.error,error:x}}return n===Ut.error?{type:Ut.error,error:new bc(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:Ut.data,data:g,statusCode:t.status,headers:t.headers}}if(n===Ut.error){if(ty(t)){var s,o;if(t.data instanceof Error){var c,l;return{type:Ut.error,error:t.data,statusCode:(c=t.init)==null?void 0:c.status,headers:(l=t.init)!=null&&l.headers?new Headers(t.init.headers):void 0}}return{type:Ut.error,error:new bc(((s=t.init)==null?void 0:s.status)||500,void 0,t.data),statusCode:wo(t)?t.status:void 0,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:Ut.error,error:t,statusCode:wo(t)?t.status:void 0}}if(hj(t)){var d,m;return{type:Ut.deferred,deferredData:t,statusCode:(d=t.init)==null?void 0:d.status,headers:((m=t.init)==null?void 0:m.headers)&&new Headers(t.init.headers)}}if(ty(t)){var p,y;return{type:Ut.data,data:t.data,statusCode:(p=t.init)==null?void 0:p.status,headers:(y=t.init)!=null&&y.headers?new Headers(t.init.headers):void 0}}return{type:Ut.data,data:t}}function lj(e,t,n,s,o,c){let l=e.headers.get("Location");if(Et(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!yf.test(l)){let d=s.slice(0,s.findIndex(m=>m.route.id===n)+1);l=Mh(new URL(t.url),d,o,!0,l,c),e.headers.set("Location",l)}return e}function Qg(e,t,n,s){let o=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(yf.test(e)){let c=e,l=c.startsWith("//")?new URL(t.protocol+c):new URL(c);if(o.includes(l.protocol))throw new Error("Invalid redirect location");let d=Eo(l.pathname,n)!=null;if(l.origin===t.origin&&d)return l.pathname+l.search+l.hash}try{let c=s.createURL(e);if(o.includes(c.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Ys(e,t,n,s){let o=e.createURL(Ab(t)).toString(),c={signal:n};if(s&&Kr(s.formMethod)){let{formMethod:l,formEncType:d}=s;c.method=l.toUpperCase(),d==="application/json"?(c.headers=new Headers({"Content-Type":d}),c.body=JSON.stringify(s.json)):d==="text/plain"?c.body=s.text:d==="application/x-www-form-urlencoded"&&s.formData?c.body=Lh(s.formData):c.body=s.formData}return new Request(o,c)}function Lh(e){let t=new URLSearchParams;for(let[n,s]of e.entries())t.append(n,typeof s=="string"?s:s.name);return t}function Yg(e){let t=new FormData;for(let[n,s]of e.entries())t.append(n,s);return t}function cj(e,t,n,s,o){let c={},l=null,d,m=!1,p={},y=n&&br(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let x=g.route.id,b=t[x];if(Et(!gs(b),"Cannot handle redirect results in processLoaderData"),br(b)){let C=b.error;y!==void 0&&(C=y,y=void 0),l=l||{};{let S=ms(e,x);l[S.route.id]==null&&(l[S.route.id]=C)}c[x]=void 0,m||(m=!0,d=wo(b.error)?b.error.status:500),b.headers&&(p[x]=b.headers)}else Bi(b)?(s.set(x,b.deferredData),c[x]=b.deferredData.data,b.statusCode!=null&&b.statusCode!==200&&!m&&(d=b.statusCode),b.headers&&(p[x]=b.headers)):(c[x]=b.data,b.statusCode&&b.statusCode!==200&&!m&&(d=b.statusCode),b.headers&&(p[x]=b.headers))}),y!==void 0&&n&&(l={[n[0]]:y},c[n[0]]=void 0),{loaderData:c,errors:l,statusCode:d||200,loaderHeaders:p}}function Xg(e,t,n,s,o,c,l){let{loaderData:d,errors:m}=cj(t,n,s,l);return o.forEach(p=>{let{key:y,match:g,controller:x}=p,b=c[y];if(Et(b,"Did not find corresponding fetcher result"),!(x&&x.signal.aborted))if(br(b)){let C=ms(e.matches,g==null?void 0:g.route.id);m&&m[C.route.id]||(m=tn({},m,{[C.route.id]:b.error})),e.fetchers.delete(y)}else if(gs(b))Et(!1,"Unhandled fetcher revalidation redirect");else if(Bi(b))Et(!1,"Unhandled fetcher deferred data");else{let C=_i(b.data);e.fetchers.set(y,C)}}),{loaderData:d,errors:m}}function Jg(e,t,n,s){let o=tn({},t);for(let c of n){let l=c.route.id;if(t.hasOwnProperty(l)?t[l]!==void 0&&(o[l]=t[l]):e[l]!==void 0&&c.route.loader&&(o[l]=e[l]),s&&s.hasOwnProperty(l))break}return o}function Zg(e){return e?br(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ms(e,t){return(t?e.slice(0,e.findIndex(s=>s.route.id===t)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function ey(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ar(e,t){let{pathname:n,routeId:s,method:o,type:c,message:l}=t===void 0?{}:t,d="Unknown Server Error",m="Unknown @remix-run/router error";return e===400?(d="Bad Request",o&&n&&s?m="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+s+'", ')+"so there is no way to handle the request.":c==="defer-action"?m="defer() is not supported in actions":c==="invalid-body"&&(m="Unable to encode submission body")):e===403?(d="Forbidden",m='Route "'+s+'" does not match URL "'+n+'"'):e===404?(d="Not Found",m='No route matches URL "'+n+'"'):e===405&&(d="Method Not Allowed",o&&n&&s?m="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+s+'", ')+"so there is no way to handle the request.":o&&(m='Invalid request method "'+o.toUpperCase()+'"')),new bc(e||500,d,new Error(m),!0)}function zl(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[s,o]=t[n];if(gs(o))return{key:s,result:o}}}function Ab(e){let t=typeof e=="string"?Wi(e):e;return Po(tn({},t,{hash:""}))}function uj(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function dj(e){return Lb(e.result)&&Y1.has(e.result.status)}function Bi(e){return e.type===Ut.deferred}function br(e){return e.type===Ut.error}function gs(e){return(e&&e.type)===Ut.redirect}function ty(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function hj(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function Lb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function fj(e){return Q1.has(e.toLowerCase())}function Kr(e){return G1.has(e.toLowerCase())}async function mj(e,t,n,s,o){let c=Object.entries(t);for(let l=0;l<c.length;l++){let[d,m]=c[l],p=e.find(x=>(x==null?void 0:x.route.id)===d);if(!p)continue;let y=s.find(x=>x.route.id===p.route.id),g=y!=null&&!Rb(y,p)&&(o&&o[p.route.id])!==void 0;Bi(m)&&g&&await vf(m,n,!1).then(x=>{x&&(t[d]=x)})}}async function pj(e,t,n){for(let s=0;s<n.length;s++){let{key:o,routeId:c,controller:l}=n[s],d=t[o];e.find(p=>(p==null?void 0:p.route.id)===c)&&Bi(d)&&(Et(l,"Expected an AbortController for revalidating fetcher deferred result"),await vf(d,l.signal,!0).then(p=>{p&&(t[o]=p)}))}}async function vf(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Ut.data,data:e.deferredData.unwrappedData}}catch(o){return{type:Ut.error,error:o}}return{type:Ut.data,data:e.deferredData.data}}}function wf(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function so(e,t){let n=typeof t=="string"?Wi(t).search:t.search;if(e[e.length-1].route.index&&wf(n||""))return e[e.length-1];let s=Tb(e);return s[s.length-1]}function ny(e){let{formMethod:t,formAction:n,formEncType:s,text:o,formData:c,json:l}=e;if(!(!t||!n||!s)){if(o!=null)return{formMethod:t,formAction:n,formEncType:s,formData:void 0,json:void 0,text:o};if(c!=null)return{formMethod:t,formAction:n,formEncType:s,formData:c,json:void 0,text:void 0};if(l!==void 0)return{formMethod:t,formAction:n,formEncType:s,formData:void 0,json:l,text:void 0}}}function Md(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function gj(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Qa(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function yj(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function _i(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function vj(e,t){try{let n=e.sessionStorage.getItem(Eb);if(n){let s=JSON.parse(n);for(let[o,c]of Object.entries(s||{}))c&&Array.isArray(c)&&t.set(o,new Set(c||[]))}}catch{}}function wj(e,t){if(t.size>0){let n={};for(let[s,o]of t)n[s]=[...o];try{e.sessionStorage.setItem(Eb,JSON.stringify(n))}catch(s){vs(!1,"Failed to save applied view transitions in sessionStorage ("+s+").")}}}/**
|
|
52
|
+
* React Router v6.30.3
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Remix Software Inc.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
58
|
+
*
|
|
59
|
+
* @license MIT
|
|
60
|
+
*/function xc(){return xc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},xc.apply(this,arguments)}const Dc=w.createContext(null),Ib=w.createContext(null),Ro=w.createContext(null),bf=w.createContext(null),gi=w.createContext({outlet:null,matches:[],isDataRoute:!1}),Db=w.createContext(null);function Mo(){return w.useContext(bf)!=null}function Yr(){return Mo()||Et(!1),w.useContext(bf).location}function _b(e){w.useContext(Ro).static||w.useLayoutEffect(e)}function An(){let{isDataRoute:e}=w.useContext(gi);return e?Lj():bj()}function bj(){Mo()||Et(!1);let e=w.useContext(Dc),{basename:t,future:n,navigator:s}=w.useContext(Ro),{matches:o}=w.useContext(gi),{pathname:c}=Yr(),l=JSON.stringify(pf(o,n.v7_relativeSplatPath)),d=w.useRef(!1);return _b(()=>{d.current=!0}),w.useCallback(function(p,y){if(y===void 0&&(y={}),!d.current)return;if(typeof p=="number"){s.go(p);return}let g=gf(p,JSON.parse(l),c,y.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:zi([t,g.pathname])),(y.replace?s.replace:s.push)(g,y.state,y)},[t,s,l,c,e])}const xj=w.createContext(null);function kj(e){let t=w.useContext(gi).outlet;return t&&w.createElement(xj.Provider,{value:e},t)}function xf(){let{matches:e}=w.useContext(gi),t=e[e.length-1];return t?t.params:{}}function Sj(e,t,n,s){Mo()||Et(!1);let{navigator:o}=w.useContext(Ro),{matches:c}=w.useContext(gi),l=c[c.length-1],d=l?l.params:{};l&&l.pathname;let m=l?l.pathnameBase:"/";l&&l.route;let p=Yr(),y;y=p;let g=y.pathname||"/",x=g;if(m!=="/"){let S=m.replace(/^\//,"").split("/");x="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=fs(e,{pathname:x});return Pj(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},d,S.params),pathname:zi([m,o.encodeLocation?o.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?m:zi([m,o.encodeLocation?o.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),c,n,s)}function Cj(){let e=Aj(),t=wo(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:o},n):null,null)}const jj=w.createElement(Cj,null);class Nj extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?w.createElement(gi.Provider,{value:this.props.routeContext},w.createElement(Db.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Tj(e){let{routeContext:t,match:n,children:s}=e,o=w.useContext(Dc);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(gi.Provider,{value:t},s)}function Pj(e,t,n,s){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var c;if(!n)return null;if(n.errors)e=n.matches;else if((c=s)!=null&&c.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,d=(o=n)==null?void 0:o.errors;if(d!=null){let y=l.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);y>=0||Et(!1),l=l.slice(0,Math.min(l.length,y+1))}let m=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(p=y),g.route.id){let{loaderData:x,errors:b}=n,C=g.route.loader&&x[g.route.id]===void 0&&(!b||b[g.route.id]===void 0);if(g.route.lazy||C){m=!0,p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((y,g,x)=>{let b,C=!1,S=null,N=null;n&&(b=d&&g.route.id?d[g.route.id]:void 0,S=g.route.errorElement||jj,m&&(p<0&&x===0?(Ij("route-fallback"),C=!0,N=null):p===x&&(C=!0,N=g.route.hydrateFallbackElement||null)));let T=t.concat(l.slice(0,x+1)),_=()=>{let R;return b?R=S:C?R=N:g.route.Component?R=w.createElement(g.route.Component,null):g.route.element?R=g.route.element:R=y,w.createElement(Tj,{match:g,routeContext:{outlet:y,matches:T,isDataRoute:n!=null},children:R})};return n&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?w.createElement(Nj,{location:n.location,revalidation:n.revalidation,component:S,error:b,children:_(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):_()},null)}var Fb=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Fb||{}),Ob=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(Ob||{});function Ej(e){let t=w.useContext(Dc);return t||Et(!1),t}function Rj(e){let t=w.useContext(Ib);return t||Et(!1),t}function Mj(e){let t=w.useContext(gi);return t||Et(!1),t}function Bb(e){let t=Mj(),n=t.matches[t.matches.length-1];return n.route.id||Et(!1),n.route.id}function Aj(){var e;let t=w.useContext(Db),n=Rj(Ob.UseRouteError),s=Bb();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function Lj(){let{router:e}=Ej(Fb.UseNavigateStable),t=Bb(),n=w.useRef(!1);return _b(()=>{n.current=!0}),w.useCallback(function(o,c){c===void 0&&(c={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,xc({fromRouteId:t},c)))},[e,t])}const ry={};function Ij(e,t,n){ry[e]||(ry[e]=!0)}function Dj(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Ao(e){let{to:t,replace:n,state:s,relative:o}=e;Mo()||Et(!1);let{future:c,static:l}=w.useContext(Ro),{matches:d}=w.useContext(gi),{pathname:m}=Yr(),p=An(),y=gf(t,pf(d,c.v7_relativeSplatPath),m,o==="path"),g=JSON.stringify(y);return w.useEffect(()=>p(JSON.parse(g),{replace:n,state:s,relative:o}),[p,g,o,n,s]),null}function Ih(e){return kj(e.context)}function _j(e){let{basename:t="/",children:n=null,location:s,navigationType:o=yn.Pop,navigator:c,static:l=!1,future:d}=e;Mo()&&Et(!1);let m=t.replace(/^\/*/,"/"),p=w.useMemo(()=>({basename:m,navigator:c,static:l,future:xc({v7_relativeSplatPath:!1},d)}),[m,d,c,l]);typeof s=="string"&&(s=Wi(s));let{pathname:y="/",search:g="",hash:x="",state:b=null,key:C="default"}=s,S=w.useMemo(()=>{let N=Eo(y,m);return N==null?null:{location:{pathname:N,search:g,hash:x,state:b,key:C},navigationType:o}},[m,y,g,x,b,C,o]);return S==null?null:w.createElement(Ro.Provider,{value:p},w.createElement(bf.Provider,{children:n,value:S}))}new Promise(()=>{});function Fj(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:w.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:w.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:w.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
61
|
+
* React Router DOM v6.30.3
|
|
62
|
+
*
|
|
63
|
+
* Copyright (c) Remix Software Inc.
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the MIT license found in the
|
|
66
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
67
|
+
*
|
|
68
|
+
* @license MIT
|
|
69
|
+
*/function kc(){return kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},kc.apply(this,arguments)}function Dh(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(o=>[n,o]):[[n,s]])},[]))}function Oj(e,t){let n=Dh(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(c=>{n.append(o,c)})}),n}const Bj="6";try{window.__reactRouterVersion=Bj}catch{}function Uj(e,t){return ej({basename:void 0,future:kc({},void 0,{v7_prependBasename:!0}),history:S1({window:void 0}),hydrationData:zj(),routes:e,mapRouteProperties:Fj,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function zj(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=kc({},t,{errors:Wj(t.errors)})),t}function Wj(e){if(!e)return null;let t=Object.entries(e),n={};for(let[s,o]of t)if(o&&o.__type==="RouteErrorResponse")n[s]=new bc(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let c=window[o.__subType];if(typeof c=="function")try{let l=new c(o.message);l.stack="",n[s]=l}catch{}}if(n[s]==null){let c=new Error(o.message);c.stack="",n[s]=c}}else n[s]=o;return n}const Hj=w.createContext({isTransitioning:!1}),$j=w.createContext(new Map),qj="startTransition",iy=X0[qj],Vj="flushSync",sy=k1[Vj];function Gj(e){iy?iy(e):e()}function Ya(e){sy?sy(e):e()}class Kj{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=s=>{this.status==="pending"&&(this.status="resolved",t(s))},this.reject=s=>{this.status==="pending"&&(this.status="rejected",n(s))}})}}function Qj(e){let{fallbackElement:t,router:n,future:s}=e,[o,c]=w.useState(n.state),[l,d]=w.useState(),[m,p]=w.useState({isTransitioning:!1}),[y,g]=w.useState(),[x,b]=w.useState(),[C,S]=w.useState(),N=w.useRef(new Map),{v7_startTransition:T}=s||{},_=w.useCallback(D=>{T?Gj(D):D()},[T]),R=w.useCallback((D,U)=>{let{deletedFetchers:E,flushSync:H,viewTransitionOpts:ee}=U;D.fetchers.forEach((ae,te)=>{ae.data!==void 0&&N.current.set(te,ae.data)}),E.forEach(ae=>N.current.delete(ae));let ne=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!ee||ne){H?Ya(()=>c(D)):_(()=>c(D));return}if(H){Ya(()=>{x&&(y&&y.resolve(),x.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation})});let ae=n.window.document.startViewTransition(()=>{Ya(()=>c(D))});ae.finished.finally(()=>{Ya(()=>{g(void 0),b(void 0),d(void 0),p({isTransitioning:!1})})}),Ya(()=>b(ae));return}x?(y&&y.resolve(),x.skipTransition(),S({state:D,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation})):(d(D),p({isTransitioning:!0,flushSync:!1,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation}))},[n.window,x,y,N,_]);w.useLayoutEffect(()=>n.subscribe(R),[n,R]),w.useEffect(()=>{m.isTransitioning&&!m.flushSync&&g(new Kj)},[m]),w.useEffect(()=>{if(y&&l&&n.window){let D=l,U=y.promise,E=n.window.document.startViewTransition(async()=>{_(()=>c(D)),await U});E.finished.finally(()=>{g(void 0),b(void 0),d(void 0),p({isTransitioning:!1})}),b(E)}},[_,l,y,n.window]),w.useEffect(()=>{y&&l&&o.location.key===l.location.key&&y.resolve()},[y,x,o.location,l]),w.useEffect(()=>{!m.isTransitioning&&C&&(d(C.state),p({isTransitioning:!0,flushSync:!1,currentLocation:C.currentLocation,nextLocation:C.nextLocation}),S(void 0))},[m.isTransitioning,C]),w.useEffect(()=>{},[]);let G=w.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:D=>n.navigate(D),push:(D,U,E)=>n.navigate(D,{state:U,preventScrollReset:E==null?void 0:E.preventScrollReset}),replace:(D,U,E)=>n.navigate(D,{replace:!0,state:U,preventScrollReset:E==null?void 0:E.preventScrollReset})}),[n]),q=n.basename||"/",F=w.useMemo(()=>({router:n,navigator:G,static:!1,basename:q}),[n,G,q]),M=w.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return w.useEffect(()=>Dj(s,n.future),[s,n.future]),w.createElement(w.Fragment,null,w.createElement(Dc.Provider,{value:F},w.createElement(Ib.Provider,{value:o},w.createElement($j.Provider,{value:N.current},w.createElement(Hj.Provider,{value:m},w.createElement(_j,{basename:q,location:o.location,navigationType:o.historyAction,navigator:G,future:M},o.initialized||n.future.v7_partialHydration?w.createElement(Yj,{routes:n.routes,future:n.future,state:o}):t))))),null)}const Yj=w.memo(Xj);function Xj(e){let{routes:t,future:n,state:s}=e;return Sj(t,void 0,s,n)}var ay;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ay||(ay={}));var oy;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(oy||(oy={}));function Jj(e){let t=w.useRef(Dh(e)),n=w.useRef(!1),s=Yr(),o=w.useMemo(()=>Oj(s.search,n.current?null:t.current),[s.search]),c=An(),l=w.useCallback((d,m)=>{const p=Dh(typeof d=="function"?d(o):d);n.current=!0,c("?"+p,m)},[c,o]);return[o,l]}const Ub=w.createContext(null);function Zj(e){if(typeof document>"u")return;const{documentElement:t,body:n}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),n&&(n.dataset.runtimePlatform=e.platform,n.dataset.osFamily=e.ui.osFamily,n.dataset.windowControls=e.ui.windowControlsStyle,n.dataset.viewportClass=e.viewportClass,n.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function eN(){if(!(typeof window>"u"))return window.innerWidth}function tN({children:e}){const[t,n]=w.useState(()=>eN()),s=w.useMemo(()=>si({viewportWidth:t}),[t]);return w.useEffect(()=>{if(typeof window>"u")return;function o(){n(window.innerWidth)}return o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),w.useEffect(()=>{Zj(s)},[s]),i.jsx(Ub.Provider,{value:s,children:e})}function Kn(){return w.useContext(Ub)??si()}const nN={common:{appName:"CodingNS",loading:"Loading...",retry:"Retry",back:"Back",save:"Save",logout:"Log out",unknown:"Unknown session",close:"Close",cancel:"Cancel",language:"Language"},auth:{loginTitle:"Resume your coding session",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"Server Preset",serverCustomOption:"Use custom server",serverAddress:"Server Address",serverPlaceholder:"For example: http://127.0.0.1:3002",serverHint:"Login, realtime messages, and terminals all connect through this host. Point the client at the Host API endpoint such as http://127.0.0.1:3002; frontend dev ports like 4174 or 5173 are not meant for packaged clients and only work for temporary debugging when proxying and CORS are configured correctly.",serverInvalid:"Invalid server address. Check it and try again.",serverCurrent:"Current Server",bootstrapTitle:"Complete the first-time bootstrap",bootstrapSubtitle:"This Host does not have an admin account yet. Create the minimal login entry first.",username:"Username",password:"Password",rememberPassword:"Remember Password",confirmPassword:"Confirm Password",submitLogin:"Enter Workspace",submitBootstrap:"Create Admin Account",bootstrapSuccess:"Bootstrap completed. You can log in now.",bootstrapMismatch:"The two passwords do not match.",authUnavailable:"Host is unreachable right now. Check the server and try again.",logoutSuccess:"The current login state has been cleared.",serverSettings:"Server Settings",serverSettingsTitle:"Server Configuration",saveServerSettings:"Save Settings"},settings:{title:"Settings",appearance:"Appearance",appearanceSectionSummary:"Language, theme, and interface colors",language:"Language",languageDescription:"Choose the display language used by the interface.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",serverConnection:"Server Connection",serverConnectionSectionSummary:"Server address and reconnection behavior",securityPrivacy:"Security & Privacy",securityPrivacySectionSummary:"Session permissions, risk boundaries, and default approval policy",softwareUpdate:"Software Update",softwareUpdateSectionSummary:"Server and client versions",serverAddress:"Server Address",serverDescription:"Login, API requests, and realtime connections all use this Host entry, while the frontend UI is bundled inside the client itself.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",defaultPermissionMode:"Default Session Permissions",defaultPermissionModeDescription:"Controls the default tool permissions for new and resumed sessions. Full access disables approval prompts and should only be used for trusted projects and environments.",permissionModeDefault:"Follow CLI defaults",permissionModeAcceptEdits:"Allow workspace edits without asking",permissionModeBypassPermissions:"Full access without asking",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseTargetTag:"Target Tag",releasePublishedAt:"Published At",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallerMissing:"A new version is available, but this release does not include a supported installer yet.",releaseSignatureMissing:"A new version is available, but this release does not provide checksum information yet.",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open page",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",logout:"Log out"},home:{title:"Continue from a session, not from a backend table",subtitle:"Pick a workspace and session here first. The real work starts in the next step.",terminalsEntry:"Open Terminal",workspaceSection:"Workspaces",sessionSection:"Recent Sessions",emptyWorkspaces:"No workspace has been imported yet. Import one on the Host side first, and the entry will appear here.",emptySessions:"There is no session to continue in the current workspace yet.",noActivity:"No activity yet"},terminal:{title:"Terminal",heroTitle:"Keep the real PTY on Host, keep the control surface in the workspace",heroSubtitle:"This page does not fake output and does not mix terminal with process management. It only consumes the real terminal stream managed by Host.",workspaceSection:"Workspace & Terminal",workspaceField:"Current Workspace",shellField:"Shell for New Terminal",runtimeField:"Runtime",runtimeAutoOption:"Auto",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"Use the Host default policy for this terminal runtime.",runtimeTmuxDescription:"Use a persistent external session, ideal for development terminals that should stay alive.",runtimeEmbeddedDescription:"Managed directly by the current Host and useful as the lightweight fallback.",runtimeMissingDialogTitle:"tmux is not installed on this system",runtimeMissingDialogDescription:"The tmux runtime cannot create a persistent terminal right now. Install tmux first, or temporarily switch to embedded-pty to continue.",runtimeMissingInstallDescription:"Installing tmux is recommended if you want terminals to survive Host restarts.",runtimeMissingInstallMacArm:"macOS (Apple Silicon / Homebrew): arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS (Intel Mac / Homebrew): brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian: sudo apt install tmux",runtimeMissingInstallFedora:"Fedora: sudo dnf install tmux",runtimeMissingFallbackDescription:"If you switch to embedded-pty now, the terminal can still start, but it will not stay as an external persistent session.",runtimeMissingKeepAction:"Not now",runtimeMissingFallbackAction:"Switch to embedded-pty",runtimeMissingFallbackPending:"Switching...",shellUnavailable:"Unavailable",workspaceLoadFailed:"The workspace or terminal list is not available right now.",terminalSection:"Terminal Instances",templateSection:"Command Templates",stageEmptyTitle:"No terminal selected yet",stageEmptySubtitle:"Create a terminal first, or run a command template.",emptyTerminals:"There is no terminal instance in the current workspace yet.",emptyTemplates:"There is no command template in the current workspace yet.",createButton:"Create Terminal",creating:"Creating terminal...",creationPendingDescription:"Host is starting the real PTY. This pane will take over as soon as the stream is ready.",defaultTerminalName:"Workspace Terminal",created:"The terminal has been created and connected to Host.",createFailed:"Failed to create terminal.",closeButton:"Close Terminal",closing:"Closing terminal...",closed:"The terminal close request has been submitted.",closeCompleted:"Terminal closed.",closePendingDescription:"The close request has been sent to Host. The page stays responsive and keeps syncing the final result in the background.",closeSyncDelayed:"Host is still finishing the close in the background. The list will keep syncing on the next refresh.",closeFailed:"Failed to close terminal.",inputLabel:"Send command to current terminal",inputPlaceholder:"For example: npm test",sendButton:"Send to Terminal",inputFailed:"Failed to send terminal input.",outputEmpty:"The terminal is connected, but there is no output yet.",outputTruncated:"Some output exceeded the cache window while disconnected. Only the retained part has been restored.",connectedHint:"Current output is coming from the real PTY stream on Host.",moreActions:"Terminal Actions",duplicateAction:"Duplicate Tab",duplicateSuccess:"A new terminal tab has been created with the same setup.",duplicateFailed:"Failed to duplicate the terminal tab.",disconnectAction:"Disconnect",disconnected:"Terminal connection has been disconnected.",reconnectAction:"Reconnect",reconnectRequested:"Reconnect request sent.",deleteAction:"Delete",deleting:"Deleting terminal...",deleted:"Terminal record deleted.",deletePendingDescription:"The delete request has been sent to Host. The page stays responsive and keeps syncing the list in the background.",deleteSyncDelayed:"Host is still finishing the delete in the background. The list will keep syncing on the next refresh.",deleteFailed:"Failed to delete the terminal record.",closePendingBadge:"Closing",deletePendingBadge:"Deleting",pinAction:"Pin",unpinAction:"Unpin",zoomLabel:"Terminal Zoom",zoomInAction:"Zoom in terminal display",zoomOutAction:"Zoom out terminal display",zoomResetAction:"Reset terminal zoom",toolbarToggleAction:"Open terminal toolbar",mobileSwipeHint:"Swipe left or right to switch terminals",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"Open quick terminal list",mobileDrawerTitle:"Quick Terminals",mobileDrawerDescription:"Swipe right to reveal the list, then tap to jump to another terminal.",mobilePinnedSectionTitle:"Pinned Terminals",mobileDrawerEmptyTitle:"No terminals yet",mobileDrawerEmptyDescription:"Create one first and the quick switcher will appear here.",mobileCreateSheetTitle:"Create Terminal",mobileCreateShellLabel:"Terminal Type",mobileCreateShellDescription:"Pick the shell for this terminal instead of squeezing desktop dropdowns onto mobile.",mobileCreateRuntimeLabel:"Session Type",mobileCreateRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",mobileCreateLoadingShells:"Loading available terminal types for this system...",mobileCreateConfirm:"Create this terminal",mobileRuntimePersistentTitle:"tmux (persistent)",mobileRuntimePersistentDescription:"Best for development terminals that should stay alive longer.",mobileRuntimeSessionTitle:"runtime (current session)",mobileRuntimeSessionDescription:"Managed directly by the current Host. Lighter, but not an external persistent session.",mobileWorkspaceSwitcherPlaceholder:"Choose Workspace",mobileEmptyTitle:"No terminal content yet",mobileEmptyDescription:"Create a terminal first, or swipe right to open the quick list and switch to an existing one.",layoutLabel:"Layout",layoutSingleAction:"Single pane",layoutVerticalAction:"Split left and right",layoutHorizontalAction:"Split top and bottom",saveLogAction:"Save Log",saveLogSuccess:"The terminal log has been saved.",saveLogFailed:"Failed to save the terminal log.",logEmpty:"There is no terminal log to save yet.",bindToPaneAction:"Bind to current pane",bindToPrimaryPaneAction:"Bind to main pane",bindToSecondaryPaneAction:"Bind to side pane",panePrimary:"Main Pane",paneSecondary:"Side Pane",splitEmptySubtitle:"Pick a tab or create a terminal first, then bind it to this pane.",statusBadge:{creating:"starting",running:"running",closed:"closed",error:"error"},recoveryComplete:"Recovered to the terminal from before refresh. Key cached output has been restored.",recoveryTruncated:"Recovered to the previous terminal, but some disconnected output exceeded the cache window.",recoveryIdleClosed:"The previous terminal was auto-closed by Host after being idle too long. You are seeing the output kept before close.",reconnect:"Reconnect",liveConnected:"Live stream connected",templateName:"Template Name",templateCommand:"Main Command",templateArgs:"Arguments (space separated)",templateCreateButton:"Save Template",templateCreated:"The command template has been saved.",templateCreateFailed:"Failed to save the command template.",templateRunSent:"The command template has been sent to the current terminal.",templateRunCreatedTerminal:"The command template started in a new terminal.",templateRunFailed:"Failed to run the command template.",connection:{connected:"Connected",reconnecting:"Reconnecting",reconnect_failed:"Reconnect failed",closed:"Closed"}},conversation:{titleFallback:"Continue Conversation",historyLoading:"Loading message history from Host...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Message history is not available right now. Try again later.",timelineEmpty:"There are no messages in this session yet. Your first message will go straight into the Host chain.",rawRefLabel:"Source",copyAction:"Copy",copyContentSuccess:"Content copied.",copyContentFailed:"Failed to copy the content.",loadMore:"Load More",composerPlaceholder:"State the next step clearly. Let the rest continue inside this session.",sendButton:"Send Message",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",queueSteer:"Steer",queueSteering:"Steering",resendButton:"Resend",quickPhraseTrigger:"Quick Phrases",quickPhraseModalTitle:"Quick Phrases",quickPhraseModalDescription:"Keep the prompts you reuse often in one place and drop them straight into the current composer.",quickPhraseCreateLabel:"New Phrase",quickPhraseOpenCreateAction:"Add Phrase",quickPhraseCreateModalTitle:"Create Quick Phrase",quickPhraseCreateModalDescription:"Save a reusable prompt on its own so it is ready across devices whenever you need it.",quickPhraseCreatePlaceholder:"Write a phrase you want to reuse later.",quickPhraseCreateAction:"Add Phrase",quickPhraseListLabel:"Quick phrase list",quickPhraseEmpty:"There are no quick phrases yet. Add the first one you actually reuse.",quickPhraseOrderLabel:"Item {index}",quickPhraseMoveUp:"Move phrase up",quickPhraseMoveDown:"Move phrase down",quickPhraseDelete:"Delete phrase",quickPhraseSaveFailed:"Failed to save quick phrases. Try again later.",sendingState:"Sending",sentState:"Synced",failedState:"Send failed",contextUsageTitle:"Context Usage",contextUsageUnavailable:"Context usage is not available yet",contextUsageEstimated:"Window is estimated",contextUsageCachedTokens:"{count} cached",contextUsageSourceProviderLog:"window from provider log",contextUsageSourceProviderRuntime:"window from provider runtime",contextUsageSourceProviderConfig:"window from provider config",contextUsageSourceModelMap:"window from model map",headerWorkspace:"Workspace",headerProvider:"Provider",headerCapability:"Capability Summary",connectionConnected:"Connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeErrorTitle:"Session run failed",reconnectExplain:"The realtime link is broken. The system is replaying missing messages.",reconnectFailedExplain:"Automatic recovery failed. Retry manually, or reopen the session later.",capabilityDenied:"This action is not supported in the current session.",capabilitySendDisabled:"The current provider does not support sending new messages.",capabilityAttachmentDisabled:"This session does not support attachment input yet.",capabilityInterruptDisabled:"This session does not support interruption.",sidebarTitle:"Current Session Context",sidebarSubtitle:"This sidebar only keeps the minimum capability summary. It does not turn the page into an admin console.",reconnectButton:"Restore Realtime Sync",headerResumedAt:"Last Resumed",headerLastSyncAt:"Last Synced",historyPages:"History Pages",syncStatusIdle:"Sync Idle",syncStatusSyncing:"Syncing",syncStatusError:"Sync Error",capabilityResume:"Resumable",capabilitySend:"Send Enabled",capabilityInterrupt:"Interrupt Enabled",capabilityTools:"Tool Calls",attachmentsLabel:"Attachments",filePanelTitle:"File Manager",filePanelSubtitle:"File capabilities here only serve the current session. This is not a heavy IDE shell.",filePanelNoWorkspace:"There is no selected workspace yet. Browsing or attaching files is unavailable.",filePanelRefresh:"Refresh",filePanelCopyPath:"Copy Path",filePanelCopyAbsolutePath:"Copy Absolute Path",filePanelCopyRelativePath:"Copy Relative Path",filePanelCopyAbsolutePathSuccess:"Absolute path copied.",filePanelCopyRelativePathSuccess:"Relative path copied.",filePanelCopyPathFailed:"Failed to copy the path.",filePanelActionsMenu:"File Actions",filePanelSearchPlaceholder:"Enter a file name or path fragment",filePanelSearchButton:"Search",filePanelShowSearch:"Open Search",filePanelHideSearch:"Hide Search",filePanelSearchEmpty:"No matching files found.",filePanelSearchResults:"Search Results",filePanelSearchFailed:"File search failed. Try again later.",filePanelBrowse:"Workspace Files",filePanelCollapseCurrent:"Collapse Current",filePanelCollapseAll:"Collapse All",filePanelBackDirectory:"Go to Parent",filePanelEmptyDirectory:"There are no files to show in this directory.",filePanelRecentTitle:"Recently Opened",filePanelEmptyRecent:"There is no recently opened file yet.",filePanelContextTitle:"Attached Files",filePanelEmptyContexts:"No file is attached to the current session yet.",filePanelEditorTitle:"Preview & Editor",filePanelEditorPlaceholder:"This is a lightweight text editor, not a full IDE.",filePanelSelectHint:"Pick a file first from browse, search, or recent items.",filePanelUnsupported:"This file cannot be edited directly in the sidebar right now.",filePanelAttach:"Attach to Session",filePanelAttached:"Attached",filePanelDetach:"Detach",filePanelSave:"Save",filePanelSaving:"Saving...",filePanelLoadFailed:"Failed to load the file panel.",filePanelOpenFailed:"Failed to open the file.",filePanelSaveSuccess:"File saved.",filePanelSaveFailed:"Failed to save the file.",fileViewerHint:"Opened in {language} mode. Preview and save after editing are supported.",fileViewerModeLabel:"File View Mode",fileViewerPreview:"Preview",fileViewerCode:"Code",fileViewerEdit:"Edit",fileViewerPlainText:"Plain Text",filePanelAttachSuccess:"The file has been attached to the current session.",filePanelAttachFailed:"Failed to attach the file.",filePanelDetachSuccess:"The file has been detached from the current session.",filePanelDetachFailed:"Failed to detach the file.",filePanelNewFile:"New File",filePanelNewDirectory:"New Directory",filePanelUpload:"Upload File",filePanelDownload:"Download File",filePanelUploadSuccess:"{name} uploaded.",filePanelUploadFailed:"Failed to upload the file.",filePanelDownloadSuccess:"Started downloading {name}.",filePanelDownloadFailed:"Failed to download the file.",filePanelDelete:"Delete",filePanelRenameMove:"Rename / Move",filePanelMutateFailed:"File operation failed. Check the path and current state.",filePanelCreateFilePrompt:"Enter the relative path of the file to create",filePanelCreateDirectoryPrompt:"Enter the relative path of the directory to create",filePanelDeleteConfirm:"Delete this file? {path}",filePanelRenameMovePrompt:"Enter the new relative path",unavailableAction:"Unavailable",roleUser:"User",roleAssistant:"Assistant",roleTool:"Tool",roleSystem:"System"},git:{title:"Git Context",subtitle:"This is the session-side support area. It only handles Git facts inside the current workspace.",loading:"Loading Git context for the current workspace...",refresh:"Refresh",panelLoadFailed:"Git context is not available right now.",ahead:"Ahead",behind:"Behind",dirty:"Dirty",clean:"Clean",changeCount:"{count} changed files in the current workspace",noChanges:"There are no pending changes right now.",changesTitle:"Current Changes",rulesFirstHint:"Rules come first. Drafts must not bypass validation.",stage:"Stage",unstage:"Unstage",stageFailed:"Stage operation failed.",diffTitle:"Diff Preview",diffLoadFailed:"Diff content is not available right now.",binaryDiff:"This file is a binary change. The sidebar does not render its content directly.",stagedDiff:"Staged diff",worktreeDiff:"Working tree diff",emptyDiff:"There is no text diff to display right now.",diffTruncated:"The diff is too long and has been truncated for safety.",commitTitle:"Commit Draft",defaultRuleName:"Default Commit Rule",language:"Language",maxLength:"Max Length",bodyRequired:"Body Required",bodyOptional:"Body Optional",issueRequired:"Issue Required",issueOptional:"Issue Optional",commitSubject:"Commit Subject",commitSubjectPlaceholder:"Enter the commit message here",commitBody:"Commit Body",commitBodyPlaceholder:"Explain the change clearly. Do not write empty words.",commitFooter:"Commit Footer",commitFooterPlaceholder:"For example: Refs: #123",generateDraft:"AI Draft",validate:"Validate Draft",commit:"Commit",draftFailed:"Failed to generate the commit draft.",validateFailed:"Commit rule validation failed.",commitFailed:"Commit failed.",commitSuccess:"The commit has been written to the current repository.",validationPassed:"Rule validation passed. You can continue to commit.",validationFailed:"Rule validation failed. Fix the issues below first.",branchTitle:"Branch",branchPlaceholder:"Enter the branch name to switch to or create",switchBranch:"Switch",createBranch:"Create",branchFailed:"Branch operation failed.",historyTitle:"Recent History",historyHint:"Only keep the latest few entries here. This is not a graphical history tree.",noHistory:"There is no commit history to show right now.",remoteTitle:"Remote Sync",remoteReady:"A remote is configured for the current repository.",remoteMissing:"The current repository has no remote configured yet.",fetch:"Fetch",pull:"Pull",push:"Push",publish:"Publish",remoteFailed:"Remote sync failed.",errors:{unauthorized:"The current login is no longer valid. Log in again and retry.",workspaceNotFound:"The workspace bound to the current session does not exist. Check whether it is still available.",invalidWorkspace:"The current workspace config is invalid. The Git sidebar must not operate outside the repo root.",notGitRepository:"The current workspace is not a Git repository. The Git sidebar will not fake a state.",repoNotFound:"No usable Git repository root was found for the current workspace.",pathOutOfWorkspace:"The Git target is outside the current workspace repository boundary. The operation was blocked.",invalidTarget:"The Git target path is invalid. Refresh the sidebar and try again.",notStaged:"The target file is not staged yet. Check the current change state first.",emptyStagedChanges:"The staging area is empty. Stage the changes before committing.",branchConflict:"The current branch has conflicts or is not a fast-forward update. Sync and resolve differences first.",branchNotFound:"The target branch does not exist. Check the branch name first.",remoteNotFound:"The current repository does not have a usable origin remote yet.",remoteAuthFailed:"Remote repository authentication failed. Check the current credentials first.",pushFailed:"Push failed. Check remote state and local commits first.",pullFailed:"Pull failed. Check the remote branch state first.",remoteFailed:"Remote sync failed. Check Git output and network state.",commitValidationFailed:"The commit draft has not passed validation yet. Fix validation issues first.",commandTimeout:"The Git operation timed out. Check repository state and network conditions."}},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"},locale:{zhCN:"Simplified Chinese",enUS:"English"}},rN={common:{appName:"CodingNS",loading:"正在准备会话工作区…",retry:"重新尝试",back:"返回",save:"保存",close:"关闭",cancel:"取消",logout:"退出登录",unknown:"未命名会话"},auth:{loginTitle:"继续你的编码会话",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"服务器列表",serverCustomOption:"使用自定义服务器",serverAddress:"服务器地址",serverPlaceholder:"例如:http://127.0.0.1:3002",serverHint:"登录、实时消息和终端都会连接到这里。客户端应填写 Host API 地址,例如 http://127.0.0.1:3002;4174、5173 这类前端开发端口不是给正式客户端直接连接的,只有代理和跨域都配好时才适合临时调试。",serverInvalid:"服务器地址无效,请检查后再试。",serverCurrent:"当前服务器",bootstrapTitle:"先完成首次初始化",bootstrapSubtitle:"这个 Host 还没有管理员账号,先创建一个最小登录入口。",username:"用户名",password:"密码",rememberPassword:"保存密码",confirmPassword:"确认密码",submitLogin:"进入工作台",submitBootstrap:"创建管理员账号",bootstrapSuccess:"初始化完成,现在可以登录了。",bootstrapMismatch:"两次输入的密码不一致。",authUnavailable:"暂时连不上 Host,请确认服务可访问。",logoutSuccess:"当前登录态已经清空。",serverSettings:"服务器设置",serverSettingsTitle:"服务器配置",saveServerSettings:"保存设置"},settings:{title:"设置",appearance:"外观",appearanceSectionSummary:"语言、主题与界面配色",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",serverConnection:"服务器连接",serverConnectionSectionSummary:"服务器地址与连接恢复策略",securityPrivacy:"安全与隐私",securityPrivacySectionSummary:"会话权限、风险边界与默认授权策略",softwareUpdate:"软件更新",softwareUpdateSectionSummary:"服务端和客户端版本",serverAddress:"服务器地址",serverDescription:"客户端的登录、接口请求和实时连接都通过这个 Host 入口工作;前端界面资源由应用自身携带。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"稳定版",releaseBeta:"测试版",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",defaultPermissionMode:"默认会话权限",defaultPermissionModeDescription:"控制新建和继续会话时默认使用的工具权限。完整权限会关闭询问,只适合你已经信任当前项目和运行环境时使用。",permissionModeDefault:"跟随 CLI 默认策略",permissionModeAcceptEdits:"允许编辑工作区,不询问",permissionModeBypassPermissions:"完整权限,不询问",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseTargetTag:"目标 Tag",releasePublishedAt:"发布时间",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallerMissing:"有新版本,暂无安装包",releaseSignatureMissing:"有新版本,缺少校验信息",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开页面失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",logout:"退出登录"},home:{title:"从一条会话继续,而不是从后台表格开始",subtitle:"这里先挑一个工作区和会话,真正的工作区在下一步。",terminalsEntry:"进入终端页",workspaceSection:"工作区",sessionSection:"最近会话",emptyWorkspaces:"还没有导入工作区。先在 Host 侧导入后,这里会出现入口。",emptySessions:"当前工作区还没有可继续的会话。",noActivity:"暂时还没有活动"},terminal:{title:"终端",heroTitle:"把真实 PTY 留在 Host,把操作入口留在工作台",heroSubtitle:"这里不伪造输出,不把终端和进程搅在一起,只消费 Host 统一托管的真实终端流。",workspaceSection:"工作区与终端",workspaceField:"当前工作区",shellField:"新终端使用的 Shell",runtimeField:"Runtime",runtimeAutoOption:"自动选择",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"按 Host 默认策略选择当前终端 runtime。",runtimeTmuxDescription:"持久化外部会话,适合需要后台常驻的开发终端。",runtimeEmbeddedDescription:"由当前 Host 直接托管,适合作为轻量回退方案。",runtimeMissingDialogTitle:"当前系统没有安装 tmux",runtimeMissingDialogDescription:"tmux runtime 无法继续创建持久化终端。你可以先安装 tmux,或者临时切换到 embedded-pty 继续。",runtimeMissingInstallDescription:"建议优先安装 tmux,这样终端才能在 Host 重启后继续保留。",runtimeMissingInstallMacArm:"macOS(Apple Silicon / Homebrew):arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS(Intel Mac / Homebrew):brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian:sudo apt install tmux",runtimeMissingInstallFedora:"Fedora:sudo dnf install tmux",runtimeMissingFallbackDescription:"如果现在先切到 embedded-pty,本次终端可以继续创建,但它不会作为外部持久会话保留。",runtimeMissingKeepAction:"先不切换",runtimeMissingFallbackAction:"切换到 embedded-pty 并继续",runtimeMissingFallbackPending:"正在切换…",shellUnavailable:"当前不可用",workspaceLoadFailed:"工作区或终端列表暂时没有拉回来。",terminalSection:"终端实例",templateSection:"命令模板",stageEmptyTitle:"还没有选中终端",stageEmptySubtitle:"先创建一个终端,或者运行一个命令模板。",emptyTerminals:"当前工作区还没有终端实例。",emptyTemplates:"当前工作区还没有命令模板。",createButton:"新建终端",creating:"正在创建终端…",creationPendingDescription:"Host 正在启动真实 PTY,连上以后这个窗口会立刻接管显示。",defaultTerminalName:"工作终端",created:"终端已经创建并接入 Host。",createFailed:"终端创建失败。",closeButton:"关闭终端",closing:"正在关闭终端…",closed:"终端关闭请求已经提交。",closeCompleted:"终端已关闭。",closePendingDescription:"关闭请求已经发给 Host,前台不会阻塞,系统会继续同步最终结果。",closeSyncDelayed:"Host 还在后台处理关闭,列表会在后续刷新时继续同步。",closeFailed:"终端关闭失败。",inputLabel:"向当前终端发送命令",inputPlaceholder:"例如:pnpm test",sendButton:"发送到终端",inputFailed:"终端输入发送失败。",outputEmpty:"终端已经连上,但暂时还没有输出。",outputTruncated:"断线期间有一段输出超出缓存窗口,当前只补回了仍保留的部分。",connectedHint:"当前输出来自 Host 真实 PTY 流。",moreActions:"终端操作",duplicateAction:"复制标签",duplicateSuccess:"已按当前终端配置新建一个标签。",duplicateFailed:"复制终端标签失败。",disconnectAction:"断开",disconnected:"终端连接已断开。",reconnectAction:"重连",reconnectRequested:"终端重连请求已发出。",deleteAction:"删除",deleting:"正在删除终端…",deleted:"终端记录已删除。",deletePendingDescription:"删除请求已经发给 Host,前台不会阻塞,系统会在后台继续同步列表。",deleteSyncDelayed:"Host 还在后台处理删除,列表会在后续刷新时继续同步。",deleteFailed:"终端记录删除失败。",closePendingBadge:"关闭中",deletePendingBadge:"删除中",pinAction:"固定",unpinAction:"取消固定",zoomLabel:"终端缩放",zoomInAction:"放大终端显示",zoomOutAction:"缩小终端显示",zoomResetAction:"恢复默认缩放",toolbarToggleAction:"展开终端工具栏",mobileSwipeHint:"左右滑动切换终端",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"打开快捷终端列表",mobileDrawerTitle:"快捷终端",mobileDrawerDescription:"右滑呼出列表,点一下就切到别的终端。",mobilePinnedSectionTitle:"已固定终端",mobileDrawerEmptyTitle:"当前还没有终端",mobileDrawerEmptyDescription:"先新建一个终端,这里才会出现可切换的列表。",mobileCreateSheetTitle:"新建终端",mobileCreateShellLabel:"终端类型",mobileCreateShellDescription:"先选这次要开的 Shell,别把桌面端那套下拉框搬到手机上。",mobileCreateRuntimeLabel:"会话方式",mobileCreateRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",mobileCreateLoadingShells:"正在读取当前系统可用的终端类型…",mobileCreateConfirm:"创建这个终端",mobileRuntimePersistentTitle:"tmux(持久会话)",mobileRuntimePersistentDescription:"适合需要一直挂着的开发终端,Host 重启后也能尽量保留。",mobileRuntimeSessionTitle:"runtime(当前会话)",mobileRuntimeSessionDescription:"直接由当前 Host 托管,创建更轻,但不会保留成外部持久会话。",mobileWorkspaceSwitcherPlaceholder:"选择项目",mobileEmptyTitle:"这里还没有终端内容",mobileEmptyDescription:"先新建一个终端,或者右滑呼出快捷列表,切到当前工作区已有的终端。",layoutLabel:"分栏布局",layoutSingleAction:"单栏显示",layoutVerticalAction:"左右分栏",layoutHorizontalAction:"上下分栏",saveLogAction:"保存日志",saveLogSuccess:"终端日志已保存。",saveLogFailed:"终端日志保存失败。",logEmpty:"当前终端还没有可保存的日志内容。",bindToPaneAction:"绑定到当前分栏",bindToPrimaryPaneAction:"绑定到主分栏",bindToSecondaryPaneAction:"绑定到副分栏",panePrimary:"主分栏",paneSecondary:"副分栏",splitEmptySubtitle:"先点一个标签,或者新建一个终端,把它绑定到当前分栏。",statusBadge:{creating:"启动中",running:"运行中",closed:"已关闭",error:"异常"},recoveryComplete:"已回到刷新前的终端,缓存内的关键输出已经补回。",recoveryTruncated:"已恢复到上一个终端,但断线期间的部分输出已经超出缓存窗口。",recoveryIdleClosed:"上一个终端已因空闲超时被 Host 自动关闭,你现在看到的是关闭前保留的输出。",reconnect:"手动重连",liveConnected:"实时流已接入",templateName:"模板名称",templateCommand:"主命令",templateArgs:"参数(空格分隔)",templateCreateButton:"保存模板",templateCreated:"命令模板已经保存。",templateCreateFailed:"命令模板保存失败。",templateRunSent:"命令模板已经发送到当前终端。",templateRunCreatedTerminal:"命令模板已在新终端中启动。",templateRunFailed:"命令模板执行失败。",connection:{connected:"已连接",reconnecting:"正在重连",reconnect_failed:"重连失败",closed:"已关闭"}},conversation:{titleFallback:"继续对话",historyLoading:"正在从 Host 拉取消息历史…",historyLoadingOlder:"正在加载更早的消息…",historyLoadFailed:"历史消息暂时没有拉回来,可以稍后再试。",timelineEmpty:"这条会话还没有消息。你发出的第一句话会直接进入 Host 链路。",rawRefLabel:"来源",copyAction:"复制",copyContentSuccess:"内容已复制。",copyContentFailed:"内容复制失败。",loadMore:"加载更多消息",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",queueTitle:"待发队列",queueDescription:"当前这轮结束后,队列里的消息会按顺序自动继续处理。",queueOrderPrefix:"队列序号",queueStatusQueued:"等待中",queueStatusFailed:"发送失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"仅图片附件",sendGuidanceButton:"追加引导",queueGuidanceButton:"加入队列",queueSteer:"引导",queueSteering:"引导中",resendButton:"重试发送",quickPhraseTrigger:"快捷短语",quickPhraseModalTitle:"快捷短语",quickPhraseModalDescription:"这里集中管理你常用的会话指令,点一下就能直接填回当前输入框。",quickPhraseCreateLabel:"新增短语",quickPhraseOpenCreateAction:"新增短语",quickPhraseCreateModalTitle:"新增快捷短语",quickPhraseCreateModalDescription:"把常用指令单独存起来,后面在任何设备上都能直接复用。",quickPhraseCreatePlaceholder:"输入一条常用短语,保存后下次可以直接复用。",quickPhraseCreateAction:"添加短语",quickPhraseListLabel:"快捷短语列表",quickPhraseEmpty:"还没有可用的快捷短语,先加一条最常用的。",quickPhraseOrderLabel:"第 {index} 条",quickPhraseMoveUp:"上移短语",quickPhraseMoveDown:"下移短语",quickPhraseDelete:"删除短语",quickPhraseSaveFailed:"快捷短语保存失败,请稍后再试。",sendingState:"发送中",sentState:"已同步",failedState:"发送失败",contextUsageTitle:"当前上下文占用",contextUsageUnavailable:"当前上下文占用暂时不可用",contextUsageEstimated:"上限为估算值",contextUsageCachedTokens:"缓存命中 {count}",contextUsageSourceProviderLog:"上限来自 provider 运行日志",contextUsageSourceProviderRuntime:"上限来自 provider runtime",contextUsageSourceProviderConfig:"上限来自 provider 配置",contextUsageSourceModelMap:"上限来自模型映射",headerWorkspace:"工作区",headerProvider:"Provider",headerCapability:"能力摘要",connectionConnected:"已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeErrorTitle:"会话运行失败",reconnectExplain:"实时链路断开了,系统正在补回缺失消息。",reconnectFailedExplain:"自动恢复没有成功。你可以手动重试,或者稍后重新进入会话。",capabilityDenied:"当前会话不支持这个动作",capabilitySendDisabled:"当前 provider 不支持发送新消息",capabilityAttachmentDisabled:"当前会话还不支持附件输入",capabilityInterruptDisabled:"当前会话不支持中断运行",sidebarTitle:"当前会话上下文",sidebarSubtitle:"这里只保留最小能力摘要,不把页面做成后台控制台。",reconnectButton:"手动恢复实时同步",headerResumedAt:"最近续接",headerLastSyncAt:"最近同步",historyPages:"历史分页",syncStatusIdle:"同步空闲",syncStatusSyncing:"同步中",syncStatusError:"同步异常",capabilityResume:"可续接",capabilitySend:"可发送",capabilityInterrupt:"可中断",capabilityTools:"工具调用",attachmentsLabel:"附件",filePanelTitle:"文件管理",filePanelSubtitle:"这里的文件能力只服务当前会话,不把页面拉成重型 IDE。",filePanelNoWorkspace:"当前还没有选中项目,暂时不能浏览或挂载文件。",filePanelRefresh:"刷新",filePanelCopyPath:"复制路径",filePanelCopyAbsolutePath:"复制绝对路径",filePanelCopyRelativePath:"复制相对路径",filePanelCopyAbsolutePathSuccess:"绝对路径已复制。",filePanelCopyRelativePathSuccess:"相对路径已复制。",filePanelCopyPathFailed:"路径复制失败。",filePanelActionsMenu:"文件操作",filePanelSearchPlaceholder:"输入文件名或路径片段",filePanelSearchButton:"搜索",filePanelShowSearch:"打开搜索",filePanelHideSearch:"收起搜索",filePanelSearchEmpty:"没有找到匹配的文件。",filePanelSearchResults:"搜索结果",filePanelSearchFailed:"文件搜索失败,请稍后再试。",filePanelBrowse:"工作区文件",filePanelCollapseCurrent:"折叠当前选中",filePanelCollapseAll:"全部折叠",filePanelBackDirectory:"返回上级",filePanelEmptyDirectory:"这个目录里暂时没有可显示的文件。",filePanelRecentTitle:"最近打开",filePanelEmptyRecent:"最近还没有打开记录。",filePanelContextTitle:"已挂载文件",filePanelEmptyContexts:"当前会话还没有挂载文件管理。",filePanelEditorTitle:"预览与编辑",filePanelEditorPlaceholder:"这里只做轻量文本编辑,不在这里做完整 IDE。",filePanelSelectHint:"先从目录、搜索或最近打开里选一个文件。",filePanelUnsupported:"这个文件当前不能在侧栏里直接编辑。",filePanelAttach:"挂到会话",filePanelAttached:"已挂载",filePanelDetach:"解绑",filePanelSave:"保存",filePanelSaving:"保存中",filePanelLoadFailed:"文件管理面板加载失败。",filePanelOpenFailed:"文件打开失败。",filePanelSaveSuccess:"文件已经保存。",filePanelSaveFailed:"文件保存失败。",fileViewerHint:"当前以 {language} 模式打开,支持预览与编辑保存。",fileViewerModeLabel:"文件查看模式",fileViewerPreview:"预览",fileViewerCode:"代码",fileViewerEdit:"编辑",fileViewerPlainText:"纯文本",filePanelAttachSuccess:"文件已经挂到当前会话。",filePanelAttachFailed:"文件挂载失败。",filePanelDetachSuccess:"文件已经从当前会话解绑。",filePanelDetachFailed:"文件解绑失败。",filePanelNewFile:"新建文件",filePanelNewDirectory:"新建目录",filePanelUpload:"上传文件",filePanelDownload:"下载文件",filePanelUploadSuccess:"已上传 {name}。",filePanelUploadFailed:"文件上传失败。",filePanelDownloadSuccess:"已开始下载 {name}。",filePanelDownloadFailed:"文件下载失败。",filePanelDelete:"删除",filePanelRenameMove:"重命名/移动",filePanelMutateFailed:"文件操作失败,请检查路径和当前状态。",filePanelCreateFilePrompt:"输入要创建的相对文件路径",filePanelCreateDirectoryPrompt:"输入要创建的相对目录路径",filePanelDeleteConfirm:"确认删除这个文件吗?{path}",filePanelRenameMovePrompt:"输入新的相对路径",unavailableAction:"当前不可用",roleUser:"你",roleAssistant:"助手",roleTool:"工具",roleSystem:"系统"},git:{title:"Git 上下文",subtitle:"这里是会话侧边的辅助区,只处理当前工作区里的 Git 事实。",loading:"正在读取当前工作区的 Git 上下文。",refresh:"刷新",panelLoadFailed:"Git 上下文暂时没有加载出来。",ahead:"领先",behind:"落后",dirty:"有改动",clean:"已干净",changeCount:"当前有 {count} 个变更文件",noChanges:"当前没有待处理改动。",changesTitle:"当前变更",rulesFirstHint:"规则先于生成,草稿不能绕过校验。",stage:"暂存",unstage:"取消暂存",stageFailed:"暂存操作失败。",diffTitle:"差异预览",diffLoadFailed:"差异内容暂时没有拉回来。",binaryDiff:"这个文件是二进制改动,侧栏不直接展示内容。",stagedDiff:"暂存区 diff",worktreeDiff:"工作区 diff",emptyDiff:"当前没有可展示的文本差异。",diffTruncated:"差异内容过长,已经做了截断保护。",commitTitle:"提交草稿",defaultRuleName:"默认提交规则",language:"语言",maxLength:"长度",bodyRequired:"正文必填",bodyOptional:"正文可选",issueRequired:"Issue 必填",issueOptional:"Issue 可选",commitSubject:"提交标题",commitSubjectPlaceholder:"在这里输入提交信息",commitBody:"提交正文",commitBodyPlaceholder:"把这次改动说清楚,别写空话。",commitFooter:"提交脚注",commitFooterPlaceholder:"例如:Refs: #123",generateDraft:"AI 起草",validate:"校验草稿",commit:"执行提交",draftFailed:"提交草稿生成失败。",validateFailed:"提交规则校验失败。",commitFailed:"提交失败。",commitSuccess:"提交已经写入当前仓库。",validationPassed:"规则校验通过,可以继续提交。",validationFailed:"规则校验没有通过,先把下面的问题修掉。",branchTitle:"分支",branchPlaceholder:"输入要切换或创建的分支名",switchBranch:"切换",createBranch:"新建",branchFailed:"分支操作失败。",historyTitle:"最近历史",historyHint:"只放最近几条,不做图形历史树。",noHistory:"当前没有可展示的提交历史。",remoteTitle:"远程同步",remoteReady:"当前仓库已配置远程。",remoteMissing:"当前仓库还没有远程。",fetch:"Fetch",pull:"Pull",push:"Push",publish:"Publish",remoteFailed:"远程同步失败。",errors:{unauthorized:"当前登录态已经失效,请重新登录后再试。",workspaceNotFound:"当前会话绑定的工作区不存在,先确认工作区是否还可用。",invalidWorkspace:"当前工作区配置无效,Git 侧栏不能脱离仓库根目录执行。",notGitRepository:"当前工作区不是 Git 仓库,Git 侧栏不会伪造状态。",repoNotFound:"当前工作区找不到可用的 Git 仓库根目录。",pathOutOfWorkspace:"Git 目标超出了当前工作区仓库边界,操作已被拦截。",invalidTarget:"Git 目标路径无效,请先刷新侧栏后重试。",notStaged:"目标文件还不在暂存区里,先确认当前变更状态。",emptyStagedChanges:"暂存区为空,先把要提交的改动放进暂存区。",branchConflict:"当前分支存在冲突或不是快进更新,先同步并处理差异。",branchNotFound:"目标分支不存在,先确认分支名是否正确。",remoteNotFound:"当前仓库还没有可用的 origin 远程,先配置远程再同步。",remoteAuthFailed:"远程仓库认证失败,请先确认当前仓库凭据可用。",pushFailed:"推送失败,请先检查远程状态和本地提交。",pullFailed:"拉取失败,请先确认远程分支状态。",remoteFailed:"远程同步失败,请检查 Git 输出和网络状态。",commitValidationFailed:"提交草稿还没通过规则校验,先把校验问题修掉。",commandTimeout:"Git 操作超时了,先确认仓库状态和网络环境。"}}},iN=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function kf({variant:e="default",className:t}){const n=Ic(o=>o.language);function s(o){o!==n&&cn.update({language:o})}return i.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[i.jsx("span",{className:"language-switcher-label",children:h("common.language")}),i.jsx("div",{className:"language-switcher-options",role:"group","aria-label":h("common.language"),children:iN.map(o=>i.jsx("button",{type:"button",className:`language-switcher-option${n===o.id?" active":""}`,"aria-pressed":n===o.id,onClick:()=>s(o.id),children:h(o.labelKey)},o.id))})]})}const sN={common:{close:"关闭",cancel:"取消",logout:"退出登录",language:"语言"},locale:{zhCN:"简体中文",enUS:"English"},settings:{title:"设置",appearance:"外观",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",connection:"连接与更新",serverAddress:"服务地址",serverDescription:"桌面端和 H5 都通过这个 Host 入口工作。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",runtimePlatform:"当前运行平台",runtimePlatformDescription:"用来确认现在是 Web/H5、Desktop、iOS 还是 Android 运行环境。",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"当前是 Web/H5 运行环境,不支持桌面更新。",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",account:"账号",logout:"退出登录",logoutDescription:"退出当前账号并返回登录页面"},shell:{title:"工作台",subtitle:"管理代码项目里的 AI 会话",mobileWorkspacesEntry:"工作区",mobileTerminalsEntry:"终端",mobileSessionsEntry:"对话",mobileToolsEntry:"工具",mobileSettingsEntry:"设置",mobileNavigationAction:"打开工作台菜单",mobileSearchAction:"打开搜索",mobileAuxiliaryAction:"打开工具面板",mobileRevealNavigationAction:"显示主导航",mobileHideNavigationAction:"收起主导航",mobileConversationPreviewTitle:"快速预览",mobileConversationCurrentWorkspaceSection:"当前工作区",mobileConversationCollapsePreviewAction:"收起预览",mobileConversationRestorePreviewAction:"恢复会话预览",iosMoreAction:"更多操作",androidMoreAction:"更多操作",conversationEntry:"对话",terminalsEntry:"终端",searchEntry:"搜索",searchModalTitle:"搜索",searchModalDescription:"支持搜会话标题,或在当前工作区里搜代码文件。",searchModeLabel:"搜索模式",searchModeSessions:"会话",searchModeCode:"代码",searchKeywordLabel:"关键词",searchWorkspaceLabel:"工作区",searchSessionPlaceholder:"输入会话名称、工作区或 provider",searchCodePlaceholder:"输入文件名或路径片段",searchSessionHint:"输入关键词后,这里会立即列出匹配的会话。",searchCodeHint:"选一个工作区,然后搜文件名或路径。",searchSessionEmpty:"没找到匹配的会话。",searchCodeEmpty:"没找到匹配的文件。",searchCodeFailed:"代码搜索失败,请稍后重试。",searchSubmit:"开始搜索",filesEntry:"文件管理",gitEntry:"GIT管理",terminalManagerEntry:"进程管理",workspaceSectionTitle:"工作区",goBack:"后退",goForward:"前进",workspaceCount:"项目",sessionCount:"会话",manageWorkspaceAction:"管理项目",manageWorkspaceTitle:"管理项目",manageWorkspaceDescription:"默认只列出当前已加载的项目,展开后可以查看路径、Git 摘要、代码类型组成,也可以从当前工作台列表里移除。",manageWorkspaceEmpty:"当前没有可管理的项目。",manageWorkspaceLoading:"正在读取项目详情...",manageWorkspaceLoadFailed:"项目详情加载失败",manageWorkspacePathLabel:"路径",manageWorkspaceGitCommitCount:"Git 提交版本数",manageWorkspaceGitInfoLabel:"Git 仓库信息",manageWorkspaceRepoRoot:"仓库根目录",manageWorkspaceCurrentBranch:"当前分支",manageWorkspaceRemoteLabel:"远程",manageWorkspaceNoRemote:"未配置远程",manageWorkspaceNotGit:"当前项目不是 Git 仓库。",manageWorkspaceCodeCompositionLabel:"代码类型组成",manageWorkspaceCodeCompositionFiles:"文件",manageWorkspaceCodeCompositionOther:"其他",manageWorkspaceNoCodeComposition:"暂时没有识别到可统计的代码文件。",manageWorkspaceCodeTruncated:"文件过多,只统计了前 {count} 个可识别文件。",manageWorkspaceRemoveAction:"移除项目",manageWorkspaceRemoving:"移除中...",manageWorkspaceRemoveSuccess:"项目已从当前工作台移除",manageWorkspaceRemoveFailed:"移除项目失败",manageWorkspaceRemoveConfirmTitle:"确认移除项目",manageWorkspaceRemoveConfirmDescription:"这只会把项目从当前工作台列表移除,不会删除任何磁盘数据或历史记录。后续重新加载同一路径时,旧记录会直接恢复显示。",manageWorkspaceRemoveConfirmTarget:"确定移除「{name}」吗?",manageWorkspaceRemoveConfirmAction:"确认移除",importWorkspaceTitle:"添加项目",importWorkspaceHint:"导入本地代码目录",importExpand:"展开",importCollapse:"收起",importPathLabel:"项目路径",importPathPlaceholder:"输入项目文件夹路径",importNameLabel:"项目名称",importNamePlaceholder:"可选",importSubmit:"添加项目",importSubmitting:"添加中...",importChooseFolder:"选择文件夹",importPickFolderFailed:"打开文件夹选择器失败",importDesktopDropHint:"支持把本地项目文件夹直接拖到这个区域",importHint:"输入本地代码目录后就能开始工作",importServerDirectoryHint:"浏览并选择运行服务器上的项目目录",importBrowserTitle:"选择服务器目录",importBrowserDescription:"这里浏览的是项目运行所在服务器上的目录,不是当前设备的本地目录。",importBrowserCurrentPath:"当前目录",importBrowserRoots:"根目录",importBrowserOpenParent:"返回上一级",importBrowserOpenPath:"打开路径",importBrowserCreateDirectory:"新建文件夹",importBrowserCreateDirectoryTitle:"新建文件夹",importBrowserCreateDirectoryDescription:"只在当前服务器目录下新建一层子文件夹,不接受带路径的输入。",importBrowserCreateDirectoryLabel:"文件夹名称",importBrowserCreateDirectoryPlaceholder:"输入新文件夹名称",importBrowserCreateDirectorySuccess:"文件夹已创建",importBrowserCreateDirectoryFailed:"新建文件夹失败",importBrowserCreateDirectorySubmit:"确认新建",importBrowserCreatingDirectory:"新建中...",importBrowserEmpty:"当前目录下没有可选的子目录",importBrowserBrowseFailed:"加载服务器目录失败",importBrowserSubmit:"导入当前目录",importPathRequired:"请输入项目路径",importSuccess:"项目已添加",importFailed:"添加失败",cloneWorkspaceTitle:"Clone项目",cloneWorkspaceHint:"从 Git 仓库拉取代码到服务端目录,完成后直接加入项目列表。",cloneSubmit:"Clone项目",cloneSubmitting:"Clone 中...",cloneRepositoryLabel:"Git 仓库地址",cloneRepositoryPlaceholder:"例如:https://github.com/org/repo.git",cloneParentPathLabel:"目标父目录",cloneParentPathPlaceholder:"选择后端服务上已存在的目录",cloneDirectoryNameLabel:"新项目目录名",cloneDirectoryNamePlaceholder:"留空时默认使用仓库名",clonePickDirectory:"选择目录",cloneAuthModeLabel:"认证方式",cloneAuthModeNone:"无认证",cloneAuthModeBasic:"用户名 + 密码",cloneAuthModeToken:"Token",cloneUsernameLabel:"用户名",cloneUsernamePlaceholder:"输入 Git 用户名",clonePasswordLabel:"密码",clonePasswordPlaceholder:"输入 Git 密码",cloneTokenLabel:"Token",cloneTokenPlaceholder:"输入 access token",cloneTokenUsernamePlaceholder:"可选,留空时默认使用 git",cloneRepoRequired:"请输入 Git 仓库地址",clonePathRequired:"请选择目标父目录",cloneSuccess:"项目已成功 Clone",cloneFailed:"Clone 失败",cloneHint:"目标父目录必须已经存在,Clone 时会在这个目录下新建仓库文件夹。",cloneBrowserTitle:"选择 Clone 目标父目录",cloneBrowserDescription:"这里选的是服务端已存在的父目录,Clone 时会在其下新建一个项目文件夹。",cloneBrowserSubmit:"使用当前目录",refreshNavigation:"刷新",desktopChromeLabel:"桌面工作台",windowMinimize:"最小化窗口",windowMaximize:"最大化或还原窗口",windowClose:"关闭窗口",contextOpenSession:"打开会话",navigationLoadFailed:"加载失败,请重试",emptyNavigationTitle:"还没有项目",emptyNavigationBody:"添加本地代码目录开始工作",emptyWorkspaceSessions:"暂无会话",favoriteSectionTitle:"收藏会话",favoriteSectionEmpty:"收藏后的会话会固定放在这里,方便你快速回到常用链路。",favoriteAction:"收藏会话",unfavoriteAction:"取消收藏",favoriteAdded:"会话已加入收藏",favoriteRemoved:"会话已取消收藏",favoriteToggleFailed:"收藏状态更新失败",sessionMoreAction:"更多操作",sessionStateInferred:"推断",renameAction:"重命名",renameSuccess:"会话名称已更新",renameFailed:"会话重命名失败",renameModalTitle:"重命名会话",renameModalDescription:"改成你自己能一眼认出来的名字,只改标题,不改消息内容。",renameInputLabel:"会话名称",renameInputPlaceholder:"输入新的会话名称",renamingSession:"保存中...",archiveFolderLabel:"归档会话",archiveFolderAction:"打开归档文件夹",archiveAction:"归档会话",archiveCurrentSessionAction:"归档当前会话",archiveAdded:"会话已归档",archiveConfirmTitle:"确认归档会话",archiveConfirmDescription:"归档后,这条会话会从当前工作区主列表里隐藏,你仍然可以在归档区恢复它。",unarchiveAction:"取消归档",archiveRestored:"会话已恢复到主列表",archiveModalTitle:"归档会话",archiveModalDescription:"这里列出当前项目暂时隐藏的会话,需要时可以恢复到主列表。",archiveEmpty:"这个项目还没有归档会话。",subagentBadge:"子代理",subagentExpand:"展开子代理列表",subagentCollapse:"收起子代理列表",subagentExpandMore:"展开更多子代理",favoriteExpandMore:"显示更多收藏",sessionExpandMore:"显示更多会话",archiveExpandMore:"查看更多归档会话",workspaceCollapse:"收起项目",workspaceExpand:"展开项目",switchWorkspace:"切换到此项目",workspaceHomeSwitcherLabel:"切换工作区",workspaceHomeSwitcherTitle:"工作区",workspaceHomeStatusSectionTitle:"当前工作区",workspaceHomeViewAllAction:"查看全部会话",workspaceHomeMetricActive:"活动",workspaceHomeMetricUnread:"待看",workspaceHomeMetricTerminal:"终端",workspaceHomeMetricChanges:"变更",workspaceHomeActiveSessionsSectionTitle:"活动会话",workspaceHomeQuickLaunchStatusLabel:"快捷启动进程",workspaceHomeQuickLaunchRunning:"运行中",workspaceHomeQuickLaunchStopped:"未运行",workspaceHomeWaitingInputLabel:"等待输入",workspaceOverviewTitle:"把项目入口放到看得见的地方",workspaceOverviewBody:"先选项目,再决定是继续已有会话,还是开一条新的工作链路。",workspaceListBody:"这里保留当前工作台里的全部项目,并把高频操作直接放到首页。",workspaceDetailTitle:"项目详情",workspaceDetailSummaryTitle:"项目概览",workspaceDetailSummaryBody:"先看当前项目路径、Git 摘要和代码规模,再决定下一步去哪做事。",workspaceDetailMissingTitle:"没找到这个项目",workspaceDetailMissingBody:"这个项目可能已经被移除,或者当前快照还没加载到它。",workspaceSessionListBody:"项目里的会话、收藏和归档操作都收在这里,不再让你先去翻侧栏。",recentSessionsSectionTitle:"最近会话",recentSessionsSectionBody:"先回到最近在做的事情,别让手机端还要你猜入口。",currentWorkspaceSectionTitle:"当前项目会话",currentWorkspaceSectionBody:"当前项目下的会话都集中在这里,方便继续刚才的上下文。",sessionIndexTitle:"会话入口单独成页",sessionIndexBody:"最近、收藏、当前项目三块分开看,手机上找会话别再靠侧栏折叠。",toolsMoreAction:"更多",toolsSwipeHint:"左右滑动切换文件管理和 Git 管理",toolsSwipePosition:"{current} / {total}",toolFilesBody:"查看项目文件、变更文件和代码上下文,不再靠桌面右栏概念。",toolGitBody:"把当前项目的 Git 状态、提交和分支操作收进一个明确入口。",toolTerminalsBody:"进入终端主页面,处理输入密集和滚动密集的操作。",toolProcessesBody:"查看当前项目的终端模板、运行状态和进程入口。",toolsWorkspaceRequiredBody:"先选一个项目,再打开对应的工具页。",createSession:"新建会话",createSessionModalTitle:"选择新会话类型",createSessionModalDescription:"先选会话类型,再启动真正的会话进程。",createSessionWorkspaceLabel:"选择工作区",createSessionProviderLabel:"选择供应商",createSessionTarget:"当前项目",providerClaudeCode:"Claude Code",providerCodexDescription:"创建 Codex 会话,适合继续当前默认工作流。",providerClaudeDescription:"创建 Claude Code 会话,适合切换另一条会话链路。",providerOpenCodeDescription:"创建 OpenCode 会话,适合通过 OpenCode server 延续当前上下文。",providerOptionHint:"选择后会立即创建会话",startClaude:"Claude",startCodex:"Codex",startingSession:"创建中...",startClaudeSuccess:"Claude 会话已创建",startCodexSuccess:"Codex 会话已创建",startSessionFailed:"创建失败",auxiliaryTitle:"信息",auxiliarySubtitle:"文件与 Git 状态",expandAuxiliary:"展开",collapseAuxiliary:"收起",auxiliaryEmptyTitle:"选择一个会话",auxiliaryEmptyBody:"会话文件和 Git 信息将显示在这里",batchSelectSessions:"批量选择会话",batchSelectionMode:"批量选择",selectAllSessions:"全选",clearSelectedSessions:"清空选择",batchArchiveAction:"归档已选",batchArchiving:"归档中...",batchArchiveSuccess:"已归档选中的会话",batchArchivePartialFailed:"部分会话归档失败,请重试",batchArchiveFailed:"批量归档失败",hideSessionSidebar:"隐藏会话列表",showSessionSidebar:"显示会话列表",hideInfoSidebar:"隐藏信息栏",showInfoSidebar:"显示信息栏",centerTabsLabel:"中间区域标签",infoTabsLabel:"信息栏标签",leftResizerLabel:"调整左侧宽度",rightResizerLabel:"调整右侧宽度",filesPanelEmpty:"先导入或选中一个项目,文件管理才能显示。",gitPanelEmpty:"先导入或选中一个工作区,Git 信息才能显示。",infoPanelDeferred:"左侧会话列表优先加载,右侧附属面板稍后再挂载。"},workbench:{emptyEyebrow:"开始",emptyTitle:"先选一个会话",emptyBody:"从左侧继续之前的内容,或新建一个会话。",emptyResumeTitle:"继续",emptyResumeBody:"回到上次停下的地方。",emptyNewTitle:"新建",emptyNewBody:"把新问题放进新会话。",emptyCompanionTitle:"查看辅助信息",emptyCompanionBody:"需要文件、Git 或终端时,再看右侧。",emptyTip:"准备好后,从左侧选一个会话开始。"},conversation:{resendButton:"重发",historyLoading:"加载中...",historyLoadingOlder:"加载更早的消息...",historyLoadFailed:"加载失败",timelineEmpty:"开始对话",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",attachFiles:"附加文件",pasteImagesHint:"支持直接粘贴图片",attachmentImageOnly:"目前只支持图片附件",attachmentReadFailed:"图片读取失败,请重试",attachmentPreviewAlt:"已选图片预览",attachmentPreviewOpen:"点击查看大图",attachmentPreviewClose:"关闭图片预览",attachmentPreviewLoading:"图片加载中",attachmentPreviewUnavailable:"图片暂时不可预览",imageAttachmentLabel:"图片附件",imagePreviewTitle:"图片预览",imagePreviewHint:"点击遮罩或按 Esc 可以关闭预览",removeAttachment:"移除附件",modelSelectorLabel:"选择模型",modelUseCliDefault:"默认",modelUseCodexConfig:"跟随当前 Codex 配置",modelUseOpenCodeConfig:"跟随当前 OpenCode 配置",reasoningSelectorLabel:"选择推理强度",reasoningLow:"低",reasoningMedium:"中",reasoningHigh:"高",reasoningMaximum:"极高",slashMenu:"命令",slashMenuTitle:"快捷命令",slashCommandPlan:"先让对方给出执行路线",slashCommandReview:"直接进入代码审查模式",slashCommandExplain:"要求用更清楚的方式解释",toolInputLabel:"输入",toolResultLabel:"结果",toolResultEmpty:"暂无输出",toolPreviewCommand:"命令",toolPreviewTerminal:"终端",toolStatusRunning:"运行中",toolStatusFailed:"已失败",toolStatusCompleted:"已完成",applyPatchEditedLabel:"已编辑",applyPatchAddedLabel:"已新增",applyPatchDeletedLabel:"已删除",applyPatchDialogTitle:"Patch 变更预览",applyPatchDialogDescription:"这里按文件显示 apply_patch 将要执行的变更。",applyPatchOpenDiff:"查看 diff",applyPatchAddedStat:"新增",applyPatchRemovedStat:"减少",applyPatchEmpty:"这个 patch 暂时没有可展示的文件变更。",titleFallback:"继续对话",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",headerWorkspace:"工作区",headerWorkspaceUnknown:"未知工作区",headerProvider:"Provider",headerConnection:"连接",headerRuntime:"运行态",providerCodex:"Codex",providerClaude:"Claude",providerOpenCode:"OpenCode",capabilitySend:"可发送",queueTitle:"待发队列",queueDescription:"当前运行结束后,会按顺序自动继续处理下面的消息。",queueOrderPrefix:"等待顺序",queueStatusQueued:"等待中",queueStatusFailed:"续跑失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"只包含图片附件",sendGuidanceButton:"追加指导",queueGuidanceButton:"加入队列",capabilityDenied:"受限",capabilitySendDisabled:"发送受限",connectionConnected:"实时已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeIdle:"空闲",runtimeStarting:"启动中",runtimeRunning:"运行中",runtimeReconnecting:"恢复中",runtimeCompleted:"已完成",runtimeInterrupted:"已中断",runtimeFailed:"失败",rulesMessageTitle:"规则信息",rulesMessageHint:"这是一段会话启动规则,默认折叠显示,需要时再展开查看。",rulesMessageExpand:"展开规则",rulesMessageCollapse:"收起规则",thinkingLabel:"思考中",filePanelWorkspaceTab:"工作区",filePanelSessionTab:"本次会话",filePanelSessionViewLabel:"本次会话视图",filePanelSessionTreeView:"树状",filePanelSessionListView:"列表",filePanelSessionLoading:"正在整理本次会话修改的文件...",filePanelSessionEmpty:"这条会话还没识别到可暂存的修改文件。",filePanelSessionNoSession:"当前只选中了项目,还没选中会话,无法查看“本次会话”文件。",filePanelSessionStageAll:"全部暂存",filePanelSessionStageSuccess:"已把本次会话的修改加入暂存区。",filePanelSessionLoadFailed:"本次会话修改文件加载失败。",filePanelSessionSummary:"已识别文件",filePanelSessionUnstagedSummary:"未暂存",filePanelSessionDeleted:"已删除"},git:{recentVersionsTitle:"最近版本",stagedChangesTitle:"暂存的更改",expandRecentVersions:"展开最近版本",collapseRecentVersions:"折叠最近版本",stagedLabel:"暂存区",workingTreeLabel:"工作区",changeTreeHint:"按目录层级展示当前变更",discard:"放弃改动",discardFailed:"放弃改动失败",operationMenu:"操作菜单",currentBranch:"当前分支",resizePanels:"调整文件区和最近版本高度",switchBranchTo:"切换到",undoLastCommit:"撤销上次提交",undoLastCommitFailed:"撤销上次提交失败",undoLastCommitSuccess:"已撤销上次提交",historyKindLocal:"本地",historyKindRemote:"远程",historyKindShared:"已同步",pushNow:"推送",commitNow:"提交",refreshNow:"刷新",stageAll:"暂存全部",unstageAll:"取消暂存全部",discardAll:"放弃全部改动",selectedFiles:"已选文件",clearSelection:"清空选中",selectFile:"选中文件",discardConfirm:"确认放弃这些改动吗?{path}",historyItemMenu:"版本操作",copyCommitHash:"复制 Commit Hash",copyCommitHashSuccess:"Commit Hash 已复制。",copyCommitSubject:"复制提交标题",copyCommitSubjectSuccess:"提交标题已复制。"},terminalManager:{workspaceField:"当前工作区",refresh:"刷新列表",loadFailed:"终端管理面板加载失败",shellLoadFailed:"终端 Shell 列表加载失败",emptyWorkspaceBody:"还没有可用工作区。",noCurrentWorkspaceBody:"先选中一条会话,进程管理才能绑定对应的工作区。",emptyTerminalBody:"当前工作区还没有终端实例。",emptyTemplateBody:"还没有快捷启动项,可以先保存一条命令或脚本。",shellField:"新终端 Shell",shellUnavailable:"当前不可用",cwdField:"启动目录",cwdLabel:"目录",cwdPlaceholder:"留空时默认使用工作区根目录",modeField:"启动方式",commandMode:"命令",scriptMode:"脚本",quickLaunchTitle:"快捷启动",quickLaunchDescription:"先保存启动方式,需要时一键拉起到新终端。",desktopPanelDescription:"默认只看启动决策所需的信息,路径和命令行收进详情层。",runningCountLabel:"运行中",portWatchCountLabel:"已监控端口",terminalCountLabel:"终端数",templateSectionTitle:"启动项",templateSectionDescription:"右侧优先显示启动项的端口状态,看清楚是否已被占用。",openCreateModalAction:"添加快捷启动项",createModalTitle:"添加快捷启动项",createModalDescription:"在这里保存命令或脚本,可以附带端口,后面就能一键启动并判断是否在跑。",editAction:"编辑启动项",editModalTitle:"编辑快捷启动项",editModalDescription:"直接修改这条快捷启动的名称、命令、目录和端口配置。",saveTemplateChangesAction:"保存修改",templateUpdating:"保存修改中...",templateUpdateSuccess:"快捷启动项已更新。",templateUpdateFailed:"快捷启动项更新失败",removeAction:"移除启动项",templateRemoving:"移除中...",removeConfirmTitle:"确认移除启动项",removeConfirmAction:"确认移除",removeConfirmTarget:"确认移除“{name}”吗?移除后将不再出现在快捷启动列表中。",removeRunningConfirmTarget:"“{name}”对应的进程还在跑。现在移除的是启动项配置,不会自动结束已经运行的进程。确认继续吗?",templateDeleteSuccess:"快捷启动项已移除。",templateDeleteFailed:"快捷启动项移除失败",terminalSectionTitle:"终端实例",terminalSectionDescription:"这里显示当前工作区由 CodingNS 托管的终端。",closeAction:"关闭终端",closing:"关闭中...",closeSuccess:"终端关闭请求已提交。",closeFailed:"终端关闭失败",createTerminalAction:"新建空终端",creatingTerminal:"创建中...",createTerminalSuccess:"新终端已创建。",createTerminalFailed:"新终端创建失败",defaultTerminalName:"工作终端",templateNameField:"名称",templateNamePlaceholder:"留空时会自动生成",commandField:"启动命令",commandPlaceholder:"例如:npm",scriptPathField:"脚本路径",scriptPathPlaceholder:"例如:scripts/dev.ps1 或 scripts/dev.sh",argsField:"参数",argsPlaceholder:"例如:run dev 或 --watch",portField:"监听端口",portLabel:"端口",portPlaceholder:"例如:3000",invalidPort:"端口必须是 1 到 65535 的整数",saveLaunchAction:"保存为快速启动",templateSaving:"保存中...",templateSaveSuccess:"快捷启动项已保存。",templateSaveFailed:"快捷启动项保存失败",runTemplateAction:"启动到新终端",runningTemplate:"启动中...",templateRunSuccess:"快捷启动已发送到新终端。",templateRunFailed:"快捷启动执行失败",showDetailsAction:"显示详细信息",hideDetailsAction:"隐藏详细信息",detailsSectionTitle:"启动项详情",commandPreviewLabel:"启动命令",processIdLabel:"进程 ID",processCommandLabel:"进程命令行",stopProcessAction:"结束进程",stoppingProcess:"结束中...",stopProcessSuccess:"监听进程已结束。",stopProcessFailed:"监听进程结束失败",defaultCommandName:"新启动命令",defaultScriptName:"新启动脚本",lastActiveAt:"最近活跃",updatedAt:"最后更新",processCommandFallback:"这个进程没有暴露命令行",portUnset:"未配置端口",portUnsetDescription:"没有端口时,只能启动,不能自动判断服务是否在跑。",portOccupied:"进程已启动",portAvailable:"端口暂未被占用",portAvailableDescription:"这个启动项对应的端口目前还没有监听进程。",statusRunning:"运行中",statusStopped:"未运行",exitCode:"Exit Code",runningValue:"运行中"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"主题"}},aN={common:{close:"Close",cancel:"Cancel",logout:"Log out",language:"Language"},locale:{zhCN:"Simplified Chinese",enUS:"English"},settings:{title:"Settings",appearance:"Appearance",language:"Language",languageDescription:"Choose the display language used by the interface. The page updates immediately.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",connection:"Connection & Updates",serverAddress:"Server Address",serverDescription:"Desktop and H5 both work through this host entry.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",runtimePlatform:"Runtime Platform",runtimePlatformDescription:"Shows whether the app is running in Web/H5, Desktop, iOS, or Android.",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"Desktop updates are not available in the current Web/H5 runtime.",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",account:"Account",logout:"Log out",logoutDescription:"Sign out of the current account and return to the login page."},shell:{title:"Workbench",subtitle:"Manage AI sessions inside code projects",mobileWorkspacesEntry:"Workspaces",mobileTerminalsEntry:"Terminal",mobileSessionsEntry:"Conversation",mobileToolsEntry:"Tools",mobileSettingsEntry:"Settings",mobileNavigationAction:"Open workbench menu",mobileSearchAction:"Open search",mobileAuxiliaryAction:"Open tools panel",mobileRevealNavigationAction:"Show primary navigation",mobileHideNavigationAction:"Hide primary navigation",mobileConversationPreviewTitle:"Quick Preview",mobileConversationCurrentWorkspaceSection:"Current Workspace",mobileConversationCollapsePreviewAction:"Hide Preview",mobileConversationRestorePreviewAction:"Restore Session Preview",iosMoreAction:"More actions",androidMoreAction:"More actions",conversationEntry:"Conversation",terminalsEntry:"Terminal",searchEntry:"Search",searchModalTitle:"Search",searchModalDescription:"Search sessions by title, or search code files inside the selected workspace.",searchModeLabel:"Search mode",searchModeSessions:"Sessions",searchModeCode:"Code",searchKeywordLabel:"Keyword",searchWorkspaceLabel:"Workspace",searchSessionPlaceholder:"Search by session title, workspace, or provider",searchCodePlaceholder:"Search by file name or path fragment",searchSessionHint:"Type a keyword to instantly filter matching sessions.",searchCodeHint:"Pick a workspace, then search by file name or path.",searchSessionEmpty:"No matching sessions found.",searchCodeEmpty:"No matching files found.",searchCodeFailed:"Code search failed. Please try again later.",searchSubmit:"Search",filesEntry:"Files",gitEntry:"Git",terminalManagerEntry:"Process Manager",workspaceSectionTitle:"Workspaces",goBack:"Back",goForward:"Forward",workspaceCount:"Projects",sessionCount:"Sessions",manageWorkspaceAction:"Manage Projects",manageWorkspaceTitle:"Manage Projects",manageWorkspaceDescription:"The list starts with the currently loaded projects. Expand one to inspect its path, Git summary, and code composition, or remove it from the current workbench list.",manageWorkspaceEmpty:"There are no projects to manage right now.",manageWorkspaceLoading:"Loading project details...",manageWorkspaceLoadFailed:"Failed to load project details.",manageWorkspacePathLabel:"Path",manageWorkspaceGitCommitCount:"Git Commit Count",manageWorkspaceGitInfoLabel:"Git Repository Info",manageWorkspaceRepoRoot:"Repository Root",manageWorkspaceCurrentBranch:"Current Branch",manageWorkspaceRemoteLabel:"Remote",manageWorkspaceNoRemote:"No remote configured",manageWorkspaceNotGit:"This project is not a Git repository.",manageWorkspaceCodeCompositionLabel:"Code Composition",manageWorkspaceCodeCompositionFiles:"files",manageWorkspaceCodeCompositionOther:"Other",manageWorkspaceNoCodeComposition:"No recognizable code files were found for composition stats.",manageWorkspaceCodeTruncated:"The project is large, so only the first {count} recognizable files were counted.",manageWorkspaceRemoveAction:"Remove Project",manageWorkspaceRemoving:"Removing...",manageWorkspaceRemoveSuccess:"Project removed from the current workbench list",manageWorkspaceRemoveFailed:"Failed to remove the project",manageWorkspaceRemoveConfirmTitle:"Confirm Project Removal",manageWorkspaceRemoveConfirmDescription:"This only removes the project from the current workbench list. It does not delete any files on disk or historical records. If you load the same path again later, the old records will appear again.",manageWorkspaceRemoveConfirmTarget:'Remove "{name}" from the current workbench?',manageWorkspaceRemoveConfirmAction:"Remove Project",importWorkspaceTitle:"Add Project",importWorkspaceHint:"Import a local code directory",importExpand:"Expand",importCollapse:"Collapse",importPathLabel:"Project Path",importPathPlaceholder:"Enter the project folder path",importNameLabel:"Project Name",importNamePlaceholder:"Optional",importSubmit:"Add Project",importSubmitting:"Adding...",importChooseFolder:"Choose Folder",importPickFolderFailed:"Failed to open the folder picker",importDesktopDropHint:"You can drag a local project folder directly into this area",importHint:"Enter a local code directory and start working",importServerDirectoryHint:"Browse and select the project directory on the server",importBrowserTitle:"Select Server Directory",importBrowserDescription:"You are browsing directories on the server, not on the current device.",importBrowserCurrentPath:"Current Path",importBrowserRoots:"Root Directories",importBrowserOpenParent:"Go Up",importBrowserOpenPath:"Open Path",importBrowserCreateDirectory:"New Folder",importBrowserCreateDirectoryTitle:"New Folder",importBrowserCreateDirectoryDescription:"Create a single child folder in the current server path. Path separators are not accepted.",importBrowserCreateDirectoryLabel:"Folder Name",importBrowserCreateDirectoryPlaceholder:"Enter the new folder name",importBrowserCreateDirectorySuccess:"Folder created",importBrowserCreateDirectoryFailed:"Failed to create folder",importBrowserCreateDirectorySubmit:"Create Folder",importBrowserCreatingDirectory:"Creating...",importBrowserEmpty:"No subdirectory is available in the current path",importBrowserBrowseFailed:"Failed to load server directories",importBrowserSubmit:"Import Current Directory",importPathRequired:"Enter the project path",importSuccess:"Project added",importFailed:"Failed to add project",cloneWorkspaceTitle:"Clone Project",cloneWorkspaceHint:"Clone a Git repository into a server directory and add it to the project list.",cloneSubmit:"Clone Project",cloneSubmitting:"Cloning...",cloneRepositoryLabel:"Git Repository URL",cloneRepositoryPlaceholder:"For example: https://github.com/org/repo.git",cloneParentPathLabel:"Target Parent Directory",cloneParentPathPlaceholder:"Choose an existing directory on the backend server",cloneDirectoryNameLabel:"New Project Directory Name",cloneDirectoryNamePlaceholder:"Defaults to the repository name when left empty",clonePickDirectory:"Choose Directory",cloneAuthModeLabel:"Authentication",cloneAuthModeNone:"No Authentication",cloneAuthModeBasic:"Username + Password",cloneAuthModeToken:"Token",cloneUsernameLabel:"Username",cloneUsernamePlaceholder:"Enter Git username",clonePasswordLabel:"Password",clonePasswordPlaceholder:"Enter Git password",cloneTokenLabel:"Token",cloneTokenPlaceholder:"Enter access token",cloneTokenUsernamePlaceholder:"Optional, defaults to git when left empty",cloneRepoRequired:"Enter the Git repository URL",clonePathRequired:"Select the target parent directory",cloneSuccess:"Project cloned successfully",cloneFailed:"Clone failed",cloneHint:"The target parent directory must already exist. Clone creates a new repository folder under it.",cloneBrowserTitle:"Select Clone Parent Directory",cloneBrowserDescription:"Choose an existing server-side parent directory. Clone will create a new project folder under it.",cloneBrowserSubmit:"Use Current Directory",refreshNavigation:"Refresh",desktopChromeLabel:"Desktop Workbench",windowMinimize:"Minimize Window",windowMaximize:"Maximize or Restore Window",windowClose:"Close Window",contextOpenSession:"Open Session",navigationLoadFailed:"Load failed. Retry.",emptyNavigationTitle:"No project yet",emptyNavigationBody:"Add a local code directory to start working",emptyWorkspaceSessions:"No sessions",favoriteSectionTitle:"Pinned Sessions",favoriteSectionEmpty:"Pinned sessions stay here for quick access.",favoriteAction:"Pin Session",unfavoriteAction:"Unpin",favoriteAdded:"Session pinned",favoriteRemoved:"Session unpinned",favoriteToggleFailed:"Failed to update pinned state",sessionMoreAction:"More Actions",sessionStateInferred:"Inferred",renameAction:"Rename",renameSuccess:"Session name updated",renameFailed:"Failed to rename session",renameModalTitle:"Rename Session",renameModalDescription:"Use a name you can recognize at a glance. This changes only the title, not the content.",renameInputLabel:"Session Name",renameInputPlaceholder:"Enter a new session name",renamingSession:"Saving...",archiveFolderLabel:"Archived Sessions",archiveFolderAction:"Open Archive Folder",archiveAction:"Archive Session",archiveCurrentSessionAction:"Archive Current Session",archiveAdded:"Session archived",archiveConfirmTitle:"Archive This Session",archiveConfirmDescription:"After archiving, this session will be hidden from the main list for the current workspace, and you can still restore it from archive.",unarchiveAction:"Restore from Archive",archiveRestored:"Session restored to the main list",archiveModalTitle:"Archived Sessions",archiveModalDescription:"This list shows sessions temporarily hidden in the current project. Restore them when needed.",archiveEmpty:"There are no archived sessions in this project yet.",subagentBadge:"Sub-agent",subagentExpand:"Expand Sub-agent List",subagentCollapse:"Collapse Sub-agent List",subagentExpandMore:"Show More Sub-agents",favoriteExpandMore:"Show More Pinned",sessionExpandMore:"Show More Sessions",archiveExpandMore:"Show More Archived Sessions",workspaceCollapse:"Collapse Project",workspaceExpand:"Expand Project",switchWorkspace:"Switch to Project",workspaceHomeSwitcherLabel:"Switch Workspace",workspaceHomeSwitcherTitle:"Workspace",workspaceHomeStatusSectionTitle:"Current Workspace",workspaceHomeViewAllAction:"View All Sessions",workspaceHomeMetricActive:"Active",workspaceHomeMetricUnread:"Review",workspaceHomeMetricTerminal:"Terminals",workspaceHomeMetricChanges:"Changes",workspaceHomeActiveSessionsSectionTitle:"Active Sessions",workspaceHomeQuickLaunchStatusLabel:"Quick Launch Process",workspaceHomeQuickLaunchRunning:"Running",workspaceHomeQuickLaunchStopped:"Stopped",workspaceHomeWaitingInputLabel:"Waiting Input",workspaceOverviewTitle:"Put project entry points where you can actually see them",workspaceOverviewBody:"Choose a project first, then decide whether to continue or start a new session.",workspaceListBody:"Keep every loaded project here and surface the frequent actions on the page.",workspaceDetailTitle:"Project Details",workspaceDetailSummaryTitle:"Project Overview",workspaceDetailSummaryBody:"See the path, Git summary, and code footprint first, then jump into the right tool.",workspaceDetailMissingTitle:"Project not found",workspaceDetailMissingBody:"This project may have been removed, or the current snapshot has not loaded it yet.",workspaceSessionListBody:"Project sessions, favorites, and archive actions live here instead of hiding in a sidebar.",recentSessionsSectionTitle:"Recent Sessions",recentSessionsSectionBody:"Jump back into the work you touched most recently.",currentWorkspaceSectionTitle:"Current Project Sessions",currentWorkspaceSectionBody:"Keep the sessions for the current project together so the context stays obvious.",sessionIndexTitle:"Sessions deserve their own page",sessionIndexBody:"Recent, favorites, and current-project sessions are split into clear sections for mobile.",toolsMoreAction:"More",toolsSwipeHint:"Swipe left or right to switch between files and Git",toolsSwipePosition:"{current} / {total}",toolFilesBody:"Browse project files, changed files, and code context without relying on a desktop sidebar.",toolGitBody:"Open a clear Git entry for status, commits, and branches in the current project.",toolTerminalsBody:"Open the full terminal page for input-heavy and scroll-heavy tasks.",toolProcessesBody:"Review terminal templates, runtime status, and process entry points for the current project.",toolsWorkspaceRequiredBody:"Pick a project before opening this tool page.",createSession:"New Session",createSessionModalTitle:"Choose Session Type",createSessionModalDescription:"Pick the session type first, then start the actual session process.",createSessionWorkspaceLabel:"Choose Workspace",createSessionProviderLabel:"Choose Provider",createSessionTarget:"Current Project",providerClaudeCode:"Claude Code",providerCodexDescription:"Create a Codex session for the current default workflow.",providerClaudeDescription:"Create a Claude Code session when you want to switch to another conversation chain.",providerOpenCodeDescription:"Create an OpenCode session to continue context via the OpenCode service.",providerOptionHint:"A session is created immediately after selection",startClaude:"Claude",startCodex:"Codex",startingSession:"Creating...",startClaudeSuccess:"Claude session created",startCodexSuccess:"Codex session created",startSessionFailed:"Failed to create session",auxiliaryTitle:"Info",auxiliarySubtitle:"Files and Git status",expandAuxiliary:"Expand",collapseAuxiliary:"Collapse",auxiliaryEmptyTitle:"Select a session",auxiliaryEmptyBody:"Session files and Git info will appear here",batchSelectSessions:"Select Sessions in Bulk",batchSelectionMode:"Batch Selection",selectAllSessions:"Select All",clearSelectedSessions:"Clear Selection",batchArchiveAction:"Archive Selected",batchArchiving:"Archiving...",batchArchiveSuccess:"Selected sessions archived",batchArchivePartialFailed:"Some sessions failed to archive. Retry.",batchArchiveFailed:"Batch archive failed",hideSessionSidebar:"Hide Session List",showSessionSidebar:"Show Session List",hideInfoSidebar:"Hide Info Sidebar",showInfoSidebar:"Show Info Sidebar",centerTabsLabel:"Center Area Tabs",infoTabsLabel:"Info Sidebar Tabs",leftResizerLabel:"Resize Left Sidebar",rightResizerLabel:"Resize Right Sidebar",filesPanelEmpty:"Import or select a workspace first to use file management.",gitPanelEmpty:"Import or select a workspace first to view Git info.",infoPanelDeferred:"The left session list loads first. The right auxiliary panel mounts slightly later."},workbench:{emptyEyebrow:"Start",emptyTitle:"Choose a session first",emptyBody:"Continue from the left, or create a new session.",emptyResumeTitle:"Continue",emptyResumeBody:"Go back to where you stopped.",emptyNewTitle:"New session",emptyNewBody:"Put a new question into a clean session.",emptyCompanionTitle:"Side details",emptyCompanionBody:"Open files, Git, or terminal on the right when needed.",emptyTip:"When you are ready, pick a session from the left."},conversation:{resendButton:"Resend",historyLoading:"Loading...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Load failed",timelineEmpty:"Start Conversation",composerPlaceholder:"State the next step clearly. Let the session continue from there.",sendButton:"Send Message",attachFiles:"Attach File",pasteImagesHint:"Supports pasting images directly",attachmentImageOnly:"Only image attachments are supported right now",attachmentReadFailed:"Failed to read image. Retry.",attachmentPreviewAlt:"Selected image preview",attachmentPreviewOpen:"Click to view full image",attachmentPreviewClose:"Close image preview",attachmentPreviewLoading:"Loading image...",attachmentPreviewUnavailable:"Image preview unavailable",imageAttachmentLabel:"Image Attachment",imagePreviewTitle:"Image Preview",imagePreviewHint:"Click the backdrop or press Esc to close the preview",removeAttachment:"Remove Attachment",modelSelectorLabel:"Model",modelUseCliDefault:"Default",modelUseCodexConfig:"Follow current Codex config",modelUseOpenCodeConfig:"Follow current OpenCode config",reasoningSelectorLabel:"Reasoning Effort",reasoningLow:"Low",reasoningMedium:"Medium",reasoningHigh:"High",reasoningMaximum:"Maximum",slashMenu:"Commands",slashMenuTitle:"Quick Commands",slashCommandPlan:"Ask for an execution plan first",slashCommandReview:"Switch directly to code review mode",slashCommandExplain:"Ask for a clearer explanation",toolInputLabel:"Input",toolResultLabel:"Result",toolResultEmpty:"No output yet",toolPreviewCommand:"Command",toolPreviewTerminal:"Terminal",toolStatusRunning:"Running",toolStatusFailed:"Failed",toolStatusCompleted:"Completed",applyPatchEditedLabel:"Edited",applyPatchAddedLabel:"Added",applyPatchDeletedLabel:"Deleted",applyPatchDialogTitle:"Patch Change Preview",applyPatchDialogDescription:"This shows the file-level changes that apply_patch is about to perform.",applyPatchOpenDiff:"View Diff",applyPatchAddedStat:"Added",applyPatchRemovedStat:"Removed",applyPatchEmpty:"This patch does not contain any file change that can be displayed right now.",titleFallback:"Continue Conversation",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",headerWorkspace:"Workspace",headerWorkspaceUnknown:"Unknown Workspace",headerProvider:"Provider",headerConnection:"Connection",headerRuntime:"Runtime",providerCodex:"Codex",providerClaude:"Claude",providerOpenCode:"OpenCode",capabilitySend:"Send Enabled",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",capabilityDenied:"Restricted",capabilitySendDisabled:"Sending disabled",connectionConnected:"Realtime connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeIdle:"Idle",runtimeStarting:"Starting",runtimeRunning:"Running",runtimeReconnecting:"Recovering",runtimeCompleted:"Completed",runtimeInterrupted:"Interrupted",runtimeFailed:"Failed",rulesMessageTitle:"Rules",rulesMessageHint:"This is the startup rule block for the session. It is collapsed by default and can be expanded when needed.",rulesMessageExpand:"Expand Rules",rulesMessageCollapse:"Collapse Rules",thinkingLabel:"Thinking",filePanelWorkspaceTab:"Workspace",filePanelSessionTab:"Session",filePanelSessionViewLabel:"Session File View",filePanelSessionTreeView:"Tree",filePanelSessionListView:"List",filePanelSessionLoading:"Collecting files changed in this session...",filePanelSessionEmpty:"No cacheable changed files have been detected in this session yet.",filePanelSessionNoSession:"Only the workspace is selected right now. Pick a session before viewing session-scoped files.",filePanelSessionStageAll:"Stage All",filePanelSessionStageSuccess:"Changes from this session have been added to the staging area.",filePanelSessionLoadFailed:"Failed to load changed files for this session.",filePanelSessionSummary:"Detected Files",filePanelSessionUnstagedSummary:"Unstaged",filePanelSessionDeleted:"Deleted"},git:{recentVersionsTitle:"Recent Versions",stagedChangesTitle:"Staged Changes",expandRecentVersions:"Expand Recent Versions",collapseRecentVersions:"Collapse Recent Versions",stagedLabel:"Staged",workingTreeLabel:"Working Tree",changeTreeHint:"Show current changes by directory hierarchy",discard:"Discard Changes",discardFailed:"Failed to discard changes",operationMenu:"Actions",currentBranch:"Current Branch",resizePanels:"Resize file and recent-version panels",switchBranchTo:"Switch To",undoLastCommit:"Undo Last Commit",undoLastCommitFailed:"Failed to undo last commit",undoLastCommitSuccess:"Last commit undone",historyKindLocal:"Local",historyKindRemote:"Remote",historyKindShared:"Synced",pushNow:"Push",commitNow:"Commit",refreshNow:"Refresh",stageAll:"Stage All",unstageAll:"Unstage All",discardAll:"Discard All Changes",selectedFiles:"Selected Files",clearSelection:"Clear Selection",selectFile:"Select File",discardConfirm:"Discard these changes? {path}",historyItemMenu:"Commit Actions",copyCommitHash:"Copy Commit Hash",copyCommitHashSuccess:"Commit hash copied.",copyCommitSubject:"Copy Commit Title",copyCommitSubjectSuccess:"Commit title copied."},terminalManager:{workspaceField:"Current Workspace",refresh:"Refresh List",loadFailed:"Failed to load the terminal management panel",shellLoadFailed:"Failed to load the terminal shell list",emptyWorkspaceBody:"There is no available workspace yet.",noCurrentWorkspaceBody:"Select a session first so process management can bind to its workspace.",emptyTerminalBody:"There is no terminal instance in the current workspace yet.",emptyTemplateBody:"There is no quick launch item yet. Save a command or script first.",shellField:"Shell for New Terminal",shellUnavailable:"Unavailable",cwdField:"Startup Directory",cwdLabel:"Directory",cwdPlaceholder:"Defaults to the workspace root when left empty",modeField:"Launch Mode",commandMode:"Command",scriptMode:"Script",quickLaunchTitle:"Quick Launch",quickLaunchDescription:"Save a launch preset here so you can start it in a new terminal with one click later.",desktopPanelDescription:"Keep the default view focused on launch decisions, while paths and command lines stay inside the details layer.",runningCountLabel:"Running",portWatchCountLabel:"Watched Ports",terminalCountLabel:"Terminals",templateSectionTitle:"Launch Items",templateSectionDescription:"The right side prioritizes the port status of launch items so you can see whether a service is already in use.",openCreateModalAction:"Add Quick Launch Item",createModalTitle:"Add Quick Launch Item",createModalDescription:"Save a command or script here. You can attach a port and then start it with one click while checking whether it is already running.",editAction:"Edit Launch Item",editModalTitle:"Edit Quick Launch Item",editModalDescription:"Update the name, command, directory, and port for this quick launch item.",saveTemplateChangesAction:"Save Changes",templateUpdating:"Saving changes...",templateUpdateSuccess:"Quick launch item updated.",templateUpdateFailed:"Failed to update quick launch item",removeAction:"Remove Launch Item",templateRemoving:"Removing...",removeConfirmTitle:"Remove Quick Launch Item",removeConfirmAction:"Remove Item",removeConfirmTarget:'Remove "{name}"? It will disappear from the quick launch list after removal.',removeRunningConfirmTarget:'"{name}" is still running. Removing it only deletes the launch item configuration and will not stop the active process. Continue?',templateDeleteSuccess:"Quick launch item removed.",templateDeleteFailed:"Failed to remove quick launch item",terminalSectionTitle:"Terminal Instances",terminalSectionDescription:"This area shows terminals currently managed by CodingNS for the workspace.",closeAction:"Close Terminal",closing:"Closing...",closeSuccess:"Terminal close request submitted.",closeFailed:"Failed to close terminal",createTerminalAction:"New Empty Terminal",creatingTerminal:"Creating...",createTerminalSuccess:"New terminal created.",createTerminalFailed:"Failed to create a new terminal",defaultTerminalName:"Workspace Terminal",templateNameField:"Name",templateNamePlaceholder:"Generated automatically when left empty",commandField:"Launch Command",commandPlaceholder:"For example: npm",scriptPathField:"Script Path",scriptPathPlaceholder:"For example: scripts/dev.ps1 or scripts/dev.sh",argsField:"Arguments",argsPlaceholder:"For example: run dev or --watch",portField:"Listening Port",portLabel:"Port",portPlaceholder:"For example: 3000",invalidPort:"Port must be an integer between 1 and 65535",saveLaunchAction:"Save as Quick Launch",templateSaving:"Saving...",templateSaveSuccess:"Quick launch item saved.",templateSaveFailed:"Failed to save quick launch item",runTemplateAction:"Run in New Terminal",runningTemplate:"Starting...",templateRunSuccess:"Quick launch item sent to a new terminal.",templateRunFailed:"Failed to run quick launch item",showDetailsAction:"Show details",hideDetailsAction:"Hide details",detailsSectionTitle:"Launch item details",commandPreviewLabel:"Launch Command",processIdLabel:"Process ID",processCommandLabel:"Process Command Line",stopProcessAction:"Stop Process",stoppingProcess:"Stopping...",stopProcessSuccess:"The listening process has been stopped.",stopProcessFailed:"Failed to stop the listening process",defaultCommandName:"New Launch Command",defaultScriptName:"New Launch Script",lastActiveAt:"Last Active",updatedAt:"Updated At",processCommandFallback:"This process did not expose its command line",portUnset:"Port Not Configured",portUnsetDescription:"Without a port, the item can only be started. The system cannot determine automatically whether the service is running.",portOccupied:"Process Started",portAvailable:"Port Available",portAvailableDescription:"There is currently no listening process on the port used by this launch item.",statusRunning:"Running",statusStopped:"Stopped",exitCode:"Exit Code",runningValue:"Running"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"}},zb={"zh-CN":rN,"en-US":nN},Wb={"zh-CN":sN,"en-US":aN};function Sc(e,t){const n=e.split(".");let s=t;for(const o of n){if(!s||typeof s=="string")return e;const c=s[o];if(c==null)return e;s=c}return typeof s=="string"?s:e}function oN(){return cn.getState().language??"zh-CN"}function h(e,t){const s=oN()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const o of s){const c=Sc(e,Wb[o]);if(c!==e)return Ad(c,t);const l=Sc(e,zb[o]);if(l!==e)return Ad(l,t)}return Ad(e,t)}function Ad(e,t){return t?e.replace(/\{([^}]+)\}/g,(n,s)=>{const o=t[s];return o==null?n:String(o)}):e}function lN({children:e,language:t}){return w.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function cN(){const e=Ic(t=>t.language);return t=>{const n=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const s of n){const o=Sc(t,Wb[s]);if(o!==t)return o;const c=Sc(t,zb[s]);if(c!==t)return c}return t}}const _c=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}],Fc="codingns-theme";function Hb(e){return h(e.labelKey)}function uN(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function dN(){if(typeof window>"u")return null;const e=localStorage.getItem(Fc);return e&&_c.some(t=>t.id===e)?e:null}function $b(){return dN()??uN()}function qb(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),localStorage.setItem(Fc,e))}function hN(e){const t=n=>{n.key===Fc&&e()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function fN(){if(typeof window>"u")return"light";const e=document.documentElement.getAttribute("data-theme");return e&&_c.some(t=>t.id===e)?e:$b()}function Vb(){return{theme:w.useSyncExternalStore(hN,fN,()=>"light"),setTheme:t=>{qb(t),window.dispatchEvent(new StorageEvent("storage",{key:Fc}))}}}function mN(){qb($b())}function pN({children:e}){return w.useEffect(()=>{mN()},[]),i.jsx(i.Fragment,{children:e})}const gN={showToast:()=>"",dismissToast:()=>{}},Gb=w.createContext(gN);function yN(){return`toast-${Math.random().toString(36).slice(2,10)}`}function vN({toast:e,onDismiss:t}){const{id:n,title:s,description:o,tone:c,durationMs:l,action:d}=e;return w.useEffect(()=>{if(l===null)return;const m=window.setTimeout(()=>{t(n)},l);return()=>{window.clearTimeout(m)}},[l,n,t,s,o,c]),i.jsxs("article",{className:"toast-card","data-tone":c,role:c==="error"?"alert":"status",children:[i.jsxs("div",{className:"toast-body",children:[i.jsx("strong",{className:"toast-title",children:s}),o?i.jsx("p",{className:"toast-description",children:o}):null]}),i.jsxs("div",{className:"toast-actions",children:[d?i.jsx("button",{className:"toast-action",type:"button",onClick:()=>{d.onClick(),t(n)},children:d.label}):null,i.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(n),children:"x"})]})]})}function wN({children:e}){const[t,n]=w.useState([]),s=w.useCallback(l=>{n(d=>d.filter(m=>m.id!==l))},[]),o=w.useCallback(l=>{const d=l.id??yN(),m={id:d,title:l.title,description:l.description,tone:l.tone??"info",durationMs:l.durationMs===void 0?4200:l.durationMs,action:l.action};return n(p=>{const y=p.findIndex(x=>x.id===d);if(y===-1)return[...p,m];const g=[...p];return g[y]=m,g}),d},[]),c=w.useMemo(()=>({showToast:o,dismissToast:s}),[s,o]);return i.jsxs(Gb.Provider,{value:c,children:[e,i.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(l=>i.jsx(vN,{toast:l,onDismiss:s},l.id))})]})}function Qn(){return w.useContext(Gb)}const cc="0.1.1",Kb=w.createContext(cc);function bN({children:e}){const t=Kn(),[n,s]=w.useState(cc);return w.useEffect(()=>{let o=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(c=>{var d,m;if(o)return;const l=c.ok?(m=(d=c.value)==null?void 0:d.version)==null?void 0:m.trim():"";s(l||cc)}),()=>{o=!0}):(s(cc),()=>{o=!0})},[t]),i.jsx(Kb.Provider,{value:n,children:e})}function Qb(){return w.useContext(Kb)}const xN="modulepreload",kN=function(e){return"/"+e},ly={},Oc=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let l=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=l(n.map(p=>{if(p=kN(p),p in ly)return;ly[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":xN,y||(x.as="script"),x.crossOrigin="",x.href=p,m&&x.setAttribute("nonce",m),document.head.appendChild(x),y)return new Promise((b,C)=>{x.addEventListener("load",b),x.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return o.then(l=>{for(const d of l||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},Yb="codingns.server.base-url.history",Xb=6,Jb="__custom__";function Zb(){return typeof window<"u"&&typeof window.localStorage<"u"}function SN(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function ex(e){if(!e)return null;try{return pi(e)}catch{return null}}function CN(){if(!Zb())return[];const e=window.localStorage.getItem(Yb);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(n=>typeof n=="string"?ex(n):null).filter(n=>!!n):[]}catch{return[]}}function jN(e){const t=new Set,n=[];for(const s of e)!s||t.has(s)||(t.add(s),n.push(s));return n}function NN(e){const t=CN();return jN([e,...t,ex(SN())]).slice(0,Xb)}function TN(e){Zb()&&window.localStorage.setItem(Yb,JSON.stringify(e.slice(0,Xb)))}class PN{constructor(){Ze(this,"state",this.createState(cn.getState().hostBaseUrl));Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);cn.subscribe(()=>{const t=this.createState(cn.getState().hostBaseUrl);t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((n,s)=>n===this.state.options[s])||(this.state=t,this.emit())})}setBaseUrl(t){const n=pi(t),s=n!==cn.getState().hostBaseUrl;return this.state=this.createState(n),this.emit(),cn.update({hostBaseUrl:n}),s}reset(){this.state=this.createState(cn.getState().hostBaseUrl),this.emit()}createState(t){const n=NN(t);return TN(n),{baseUrl:t,options:n}}emit(){for(const t of this.listeners)t()}}const Cc=new PN;function jc(e){return w.useSyncExternalStore(Cc.subscribe,()=>e(Cc.getState()))}function EN(e,t){return t.includes(e)?e:Jb}function RN(){return Jb}function MN(e){return e.endsWith("/")?e:`${e}/`}function AN(e){return e.replace(/^\/+/,"")}function bo(){return cn.getState().hostBaseUrl}function tx(e,t=bo()){return new URL(AN(e),MN(t)).toString()}function nx(e,t=bo()){const n=new URL(tx(e,t));return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.toString()}class qn extends Error{constructor(n,s){super(s.detail);Ze(this,"status");Ze(this,"errorCode");Ze(this,"field");this.name="ApiError",this.status=n,this.errorCode=s.error_code,this.field=s.field}}class LN{async request(t,n={}){const s=await this.performRequest(t,n);if(s.status===204||s.status===205)return;const o=await s.text();if(o)return JSON.parse(o)}async requestBlob(t,n={}){return(await this.performRequest(t,n)).blob()}async performRequest(t,n){var d;const s=new Headers(n.headers),o=n.body!==void 0&&n.body!==null,c=tx(t,n.baseUrl??bo());if(o&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),!n.skipAuth){const m=(d=Sn.getState().session)==null?void 0:d.accessToken;if(!m)throw Sn.clear(),new qn(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});s.set("Authorization",`Bearer ${m}`)}let l;try{l=await fetch(c,{...n,headers:s})}catch(m){const p=m instanceof Error?m.message:"未知网络错误";throw new qn(0,{detail:`请求 ${c} 失败:${p}`,error_code:"NETWORK_ERROR"})}if(!l.ok){const m=await IN(l);if(rx(l.status,m.error_code)&&!n.skipAuth&&!n.retryAfterRefresh){const p=await Sn.refresh();if(p.status==="refreshed")return this.performRequest(t,{...n,retryAfterRefresh:!0});throw p.status==="invalid"?new qn(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new qn(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!n.skipAuth&&DN(l.status,m.error_code)&&Sn.clear(),new qn(l.status,m)}return l}}const et=new LN;async function IN(e){const t=await e.text();if(!t)return cy(e.status);try{const n=JSON.parse(t);if(typeof n.detail=="string"&&typeof n.error_code=="string")return{detail:n.detail,error_code:n.error_code,field:typeof n.field=="string"?n.field:void 0,timestamp:typeof n.timestamp=="string"?n.timestamp:void 0}}catch{}return cy(e.status,t)}function cy(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function rx(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function DN(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:rx(e,t)}function _N(e){return et.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function FN(e,t){return et.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function ON(e,t){return et.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function BN(e,t){return et.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const Xa="codingns.auth.session";class UN{constructor(){Ze(this,"state",{status:"anonymous",session:this.readSession()});Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);this.state.session&&(this.state={status:"authenticated",session:this.state.session})}async login(t,n,s){const o=await ON({username:t,password:n},s);return this.setSession(o),o}async bootstrap(t,n,s){await FN({username:t,password:n},s)}hydrate(t){if(!t){this.clear();return}this.setSession(t)}async refresh(){const t=this.state.session,n=t==null?void 0:t.refreshToken;if(!n)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const s=await BN({refreshToken:n});return this.setSession(s),{status:"refreshed",session:s}}catch(s){return WN(s)?(this.clear(),{status:"invalid",session:null}):(this.state={status:t?"authenticated":"anonymous",session:t},this.emit(),{status:"deferred",session:t,error:s})}}clear(){this.state={status:"anonymous",session:null},window.localStorage.removeItem(Xa),this.emit()}setSession(t){this.state={status:"authenticated",session:t};const n={serverBaseUrl:bo(),session:t};window.localStorage.setItem(Xa,JSON.stringify(n)),this.emit()}readSession(){const t=window.localStorage.getItem(Xa);if(!t)return null;try{const n=JSON.parse(t),s=bo();return zN(n)?(n.serverBaseUrl&&n.serverBaseUrl!==s,n.session):sx(n)?n:(window.localStorage.removeItem(Xa),null)}catch{return window.localStorage.removeItem(Xa),null}}emit(){for(const t of this.listeners)t()}}const Sn=new UN;function ix(e){return w.useSyncExternalStore(Sn.subscribe,()=>e(Sn.getState()))}function zN(e){return typeof e!="object"||e===null?!1:"session"in e&&sx(e.session)}function sx(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.accessToken=="string"&&typeof t.refreshToken=="string"&&typeof t.expiresIn=="number"&&typeof t.user=="object"&&t.user!==null}function WN(e){return e instanceof qn?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const ax={login(e,t,n){return Sn.login(e,t,n)},bootstrap(e,t,n){return Sn.bootstrap(e,t,n)},refresh(){return Sn.refresh()},logout(){Sn.clear()}};function HN(){const e=An(),t=jc(S=>S.baseUrl),[n,s]=w.useState("admin"),[o,c]=w.useState(""),[l,d]=w.useState(""),[m,p]=w.useState(null),[y,g]=w.useState("error"),[x,b]=w.useState(!1);async function C(S){if(S.preventDefault(),o!==l){g("error"),p(h("auth.bootstrapMismatch"));return}b(!0),p(null);try{await ax.bootstrap(n,o),g("success"),p(h("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(N){g("error"),N instanceof qn?p(N.message):p(h("auth.authUnavailable"))}finally{b(!1)}}return i.jsx("main",{className:"page-center app-shell",children:i.jsxs("section",{className:"auth-card surface-card",children:[i.jsx("h1",{children:h("auth.bootstrapTitle")}),i.jsx("p",{className:"status-text",children:h("auth.bootstrapSubtitle")}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("auth.serverCurrent")}),i.jsx("span",{className:"auth-server-value",children:t})]}),i.jsxs("form",{className:"auth-form",onSubmit:C,children:[i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.username")}),i.jsx("input",{value:n,onChange:S=>s(S.target.value)})]}),i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.password")}),i.jsx("input",{type:"password",value:o,onChange:S=>c(S.target.value)})]}),i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.confirmPassword")}),i.jsx("input",{type:"password",value:l,onChange:S=>d(S.target.value)})]}),m?i.jsx("p",{className:"status-text","data-tone":y,children:m}):null,i.jsx("button",{className:"primary-button",type:"submit",disabled:x,children:h(x?"common.loading":"auth.submitBootstrap")})]})]})})}async function $N(e){try{return{...await _N(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function qN({isOpen:e,onClose:t,onSave:n,theme:s="dark"}){const o=jc(_=>_.baseUrl),c=jc(_=>_.options),l=RN(),[d,m]=w.useState(o),[p,y]=w.useState(null),g=w.useMemo(()=>{try{return pi(d)}catch{return null}},[d]),x=EN(g??d,c),b="server-settings-preset",C="server-settings-address";if(w.useEffect(()=>{e&&(m(o),y(null))},[e,o]),!e)return null;function S(){if(!g){y(h("auth.serverInvalid"));return}Cc.setBaseUrl(g),n==null||n(g),t()}function N(_){_.target===_.currentTarget&&t()}function T(){g&&m(g)}return i.jsx("div",{className:"server-settings-modal-backdrop","data-theme":s,onClick:N,role:"dialog","aria-modal":"true","aria-labelledby":"server-settings-title",children:i.jsxs("div",{className:"server-settings-modal",children:[i.jsxs("div",{className:"server-settings-modal-header",children:[i.jsx("div",{className:"cyber-header-line"}),i.jsxs("h2",{id:"server-settings-title",className:"cyber-title",children:[i.jsx("span",{className:"cyber-title-icon",children:"◈"}),h("auth.serverSettingsTitle")]}),i.jsx("div",{className:"cyber-header-line"}),i.jsx("button",{className:"server-settings-close",onClick:t,"aria-label":h("common.close"),children:"×"})]}),i.jsxs("div",{className:"server-settings-modal-content",children:[i.jsxs("label",{className:"field-group cyber-field",htmlFor:b,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverPreset")}),i.jsxs("div",{className:"cyber-select-wrapper",children:[i.jsxs("select",{id:b,"aria-label":h("auth.serverPreset"),className:"cyber-select",value:x,onChange:_=>{const R=_.target.value;R!==l&&(m(R),y(null))},children:[c.map(_=>i.jsx("option",{value:_,children:_},_)),i.jsx("option",{value:l,children:h("auth.serverCustomOption")})]}),i.jsx("span",{className:"cyber-select-arrow",children:"▼"})]})]}),i.jsxs("label",{className:"field-group cyber-field",htmlFor:C,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverAddress")}),i.jsxs("div",{className:"cyber-input-wrapper",children:[i.jsx("input",{id:C,"aria-label":h("auth.serverAddress"),className:"cyber-input",value:d,placeholder:h("auth.serverPlaceholder"),onBlur:T,onChange:_=>{m(_.target.value),y(null)}}),i.jsx("div",{className:"cyber-input-glow"})]})]}),i.jsxs("p",{className:"cyber-hint",children:[i.jsx("span",{className:"cyber-hint-icon",children:"ℹ"}),h("auth.serverHint")]}),p?i.jsxs("p",{className:"cyber-status","data-tone":"error",children:[i.jsx("span",{className:"cyber-status-icon",children:"⚠"}),p]}):null]}),i.jsxs("div",{className:"server-settings-modal-footer",children:[i.jsx("button",{className:"cyber-button cyber-button-secondary",onClick:t,children:h("common.cancel")}),i.jsxs("button",{className:"cyber-button cyber-button-primary",onClick:S,children:[i.jsx("span",{className:"cyber-button-glow"}),i.jsx("span",{className:"cyber-button-text",children:h("auth.saveServerSettings")})]})]})]})})}function VN(){const e=w.useRef(null);return w.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");if(!n)return;let s;const o=()=>{l(),d()};let c=[];const l=()=>{t.width=window.innerWidth,t.height=window.innerHeight},d=()=>{c=[];const p=Math.min(50,Math.floor(t.width*t.height/25e3));for(let y=0;y<p;y++)c.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},m=()=>{n.clearRect(0,0,t.width,t.height),c.forEach((p,y)=>{p.x+=p.vx,p.y+=p.vy,p.x<0&&(p.x=t.width),p.x>t.width&&(p.x=0),p.y<0&&(p.y=t.height),p.y>t.height&&(p.y=0),n.beginPath(),n.arc(p.x,p.y,p.size,0,Math.PI*2),n.fillStyle=`rgba(10, 132, 255, ${p.opacity})`,n.fill(),c.slice(y+1).forEach(g=>{const x=p.x-g.x,b=p.y-g.y,C=Math.sqrt(x*x+b*b);C<150&&(n.beginPath(),n.moveTo(p.x,p.y),n.lineTo(g.x,g.y),n.strokeStyle=`rgba(10, 132, 255, ${.1*(1-C/150)})`,n.stroke())})}),s=requestAnimationFrame(m)};return l(),d(),m(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),cancelAnimationFrame(s)}},[]),i.jsx("canvas",{ref:e,className:"particle-canvas"})}function GN({text:e}){return i.jsx("span",{className:"glitch-text","data-text":e,children:e})}function KN({text:e}){const[t,n]=w.useState(""),[s,o]=w.useState(!0);return w.useEffect(()=>{let c=0,l=null;const d=setInterval(()=>{c<=e.length?(n(e.slice(0,c)),c++):(clearInterval(d),l=window.setTimeout(()=>o(!1),1e3))},50);return()=>{clearInterval(d),l!==null&&window.clearTimeout(l)}},[e]),i.jsxs("span",{className:"typewriter-text",children:[t,s&&i.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function QN(){const e=An(),t=cN(),[n]=Jj(),s=Kn(),o=Qb(),c=ff(s.platform),l=w.useMemo(()=>Z0(s),[s]),d=w.useMemo(()=>l?fb():null,[l]),m=(d==null?void 0:d.serverBaseUrl)??null,[p,y]=w.useState(()=>(d==null?void 0:d.username)??"admin"),[g,x]=w.useState(()=>(d==null?void 0:d.password)??""),[b,C]=w.useState(()=>!!d),S=jc(ue=>ue.baseUrl),[N,T]=w.useState(S),[_,R]=w.useState(null),[G,q]=w.useState(!1),[F,M]=w.useState(!1),[D,U]=w.useState(null),E=ix(ue=>ue.session),H=w.useMemo(()=>n.get("returnTo")??"/",[n]),{theme:ee}=Vb(),ne=w.useRef(!1),ae=w.useMemo(()=>ee==="light"?"light":"dark",[ee]);w.useEffect(()=>{ne.current||(ne.current=!0,!(!l||!m||m===S)&&(Cc.setBaseUrl(m),T(m)))},[S,l,m]),w.useEffect(()=>{if(E){e(H,{replace:!0});return}if(!N)return;let ue=!1;return $N(N).then(A=>{!ue&&A.reachable&&!A.initialized&&e("/bootstrap",{replace:!0})}).catch(()=>{ue||R(t("auth.authUnavailable"))}),()=>{ue=!0}},[E,e,N,H,t]);async function te(ue){ue.preventDefault(),q(!0),R(null),T(S),l&&!b&&t1();try{await ax.login(p,g,S),l&&b&&mb({username:p,password:g,serverBaseUrl:S}),e(H,{replace:!0})}catch(A){if(A instanceof qn){if(A.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}R(A.message)}else R(t("auth.authUnavailable"))}finally{q(!1)}}function ye(ue){T(ue),R(null)}const J="login-username",K="login-password";return i.jsxs("main",{className:"cyber-login-page","data-theme":ae,children:[i.jsxs("div",{className:"cyber-bg",children:[i.jsx("div",{className:"cyber-grid"}),i.jsx("div",{className:"cyber-glow cyber-glow-1"}),i.jsx("div",{className:"cyber-glow cyber-glow-2"}),i.jsx(VN,{})]}),i.jsx("div",{className:"scanlines"}),i.jsxs("div",{className:"cyber-login-container",children:[i.jsx("div",{className:"cyber-login-toolbar",children:i.jsx(kf,{variant:"compact"})}),i.jsxs("div",{className:"cyber-brand",children:[i.jsx("div",{className:"cyber-logo",children:i.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),i.jsx("h1",{className:"cyber-brand-title",children:i.jsx(GN,{text:"CodingNS"})}),i.jsx("p",{className:"cyber-brand-subtitle",children:i.jsx(KN,{text:t("auth.loginSubtitle")})})]}),i.jsxs("div",{className:"cyber-card",children:[i.jsx("div",{className:"cyber-corner corner-tl"}),i.jsx("div",{className:"cyber-corner corner-tr"}),i.jsx("div",{className:"cyber-corner corner-bl"}),i.jsx("div",{className:"cyber-corner corner-br"}),i.jsxs("div",{className:"cyber-card-header",children:[i.jsx("div",{className:"cyber-line"}),i.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),i.jsx("div",{className:"cyber-line"})]}),i.jsxs("form",{className:"cyber-form",onSubmit:te,children:[i.jsxs("div",{className:`cyber-field ${D==="username"?"focused":""}`,children:[i.jsx("div",{className:"cyber-field-border",children:i.jsx("div",{className:"cyber-field-border-glow"})}),i.jsxs("label",{className:"cyber-field-label",htmlFor:J,children:[i.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),i.jsx("input",{id:J,"aria-label":t("auth.username"),className:"cyber-input",value:p,onChange:ue=>y(ue.target.value),onFocus:()=>U("username"),onBlur:()=>U(null),autoComplete:"username"})]}),i.jsxs("div",{className:`cyber-field ${D==="password"?"focused":""}`,children:[i.jsx("div",{className:"cyber-field-border",children:i.jsx("div",{className:"cyber-field-border-glow"})}),i.jsxs("label",{className:"cyber-field-label",htmlFor:K,children:[i.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),i.jsx("input",{id:K,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:g,onChange:ue=>x(ue.target.value),onFocus:()=>U("password"),onBlur:()=>U(null),autoComplete:"current-password"})]}),l?i.jsxs("label",{className:"cyber-remember-toggle",children:[i.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:b,onChange:ue=>C(ue.target.checked)}),i.jsx("span",{children:t("auth.rememberPassword")})]}):null,_?i.jsxs("div",{className:"cyber-status","data-tone":"error",children:[i.jsx("span",{className:"cyber-status-icon",children:"⚠"}),i.jsx("span",{children:_})]}):null,i.jsxs("button",{className:`cyber-submit ${G?"loading":""}`,type:"submit",disabled:G,children:[i.jsx("span",{className:"cyber-submit-glow"}),i.jsx("span",{className:"cyber-submit-border"}),i.jsx("span",{className:"cyber-submit-text",children:G?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),c?i.jsxs("div",{className:"cyber-footer",children:[i.jsxs("div",{className:"cyber-divider",children:[i.jsx("span",{className:"cyber-divider-line"}),i.jsx("span",{className:"cyber-divider-text",children:"//"}),i.jsx("span",{className:"cyber-divider-line"})]}),i.jsxs("button",{className:"cyber-server-btn",onClick:()=>M(!0),type:"button",children:[i.jsx("span",{className:"cyber-server-icon",children:"⚙"}),i.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),i.jsx("span",{className:"cyber-server-current",children:S})]})]}):null]}),i.jsxs("div",{className:"cyber-version",children:[i.jsxs("span",{className:"cyber-version-text",children:["v",o]}),i.jsx("span",{className:"cyber-version-divider",children:"|"}),i.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),c?i.jsx(qN,{isOpen:F,onClose:()=>M(!1),onSave:ye,theme:ae}):null]})}function Or(){return Kn().haptics}function YN(){return et.request("/api/workspaces")}async function XN(){try{return await et.request("/api/workbench")}catch(e){if(!(e instanceof qn)||e.status!==404)throw e;const t=await YN();return{items:await Promise.all(t.items.map(async s=>({workspace:s,sessions:(await tT(s.id)).items})))}}}function JN(e){return et.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function ZN(e){return et.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function ox(e){return et.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function lx(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),et.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function eT(e){return et.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function tT(e){return et.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function nT(e){return et.request(`/api/sessions/${encodeURIComponent(e)}`)}function rT(e){return et.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function iT(e){return et.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function cx(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function ux(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function sT(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function aT(e){return et.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function oT(){return et.request("/api/preferences/quick-phrases")}function lT(e){return et.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function cT(e,t){const n=new URLSearchParams;return t!=null&&t.trim()&&n.set("workspaceId",t.trim()),et.request(`/api/providers/${encodeURIComponent(e)}/capabilities${n.size>0?`?${n.toString()}`:""}`)}function uT(e,t){return et.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function dT(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function hT(e){return et.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function fT(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function mT(e){return et.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function pT(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function gT(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function yT(e,t){return et.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function uy(e){return et.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function vT(e){return et.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function dx({connectionState:e,onReconnect:t}){const{showToast:n,dismissToast:s}=Qn();return w.useEffect(()=>{if(e==="connected"||e==="closed"){s("conversation-connection-state");return}if(e==="reconnect_failed"){n({id:"conversation-connection-state",title:h("conversation.connectionReconnectFailed"),description:h("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:h("conversation.reconnectButton"),onClick:t}});return}n({id:"conversation-connection-state",title:h("conversation.connectionReconnecting"),description:h("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[e,s,t,n]),null}function Ld(e,t){if(!e)return{allowed:!1,hidden:!1,reason:h("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:h("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:h("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:h("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:h("conversation.capabilityDenied")}}}const wT=new Set(["low","medium","high","xhigh"]),bT={"claude-code":{displayNameKey:"conversation.providerClaude",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,iconVariant:"claude",supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,iconVariant:"codex",supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,iconVariant:"generic",supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1}};function Ss(e){return e?bT[e]??null:null}function xT(e){return[{id:"provider-default",name:h(e),usesProviderDefault:!0}]}function kT(e){const t=Ss(e);return xT((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function ST(e){return!!e}function CT(e){const t=Ss(e);return h((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function jT(e){const t=Ss(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(t==null?void 0:t.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:!0,supportsPermissionPrompt:!0,supportsCheckpoint:!1,modelOptions:kT(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function NT(e){return(e==null?void 0:e.provider)??"claude-code"}function TT(e){var n;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const t=(e==null?void 0:e.provider)??null;return((n=Ss(t))==null?void 0:n.supportsSlashMenuByDefault)??!1}function PT(e){var t;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((t=e==null?void 0:e.modelOptions)!=null&&t.some(n=>{var s;return((s=n.supportedReasoningEfforts)==null?void 0:s.some(o=>wT.has(o)))??!1}))}function ET(e,t){if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const n=(e==null?void 0:e.inRunInputMode)??"none";return n==="queued_guidance"||n==="none"||n==="streaming_guidance"&&t===!1}function hx(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function RT(e){const t=Ss(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function MT(e){var t;return((t=Ss(e))==null?void 0:t.iconVariant)??"generic"}function AT(e,t){var s;return((s=Ss(t??null))==null?void 0:s.foldRulesMessagesByDefault)??!1}function LT(){return i.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M7 7L17 17M17 7L7 17",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})})}function Fr({open:e,title:t,description:n,className:s,onClose:o,children:c}){return w.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&o()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[o,e]),!e||typeof document>"u"?null:Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:o}),i.jsxs("section",{className:`workbench-modal-card surface-card${s?` ${s}`:""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:n})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:o,children:i.jsx(LT,{})})]}),i.jsx("div",{className:"workbench-modal-body",children:c})]})]}),document.body)}const IT="codingns.conversation.composer-draft:",DT=1,_T=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function Sf(){return typeof window<"u"&&typeof window.localStorage<"u"}function FT(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,n="fileName"in e?e.fileName:null,s="mimeType"in e?e.mimeType:null,o="fileSize"in e?e.fileSize:null,c="lastModified"in e?e.lastModified:null,l="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof n!="string"||typeof s!="string"||typeof o!="number"||typeof c!="number"||typeof l!="string")return null;const d=t.trim(),m=n.trim(),p=s.trim(),y=l.trim();return!d||!m||!p||o<0||c<0||!y?null:{id:d,fileName:m,mimeType:p,fileSize:o,lastModified:c,contentBase64:y}}function OT(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,n="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(n))return null;const s=n.map(o=>FT(o)).filter(o=>o!==null);return s.length!==n.length||t.length===0&&s.length===0?null:{content:t,attachments:s}}function co(e){return`${IT}${e}`}function BT(e){var t,n;return{id:((n=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:n.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function UT(e){if(!Sf())return null;const t=e.trim();if(!t)return null;const n=window.localStorage.getItem(co(t));if(!n)return null;try{const s=JSON.parse(n),o=s&&typeof s=="object"&&"draft"in s&&s.draft&&typeof s.draft=="object"?s.draft:s,c=OT(o);return c||(window.localStorage.removeItem(co(t)),null)}catch{return window.localStorage.removeItem(co(t)),null}}function zT(e,t){if(!Sf())return!1;const n=e.trim();if(!n)return!1;if(t.content.length===0&&t.attachments.length===0)return fx(n),!0;try{return window.localStorage.setItem(co(n),JSON.stringify({schemaVersion:DT,draft:t})),!0}catch{return!1}}function fx(e){if(!Sf())return;const t=e.trim();t&&window.localStorage.removeItem(co(t))}const WT="provider-default",HT="provider-default",$T="provider-default",dy="workbench:focus-composer",qT="provider-default";function VT(){return[{id:WT,name:h("conversation.modelUseCliDefault"),provider:"claude-code",usesProviderDefault:!0}]}function GT(){return[{id:HT,name:h("conversation.modelUseCliDefault"),provider:"codex",usesProviderDefault:!0}]}function KT(){return[{id:$T,name:h("conversation.modelUseCliDefault"),provider:"opencode",usesProviderDefault:!0}]}function QT(e){return e==="claude-code"?VT():e==="opencode"?KT():GT()}function Id(e){return`composer-selected-model:${e}`}function Wl(e){return`composer-reasoning-level:${e}`}function YT(e){return e.usesProviderDefault===!0||e.id===qT}function XT(){var e,t;return((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function JT(e,t,n,s){const o=globalThis.atob(n),c=Uint8Array.from(o,l=>l.charCodeAt(0));return new File([c],e,{type:t,lastModified:s})}function ZT(e){const t=JT(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function eP(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function hy(e){return new Promise((t,n)=>{const s=new FileReader;s.onerror=()=>{n(s.error??new Error("FILE_READ_FAILED"))},s.onload=()=>{const o=typeof s.result=="string"?s.result:"",c=o.includes(",")?o.split(",").at(-1)??"":o;t(c)},s.readAsDataURL(e)})}function tP(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function nP(e){const t=[];let n=0;for(const s of e){if(s.type.startsWith("image/")){t.push(s);continue}n+=1}return{accepted:t,rejectedCount:n}}function rP(e,t){const n=new Set(e.map(o=>`${o.file.name}:${o.file.size}:${o.file.lastModified}`)),s=[...e];return t.forEach(o=>{const c=`${o.name}:${o.size}:${o.lastModified}`;n.has(c)||(n.add(c),s.push({id:XT(),file:o,previewUrl:URL.createObjectURL(o)}))}),s}function mx({capabilities:e,draftStorageId:t,panelRef:n,portalContainer:s=null,hasActiveRun:o=null,canInterrupt:c=null,contextUsage:l=null,hasPendingQueuedMessages:d=!1,isSubmitting:m,isRunning:p=!1,onInterrupt:y,onQueueSend:g,onSend:x}){const[b,C]=w.useState(""),[S,N]=w.useState(""),[T,_]=w.useState("medium"),[R,G]=w.useState([]),[q,F]=w.useState(_T),[M,D]=w.useState(!1),[U,E]=w.useState(!1),[H,ee]=w.useState(""),[ne,ae]=w.useState(!1),[te,ye]=w.useState(!1),[J,K]=w.useState(!1),[ue,A]=w.useState(!1),z=w.useRef(null),le=w.useRef(!1),P=w.useRef(new Set),ve=w.useRef(new Map),je=w.useRef(0),{showToast:Se}=Qn(),De=Or(),Re=NT(e),We=w.useMemo(()=>Ld(e,"send_message"),[e]),ct=w.useMemo(()=>Ld(e,"interrupt"),[e]),Tt=w.useMemo(()=>Ld(e,"attachments"),[e]),qe=w.useMemo(()=>{var X;const L=(X=e==null?void 0:e.modelOptions)==null?void 0:X.map(ce=>{var ke;return{...ce,provider:Re,supportedReasoningEfforts:(ke=ce.supportedReasoningEfforts)==null?void 0:ke.filter(Fe=>Fe==="low"||Fe==="medium"||Fe==="high"||Fe==="xhigh")}});return L!=null&&L.length?L:QT(Re)},[e==null?void 0:e.modelOptions,Re]),ft=w.useMemo(()=>qe.find(L=>L.id===S)??null,[qe,S]),Ue=PT(e),Ht=TT(e),vt=w.useMemo(()=>[{value:"low",label:h("conversation.reasoningLow")},{value:"medium",label:h("conversation.reasoningMedium")},{value:"high",label:h("conversation.reasoningHigh")},{value:"xhigh",label:h("conversation.reasoningMaximum")}],[]),Ge=w.useMemo(()=>{if(!Ue)return[];const L=ft==null?void 0:ft.supportedReasoningEfforts;return!L||L.length===0?vt:vt.filter(X=>L.includes(X.value))},[Ue,vt,ft==null?void 0:ft.supportedReasoningEfforts]),yt=w.useMemo(()=>qe.map(L=>({value:L.id,label:YT(L)?h("conversation.modelUseCliDefault"):L.name})),[qe]),Rt=w.useMemo(()=>Ge.map(L=>({value:L.value,label:L.label})),[Ge]),zt=w.useMemo(()=>[{command:"/plan",label:h("conversation.slashCommandPlan")},{command:"/review",label:h("conversation.slashCommandReview")},{command:"/explain",label:h("conversation.slashCommandExplain")}],[]),gt=(e==null?void 0:e.inRunInputMode)??"none",Mt=o??null,Vt=p&>==="streaming_guidance"&&Mt===!1&&!hx(e),bt=p&>==="streaming_guidance"&&!Vt,It=p&&typeof g=="function"&&ET(e,Mt),de=p&&!bt&&!It,xe=b.trim().length>0||R.length>0,_e=c??ct.allowed,Qe=p&&_e&&!!y&&!J&&!xe&&!ue&&!m,dt=!Qe&&!xe&&(ue||m||p||!p&&d),At=h(ue||m||d?"conversation.sendingState":"conversation.runtimeRunning"),at=h(p?It?"conversation.queueGuidanceButton":bt?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),be=w.useCallback(L=>{N(L),localStorage.setItem(Id(Re),L)},[Re]),W=w.useCallback(L=>{_(L),localStorage.setItem(Wl(Re),L)},[Re]),Pe=w.useCallback(L=>{P.current.forEach(X=>{URL.revokeObjectURL(X)}),P.current.clear(),L.forEach(X=>{P.current.add(X.previewUrl)}),G(L)},[]),nt=w.useCallback(L=>{const{accepted:X,rejectedCount:ce}=nP(L);ce>0&&Se({title:h("conversation.attachmentImageOnly"),tone:"error"}),X.length!==0&&G(ke=>{const Fe=rP(ke,X);return Fe.forEach(Ne=>{P.current.add(Ne.previewUrl)}),Fe})},[Se]),ot=w.useCallback(L=>{ve.current.delete(L),G(X=>{const ce=X.find(ke=>ke.id===L);return ce&&(P.current.delete(ce.previewUrl),URL.revokeObjectURL(ce.previewUrl)),X.filter(ke=>ke.id!==L)})},[]),Pt=w.useCallback(()=>{ye(L=>!L)},[]),Ot=w.useCallback(L=>{var X;C(ce=>ce.trimStart().startsWith(L)?ce:ce.trim()?`${L} ${ce.trim()}`:`${L} `),ye(!1),(X=z.current)==null||X.focus()},[]),St=w.useCallback(async L=>{const X=q;je.current+=1,F(L),ae(!0);try{const ce=await lT(L.map(ke=>({id:ke.id,text:ke.text})));return F(ce.items.map(ke=>({id:ke.id,text:ke.text}))),!0}catch(ce){return F(X),Se({title:ce instanceof Error?ce.message:h("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{ae(!1)}},[q,Se]),Jt=w.useCallback(async()=>{const L=H.trim();!L||!await St([...q,BT(L)])||(ee(""),E(!1))},[St,H,q]),Gt=w.useCallback(L=>{St(q.filter(X=>X.id!==L))},[St,q]),nn=w.useCallback((L,X)=>{const ce=q.findIndex(Me=>Me.id===L);if(ce<0)return;const ke=ce+X;if(ke<0||ke>=q.length)return;const Fe=[...q],[Ne]=Fe.splice(ce,1);Fe.splice(ke,0,Ne),St(Fe)},[St,q]),vn=w.useCallback(L=>{var X;C(L),D(!1),(X=z.current)==null||X.focus()},[]),Pn=w.useCallback(L=>{const X=L?UT(L):null,ce=(X==null?void 0:X.attachments.map(ke=>ZT(ke)))??[];ve.current=new Map(((X==null?void 0:X.attachments)??[]).map(ke=>[ke.id,ke])),Pe(ce),C((X==null?void 0:X.content)??""),ye(!1)},[Pe]);w.useEffect(()=>{if(!qe.length)return;const L=localStorage.getItem(Id(Re));if(L&&qe.some(ce=>ce.id===L)){S!==L&&N(L);return}if(qe.some(ce=>ce.id===S))return;const X=qe[0].id;N(X),localStorage.setItem(Id(Re),X)},[qe,Re,S]),w.useEffect(()=>{if(!RT(Re)||Ge.length===0)return;const L=localStorage.getItem(Wl(Re));if(L&&Ge.some(ke=>ke.value===L)){T!==L&&_(L);return}const X=e==null?void 0:e.defaultReasoningLevel;if(X&&Ge.some(ke=>ke.value===X)){T!==X&&_(X),localStorage.setItem(Wl(Re),X);return}if(Ge.some(ke=>ke.value===T))return;const ce=Ge[0].value;_(ce),localStorage.setItem(Wl(Re),ce)},[Ge,e==null?void 0:e.defaultReasoningLevel,Re,T]),w.useEffect(()=>{let L=!1;const X=je.current;return oT().then(ce=>{L||je.current!==X||F(ce.items.map(ke=>({id:ke.id,text:ke.text})))}).catch(()=>{}),()=>{L=!0}},[]),w.useEffect(()=>{Pn(t)},[t,Pn]),w.useEffect(()=>{if(!t)return;const L=t,X=new Set(R.map(Fe=>Fe.id));ve.current.forEach((Fe,Ne)=>{X.has(Ne)||ve.current.delete(Ne)});let ce=!1;async function ke(){if(b.length===0&&R.length===0){fx(L);return}const Fe=await Promise.all(R.map(async Ne=>{const Me=ve.current.get(Ne.id);return Me&&Me.fileName===Ne.file.name&&Me.fileSize===Ne.file.size&&Me.lastModified===Ne.file.lastModified&&Me.mimeType===(Ne.file.type||"image/png")?Me:{id:Ne.id,fileName:Ne.file.name,mimeType:Ne.file.type||"image/png",fileSize:Ne.file.size,lastModified:Ne.file.lastModified,contentBase64:await hy(Ne.file)}}));ce||(ve.current=new Map(Fe.map(Ne=>[Ne.id,Ne])),zT(L,{content:b,attachments:Fe}))}return ke(),()=>{ce=!0}},[R,b,t]),w.useEffect(()=>{const L=z.current;L&&(L.style.height="0px",L.style.height=`${Math.min(L.scrollHeight,120)}px`)},[b]),w.useEffect(()=>{Tt.allowed||(ve.current.clear(),Pe([]))},[Tt.allowed]),w.useEffect(()=>()=>{P.current.forEach(L=>{URL.revokeObjectURL(L)}),P.current.clear()},[]),w.useEffect(()=>{function L(){var X;(X=z.current)==null||X.focus()}return window.addEventListener(dy,L),()=>{window.removeEventListener(dy,L)}},[]);async function mn(L){if(le.current)return;const X=b.trim(),ce=R;if(X.length===0&&ce.length===0||!We.allowed||de){Se({title:de?h("conversation.runtimeRunning"):We.reason??h("conversation.capabilityDenied"),tone:"error"});return}le.current=!0,De.trigger(L==="queue"?"selection":"action"),A(!0),C(""),G([]),D(!1),E(!1),ye(!1);try{const ke=await Promise.all(ce.map(async Me=>({fileName:Me.file.name,mimeType:Me.file.type||"image/png",fileSize:Me.file.size,contentBase64:await hy(Me.file)}))),Fe=ce.map(Me=>eP(Me.file,Me.id));await(L==="queue"&&g?g:x)(X,{model:ft!=null&&ft.usesProviderDefault?void 0:S||void 0,reasoningLevel:Ue&&Ge.length>0?T:void 0,attachments:ke,attachmentMeta:Fe}),tP(ce),ce.forEach(Me=>{P.current.delete(Me.previewUrl)})}catch(ke){C(X),G(ce),Se({title:ke instanceof Error&&ke.message==="FILE_READ_FAILED"?h("conversation.attachmentReadFailed"):ke instanceof Error?ke.message:h("conversation.capabilityDenied"),tone:"error"})}finally{A(!1),le.current=!1}}async function an(L){L.preventDefault(),await mn(It?"queue":"send")}async function Ln(){if(!(!_e||!y||J))try{K(!0),De.trigger("action"),await y()}catch(L){Se({title:L instanceof Error?L.message:h("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{K(!1)}}const re=ue||m||de||!We.allowed||!xe,I=b.length===0&&!de,$=i.jsxs("section",{ref:n,className:"composer-panel",children:[i.jsx("form",{className:"composer-form",onSubmit:an,children:i.jsxs("div",{className:"composer-input-container",children:[R.length>0?i.jsx("div",{className:"composer-attachments",children:R.map(L=>i.jsxs("div",{className:"composer-attachment-card",children:[i.jsx("img",{src:L.previewUrl,alt:h("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),i.jsxs("div",{className:"composer-attachment-meta",children:[i.jsx("span",{className:"attachment-name",title:L.file.name,children:L.file.name}),i.jsxs("span",{className:"attachment-size",children:[(L.file.size/1024).toFixed(1)," KB"]})]}),i.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>ot(L.id),"aria-label":h("conversation.removeAttachment"),children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},L.id))}):null,i.jsxs("div",{className:"composer-input-wrapper",children:[i.jsx("textarea",{ref:z,className:"composer-input",value:b,placeholder:h("conversation.composerPlaceholder"),readOnly:de,"aria-readonly":de,onChange:L=>C(L.target.value),rows:1,onFocus:()=>ye(!1),onPaste:L=>{if(de||!Tt.allowed)return;const X=Array.from(L.clipboardData.items).filter(ce=>ce.kind==="file").map(ce=>ce.getAsFile()).filter(ce=>!!ce);X.length!==0&&(L.preventDefault(),nt(X))},onKeyDown:L=>{L.key==="Escape"&&ye(!1),L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),re||an(L))}}),I?i.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":h("conversation.quickPhraseTrigger"),title:h("conversation.quickPhraseTrigger"),onClick:()=>{D(!0),ye(!1)},children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M7 8h10"}),i.jsx("path",{d:"M7 12h8"}),i.jsx("path",{d:"M7 16h5"}),i.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})}):null]}),te?i.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":h("conversation.slashMenuTitle"),children:zt.map(L=>i.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>Ot(L.command),children:[i.jsx("span",{className:"composer-slash-command",children:L.command}),i.jsx("span",{className:"composer-slash-label",children:L.label})]},L.command))}):null,i.jsxs("div",{className:"composer-controls",children:[i.jsxs("div",{className:"composer-controls-left",children:[i.jsx("div",{className:"composer-provider-logo",children:iP(Re)}),i.jsx(fy,{ariaLabel:h("conversation.modelSelectorLabel"),value:S,options:yt,onChange:be}),Ue&&Ge.length>0?i.jsx(fy,{ariaLabel:h("conversation.reasoningSelectorLabel"),value:T,options:Rt,onChange:L=>W(L),compact:!0}):null,Ht?i.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:Pt,title:h("conversation.slashMenu"),children:[i.jsx("span",{className:"slash-icon",children:"/"}),i.jsx("span",{children:h("conversation.slashMenu")})]}):null,i.jsx(sP,{contextUsage:l})]}),dt?i.jsx("div",{className:"composer-send-group",children:i.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":At,title:At,children:i.jsxs("svg",{className:"composer-send-spinner",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeOpacity:"0.28",strokeWidth:"2.5"}),i.jsx("path",{d:"M20 12a8 8 0 0 0-8-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}):i.jsx("div",{className:"composer-send-group",children:Qe?i.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{Ln()},"aria-label":h("conversation.capabilityInterrupt"),title:h("conversation.capabilityInterrupt"),children:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):i.jsx("button",{className:"composer-send",type:"submit",disabled:re,"aria-label":at,title:at,children:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),i.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]})]})}),i.jsx(Fr,{open:M,title:h("conversation.quickPhraseModalTitle"),description:h("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{D(!1),E(!1)},children:i.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[i.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[i.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:i.jsx("span",{children:h("conversation.quickPhraseListLabel")})}),i.jsx("button",{type:"button",className:"primary-button",disabled:ne,onClick:()=>E(!0),children:h("conversation.quickPhraseOpenCreateAction")})]}),i.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":h("conversation.quickPhraseListLabel"),children:q.length===0?i.jsx("div",{className:"composer-quick-phrase-empty",children:h("conversation.quickPhraseEmpty")}):q.map((L,X)=>i.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[i.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>vn(L.text),children:[i.jsx("span",{className:"composer-quick-phrase-order",children:h("conversation.quickPhraseOrderLabel",{index:X+1})}),i.jsx("span",{className:"composer-quick-phrase-text",children:L.text})]}),i.jsxs("div",{className:"composer-quick-phrase-actions",children:[i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:ne||X===0,"aria-label":h("conversation.quickPhraseMoveUp"),title:h("conversation.quickPhraseMoveUp"),onClick:()=>nn(L.id,-1),children:"↑"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:ne||X===q.length-1,"aria-label":h("conversation.quickPhraseMoveDown"),title:h("conversation.quickPhraseMoveDown"),onClick:()=>nn(L.id,1),children:"↓"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:ne,"aria-label":h("conversation.quickPhraseDelete"),title:h("conversation.quickPhraseDelete"),onClick:()=>Gt(L.id),children:"×"})]})]},L.id))})]})}),i.jsx(Fr,{open:U,title:h("conversation.quickPhraseCreateModalTitle"),description:h("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>E(!1),children:i.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("conversation.quickPhraseCreateLabel")}),i.jsx("textarea",{className:"composer-quick-phrase-textarea",value:H,placeholder:h("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:L=>ee(L.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>E(!1),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:ne||H.trim().length===0,onClick:()=>{Jt()},children:h("conversation.quickPhraseCreateAction")})]})]})})]});return s?Mn.createPortal($,s):$}function iP(e){return MT(e)==="codex"?i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),i.jsx("path",{d:"M8 12h8M12 8v8"})]}):i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"9"}),i.jsx("path",{d:"M12 8v8M8 12h8"})]})}function fy({ariaLabel:e,value:t,options:n,onChange:s,compact:o=!1}){const[c,l]=w.useState(!1),d=w.useRef(null),m=w.useRef(null),p=w.useRef(null),[y,g]=w.useState(null),x=w.useId(),b=n.find(S=>S.value===t)??n[0]??null,C=w.useCallback(()=>{const S=m.current;if(!S||typeof window>"u")return;const N=S.getBoundingClientRect(),T=window.innerWidth,_=window.innerHeight,R=12,G=10,q=Math.max(160,T-R*2),F=o?140:220,M=Math.min(q,Math.max(N.width,F)),D=Math.min(Math.max(R,N.left),Math.max(R,T-M-R)),U=N.top-R,E=_-N.bottom-R,H=U>=180||U>=E;g({position:"fixed",left:D,width:M,maxWidth:q,top:H?void 0:N.bottom+G,bottom:H?_-N.top+G:void 0})},[o]);return w.useEffect(()=>{if(!c)return;function S(T){var R,G;const _=T.target;!((R=d.current)!=null&&R.contains(_))&&!((G=p.current)!=null&&G.contains(_))&&l(!1)}function N(T){T.key==="Escape"&&l(!1)}return window.addEventListener("pointerdown",S),window.addEventListener("keydown",N),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),C(),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",N),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[c,C]),b?i.jsxs("div",{ref:d,className:`composer-mac-select ${o?"is-compact":""}`,"data-open":c?"true":"false",children:[i.jsxs("button",{ref:m,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":c,"aria-controls":x,onClick:()=>l(S=>!S),children:[i.jsx("span",{className:"composer-mac-select-label",children:b.label}),i.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),c&&y&&typeof document<"u"?Mn.createPortal(i.jsx("div",{ref:p,className:"composer-mac-select-popover",style:y,role:"presentation",children:i.jsx("div",{id:x,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:n.map(S=>{const N=S.value===t;return i.jsxs("button",{type:"button",role:"option","aria-selected":N,className:`composer-mac-select-option ${N?"is-selected":""}`,onClick:()=>{s(S.value),l(!1)},children:[i.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:N?"✓":""}),i.jsx("span",{className:"composer-mac-select-option-label",children:S.label})]},S.value)})})}),document.body):null]}):null}function sP({contextUsage:e}){const[t,n]=w.useState(!1),s=w.useRef(null),o=w.useRef(null),[c,l]=w.useState(null),d=w.useId(),m=e?Math.round(e.usageRatio*100):null,p=e?Math.max(0,Math.min(e.usageRatio,1)):0,y=aP(p),g=e?oP(e.contextWindowSource):null,x=e?`${h("conversation.contextUsageTitle")} ${m}%`:h("conversation.contextUsageUnavailable"),b=w.useCallback(()=>{const C=s.current;if(!C||typeof window>"u")return;const S=C.getBoundingClientRect(),N=window.innerWidth,T=window.innerHeight,_=12,R=10,G=Math.min(240,Math.max(188,N-_*2)),q=Math.min(Math.max(_,S.left+S.width/2-G/2),Math.max(_,N-G-_)),F=S.top-_,M=T-S.bottom-_,D=F>=140||F>=M;l({position:"fixed",left:q,width:G,maxWidth:N-_*2,top:D?void 0:S.bottom+R,bottom:D?T-S.top+R:void 0})},[]);return w.useEffect(()=>{if(!t)return;function C(N){var _,R;const T=N.target;!((_=s.current)!=null&&_.contains(T))&&!((R=o.current)!=null&&R.contains(T))&&n(!1)}function S(N){N.key==="Escape"&&n(!1)}return window.addEventListener("pointerdown",C),window.addEventListener("keydown",S),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),b(),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",S),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[t,b]),i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:s,type:"button",className:`composer-context-ring ${y}`,style:{"--context-usage-progress":`${p}`},"aria-label":x,"aria-expanded":t,"aria-describedby":t?d:void 0,onClick:()=>n(C=>!C),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:i.jsx("span",{className:"composer-context-ring-value",children:m===null?"--":i.jsxs(i.Fragment,{children:[i.jsx("span",{children:m}),i.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&c&&typeof document<"u"?Mn.createPortal(i.jsx("div",{ref:o,id:d,className:"composer-context-tooltip",style:c,role:"tooltip",children:e?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"composer-context-tooltip-title",children:h("conversation.contextUsageTitle")}),i.jsxs("div",{className:"composer-context-tooltip-line",children:[m,"% · ",Dd(e.promptTokens)," /"," ",Dd(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageCachedTokens").replace("{count}",Dd(e.cachedInputTokens))}):null,g?i.jsx("div",{className:"composer-context-tooltip-meta",children:g}):null,e.isEstimated?i.jsx("div",{className:"composer-context-tooltip-meta",children:h("conversation.contextUsageEstimated")}):null]}):i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageUnavailable")})}),document.body):null]})}function aP(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function oP(e){switch(e){case"provider-log":return h("conversation.contextUsageSourceProviderLog");case"provider-runtime":return h("conversation.contextUsageSourceProviderRuntime");case"provider-config":return h("conversation.contextUsageSourceProviderConfig");case"model-map":return h("conversation.contextUsageSourceModelMap");default:return""}}function Dd(e){return new Intl.NumberFormat().format(e)}function lP(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dP={};function my(e,t){return(dP.jsx?uP:cP).test(e)}const hP=/[ \t\n\f\r]/g;function fP(e){return typeof e=="object"?e.type==="text"?py(e.value):!1:py(e)}function py(e){return e.replace(hP,"")===""}class Lo{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Lo.prototype.normal={};Lo.prototype.property={};Lo.prototype.space=void 0;function px(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new Lo(n,s,t)}function _h(e){return e.toLowerCase()}class lr{constructor(t,n){this.attribute=n,this.property=t}}lr.prototype.attribute="";lr.prototype.booleanish=!1;lr.prototype.boolean=!1;lr.prototype.commaOrSpaceSeparated=!1;lr.prototype.commaSeparated=!1;lr.prototype.defined=!1;lr.prototype.mustUseProperty=!1;lr.prototype.number=!1;lr.prototype.overloadedBoolean=!1;lr.prototype.property="";lr.prototype.spaceSeparated=!1;lr.prototype.space=void 0;let mP=0;const wt=Cs(),gn=Cs(),Fh=Cs(),Ae=Cs(),Qt=Cs(),aa=Cs(),yr=Cs();function Cs(){return 2**++mP}const Oh=Object.freeze(Object.defineProperty({__proto__:null,boolean:wt,booleanish:gn,commaOrSpaceSeparated:yr,commaSeparated:aa,number:Ae,overloadedBoolean:Fh,spaceSeparated:Qt},Symbol.toStringTag,{value:"Module"})),_d=Object.keys(Oh);class Cf extends lr{constructor(t,n,s,o){let c=-1;if(super(t,n),gy(this,"space",o),typeof s=="number")for(;++c<_d.length;){const l=_d[c];gy(this,_d[c],(s&Oh[l])===Oh[l])}}}Cf.prototype.defined=!0;function gy(e,t,n){n&&(e[t]=n)}function ua(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const c=new Cf(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[_h(s)]=s,n[_h(c.attribute)]=s}return new Lo(t,n,e.space)}const gx=ua({properties:{ariaActiveDescendant:null,ariaAtomic:gn,ariaAutoComplete:null,ariaBusy:gn,ariaChecked:gn,ariaColCount:Ae,ariaColIndex:Ae,ariaColSpan:Ae,ariaControls:Qt,ariaCurrent:null,ariaDescribedBy:Qt,ariaDetails:null,ariaDisabled:gn,ariaDropEffect:Qt,ariaErrorMessage:null,ariaExpanded:gn,ariaFlowTo:Qt,ariaGrabbed:gn,ariaHasPopup:null,ariaHidden:gn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qt,ariaLevel:Ae,ariaLive:null,ariaModal:gn,ariaMultiLine:gn,ariaMultiSelectable:gn,ariaOrientation:null,ariaOwns:Qt,ariaPlaceholder:null,ariaPosInSet:Ae,ariaPressed:gn,ariaReadOnly:gn,ariaRelevant:null,ariaRequired:gn,ariaRoleDescription:Qt,ariaRowCount:Ae,ariaRowIndex:Ae,ariaRowSpan:Ae,ariaSelected:gn,ariaSetSize:Ae,ariaSort:null,ariaValueMax:Ae,ariaValueMin:Ae,ariaValueNow:Ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function yx(e,t){return t in e?e[t]:t}function vx(e,t){return yx(e,t.toLowerCase())}const pP=ua({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:aa,acceptCharset:Qt,accessKey:Qt,action:null,allow:null,allowFullScreen:wt,allowPaymentRequest:wt,allowUserMedia:wt,alt:null,as:null,async:wt,autoCapitalize:null,autoComplete:Qt,autoFocus:wt,autoPlay:wt,blocking:Qt,capture:null,charSet:null,checked:wt,cite:null,className:Qt,cols:Ae,colSpan:null,content:null,contentEditable:gn,controls:wt,controlsList:Qt,coords:Ae|aa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wt,defer:wt,dir:null,dirName:null,disabled:wt,download:Fh,draggable:gn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wt,formTarget:null,headers:Qt,height:Ae,hidden:Fh,high:Ae,href:null,hrefLang:null,htmlFor:Qt,httpEquiv:Qt,id:null,imageSizes:null,imageSrcSet:null,inert:wt,inputMode:null,integrity:null,is:null,isMap:wt,itemId:null,itemProp:Qt,itemRef:Qt,itemScope:wt,itemType:Qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wt,low:Ae,manifest:null,max:null,maxLength:Ae,media:null,method:null,min:null,minLength:Ae,multiple:wt,muted:wt,name:null,nonce:null,noModule:wt,noValidate:wt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:wt,optimum:Ae,pattern:null,ping:Qt,placeholder:null,playsInline:wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wt,referrerPolicy:null,rel:Qt,required:wt,reversed:wt,rows:Ae,rowSpan:Ae,sandbox:Qt,scope:null,scoped:wt,seamless:wt,selected:wt,shadowRootClonable:wt,shadowRootDelegatesFocus:wt,shadowRootMode:null,shape:null,size:Ae,sizes:null,slot:null,span:Ae,spellCheck:gn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ae,step:null,style:null,tabIndex:Ae,target:null,title:null,translate:null,type:null,typeMustMatch:wt,useMap:null,value:gn,width:Ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qt,axis:null,background:null,bgColor:null,border:Ae,borderColor:null,bottomMargin:Ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wt,declare:wt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ae,leftMargin:Ae,link:null,longDesc:null,lowSrc:null,marginHeight:Ae,marginWidth:Ae,noResize:wt,noHref:wt,noShade:wt,noWrap:wt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ae,rules:null,scheme:null,scrolling:gn,standby:null,summary:null,text:null,topMargin:Ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wt,disableRemotePlayback:wt,prefix:null,property:null,results:Ae,security:null,unselectable:null},space:"html",transform:vx}),gP=ua({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:yr,accentHeight:Ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ae,amplitude:Ae,arabicForm:null,ascent:Ae,attributeName:null,attributeType:null,azimuth:Ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ae,by:null,calcMode:null,capHeight:Ae,className:Qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ae,diffuseConstant:Ae,direction:null,display:null,dur:null,divisor:Ae,dominantBaseline:null,download:wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ae,enableBackground:null,end:null,event:null,exponent:Ae,externalResourcesRequired:null,fill:null,fillOpacity:Ae,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:aa,g2:aa,glyphName:aa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ae,horizOriginX:Ae,horizOriginY:Ae,id:null,ideographic:Ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ae,k:Ae,k1:Ae,k2:Ae,k3:Ae,k4:Ae,kernelMatrix:yr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ae,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ae,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ae,overlineThickness:Ae,paintOrder:null,panose1:null,path:null,pathLength:Ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ae,pointsAtY:Ae,pointsAtZ:Ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:yr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:yr,rev:yr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:yr,requiredFeatures:yr,requiredFonts:yr,requiredFormats:yr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ae,specularExponent:Ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ae,strikethroughThickness:Ae,string:null,stroke:null,strokeDashArray:yr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ae,strokeOpacity:Ae,strokeWidth:null,style:null,surfaceScale:Ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:yr,tabIndex:Ae,tableValues:null,target:null,targetX:Ae,targetY:Ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:yr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ae,underlineThickness:Ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ae,values:null,vAlphabetic:Ae,vMathematical:Ae,vectorEffect:null,vHanging:Ae,vIdeographic:Ae,version:null,vertAdvY:Ae,vertOriginX:Ae,vertOriginY:Ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:yx}),wx=ua({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),bx=ua({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vx}),xx=ua({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),yP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},vP=/[A-Z]/g,yy=/-[a-z]/g,wP=/^data[-\w.:]+$/i;function bP(e,t){const n=_h(t);let s=t,o=lr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&wP.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(yy,kP);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!yy.test(c)){let l=c.replace(vP,xP);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=Cf}return new o(s,t)}function xP(e){return"-"+e.toLowerCase()}function kP(e){return e.charAt(1).toUpperCase()}const SP=px([gx,pP,wx,bx,xx],"html"),jf=px([gx,gP,wx,bx,xx],"svg");function CP(e){return e.join(" ").trim()}var Xs={},Fd,vy;function jP(){if(vy)return Fd;vy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
|
|
70
|
+
`,p="/",y="*",g="",x="comment",b="declaration";function C(N,T){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];T=T||{};var _=1,R=1;function G(ae){var te=ae.match(t);te&&(_+=te.length);var ye=ae.lastIndexOf(m);R=~ye?ae.length-ye:R+ae.length}function q(){var ae={line:_,column:R};return function(te){return te.position=new F(ae),U(),te}}function F(ae){this.start=ae,this.end={line:_,column:R},this.source=T.source}F.prototype.content=N;function M(ae){var te=new Error(T.source+":"+_+":"+R+": "+ae);if(te.reason=ae,te.filename=T.source,te.line=_,te.column=R,te.source=N,!T.silent)throw te}function D(ae){var te=ae.exec(N);if(te){var ye=te[0];return G(ye),N=N.slice(ye.length),te}}function U(){D(n)}function E(ae){var te;for(ae=ae||[];te=H();)te!==!1&&ae.push(te);return ae}function H(){var ae=q();if(!(p!=N.charAt(0)||y!=N.charAt(1))){for(var te=2;g!=N.charAt(te)&&(y!=N.charAt(te)||p!=N.charAt(te+1));)++te;if(te+=2,g===N.charAt(te-1))return M("End of comment missing");var ye=N.slice(2,te-2);return R+=2,G(ye),N=N.slice(te),R+=2,ae({type:x,comment:ye})}}function ee(){var ae=q(),te=D(s);if(te){if(H(),!D(o))return M("property missing ':'");var ye=D(c),J=ae({type:b,property:S(te[0].replace(e,g)),value:ye?S(ye[0].replace(e,g)):g});return D(l),J}}function ne(){var ae=[];E(ae);for(var te;te=ee();)te!==!1&&(ae.push(te),E(ae));return ae}return U(),ne()}function S(N){return N?N.replace(d,g):g}return Fd=C,Fd}var wy;function NP(){if(wy)return Xs;wy=1;var e=Xs&&Xs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.default=n;const t=e(jP());function n(s,o){let c=null;if(!s||typeof s!="string")return c;const l=(0,t.default)(s),d=typeof o=="function";return l.forEach(m=>{if(m.type!=="declaration")return;const{property:p,value:y}=m;d?o(p,y,m):y&&(c=c||{},c[p]=y)}),c}return Xs}var Ja={},by;function TP(){if(by)return Ja;by=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},l=function(p,y){return y.toUpperCase()},d=function(p,y){return"".concat(y,"-")},m=function(p,y){return y===void 0&&(y={}),c(p)?p:(p=p.toLowerCase(),y.reactCompat?p=p.replace(o,d):p=p.replace(s,d),p.replace(t,l))};return Ja.camelCase=m,Ja}var Za,xy;function PP(){if(xy)return Za;xy=1;var e=Za&&Za.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(NP()),n=TP();function s(o,c){var l={};return!o||typeof o!="string"||(0,t.default)(o,function(d,m){d&&m&&(l[(0,n.camelCase)(d,c)]=m)}),l}return s.default=s,Za=s,Za}var EP=PP();const RP=To(EP),kx=Sx("end"),Nf=Sx("start");function Sx(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function MP(e){const t=Nf(e),n=kx(e);if(t&&n)return{start:t,end:n}}function uo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ky(e.position):"start"in e||"end"in e?ky(e):"line"in e||"column"in e?Bh(e):""}function Bh(e){return Sy(e&&e.line)+":"+Sy(e&&e.column)}function ky(e){return Bh(e&&e.start)+"-"+Bh(e&&e.end)}function Sy(e){return e&&typeof e=="number"?e:1}class zn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let o="",c={},l=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?o=t:!c.cause&&t&&(l=!0,o=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?c.ruleId=s:(c.source=s.slice(0,m),c.ruleId=s.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=d?d.line:void 0,this.name=uo(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=l&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const Tf={}.hasOwnProperty,AP=new Map,LP=/[A-Z]/g,IP=new Set(["table","tbody","thead","tfoot","tr"]),DP=new Set(["td","th"]),Cx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _P(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=$P(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=HP(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?jf:SP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=jx(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function jx(e,t,n){if(t.type==="element")return FP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return OP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return UP(e,t,n);if(t.type==="mdxjsEsm")return BP(e,t);if(t.type==="root")return zP(e,t,n);if(t.type==="text")return WP(e,t)}function FP(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=jf,e.schema=o),e.ancestors.push(t);const c=Tx(e,t.tagName,!1),l=qP(e,t);let d=Ef(e,t);return IP.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!fP(m):!0})),Nx(e,l,c,t),Pf(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function OP(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}xo(e,t.position)}function BP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xo(e,t.position)}function UP(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=jf,e.schema=o),e.ancestors.push(t);const c=t.name===null?e.Fragment:Tx(e,t.name,!0),l=VP(e,t),d=Ef(e,t);return Nx(e,l,c,t),Pf(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function zP(e,t,n){const s={};return Pf(s,Ef(e,t)),e.create(t,e.Fragment,s,n)}function WP(e,t){return t.value}function Nx(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Pf(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function HP(e,t,n){return s;function s(o,c,l,d){const p=Array.isArray(l.children)?n:t;return d?p(c,l,d):p(c,l)}}function $P(e,t){return n;function n(s,o,c,l){const d=Array.isArray(c.children),m=Nf(s);return t(o,c,l,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function qP(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&Tf.call(t.properties,o)){const c=GP(e,o,t.properties[o]);if(c){const[l,d]=c;e.tableCellAlignToStyle&&l==="align"&&typeof d=="string"&&DP.has(t.tagName)?s=d:n[l]=d}}if(s){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function VP(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const l=c.expression;l.type;const d=l.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else xo(e,t.position);else{const o=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const d=s.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else xo(e,t.position);else c=s.value===null?!0:s.value;n[o]=c}return n}function Ef(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:AP;for(;++s<t.children.length;){const c=t.children[s];let l;if(e.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const p=o.get(m)||0;l=m+"-"+p,o.set(m,p+1)}}const d=jx(e,c,l);d!==void 0&&n.push(d)}return n}function GP(e,t,n){const s=bP(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?lP(n):CP(n)),s.property==="style"){let o=typeof n=="object"?n:KP(e,String(n));return e.stylePropertyNameCase==="css"&&(o=QP(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?yP[s.property]||s.property:s.attribute,n]}}function KP(e,t){try{return RP(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,o=new zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Cx+"#cannot-parse-style-attribute",o}}function Tx(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let c=-1,l;for(;++c<o.length;){const d=my(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};l=l?{type:"MemberExpression",object:l,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}s=l}else s=my(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return Tf.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);xo(e)}function xo(e,t){const n=new zn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Cx+"#cannot-handle-mdx-estrees-without-createevaluater",n}function QP(e){const t={};let n;for(n in e)Tf.call(e,n)&&(t[YP(n)]=e[n]);return t}function YP(e){let t=e.replace(LP,XP);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function XP(e){return"-"+e.toLowerCase()}const Od={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},JP={};function Rf(e,t){const n=JP,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Px(e,s,o)}function Px(e,t,n){if(ZP(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Cy(e.children,t,n)}return Array.isArray(e)?Cy(e,t,n):""}function Cy(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=Px(e[o],t,n);return s.join("")}function ZP(e){return!!(e&&typeof e=="object")}const jy=document.createElement("i");function Mf(e){const t="&"+e+";";jy.innerHTML=t;const n=jy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function kr(e,t,n,s){const o=e.length;let c=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,s.length<1e4)l=Array.from(s),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);c<s.length;)l=s.slice(c,c+1e4),l.unshift(t,0),e.splice(...l),c+=1e4,t+=1e4}function _r(e,t){return e.length>0?(kr(e,e.length,0,t),e):t}const Ny={}.hasOwnProperty;function Ex(e){const t={};let n=-1;for(;++n<e.length;)eE(t,e[n]);return t}function eE(e,t){let n;for(n in t){const o=(Ny.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let l;if(c)for(l in c){Ny.call(o,l)||(o[l]=[]);const d=c[l];tE(o[l],Array.isArray(d)?d:d?[d]:[])}}}function tE(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);kr(e,0,0,s)}function Rx(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&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 Qr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vn=Hi(/[A-Za-z]/),Bn=Hi(/[\dA-Za-z]/),nE=Hi(/[#-'*+\--9=?A-Z^-~]/);function Nc(e){return e!==null&&(e<32||e===127)}const Uh=Hi(/\d/),rE=Hi(/[\dA-Fa-f]/),iE=Hi(/[!-/:-@[-`{-~]/);function st(e){return e!==null&&e<-2}function qt(e){return e!==null&&(e<0||e===32)}function Nt(e){return e===-2||e===-1||e===32}const Bc=Hi(new RegExp("\\p{P}|\\p{S}","u")),ws=Hi(/\s/);function Hi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function da(e){const t=[];let n=-1,s=0,o=0;for(;++n<e.length;){const c=e.charCodeAt(n);let l="";if(c===37&&Bn(e.charCodeAt(n+1))&&Bn(e.charCodeAt(n+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(l=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(n+1);c<56320&&d>56319&&d<57344?(l=String.fromCharCode(c,d),o=1):l="�"}else l=String.fromCharCode(c);l&&(t.push(e.slice(s,n),encodeURIComponent(l)),s=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(s)}function Lt(e,t,n,s){const o=s?s-1:Number.POSITIVE_INFINITY;let c=0;return l;function l(m){return Nt(m)?(e.enter(n),d(m)):t(m)}function d(m){return Nt(m)&&c++<o?(e.consume(m),d):(e.exit(n),t(m))}}const sE={tokenize:aE};function aE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,o);let n;return t;function s(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Lt(e,t,"linePrefix")}function o(d){return e.enter("paragraph"),c(d)}function c(d){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,l(d)}function l(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return st(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),l)}}const oE={tokenize:lE},Ty={tokenize:cE};function lE(e){const t=this,n=[];let s=0,o,c,l;return d;function d(R){if(s<n.length){const G=n[s];return t.containerState=G[1],e.attempt(G[0].continuation,m,p)(R)}return p(R)}function m(R){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&_();const G=t.events.length;let q=G,F;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){F=t.events[q][1].end;break}T(s);let M=G;for(;M<t.events.length;)t.events[M][1].end={...F},M++;return kr(t.events,q+1,0,t.events.slice(G)),t.events.length=M,p(R)}return d(R)}function p(R){if(s===n.length){if(!o)return x(R);if(o.currentConstruct&&o.currentConstruct.concrete)return C(R);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ty,y,g)(R)}function y(R){return o&&_(),T(s),x(R)}function g(R){return t.parser.lazy[t.now().line]=s!==n.length,l=t.now().offset,C(R)}function x(R){return t.containerState={},e.attempt(Ty,b,C)(R)}function b(R){return s++,n.push([t.currentConstruct,t.containerState]),x(R)}function C(R){if(R===null){o&&_(),T(0),e.consume(R);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),S(R)}function S(R){if(R===null){N(e.exit("chunkFlow"),!0),T(0),e.consume(R);return}return st(R)?(e.consume(R),N(e.exit("chunkFlow")),s=0,t.interrupt=void 0,d):(e.consume(R),S)}function N(R,G){const q=t.sliceStream(R);if(G&&q.push(null),R.previous=c,c&&(c.next=R),c=R,o.defineSkip(R.start),o.write(q),t.parser.lazy[R.start.line]){let F=o.events.length;for(;F--;)if(o.events[F][1].start.offset<l&&(!o.events[F][1].end||o.events[F][1].end.offset>l))return;const M=t.events.length;let D=M,U,E;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(U){E=t.events[D][1].end;break}U=!0}for(T(s),F=M;F<t.events.length;)t.events[F][1].end={...E},F++;kr(t.events,D+1,0,t.events.slice(M)),t.events.length=F}}function T(R){let G=n.length;for(;G-- >R;){const q=n[G];t.containerState=q[1],q[0].exit.call(t,e)}n.length=R}function _(){o.write([null]),c=void 0,o=void 0,t.containerState._closeFlow=void 0}}function cE(e,t,n){return Lt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function la(e){if(e===null||qt(e)||ws(e))return 1;if(Bc(e))return 2}function Uc(e,t,n){const s=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!s.includes(c)&&(t=c(t,n),s.push(c))}return t}const zh={name:"attention",resolveAll:uE,tokenize:dE};function uE(e,t){let n=-1,s,o,c,l,d,m,p,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},x={...e[n][1].start};Py(g,-m),Py(x,m),l={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},c={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},o={type:m>1?"strong":"emphasis",start:{...l.start},end:{...d.end}},e[s][1].end={...l.start},e[n][1].start={...d.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=_r(p,[["enter",e[s][1],t],["exit",e[s][1],t]])),p=_r(p,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",c,t]]),p=_r(p,Uc(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),p=_r(p,[["exit",c,t],["enter",d,t],["exit",d,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,p=_r(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,kr(e,s-1,n-s+3,p),n=s+p.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function dE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=la(s);let c;return l;function l(m){return c=m,e.enter("attentionSequence"),d(m)}function d(m){if(m===c)return e.consume(m),d;const p=e.exit("attentionSequence"),y=la(m),g=!y||y===2&&o||n.includes(m),x=!o||o===2&&y||n.includes(s);return p._open=!!(c===42?g:g&&(o||!x)),p._close=!!(c===42?x:x&&(y||!g)),t(m)}}function Py(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hE={name:"autolink",tokenize:fE};function fE(e,t,n){let s=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return Vn(b)?(e.consume(b),l):b===64?n(b):p(b)}function l(b){return b===43||b===45||b===46||Bn(b)?(s=1,d(b)):p(b)}function d(b){return b===58?(e.consume(b),s=0,m):(b===43||b===45||b===46||Bn(b))&&s++<32?(e.consume(b),d):(s=0,p(b))}function m(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Nc(b)?n(b):(e.consume(b),m)}function p(b){return b===64?(e.consume(b),y):nE(b)?(e.consume(b),p):n(b)}function y(b){return Bn(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),s=0,y):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):x(b)}function x(b){if((b===45||Bn(b))&&s++<63){const C=b===45?x:g;return e.consume(b),C}return n(b)}}const Io={partial:!0,tokenize:mE};function mE(e,t,n){return s;function s(c){return Nt(c)?Lt(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||st(c)?t(c):n(c)}}const Mx={continuation:{tokenize:gE},exit:yE,name:"blockQuote",tokenize:pE};function pE(e,t,n){const s=this;return o;function o(l){if(l===62){const d=s.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),c}return n(l)}function c(l){return Nt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function gE(e,t,n){const s=this;return o;function o(l){return Nt(l)?Lt(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):c(l)}function c(l){return e.attempt(Mx,t,n)(l)}}function yE(e){e.exit("blockQuote")}const Ax={name:"characterEscape",tokenize:vE};function vE(e,t,n){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return iE(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Lx={name:"characterReference",tokenize:wE};function wE(e,t,n){const s=this;let o=0,c,l;return d;function d(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,l=Bn,y(g))}function p(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,l=rE,y):(e.enter("characterReferenceValue"),c=7,l=Uh,y(g))}function y(g){if(g===59&&o){const x=e.exit("characterReferenceValue");return l===Bn&&!Mf(s.sliceSerialize(x))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&o++<c?(e.consume(g),y):n(g)}}const Ey={partial:!0,tokenize:xE},Ry={concrete:!0,name:"codeFenced",tokenize:bE};function bE(e,t,n){const s=this,o={partial:!0,tokenize:q};let c=0,l=0,d;return m;function m(F){return p(F)}function p(F){const M=s.events[s.events.length-1];return c=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,d=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(F)}function y(F){return F===d?(l++,e.consume(F),y):l<3?n(F):(e.exit("codeFencedFenceSequence"),Nt(F)?Lt(e,g,"whitespace")(F):g(F))}function g(F){return F===null||st(F)?(e.exit("codeFencedFence"),s.interrupt?t(F):e.check(Ey,S,G)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(F))}function x(F){return F===null||st(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(F)):Nt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Lt(e,b,"whitespace")(F)):F===96&&F===d?n(F):(e.consume(F),x)}function b(F){return F===null||st(F)?g(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(F))}function C(F){return F===null||st(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(F)):F===96&&F===d?n(F):(e.consume(F),C)}function S(F){return e.attempt(o,G,N)(F)}function N(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),T}function T(F){return c>0&&Nt(F)?Lt(e,_,"linePrefix",c+1)(F):_(F)}function _(F){return F===null||st(F)?e.check(Ey,S,G)(F):(e.enter("codeFlowValue"),R(F))}function R(F){return F===null||st(F)?(e.exit("codeFlowValue"),_(F)):(e.consume(F),R)}function G(F){return e.exit("codeFenced"),t(F)}function q(F,M,D){let U=0;return E;function E(te){return F.enter("lineEnding"),F.consume(te),F.exit("lineEnding"),H}function H(te){return F.enter("codeFencedFence"),Nt(te)?Lt(F,ee,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):ee(te)}function ee(te){return te===d?(F.enter("codeFencedFenceSequence"),ne(te)):D(te)}function ne(te){return te===d?(U++,F.consume(te),ne):U>=l?(F.exit("codeFencedFenceSequence"),Nt(te)?Lt(F,ae,"whitespace")(te):ae(te)):D(te)}function ae(te){return te===null||st(te)?(F.exit("codeFencedFence"),M(te)):D(te)}}}function xE(e,t,n){const s=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c)}function c(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}const Bd={name:"codeIndented",tokenize:SE},kE={partial:!0,tokenize:CE};function SE(e,t,n){const s=this;return o;function o(p){return e.enter("codeIndented"),Lt(e,c,"linePrefix",5)(p)}function c(p){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?l(p):n(p)}function l(p){return p===null?m(p):st(p)?e.attempt(kE,l,m)(p):(e.enter("codeFlowValue"),d(p))}function d(p){return p===null||st(p)?(e.exit("codeFlowValue"),l(p)):(e.consume(p),d)}function m(p){return e.exit("codeIndented"),t(p)}}function CE(e,t,n){const s=this;return o;function o(l){return s.parser.lazy[s.now().line]?n(l):st(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):Lt(e,c,"linePrefix",5)(l)}function c(l){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(l):st(l)?o(l):n(l)}}const jE={name:"codeText",previous:TE,resolve:NE,tokenize:PE};function NE(e){let t=e.length-4,n=3,s,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)o===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(o=s):(s===t||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),t-=s-o-2,s=o+2),o=void 0);return e}function TE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function PE(e,t,n){let s=0,o,c;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),s++,d):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(c=e.enter("codeTextSequence"),o=0,y(g)):st(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),p(g))}function p(g){return g===null||g===32||g===96||st(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),p)}function y(g){return g===96?(e.consume(g),o++,y):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(c.type="codeTextData",p(g))}}class EE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const o=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&eo(this.left,s),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),eo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),eo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);eo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);eo(this.left,n.reverse())}}}function eo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ix(e){const t={};let n=-1,s,o,c,l,d,m,p;const y=new EE(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(s=y.get(n),n&&s[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,RE(y,n)),n=t[n],p=!0);else if(s[1]._container){for(c=n,o=void 0;c--;)if(l=y.get(c),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(o&&(y.get(o)[1].type="lineEndingBlank"),l[1].type="lineEnding",o=c);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;o&&(s[1].end={...y.get(o)[1].start},d=y.slice(o,n),d.unshift(s),y.splice(o,n-o+1,d))}}return kr(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!p}function RE(e,t){const n=e.get(t)[1],s=e.get(t)[2];let o=t-1;const c=[];let l=n._tokenizer;l||(l=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const d=l.events,m=[],p={};let y,g,x=-1,b=n,C=0,S=0;const N=[S];for(;b;){for(;e.get(++o)[1]!==b;);c.push(o),b._tokenizer||(y=s.sliceStream(b),b.next||y.push(null),g&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(y),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++x<d.length;)d[x][0]==="exit"&&d[x-1][0]==="enter"&&d[x][1].type===d[x-1][1].type&&d[x][1].start.line!==d[x][1].end.line&&(S=x+1,N.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):N.pop(),x=N.length;x--;){const T=d.slice(N[x],N[x+1]),_=c.pop();m.push([_,_+T.length-1]),e.splice(_,2,T)}for(m.reverse(),x=-1;++x<m.length;)p[C+m[x][0]]=C+m[x][1],C+=m[x][1]-m[x][0]-1;return p}const ME={resolve:LE,tokenize:IE},AE={partial:!0,tokenize:DE};function LE(e){return Ix(e),e}function IE(e,t){let n;return s;function s(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(d)}function o(d){return d===null?c(d):st(d)?e.check(AE,l,c)(d):(e.consume(d),o)}function c(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function l(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function DE(e,t,n){const s=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Lt(e,c,"linePrefix")}function c(l){if(l===null||st(l))return n(l);const d=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(l):e.interrupt(s.parser.constructs.flow,n,t)(l)}}function Dx(e,t,n,s,o,c,l,d,m){const p=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(T){return T===60?(e.enter(s),e.enter(o),e.enter(c),e.consume(T),e.exit(c),x):T===null||T===32||T===41||Nc(T)?n(T):(e.enter(s),e.enter(l),e.enter(d),e.enter("chunkString",{contentType:"string"}),S(T))}function x(T){return T===62?(e.enter(c),e.consume(T),e.exit(c),e.exit(o),e.exit(s),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===62?(e.exit("chunkString"),e.exit(d),x(T)):T===null||T===60||st(T)?n(T):(e.consume(T),T===92?C:b)}function C(T){return T===60||T===62||T===92?(e.consume(T),b):b(T)}function S(T){return!y&&(T===null||T===41||qt(T))?(e.exit("chunkString"),e.exit(d),e.exit(l),e.exit(s),t(T)):y<p&&T===40?(e.consume(T),y++,S):T===41?(e.consume(T),y--,S):T===null||T===32||T===40||Nc(T)?n(T):(e.consume(T),T===92?N:S)}function N(T){return T===40||T===41||T===92?(e.consume(T),S):S(T)}}function _x(e,t,n,s,o,c){const l=this;let d=0,m;return p;function p(b){return e.enter(s),e.enter(o),e.consume(b),e.exit(o),e.enter(c),y}function y(b){return d>999||b===null||b===91||b===93&&!m||b===94&&!d&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(e.exit(c),e.enter(o),e.consume(b),e.exit(o),e.exit(s),t):st(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||st(b)||d++>999?(e.exit("chunkString"),y(b)):(e.consume(b),m||(m=!Nt(b)),b===92?x:g)}function x(b){return b===91||b===92||b===93?(e.consume(b),d++,g):g(b)}}function Fx(e,t,n,s,o,c){let l;return d;function d(x){return x===34||x===39||x===40?(e.enter(s),e.enter(o),e.consume(x),e.exit(o),l=x===40?41:x,m):n(x)}function m(x){return x===l?(e.enter(o),e.consume(x),e.exit(o),e.exit(s),t):(e.enter(c),p(x))}function p(x){return x===l?(e.exit(c),m(l)):x===null?n(x):st(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),Lt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===l||x===null||st(x)?(e.exit("chunkString"),p(x)):(e.consume(x),x===92?g:y)}function g(x){return x===l||x===92?(e.consume(x),y):y(x)}}function ho(e,t){let n;return s;function s(o){return st(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,s):Nt(o)?Lt(e,s,n?"linePrefix":"lineSuffix")(o):t(o)}}const _E={name:"definition",tokenize:OE},FE={partial:!0,tokenize:BE};function OE(e,t,n){const s=this;let o;return c;function c(b){return e.enter("definition"),l(b)}function l(b){return _x.call(s,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return o=Qr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):n(b)}function m(b){return qt(b)?ho(e,p)(b):p(b)}function p(b){return Dx(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function y(b){return e.attempt(FE,g,g)(b)}function g(b){return Nt(b)?Lt(e,x,"whitespace")(b):x(b)}function x(b){return b===null||st(b)?(e.exit("definition"),s.parser.defined.push(o),t(b)):n(b)}}function BE(e,t,n){return s;function s(d){return qt(d)?ho(e,o)(d):n(d)}function o(d){return Fx(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return Nt(d)?Lt(e,l,"whitespace")(d):l(d)}function l(d){return d===null||st(d)?t(d):n(d)}}const UE={name:"hardBreakEscape",tokenize:zE};function zE(e,t,n){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return st(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const WE={name:"headingAtx",resolve:HE,tokenize:$E};function HE(e,t){let n=e.length-2,s=3,o,c;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},c={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},kr(e,s,n-s+1,[["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t]])),e}function $E(e,t,n){let s=0;return o;function o(y){return e.enter("atxHeading"),c(y)}function c(y){return e.enter("atxHeadingSequence"),l(y)}function l(y){return y===35&&s++<6?(e.consume(y),l):y===null||qt(y)?(e.exit("atxHeadingSequence"),d(y)):n(y)}function d(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||st(y)?(e.exit("atxHeading"),t(y)):Nt(y)?Lt(e,d,"whitespace")(y):(e.enter("atxHeadingText"),p(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),d(y))}function p(y){return y===null||y===35||qt(y)?(e.exit("atxHeadingText"),d(y)):(e.consume(y),p)}}const qE=["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"],My=["pre","script","style","textarea"],VE={concrete:!0,name:"htmlFlow",resolveTo:QE,tokenize:YE},GE={partial:!0,tokenize:JE},KE={partial:!0,tokenize:XE};function QE(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 YE(e,t,n){const s=this;let o,c,l,d,m;return p;function p(P){return y(P)}function y(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),g}function g(P){return P===33?(e.consume(P),x):P===47?(e.consume(P),c=!0,S):P===63?(e.consume(P),o=3,s.interrupt?t:A):Vn(P)?(e.consume(P),l=String.fromCharCode(P),N):n(P)}function x(P){return P===45?(e.consume(P),o=2,b):P===91?(e.consume(P),o=5,d=0,C):Vn(P)?(e.consume(P),o=4,s.interrupt?t:A):n(P)}function b(P){return P===45?(e.consume(P),s.interrupt?t:A):n(P)}function C(P){const ve="CDATA[";return P===ve.charCodeAt(d++)?(e.consume(P),d===ve.length?s.interrupt?t:ee:C):n(P)}function S(P){return Vn(P)?(e.consume(P),l=String.fromCharCode(P),N):n(P)}function N(P){if(P===null||P===47||P===62||qt(P)){const ve=P===47,je=l.toLowerCase();return!ve&&!c&&My.includes(je)?(o=1,s.interrupt?t(P):ee(P)):qE.includes(l.toLowerCase())?(o=6,ve?(e.consume(P),T):s.interrupt?t(P):ee(P)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(P):c?_(P):R(P))}return P===45||Bn(P)?(e.consume(P),l+=String.fromCharCode(P),N):n(P)}function T(P){return P===62?(e.consume(P),s.interrupt?t:ee):n(P)}function _(P){return Nt(P)?(e.consume(P),_):E(P)}function R(P){return P===47?(e.consume(P),E):P===58||P===95||Vn(P)?(e.consume(P),G):Nt(P)?(e.consume(P),R):E(P)}function G(P){return P===45||P===46||P===58||P===95||Bn(P)?(e.consume(P),G):q(P)}function q(P){return P===61?(e.consume(P),F):Nt(P)?(e.consume(P),q):R(P)}function F(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),m=P,M):Nt(P)?(e.consume(P),F):D(P)}function M(P){return P===m?(e.consume(P),m=null,U):P===null||st(P)?n(P):(e.consume(P),M)}function D(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||qt(P)?q(P):(e.consume(P),D)}function U(P){return P===47||P===62||Nt(P)?R(P):n(P)}function E(P){return P===62?(e.consume(P),H):n(P)}function H(P){return P===null||st(P)?ee(P):Nt(P)?(e.consume(P),H):n(P)}function ee(P){return P===45&&o===2?(e.consume(P),ye):P===60&&o===1?(e.consume(P),J):P===62&&o===4?(e.consume(P),z):P===63&&o===3?(e.consume(P),A):P===93&&o===5?(e.consume(P),ue):st(P)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(GE,le,ne)(P)):P===null||st(P)?(e.exit("htmlFlowData"),ne(P)):(e.consume(P),ee)}function ne(P){return e.check(KE,ae,le)(P)}function ae(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),te}function te(P){return P===null||st(P)?ne(P):(e.enter("htmlFlowData"),ee(P))}function ye(P){return P===45?(e.consume(P),A):ee(P)}function J(P){return P===47?(e.consume(P),l="",K):ee(P)}function K(P){if(P===62){const ve=l.toLowerCase();return My.includes(ve)?(e.consume(P),z):ee(P)}return Vn(P)&&l.length<8?(e.consume(P),l+=String.fromCharCode(P),K):ee(P)}function ue(P){return P===93?(e.consume(P),A):ee(P)}function A(P){return P===62?(e.consume(P),z):P===45&&o===2?(e.consume(P),A):ee(P)}function z(P){return P===null||st(P)?(e.exit("htmlFlowData"),le(P)):(e.consume(P),z)}function le(P){return e.exit("htmlFlow"),t(P)}}function XE(e,t,n){const s=this;return o;function o(l){return st(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c):n(l)}function c(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}function JE(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Io,t,n)}}const ZE={name:"htmlText",tokenize:eR};function eR(e,t,n){const s=this;let o,c,l;return d;function d(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),p):A===47?(e.consume(A),q):A===63?(e.consume(A),R):Vn(A)?(e.consume(A),D):n(A)}function p(A){return A===45?(e.consume(A),y):A===91?(e.consume(A),c=0,C):Vn(A)?(e.consume(A),_):n(A)}function y(A){return A===45?(e.consume(A),b):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),x):st(A)?(l=g,J(A)):(e.consume(A),g)}function x(A){return A===45?(e.consume(A),b):g(A)}function b(A){return A===62?ye(A):A===45?x(A):g(A)}function C(A){const z="CDATA[";return A===z.charCodeAt(c++)?(e.consume(A),c===z.length?S:C):n(A)}function S(A){return A===null?n(A):A===93?(e.consume(A),N):st(A)?(l=S,J(A)):(e.consume(A),S)}function N(A){return A===93?(e.consume(A),T):S(A)}function T(A){return A===62?ye(A):A===93?(e.consume(A),T):S(A)}function _(A){return A===null||A===62?ye(A):st(A)?(l=_,J(A)):(e.consume(A),_)}function R(A){return A===null?n(A):A===63?(e.consume(A),G):st(A)?(l=R,J(A)):(e.consume(A),R)}function G(A){return A===62?ye(A):R(A)}function q(A){return Vn(A)?(e.consume(A),F):n(A)}function F(A){return A===45||Bn(A)?(e.consume(A),F):M(A)}function M(A){return st(A)?(l=M,J(A)):Nt(A)?(e.consume(A),M):ye(A)}function D(A){return A===45||Bn(A)?(e.consume(A),D):A===47||A===62||qt(A)?U(A):n(A)}function U(A){return A===47?(e.consume(A),ye):A===58||A===95||Vn(A)?(e.consume(A),E):st(A)?(l=U,J(A)):Nt(A)?(e.consume(A),U):ye(A)}function E(A){return A===45||A===46||A===58||A===95||Bn(A)?(e.consume(A),E):H(A)}function H(A){return A===61?(e.consume(A),ee):st(A)?(l=H,J(A)):Nt(A)?(e.consume(A),H):U(A)}function ee(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),o=A,ne):st(A)?(l=ee,J(A)):Nt(A)?(e.consume(A),ee):(e.consume(A),ae)}function ne(A){return A===o?(e.consume(A),o=void 0,te):A===null?n(A):st(A)?(l=ne,J(A)):(e.consume(A),ne)}function ae(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||qt(A)?U(A):(e.consume(A),ae)}function te(A){return A===47||A===62||qt(A)?U(A):n(A)}function ye(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function J(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),K}function K(A){return Nt(A)?Lt(e,ue,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ue(A)}function ue(A){return e.enter("htmlTextData"),l(A)}}const Af={name:"labelEnd",resolveAll:iR,resolveTo:sR,tokenize:aR},tR={tokenize:oR},nR={tokenize:lR},rR={tokenize:cR};function iR(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",t+=o}}return e.length!==n.length&&kr(e,0,e.length,n),e}function sR(e,t){let n=e.length,s=0,o,c,l,d;for(;n--;)if(o=e[n][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=n,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(l=n);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[l][1].end}},y={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[l-2][1].start}};return d=[["enter",m,t],["enter",p,t]],d=_r(d,e.slice(c+1,c+s+3)),d=_r(d,[["enter",y,t]]),d=_r(d,Uc(t.parser.constructs.insideSpan.null,e.slice(c+s+4,l-3),t)),d=_r(d,[["exit",y,t],e[l-2],e[l-1],["exit",p,t]]),d=_r(d,e.slice(l+1)),d=_r(d,[["exit",m,t]]),kr(e,c,e.length,d),e}function aR(e,t,n){const s=this;let o=s.events.length,c,l;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){c=s.events[o][1];break}return d;function d(x){return c?c._inactive?g(x):(l=s.parser.defined.includes(Qr(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):n(x)}function m(x){return x===40?e.attempt(tR,y,l?y:g)(x):x===91?e.attempt(nR,y,l?p:g)(x):l?y(x):g(x)}function p(x){return e.attempt(rR,y,g)(x)}function y(x){return t(x)}function g(x){return c._balanced=!0,n(x)}}function oR(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return qt(g)?ho(e,c)(g):c(g)}function c(g){return g===41?y(g):Dx(e,l,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return qt(g)?ho(e,m)(g):y(g)}function d(g){return n(g)}function m(g){return g===34||g===39||g===40?Fx(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function p(g){return qt(g)?ho(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function lR(e,t,n){const s=this;return o;function o(d){return _x.call(s,e,c,l,"reference","referenceMarker","referenceString")(d)}function c(d){return s.parser.defined.includes(Qr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function l(d){return n(d)}}function cR(e,t,n){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const uR={name:"labelStartImage",resolveAll:Af.resolveAll,tokenize:dR};function dR(e,t,n){const s=this;return o;function o(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),l):n(d)}function l(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):t(d)}}const hR={name:"labelStartLink",resolveAll:Af.resolveAll,tokenize:fR};function fR(e,t,n){const s=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),c}function c(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const Ud={name:"lineEnding",tokenize:mR};function mR(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Lt(e,t,"linePrefix")}}const uc={name:"thematicBreak",tokenize:pR};function pR(e,t,n){let s=0,o;return c;function c(p){return e.enter("thematicBreak"),l(p)}function l(p){return o=p,d(p)}function d(p){return p===o?(e.enter("thematicBreakSequence"),m(p)):s>=3&&(p===null||st(p))?(e.exit("thematicBreak"),t(p)):n(p)}function m(p){return p===o?(e.consume(p),s++,m):(e.exit("thematicBreakSequence"),Nt(p)?Lt(e,d,"whitespace")(p):d(p))}}const sr={continuation:{tokenize:wR},exit:xR,name:"list",tokenize:vR},gR={partial:!0,tokenize:kR},yR={partial:!0,tokenize:bR};function vR(e,t,n){const s=this,o=s.events[s.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=0;return d;function d(b){const C=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:Uh(b)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(uc,n,p)(b):p(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return n(b)}function m(b){return Uh(b)&&++l<10?(e.consume(b),m):(!s.interrupt||l<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(Io,s.interrupt?n:y,e.attempt(gR,x,g))}function y(b){return s.containerState.initialBlankLine=!0,c++,x(b)}function g(b){return Nt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),x):n(b)}function x(b){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function wR(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Io,o,c);function o(d){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Lt(e,t,"listItemIndent",s.containerState.size+1)(d)}function c(d){return s.containerState.furtherBlankLines||!Nt(d)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,l(d)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(yR,t,l)(d))}function l(d){return s.containerState._closeFlow=!0,s.interrupt=void 0,Lt(e,e.attempt(sr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function bR(e,t,n){const s=this;return Lt(e,o,"listItemIndent",s.containerState.size+1);function o(c){const l=s.events[s.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===s.containerState.size?t(c):n(c)}}function xR(e){e.exit(this.containerState.type)}function kR(e,t,n){const s=this;return Lt(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const l=s.events[s.events.length-1];return!Nt(c)&&l&&l[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Ay={name:"setextUnderline",resolveTo:SR,tokenize:CR};function SR(e,t){let n=e.length,s,o,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const l={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",l,t]),e.splice(c+1,0,["exit",e[s][1],t]),e[s][1].end={...e[c][1].end}):e[s][1]=l,e.push(["exit",l,t]),e}function CR(e,t,n){const s=this;let o;return c;function c(p){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),o=p,l(p)):n(p)}function l(p){return e.enter("setextHeadingLineSequence"),d(p)}function d(p){return p===o?(e.consume(p),d):(e.exit("setextHeadingLineSequence"),Nt(p)?Lt(e,m,"lineSuffix")(p):m(p))}function m(p){return p===null||st(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const jR={tokenize:NR};function NR(e){const t=this,n=e.attempt(Io,s,e.attempt(this.parser.constructs.flowInitial,o,Lt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(ME,o)),"linePrefix")));return n;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const TR={resolveAll:Bx()},PR=Ox("string"),ER=Ox("text");function Ox(e){return{resolveAll:Bx(e==="text"?RR:void 0),tokenize:t};function t(n){const s=this,o=this.parser.constructs[e],c=n.attempt(o,l,d);return l;function l(y){return p(y)?c(y):d(y)}function d(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),m}function m(y){return p(y)?(n.exit("data"),c(y)):(n.consume(y),m)}function p(y){if(y===null)return!0;const g=o[y];let x=-1;if(g)for(;++x<g.length;){const b=g[x];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function Bx(e){return t;function t(n,s){let o=-1,c;for(;++o<=n.length;)c===void 0?n[o]&&n[o][1].type==="data"&&(c=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==c+2&&(n[c][1].end=n[o-1][1].end,n.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(n,s):n}}function RR(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],o=t.sliceStream(s);let c=o.length,l=-1,d=0,m;for(;c--;){const p=o[c];if(typeof p=="string"){for(l=p.length;p.charCodeAt(l-1)===32;)d++,l--;if(l)break;l=-1}else if(p===-2)m=!0,d++;else if(p!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const p={type:n===e.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?l:s.start._bufferIndex+l,_index:s.start._index+c,line:s.end.line,column:s.end.column-d,offset:s.end.offset-d},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const MR={42:sr,43:sr,45:sr,48:sr,49:sr,50:sr,51:sr,52:sr,53:sr,54:sr,55:sr,56:sr,57:sr,62:Mx},AR={91:_E},LR={[-2]:Bd,[-1]:Bd,32:Bd},IR={35:WE,42:uc,45:[Ay,uc],60:VE,61:Ay,95:uc,96:Ry,126:Ry},DR={38:Lx,92:Ax},_R={[-5]:Ud,[-4]:Ud,[-3]:Ud,33:uR,38:Lx,42:zh,60:[hE,ZE],91:hR,92:[UE,Ax],93:Af,95:zh,96:jE},FR={null:[zh,TR]},OR={null:[42,95]},BR={null:[]},UR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:OR,contentInitial:AR,disable:BR,document:MR,flow:IR,flowInitial:LR,insideSpan:FR,string:DR,text:_R},Symbol.toStringTag,{value:"Module"}));function zR(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},c=[];let l=[],d=[];const m={attempt:M(q),check:M(F),consume:_,enter:R,exit:G,interrupt:M(F,{interrupt:!0})},p={code:null,containerState:{},defineSkip:S,events:[],now:C,parser:e,previous:null,sliceSerialize:x,sliceStream:b,write:g};let y=t.tokenize.call(p,m);return t.resolveAll&&c.push(t),p;function g(H){return l=_r(l,H),N(),l[l.length-1]!==null?[]:(D(t,0),p.events=Uc(c,p.events,p),p.events)}function x(H,ee){return HR(b(H),ee)}function b(H){return WR(l,H)}function C(){const{_bufferIndex:H,_index:ee,line:ne,column:ae,offset:te}=s;return{_bufferIndex:H,_index:ee,line:ne,column:ae,offset:te}}function S(H){o[H.line]=H.column,E()}function N(){let H;for(;s._index<l.length;){const ee=l[s._index];if(typeof ee=="string")for(H=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===H&&s._bufferIndex<ee.length;)T(ee.charCodeAt(s._bufferIndex));else T(ee)}}function T(H){y=y(H)}function _(H){st(H)?(s.line++,s.column=1,s.offset+=H===-3?2:1,E()):H!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===l[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=H}function R(H,ee){const ne=ee||{};return ne.type=H,ne.start=C(),p.events.push(["enter",ne,p]),d.push(ne),ne}function G(H){const ee=d.pop();return ee.end=C(),p.events.push(["exit",ee,p]),ee}function q(H,ee){D(H,ee.from)}function F(H,ee){ee.restore()}function M(H,ee){return ne;function ne(ae,te,ye){let J,K,ue,A;return Array.isArray(ae)?le(ae):"tokenize"in ae?le([ae]):z(ae);function z(Se){return De;function De(Re){const We=Re!==null&&Se[Re],ct=Re!==null&&Se.null,Tt=[...Array.isArray(We)?We:We?[We]:[],...Array.isArray(ct)?ct:ct?[ct]:[]];return le(Tt)(Re)}}function le(Se){return J=Se,K=0,Se.length===0?ye:P(Se[K])}function P(Se){return De;function De(Re){return A=U(),ue=Se,Se.partial||(p.currentConstruct=Se),Se.name&&p.parser.constructs.disable.null.includes(Se.name)?je():Se.tokenize.call(ee?Object.assign(Object.create(p),ee):p,m,ve,je)(Re)}}function ve(Se){return H(ue,A),te}function je(Se){return A.restore(),++K<J.length?P(J[K]):ye}}}function D(H,ee){H.resolveAll&&!c.includes(H)&&c.push(H),H.resolve&&kr(p.events,ee,p.events.length-ee,H.resolve(p.events.slice(ee),p)),H.resolveTo&&(p.events=H.resolveTo(p.events,p))}function U(){const H=C(),ee=p.previous,ne=p.currentConstruct,ae=p.events.length,te=Array.from(d);return{from:ae,restore:ye};function ye(){s=H,p.previous=ee,p.currentConstruct=ne,p.events.length=ae,d=te,E()}}function E(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function WR(e,t){const n=t.start._index,s=t.start._bufferIndex,o=t.end._index,c=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(s,c)];else{if(l=e.slice(n,o),s>-1){const d=l[0];typeof d=="string"?l[0]=d.slice(s):l.shift()}c>0&&l.push(e[o].slice(0,c))}return l}function HR(e,t){let n=-1;const s=[];let o;for(;++n<e.length;){const c=e[n];let l;if(typeof c=="string")l=c;else switch(c){case-5:{l="\r";break}case-4:{l=`
|
|
71
|
+
`;break}case-3:{l=`\r
|
|
72
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(c)}o=c===-2,s.push(l)}return s.join("")}function $R(e){const s={constructs:Ex([UR,...(e||{}).extensions||[]]),content:o(sE),defined:[],document:o(oE),flow:o(jR),lazy:{},string:o(PR),text:o(ER)};return s;function o(c){return l;function l(d){return zR(s,c,d)}}}function qR(e){for(;!Ix(e););return e}const Ly=/[\0\t\n\r]/g;function VR(){let e=1,t="",n=!0,s;return o;function o(c,l,d){const m=[];let p,y,g,x,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(l||void 0).decode(c)),g=0,t="",n&&(c.charCodeAt(0)===65279&&g++,n=void 0);g<c.length;){if(Ly.lastIndex=g,p=Ly.exec(c),x=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(x),!p){t=c.slice(g);break}if(b===10&&g===x&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),g<x&&(m.push(c.slice(g,x)),e+=x-g),b){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return d&&(s&&m.push(-5),t&&m.push(t),m.push(null)),m}}const GR=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function KR(e){return e.replace(GR,QR)}function QR(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),c=o===120||o===88;return Rx(n.slice(c?2:1),c?16:10)}return Mf(n)||e}const Ux={}.hasOwnProperty;function YR(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XR(n)(qR($R(n).document().write(VR()(e,t,!0))))}function XR(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Rt),autolinkProtocol:U,autolinkEmail:U,atxHeading:c(Ht),blockQuote:c(ct),characterEscape:U,characterReference:U,codeFenced:c(Tt),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:c(Tt,l),codeText:c(qe,l),codeTextData:U,data:U,codeFlowValue:U,definition:c(ft),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:c(Ue),hardBreakEscape:c(vt),hardBreakTrailing:c(vt),htmlFlow:c(Ge,l),htmlFlowData:U,htmlText:c(Ge,l),htmlTextData:U,image:c(yt),label:l,link:c(Rt),listItem:c(gt),listItemValue:x,listOrdered:c(zt,g),listUnordered:c(zt),paragraph:c(Mt),reference:P,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:c(Ht),strong:c(Vt),thematicBreak:c(It)},exit:{atxHeading:m(),atxHeadingSequence:q,autolink:m(),autolinkEmail:We,autolinkProtocol:Re,blockQuote:m(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:je,characterReferenceMarkerNumeric:je,characterReferenceValue:Se,characterReference:De,codeFenced:m(N),codeFencedFence:S,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:E,codeIndented:m(T),codeText:m(te),codeTextData:E,data:E,definition:m(),definitionDestinationString:G,definitionLabelString:_,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(ee),hardBreakTrailing:m(ee),htmlFlow:m(ne),htmlFlowData:E,htmlText:m(ae),htmlTextData:E,image:m(J),label:ue,labelText:K,lineEnding:H,link:m(ye),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ve,resourceDestinationString:A,resourceTitleString:z,resource:le,setextHeading:m(D),setextHeadingLineSequence:M,setextHeadingText:F,strong:m(),thematicBreak:m()}};zx(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(de){let xe={type:"root",children:[]};const _e={stack:[xe],tokenStack:[],config:t,enter:d,exit:p,buffer:l,resume:y,data:n},Ve=[];let Qe=-1;for(;++Qe<de.length;)if(de[Qe][1].type==="listOrdered"||de[Qe][1].type==="listUnordered")if(de[Qe][0]==="enter")Ve.push(Qe);else{const dt=Ve.pop();Qe=o(de,dt,Qe)}for(Qe=-1;++Qe<de.length;){const dt=t[de[Qe][0]];Ux.call(dt,de[Qe][1].type)&&dt[de[Qe][1].type].call(Object.assign({sliceSerialize:de[Qe][2].sliceSerialize},_e),de[Qe][1])}if(_e.tokenStack.length>0){const dt=_e.tokenStack[_e.tokenStack.length-1];(dt[1]||Iy).call(_e,void 0,dt[0])}for(xe.position={start:Ii(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Ii(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Qe=-1;++Qe<t.transforms.length;)xe=t.transforms[Qe](xe)||xe;return xe}function o(de,xe,_e){let Ve=xe-1,Qe=-1,dt=!1,At,at,be,W;for(;++Ve<=_e;){const Pe=de[Ve];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?Qe++:Qe--,W=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(At&&!W&&!Qe&&!be&&(be=Ve),W=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:W=void 0}if(!Qe&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Qe===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(At){let nt=Ve;for(at=void 0;nt--;){const ot=de[nt];if(ot[1].type==="lineEnding"||ot[1].type==="lineEndingBlank"){if(ot[0]==="exit")continue;at&&(de[at][1].type="lineEndingBlank",dt=!0),ot[1].type="lineEnding",at=nt}else if(!(ot[1].type==="linePrefix"||ot[1].type==="blockQuotePrefix"||ot[1].type==="blockQuotePrefixWhitespace"||ot[1].type==="blockQuoteMarker"||ot[1].type==="listItemIndent"))break}be&&(!at||be<at)&&(At._spread=!0),At.end=Object.assign({},at?de[at][1].start:Pe[1].end),de.splice(at||Ve,0,["exit",At,Pe[2]]),Ve++,_e++}if(Pe[1].type==="listItemPrefix"){const nt={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};At=nt,de.splice(Ve,0,["enter",nt,Pe[2]]),Ve++,_e++,be=void 0,W=!0}}}return de[xe][1]._spread=dt,_e}function c(de,xe){return _e;function _e(Ve){d.call(this,de(Ve),Ve),xe&&xe.call(this,Ve)}}function l(){this.stack.push({type:"fragment",children:[]})}function d(de,xe,_e){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([xe,_e||void 0]),de.position={start:Ii(xe.start),end:void 0}}function m(de){return xe;function xe(_e){de&&de.call(this,_e),p.call(this,_e)}}function p(de,xe){const _e=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==de.type&&(xe?xe.call(this,de,Ve[0]):(Ve[1]||Iy).call(this,de,Ve[0]));else throw new Error("Cannot close `"+de.type+"` ("+uo({start:de.start,end:de.end})+"): it’s not open");_e.position.end=Ii(de.end)}function y(){return Rf(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(de){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function b(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=de}function C(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=de}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.value=de.replace(/(\r?\n|\r)$/g,"")}function _(de){const xe=this.resume(),_e=this.stack[this.stack.length-1];_e.label=xe,_e.identifier=Qr(this.sliceSerialize(de)).toLowerCase()}function R(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.title=de}function G(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.url=de}function q(de){const xe=this.stack[this.stack.length-1];if(!xe.depth){const _e=this.sliceSerialize(de).length;xe.depth=_e}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function M(de){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function U(de){const _e=this.stack[this.stack.length-1].children;let Ve=_e[_e.length-1];(!Ve||Ve.type!=="text")&&(Ve=bt(),Ve.position={start:Ii(de.start),end:void 0},_e.push(Ve)),this.stack.push(Ve)}function E(de){const xe=this.stack.pop();xe.value+=this.sliceSerialize(de),xe.position.end=Ii(de.end)}function H(de){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=xe.children[xe.children.length-1];_e.position.end=Ii(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(xe.type)&&(U.call(this,de),E.call(this,de))}function ee(){this.data.atHardBreak=!0}function ne(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.value=de}function ae(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.value=de}function te(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.value=de}function ye(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=xe,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function J(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=xe,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function K(de){const xe=this.sliceSerialize(de),_e=this.stack[this.stack.length-2];_e.label=KR(xe),_e.identifier=Qr(xe).toLowerCase()}function ue(){const de=this.stack[this.stack.length-1],xe=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const Ve=de.children;_e.children=Ve}else _e.alt=xe}function A(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.url=de}function z(){const de=this.resume(),xe=this.stack[this.stack.length-1];xe.title=de}function le(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function ve(de){const xe=this.resume(),_e=this.stack[this.stack.length-1];_e.label=xe,_e.identifier=Qr(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function je(de){this.data.characterReferenceType=de.type}function Se(de){const xe=this.sliceSerialize(de),_e=this.data.characterReferenceType;let Ve;_e?(Ve=Rx(xe,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=Mf(xe);const Qe=this.stack[this.stack.length-1];Qe.value+=Ve}function De(de){const xe=this.stack.pop();xe.position.end=Ii(de.end)}function Re(de){E.call(this,de);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(de)}function We(de){E.call(this,de);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(de)}function ct(){return{type:"blockquote",children:[]}}function Tt(){return{type:"code",lang:null,meta:null,value:""}}function qe(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ue(){return{type:"emphasis",children:[]}}function Ht(){return{type:"heading",depth:0,children:[]}}function vt(){return{type:"break"}}function Ge(){return{type:"html",value:""}}function yt(){return{type:"image",title:null,url:"",alt:null}}function Rt(){return{type:"link",title:null,url:"",children:[]}}function zt(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function gt(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function Mt(){return{type:"paragraph",children:[]}}function Vt(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function It(){return{type:"thematicBreak"}}}function Ii(e){return{line:e.line,column:e.column,offset:e.offset}}function zx(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?zx(e,s):JR(e,s)}}function JR(e,t){let n;for(n in t)if(Ux.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Iy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+uo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+uo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+uo({start:t.start,end:t.end})+") is still open")}function ZR(e){const t=this;t.parser=n;function n(s){return YR(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eM(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function tM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
73
|
+
`}]}function nM(e,t){const n=t.value?t.value+`
|
|
74
|
+
`:"",s={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function rM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=da(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let l,d=e.footnoteCounts.get(s);d===void 0?(d=0,e.footnoteOrder.push(s),l=e.footnoteOrder.length):l=c+1,d+=1,e.footnoteCounts.set(s,d);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,m);const p={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,p),e.applyData(t,p)}function aM(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Wx(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const o=e.all(t),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const l=o[o.length-1];return l&&l.type==="text"?l.value+=s:o.push({type:"text",value:s}),o}function lM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Wx(e,t);const o={src:da(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,c),e.applyData(t,c)}function cM(e,t){const n={src:da(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function uM(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function dM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Wx(e,t);const o={href:da(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function hM(e,t){const n={href:da(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function fM(e,t,n){const s=e.all(t),o=n?mM(n):Hx(t),c={},l=[];if(typeof t.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<s.length;){const y=s[d];(o||d!==0||y.type!=="element"||y.tagName!=="p")&&l.push({type:"text",value:`
|
|
75
|
+
`}),y.type==="element"&&y.tagName==="p"&&!o?l.push(...y.children):l.push(y)}const m=s[s.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&l.push({type:"text",value:`
|
|
76
|
+
`});const p={type:"element",tagName:"li",properties:c,children:l};return e.patch(t,p),e.applyData(t,p)}function mM(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=Hx(n[s])}return t}function Hx(e){const t=e.spread;return t??e.children.length>1}function pM(e,t){const n={},s=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<s.length;){const l=s[o];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)}function gM(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yM(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function vM(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wM(e,t){const n=e.all(t),s=n.shift(),o=[];if(s){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],l),o.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Nf(t.children[1]),m=kx(t.children[t.children.length-1]);d&&m&&(l.position={start:d,end:m}),o.push(l)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,c),e.applyData(t,c)}function bM(e,t,n){const s=n?n.children:void 0,c=(s?s.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,d=l?l.length:t.children.length;let m=-1;const p=[];for(;++m<d;){const g=t.children[m],x={},b=l?l[m]:void 0;b&&(x.align=b);let C={type:"element",tagName:c,properties:x,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),p.push(C)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,y),e.applyData(t,y)}function xM(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Dy=9,_y=32;function kM(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const c=[];for(;s;)c.push(Fy(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return c.push(Fy(t.slice(o),o>0,!1)),c.join("")}function Fy(e,t,n){let s=0,o=e.length;if(t){let c=e.codePointAt(s);for(;c===Dy||c===_y;)s++,c=e.codePointAt(s)}if(n){let c=e.codePointAt(o-1);for(;c===Dy||c===_y;)o--,c=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function SM(e,t){const n={type:"text",value:kM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function CM(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const jM={blockquote:eM,break:tM,code:nM,delete:rM,emphasis:iM,footnoteReference:sM,heading:aM,html:oM,imageReference:lM,image:cM,inlineCode:uM,linkReference:dM,link:hM,listItem:fM,list:pM,paragraph:gM,root:yM,strong:vM,table:wM,tableCell:xM,tableRow:bM,text:SM,thematicBreak:CM,toml:Hl,yaml:Hl,definition:Hl,footnoteDefinition:Hl};function Hl(){}const $x=-1,zc=0,fo=1,Tc=2,Lf=3,If=4,Df=5,_f=6,qx=7,Vx=8,Oy=typeof self=="object"?self:globalThis,NM=(e,t)=>{const n=(o,c)=>(e.set(c,o),o),s=o=>{if(e.has(o))return e.get(o);const[c,l]=t[o];switch(c){case zc:case $x:return n(l,o);case fo:{const d=n([],o);for(const m of l)d.push(s(m));return d}case Tc:{const d=n({},o);for(const[m,p]of l)d[s(m)]=s(p);return d}case Lf:return n(new Date(l),o);case If:{const{source:d,flags:m}=l;return n(new RegExp(d,m),o)}case Df:{const d=n(new Map,o);for(const[m,p]of l)d.set(s(m),s(p));return d}case _f:{const d=n(new Set,o);for(const m of l)d.add(s(m));return d}case qx:{const{name:d,message:m}=l;return n(new Oy[d](m),o)}case Vx:return n(BigInt(l),o);case"BigInt":return n(Object(BigInt(l)),o);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:d}=new Uint8Array(l);return n(new DataView(d),l)}}return n(new Oy[c](l),o)};return s},By=e=>NM(new Map,e)(0),Js="",{toString:TM}={},{keys:PM}=Object,to=e=>{const t=typeof e;if(t!=="object"||!e)return[zc,t];const n=TM.call(e).slice(8,-1);switch(n){case"Array":return[fo,Js];case"Object":return[Tc,Js];case"Date":return[Lf,Js];case"RegExp":return[If,Js];case"Map":return[Df,Js];case"Set":return[_f,Js];case"DataView":return[fo,n]}return n.includes("Array")?[fo,n]:n.includes("Error")?[qx,n]:[Tc,n]},$l=([e,t])=>e===zc&&(t==="function"||t==="symbol"),EM=(e,t,n,s)=>{const o=(l,d)=>{const m=s.push(l)-1;return n.set(d,m),m},c=l=>{if(n.has(l))return n.get(l);let[d,m]=to(l);switch(d){case zc:{let y=l;switch(m){case"bigint":d=Vx,y=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return o([$x],l)}return o([d,y],l)}case fo:{if(m){let x=l;return m==="DataView"?x=new Uint8Array(l.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(l)),o([m,[...x]],l)}const y=[],g=o([d,y],l);for(const x of l)y.push(c(x));return g}case Tc:{if(m)switch(m){case"BigInt":return o([m,l.toString()],l);case"Boolean":case"Number":case"String":return o([m,l.valueOf()],l)}if(t&&"toJSON"in l)return c(l.toJSON());const y=[],g=o([d,y],l);for(const x of PM(l))(e||!$l(to(l[x])))&&y.push([c(x),c(l[x])]);return g}case Lf:return o([d,l.toISOString()],l);case If:{const{source:y,flags:g}=l;return o([d,{source:y,flags:g}],l)}case Df:{const y=[],g=o([d,y],l);for(const[x,b]of l)(e||!($l(to(x))||$l(to(b))))&&y.push([c(x),c(b)]);return g}case _f:{const y=[],g=o([d,y],l);for(const x of l)(e||!$l(to(x)))&&y.push(c(x));return g}}const{message:p}=l;return o([d,{name:m,message:p}],l)};return c},Uy=(e,{json:t,lossy:n}={})=>{const s=[];return EM(!(t||n),!!t,new Map,s)(e),s},Pc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?By(Uy(e,t)):structuredClone(e):(e,t)=>By(Uy(e,t));function RM(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function MM(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AM(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||RM,s=e.options.footnoteBackLabel||MM,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[m]);if(!p)continue;const y=e.all(p),g=String(p.identifier).toUpperCase(),x=da(g.toLowerCase());let b=0;const C=[],S=e.footnoteCounts.get(g);for(;S!==void 0&&++b<=S;){C.length>0&&C.push({type:"text",value:" "});let _=typeof n=="string"?n:n(m,b);typeof _=="string"&&(_={type:"text",value:_}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,b),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const N=y[y.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const _=N.children[N.children.length-1];_&&_.type==="text"?_.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...C)}else y.push(...C);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(y,!0)};e.patch(p,T),d.push(T)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Pc(l),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
77
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
78
|
+
`}]}}const Wc=(function(e){if(e==null)return _M;if(typeof e=="function")return Hc(e);if(typeof e=="object")return Array.isArray(e)?LM(e):IM(e);if(typeof e=="string")return DM(e);throw new Error("Expected function, string, or object as test")});function LM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Wc(e[n]);return Hc(s);function s(...o){let c=-1;for(;++c<t.length;)if(t[c].apply(this,o))return!0;return!1}}function IM(e){const t=e;return Hc(n);function n(s){const o=s;let c;for(c in e)if(o[c]!==t[c])return!1;return!0}}function DM(e){return Hc(t);function t(n){return n&&n.type===e}}function Hc(e){return t;function t(n,s,o){return!!(FM(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function _M(){return!0}function FM(e){return e!==null&&typeof e=="object"&&"type"in e}const Gx=[],OM=!0,Wh=!1,BM="skip";function Kx(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const c=Wc(o),l=s?-1:1;d(e,void 0,[])();function d(m,p,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(b?"<"+b+">":""))+")"})}return x;function x(){let b=Gx,C,S,N;if((!t||c(m,p,y[y.length-1]||void 0))&&(b=UM(n(m,y)),b[0]===Wh))return b;if("children"in m&&m.children){const T=m;if(T.children&&b[0]!==BM)for(S=(s?T.children.length:-1)+l,N=y.concat(T);S>-1&&S<T.children.length;){const _=T.children[S];if(C=d(_,S,N)(),C[0]===Wh)return C;S=typeof C[1]=="number"?C[1]:S+l}}return b}}}function UM(e){return Array.isArray(e)?e:typeof e=="number"?[OM,e]:e==null?Gx:[e]}function Ff(e,t,n,s){let o,c,l;typeof t=="function"&&typeof n!="function"?(c=void 0,l=t,o=n):(c=t,l=n,o=s),Kx(e,c,d,o);function d(m,p){const y=p[p.length-1],g=y?y.children.indexOf(m):void 0;return l(m,g,y)}}const Hh={}.hasOwnProperty,zM={};function WM(e,t){const n=t||zM,s=new Map,o=new Map,c=new Map,l={...jM,...n.handlers},d={all:p,applyData:$M,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:l,one:m,options:n,patch:HM,wrap:VM};return Ff(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:o,x=String(y.identifier).toUpperCase();g.has(x)||g.set(x,y)}}),d;function m(y,g){const x=y.type,b=d.handlers[x];if(Hh.call(d.handlers,x)&&b)return b(d,y,g);if(d.options.passThrough&&d.options.passThrough.includes(x)){if("children"in y){const{children:S,...N}=y,T=Pc(N);return T.children=d.all(y),T}return Pc(y)}return(d.options.unknownHandler||qM)(d,y,g)}function p(y){const g=[];if("children"in y){const x=y.children;let b=-1;for(;++b<x.length;){const C=d.one(x[b],y);if(C){if(b&&x[b-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=zy(C.value)),!Array.isArray(C)&&C.type==="element")){const S=C.children[0];S&&S.type==="text"&&(S.value=zy(S.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function HM(e,t){e.position&&(t.position=MP(e))}function $M(e,t){let n=t;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const l="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:l}}n.type==="element"&&c&&Object.assign(n.properties,Pc(c)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function qM(e,t){const n=t.data||{},s="value"in t&&!(Hh.call(n,"hProperties")||Hh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function VM(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
79
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
80
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
81
|
+
`}),n}function zy(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Wy(e,t){const n=WM(e,t),s=n.one(e,void 0),o=AM(n),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
|
|
82
|
+
`},o),c}function GM(e,t){return e&&"run"in e?async function(n,s){const o=Wy(n,{file:s,...t});await e.run(o,s)}:function(n,s){return Wy(n,{file:s,...e||t})}}function Hy(e){if(e)throw e}var zd,$y;function KM(){if($y)return zd;$y=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var y=e.call(p,"constructor"),g=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!y&&!g)return!1;var x;for(x in p);return typeof x>"u"||e.call(p,x)},l=function(p,y){n&&y.name==="__proto__"?n(p,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):p[y.name]=y.newValue},d=function(p,y){if(y==="__proto__")if(e.call(p,y)){if(s)return s(p,y).value}else return;return p[y]};return zd=function m(){var p,y,g,x,b,C,S=arguments[0],N=1,T=arguments.length,_=!1;for(typeof S=="boolean"&&(_=S,S=arguments[1]||{},N=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});N<T;++N)if(p=arguments[N],p!=null)for(y in p)g=d(S,y),x=d(p,y),S!==x&&(_&&x&&(c(x)||(b=o(x)))?(b?(b=!1,C=g&&o(g)?g:[]):C=g&&c(g)?g:{},l(S,{name:y,newValue:m(_,C,x)})):typeof x<"u"&&l(S,{name:y,newValue:x}));return S},zd}var QM=KM();const Wd=To(QM);function $h(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function YM(){const e=[],t={run:n,use:s};return t;function n(...o){let c=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);d(null,...o);function d(m,...p){const y=e[++c];let g=-1;if(m){l(m);return}for(;++g<o.length;)(p[g]===null||p[g]===void 0)&&(p[g]=o[g]);o=p,y?XM(y,d)(...p):l(null,...p)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function XM(e,t){let n;return s;function s(...l){const d=e.length>l.length;let m;d&&l.push(o);try{m=e.apply(this,l)}catch(p){const y=p;if(d&&n)throw y;return o(y)}d||(m&&m.then&&typeof m.then=="function"?m.then(c,o):m instanceof Error?o(m):c(m))}function o(l,...d){n||(n=!0,t(l,...d))}function c(l){o(null,l)}}const ni={basename:JM,dirname:ZM,extname:eA,join:tA,sep:"/"};function JM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Do(e);let n=0,s=-1,o=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){n=o+1;break}}else s<0&&(c=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let l=-1,d=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){n=o+1;break}}else l<0&&(c=!0,l=o+1),d>-1&&(e.codePointAt(o)===t.codePointAt(d--)?d<0&&(s=o):(d=-1,s=l));return n===s?s=l:s<0&&(s=e.length),e.slice(n,s)}function ZM(e){if(Do(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function eA(e){Do(e);let t=e.length,n=-1,s=0,o=-1,c=0,l;for(;t--;){const d=e.codePointAt(t);if(d===47){if(l){s=t+1;break}continue}n<0&&(l=!0,n=t+1),d===46?o<0?o=t:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||n<0||c===0||c===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function tA(...e){let t=-1,n;for(;++t<e.length;)Do(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":nA(n)}function nA(e){Do(e);const t=e.codePointAt(0)===47;let n=rA(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function rA(e,t){let n="",s=0,o=-1,c=0,l=-1,d,m;for(;++l<=e.length;){if(l<e.length)d=e.codePointAt(l);else{if(d===47)break;d=47}if(d===47){if(!(o===l-1||c===1))if(o!==l-1&&c===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",s=0):(n=n.slice(0,m),s=n.length-1-n.lastIndexOf("/")),o=l,c=0;continue}}else if(n.length>0){n="",s=0,o=l,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),s=l-o-1;o=l,c=0}else d===46&&c>-1?c++:c=-1}return n}function Do(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const iA={cwd:sA};function sA(){return"/"}function qh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function aA(e){if(typeof e=="string")e=new URL(e);else if(!qh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return oA(e)}function oA(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Hd=["history","path","basename","stem","extname","dirname"];class Qx{constructor(t){let n;t?qh(t)?n={path:t}:typeof t=="string"||lA(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":iA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Hd.length;){const c=Hd[s];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let o;for(o in n)Hd.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ni.basename(this.path):void 0}set basename(t){qd(t,"basename"),$d(t,"basename"),this.path=ni.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ni.dirname(this.path):void 0}set dirname(t){qy(this.basename,"dirname"),this.path=ni.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ni.extname(this.path):void 0}set extname(t){if($d(t,"extname"),qy(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ni.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){qh(t)&&(t=aA(t)),qd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ni.basename(this.path,this.extname):void 0}set stem(t){qd(t,"stem"),$d(t,"stem"),this.path=ni.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new zn(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function $d(e,t){if(e&&e.includes(ni.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ni.sep+"`")}function qd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function qy(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function lA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cA=(function(e){const s=this.constructor.prototype,o=s[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),uA={}.hasOwnProperty;class Of extends cA{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=YM()}copy(){const t=new Of;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Wd(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Kd("data",this.frozen),this.namespace[t]=n,this):uA.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Kd("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=n.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ql(t),s=this.parser||this.Parser;return Vd("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Vd("process",this.parser||this.Parser),Gd("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(c,l){const d=ql(t),m=s.parse(d);s.run(m,d,function(y,g,x){if(y||!g||!x)return p(y);const b=g,C=s.stringify(b,x);fA(C)?x.value=C:x.result=C,p(y,x)});function p(y,g){y||!g?l(y):c?c(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),Vd("processSync",this.parser||this.Parser),Gd("processSync",this.compiler||this.Compiler),this.process(t,o),Gy("processSync","process",n),s;function o(c,l){n=!0,Hy(c),s=l}}run(t,n,s){Vy(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?c(void 0,s):new Promise(c);function c(l,d){const m=ql(n);o.run(t,m,p);function p(y,g,x){const b=g||t;y?d(y):l?l(b):s(void 0,b,x)}}}runSync(t,n){let s=!1,o;return this.run(t,n,c),Gy("runSync","run",s),o;function c(l,d){Hy(l),o=d,s=!0}}stringify(t,n){this.freeze();const s=ql(n),o=this.compiler||this.Compiler;return Gd("stringify",o),Vy(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(Kd("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(p){if(typeof p=="function")m(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[y,...g]=p;m(y,g)}else l(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function l(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(p.plugins),p.settings&&(o.settings=Wd(!0,o.settings,p.settings))}function d(p){let y=-1;if(p!=null)if(Array.isArray(p))for(;++y<p.length;){const g=p[y];c(g)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function m(p,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===p){x=g;break}if(x===-1)s.push([p,...y]);else if(y.length>0){let[b,...C]=y;const S=s[x][1];$h(S)&&$h(b)&&(b=Wd(!0,S,b)),s[x]=[p,b,...C]}}}}const dA=new Of().freeze();function Vd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Kd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Vy(e){if(!$h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Gy(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ql(e){return hA(e)?e:new Qx(e)}function hA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fA(e){return typeof e=="string"||mA(e)}function mA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ky=[],Qy={allowDangerousHtml:!0},gA=/^(https?|ircs?|mailto|xmpp)$/i,yA=[{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 Bf(e){const t=vA(e),n=wA(e);return bA(t.runSync(t.parse(n),n),e)}function vA(e){const t=e.rehypePlugins||Ky,n=e.remarkPlugins||Ky,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Qy}:Qy;return dA().use(ZR).use(n).use(GM,s).use(t)}function wA(e){const t=e.children||"",n=new Qx;return typeof t=="string"&&(n.value=t),n}function bA(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,c=t.disallowedElements,l=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||xA;for(const y of yA)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+pA+y.id,void 0);return Ff(e,p),_P(e,{Fragment:i.Fragment,components:o,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function p(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return l?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let b;for(b in Od)if(Object.hasOwn(Od,b)&&Object.hasOwn(y.properties,b)){const C=y.properties[b],S=Od[b];(S===null||S.includes(y.tagName))&&(y.properties[b]=m(String(C||""),b,y))}}if(y.type==="element"){let b=n?!n.includes(y.tagName):c?c.includes(y.tagName):!1;if(!b&&s&&typeof g=="number"&&(b=!s(y,g,x)),b&&x&&typeof g=="number")return d&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function xA(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||s!==-1&&t>s||gA.test(e.slice(0,t))?e:""}function Yy(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,o=n.indexOf(t);for(;o!==-1;)s++,o=n.indexOf(t,o+t.length);return s}function kA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function SA(e,t,n){const o=Wc((n||{}).ignore||[]),c=CA(t);let l=-1;for(;++l<c.length;)Kx(e,"text",d);function d(p,y){let g=-1,x;for(;++g<y.length;){const b=y[g],C=x?x.children:void 0;if(o(b,C?C.indexOf(b):void 0,x))return;x=b}if(x)return m(p,y)}function m(p,y){const g=y[y.length-1],x=c[l][0],b=c[l][1];let C=0;const N=g.children.indexOf(p);let T=!1,_=[];x.lastIndex=0;let R=x.exec(p.value);for(;R;){const G=R.index,q={index:R.index,input:R.input,stack:[...y,p]};let F=b(...R,q);if(typeof F=="string"&&(F=F.length>0?{type:"text",value:F}:void 0),F===!1?x.lastIndex=G+1:(C!==G&&_.push({type:"text",value:p.value.slice(C,G)}),Array.isArray(F)?_.push(...F):F&&_.push(F),C=G+R[0].length,T=!0),!x.global)break;R=x.exec(p.value)}return T?(C<p.value.length&&_.push({type:"text",value:p.value.slice(C)}),g.children.splice(N,1,..._)):_=[p],N+_.length}}function CA(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const o=n[s];t.push([jA(o[0]),NA(o[1])])}return t}function jA(e){return typeof e=="string"?new RegExp(kA(e),"g"):e}function NA(e){return typeof e=="function"?e:function(){return e}}const Qd="phrasing",Yd=["autolink","link","image","label"];function TA(){return{transforms:[IA],enter:{literalAutolink:EA,literalAutolinkEmail:Xd,literalAutolinkHttp:Xd,literalAutolinkWww:Xd},exit:{literalAutolink:LA,literalAutolinkEmail:AA,literalAutolinkHttp:RA,literalAutolinkWww:MA}}}function PA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qd,notInConstruct:Yd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qd,notInConstruct:Yd},{character:":",before:"[ps]",after:"\\/",inConstruct:Qd,notInConstruct:Yd}]}}function EA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Xd(e){this.config.enter.autolinkProtocol.call(this,e)}function RA(e){this.config.exit.autolinkProtocol.call(this,e)}function MA(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function AA(e){this.config.exit.autolinkEmail.call(this,e)}function LA(e){this.exit(e)}function IA(e){SA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,DA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),_A]],{ignore:["link","linkReference"]})}function DA(e,t,n,s,o){let c="";if(!Yx(o)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!FA(n)))return!1;const l=OA(n+s);if(!l[0])return!1;const d={type:"link",title:null,url:c+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[d,{type:"text",value:l[1]}]:d}function _A(e,t,n,s){return!Yx(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function FA(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function OA(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const o=Yy(e,"(");let c=Yy(e,")");for(;s!==-1&&o>c;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),c++;return[e,n]}function Yx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ws(n)||Bc(n))&&(!t||n!==47)}Xx.peek=GA;function BA(){this.buffer()}function UA(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function zA(){this.buffer()}function WA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function HA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $A(e){this.exit(e)}function qA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function VA(e){this.exit(e)}function GA(){return"["}function Xx(e,t,n,s){const o=n.createTracker(s);let c=o.move("[^");const l=n.enter("footnoteReference"),d=n.enter("reference");return c+=o.move(n.safe(n.associationId(e),{after:"]",before:c})),d(),l(),c+=o.move("]"),c}function KA(){return{enter:{gfmFootnoteCallString:BA,gfmFootnoteCall:UA,gfmFootnoteDefinitionLabelString:zA,gfmFootnoteDefinition:WA},exit:{gfmFootnoteCallString:HA,gfmFootnoteCall:$A,gfmFootnoteDefinitionLabelString:qA,gfmFootnoteDefinition:VA}}}function QA(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Xx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,o,c,l){const d=c.createTracker(l);let m=d.move("[^");const p=c.enter("footnoteDefinition"),y=c.enter("label");return m+=d.move(c.safe(c.associationId(s),{before:m,after:"]"})),y(),m+=d.move("]:"),s.children&&s.children.length>0&&(d.shift(4),m+=d.move((t?`
|
|
83
|
+
`:" ")+c.indentLines(c.containerFlow(s,d.current()),t?Jx:YA))),p(),m}}function YA(e,t,n){return t===0?e:Jx(e,t,n)}function Jx(e,t,n){return(n?"":" ")+e}const XA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Zx.peek=nL;function JA(){return{canContainEols:["delete"],enter:{strikethrough:eL},exit:{strikethrough:tL}}}function ZA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:XA}],handlers:{delete:Zx}}}function eL(e){this.enter({type:"delete",children:[]},e)}function tL(e){this.exit(e)}function Zx(e,t,n,s){const o=n.createTracker(s),c=n.enter("strikethrough");let l=o.move("~~");return l+=n.containerPhrasing(e,{...o.current(),before:l,after:"~"}),l+=o.move("~~"),c(),l}function nL(){return"~"}function rL(e){return e.length}function iL(e,t){const n=t||{},s=(n.align||[]).concat(),o=n.stringLength||rL,c=[],l=[],d=[],m=[];let p=0,y=-1;for(;++y<e.length;){const S=[],N=[];let T=-1;for(e[y].length>p&&(p=e[y].length);++T<e[y].length;){const _=sL(e[y][T]);if(n.alignDelimiters!==!1){const R=o(_);N[T]=R,(m[T]===void 0||R>m[T])&&(m[T]=R)}S.push(_)}l[y]=S,d[y]=N}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<p;)c[g]=Xy(s[g]);else{const S=Xy(s);for(;++g<p;)c[g]=S}g=-1;const x=[],b=[];for(;++g<p;){const S=c[g];let N="",T="";S===99?(N=":",T=":"):S===108?N=":":S===114&&(T=":");let _=n.alignDelimiters===!1?1:Math.max(1,m[g]-N.length-T.length);const R=N+"-".repeat(_)+T;n.alignDelimiters!==!1&&(_=N.length+_+T.length,_>m[g]&&(m[g]=_),b[g]=_),x[g]=R}l.splice(1,0,x),d.splice(1,0,b),y=-1;const C=[];for(;++y<l.length;){const S=l[y],N=d[y];g=-1;const T=[];for(;++g<p;){const _=S[g]||"";let R="",G="";if(n.alignDelimiters!==!1){const q=m[g]-(N[g]||0),F=c[g];F===114?R=" ".repeat(q):F===99?q%2?(R=" ".repeat(q/2+.5),G=" ".repeat(q/2-.5)):(R=" ".repeat(q/2),G=R):G=" ".repeat(q)}n.delimiterStart!==!1&&!g&&T.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||g)&&T.push(" "),n.alignDelimiters!==!1&&T.push(R),T.push(_),n.alignDelimiters!==!1&&T.push(G),n.padding!==!1&&T.push(" "),(n.delimiterEnd!==!1||g!==p-1)&&T.push("|")}C.push(n.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return C.join(`
|
|
84
|
+
`)}function sL(e){return e==null?"":String(e)}function Xy(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function aL(e,t,n,s){const o=n.enter("blockquote"),c=n.createTracker(s);c.move("> "),c.shift(2);const l=n.indentLines(n.containerFlow(e,c.current()),oL);return o(),l}function oL(e,t,n){return">"+(n?"":" ")+e}function lL(e,t){return Jy(e,t.inConstruct,!0)&&!Jy(e,t.notInConstruct,!1)}function Jy(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Zy(e,t,n,s){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
|
|
85
|
+
`&&lL(n.stack,n.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
86
|
+
`}function cL(e,t){const n=String(e);let s=n.indexOf(t),o=s,c=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===o?++c>l&&(l=c):c=1,o=s+t.length,s=n.indexOf(t,o);return l}function uL(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 dL(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function hL(e,t,n,s){const o=dL(n),c=e.value||"",l=o==="`"?"GraveAccent":"Tilde";if(uL(e,n)){const g=n.enter("codeIndented"),x=n.indentLines(c,fL);return g(),x}const d=n.createTracker(s),m=o.repeat(Math.max(cL(c,o)+1,3)),p=n.enter("codeFenced");let y=d.move(m);if(e.lang){const g=n.enter(`codeFencedLang${l}`);y+=d.move(n.safe(e.lang,{before:y,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);y+=d.move(" "),y+=d.move(n.safe(e.meta,{before:y,after:`
|
|
87
|
+
`,encode:["`"],...d.current()})),g()}return y+=d.move(`
|
|
88
|
+
`),c&&(y+=d.move(c+`
|
|
89
|
+
`)),y+=d.move(m),p(),y}function fL(e,t,n){return(n?"":" ")+e}function Uf(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function mL(e,t,n,s){const o=Uf(n),c=o==='"'?"Quote":"Apostrophe",l=n.enter("definition");let d=n.enter("label");const m=n.createTracker(s);let p=m.move("[");return p+=m.move(n.safe(n.associationId(e),{before:p,after:"]",...m.current()})),p+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),p+=m.move("<"),p+=m.move(n.safe(e.url,{before:p,after:">",...m.current()})),p+=m.move(">")):(d=n.enter("destinationRaw"),p+=m.move(n.safe(e.url,{before:p,after:e.title?" ":`
|
|
90
|
+
`,...m.current()}))),d(),e.title&&(d=n.enter(`title${c}`),p+=m.move(" "+o),p+=m.move(n.safe(e.title,{before:p,after:o,...m.current()})),p+=m.move(o),d()),l(),p}function pL(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ko(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ec(e,t,n){const s=la(e),o=la(t);return s===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ek.peek=gL;function ek(e,t,n,s){const o=pL(n),c=n.enter("emphasis"),l=n.createTracker(s),d=l.move(o);let m=l.move(n.containerPhrasing(e,{after:o,before:d,...l.current()}));const p=m.charCodeAt(0),y=Ec(s.before.charCodeAt(s.before.length-1),p,o);y.inside&&(m=ko(p)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Ec(s.after.charCodeAt(0),g,o);x.inside&&(m=m.slice(0,-1)+ko(g));const b=l.move(o);return c(),n.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},d+m+b}function gL(e,t,n){return n.options.emphasis||"*"}function yL(e,t){let n=!1;return Ff(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Wh}),!!((!e.depth||e.depth<3)&&Rf(e)&&(t.options.setext||n))}function vL(e,t,n,s){const o=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(s);if(yL(e,n)){const y=n.enter("headingSetext"),g=n.enter("phrasing"),x=n.containerPhrasing(e,{...c.current(),before:`
|
|
91
|
+
`,after:`
|
|
92
|
+
`});return g(),y(),x+`
|
|
93
|
+
`+(o===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
94
|
+
`))+1))}const l="#".repeat(o),d=n.enter("headingAtx"),m=n.enter("phrasing");c.move(l+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
95
|
+
`,...c.current()});return/^[\t ]/.test(p)&&(p=ko(p.charCodeAt(0))+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),m(),d(),p}tk.peek=wL;function tk(e){return e.value||""}function wL(){return"<"}nk.peek=bL;function nk(e,t,n,s){const o=Uf(n),c=o==='"'?"Quote":"Apostrophe",l=n.enter("image");let d=n.enter("label");const m=n.createTracker(s);let p=m.move("![");return p+=m.move(n.safe(e.alt,{before:p,after:"]",...m.current()})),p+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),p+=m.move("<"),p+=m.move(n.safe(e.url,{before:p,after:">",...m.current()})),p+=m.move(">")):(d=n.enter("destinationRaw"),p+=m.move(n.safe(e.url,{before:p,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=n.enter(`title${c}`),p+=m.move(" "+o),p+=m.move(n.safe(e.title,{before:p,after:o,...m.current()})),p+=m.move(o),d()),p+=m.move(")"),l(),p}function bL(){return"!"}rk.peek=xL;function rk(e,t,n,s){const o=e.referenceType,c=n.enter("imageReference");let l=n.enter("label");const d=n.createTracker(s);let m=d.move("![");const p=n.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(p+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return l(),n.stack=y,c(),o==="full"||!p||p!==g?m+=d.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function xL(){return"!"}ik.peek=kL;function ik(e,t,n){let s=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(s);)o+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<n.unsafe.length;){const l=n.unsafe[c],d=n.compilePattern(l);let m;if(l.atBreak)for(;m=d.exec(s);){let p=m.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(m.index+1)}}return o+s+o}function kL(){return"`"}function sk(e,t){const n=Rf(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ak.peek=SL;function ak(e,t,n,s){const o=Uf(n),c=o==='"'?"Quote":"Apostrophe",l=n.createTracker(s);let d,m;if(sk(e,n)){const y=n.stack;n.stack=[],d=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),d(),n.stack=y,g}d=n.enter("link"),m=n.enter("label");let p=l.move("[");return p+=l.move(n.containerPhrasing(e,{before:p,after:"](",...l.current()})),p+=l.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),p+=l.move("<"),p+=l.move(n.safe(e.url,{before:p,after:">",...l.current()})),p+=l.move(">")):(m=n.enter("destinationRaw"),p+=l.move(n.safe(e.url,{before:p,after:e.title?" ":")",...l.current()}))),m(),e.title&&(m=n.enter(`title${c}`),p+=l.move(" "+o),p+=l.move(n.safe(e.title,{before:p,after:o,...l.current()})),p+=l.move(o),m()),p+=l.move(")"),d(),p}function SL(e,t,n){return sk(e,n)?"<":"["}ok.peek=CL;function ok(e,t,n,s){const o=e.referenceType,c=n.enter("linkReference");let l=n.enter("label");const d=n.createTracker(s);let m=d.move("[");const p=n.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(p+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...d.current()});return l(),n.stack=y,c(),o==="full"||!p||p!==g?m+=d.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function CL(){return"["}function zf(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function jL(e){const t=zf(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function NL(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function lk(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function TL(e,t,n,s){const o=n.enter("list"),c=n.bulletCurrent;let l=e.ordered?NL(n):zf(n);const d=e.ordered?l==="."?")":".":jL(n);let m=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&y&&(!y.children||!y.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&&(m=!0),lk(n)===l&&y){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(l=d),n.bulletCurrent=l;const p=n.containerFlow(e,s);return n.bulletLastUsed=l,n.bulletCurrent=c,o(),p}function PL(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function EL(e,t,n,s){const o=PL(n);let c=n.bulletCurrent||zf(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let l=c.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const d=n.createTracker(s);d.move(c+" ".repeat(l-c.length)),d.shift(l);const m=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,d.current()),y);return m(),p;function y(g,x,b){return x?(b?"":" ".repeat(l))+g:(b?c:c+" ".repeat(l-c.length))+g}}function RL(e,t,n,s){const o=n.enter("paragraph"),c=n.enter("phrasing"),l=n.containerPhrasing(e,s);return c(),o(),l}const ML=Wc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function AL(e,t,n,s){return(e.children.some(function(l){return ML(l)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function LL(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ck.peek=IL;function ck(e,t,n,s){const o=LL(n),c=n.enter("strong"),l=n.createTracker(s),d=l.move(o+o);let m=l.move(n.containerPhrasing(e,{after:o,before:d,...l.current()}));const p=m.charCodeAt(0),y=Ec(s.before.charCodeAt(s.before.length-1),p,o);y.inside&&(m=ko(p)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Ec(s.after.charCodeAt(0),g,o);x.inside&&(m=m.slice(0,-1)+ko(g));const b=l.move(o+o);return c(),n.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},d+m+b}function IL(e,t,n){return n.options.strong||"*"}function DL(e,t,n,s){return n.safe(e.value,s)}function _L(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function FL(e,t,n){const s=(lk(n)+(n.options.ruleSpaces?" ":"")).repeat(_L(n));return n.options.ruleSpaces?s.slice(0,-1):s}const uk={blockquote:aL,break:Zy,code:hL,definition:mL,emphasis:ek,hardBreak:Zy,heading:vL,html:tk,image:nk,imageReference:rk,inlineCode:ik,link:ak,linkReference:ok,list:TL,listItem:EL,paragraph:RL,root:AL,strong:ck,text:DL,thematicBreak:FL};function OL(){return{enter:{table:BL,tableData:ev,tableHeader:ev,tableRow:zL},exit:{codeText:WL,table:UL,tableData:Jd,tableHeader:Jd,tableRow:Jd}}}function BL(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function UL(e){this.exit(e),this.data.inTable=void 0}function zL(e){this.enter({type:"tableRow",children:[]},e)}function Jd(e){this.exit(e)}function ev(e){this.enter({type:"tableCell",children:[]},e)}function WL(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,HL));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function HL(e,t){return t==="|"?t:e}function $L(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,o=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
96
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:m,tableRow:d}};function l(b,C,S,N){return p(y(b,S,N),b.align)}function d(b,C,S,N){const T=g(b,S,N),_=p([T]);return _.slice(0,_.indexOf(`
|
|
97
|
+
`))}function m(b,C,S,N){const T=S.enter("tableCell"),_=S.enter("phrasing"),R=S.containerPhrasing(b,{...N,before:c,after:c});return _(),T(),R}function p(b,C){return iL(b,{align:C,alignDelimiters:s,padding:n,stringLength:o})}function y(b,C,S){const N=b.children;let T=-1;const _=[],R=C.enter("table");for(;++T<N.length;)_[T]=g(N[T],C,S);return R(),_}function g(b,C,S){const N=b.children;let T=-1;const _=[],R=C.enter("tableRow");for(;++T<N.length;)_[T]=m(N[T],b,C,S);return R(),_}function x(b,C,S){let N=uk.inlineCode(b,C,S);return S.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function qL(){return{exit:{taskListCheckValueChecked:tv,taskListCheckValueUnchecked:tv,paragraph:GL}}}function VL(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KL}}}function tv(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function GL(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const o=t.children;let c=-1,l;for(;++c<o.length;){const d=o[c];if(d.type==="paragraph"){l=d;break}}l===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function KL(e,t,n,s){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",d=n.createTracker(s);c&&d.move(l);let m=uk.listItem(e,t,n,{...s,...d.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),m;function p(y){return y+l}}function QL(){return[TA(),KA(),JA(),OL(),qL()]}function YL(e){return{extensions:[PA(),QA(e),ZA(),$L(e),VL()]}}const XL={tokenize:rI,partial:!0},dk={tokenize:iI,partial:!0},hk={tokenize:sI,partial:!0},fk={tokenize:aI,partial:!0},JL={tokenize:oI,partial:!0},mk={name:"wwwAutolink",tokenize:tI,previous:gk},pk={name:"protocolAutolink",tokenize:nI,previous:yk},yi={name:"emailAutolink",tokenize:eI,previous:vk},ai={};function ZL(){return{text:ai}}let os=48;for(;os<123;)ai[os]=yi,os++,os===58?os=65:os===91&&(os=97);ai[43]=yi;ai[45]=yi;ai[46]=yi;ai[95]=yi;ai[72]=[yi,pk];ai[104]=[yi,pk];ai[87]=[yi,mk];ai[119]=[yi,mk];function eI(e,t,n){const s=this;let o,c;return l;function l(g){return!Vh(g)||!vk.call(s,s.previous)||Wf(s.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return Vh(g)?(e.consume(g),d):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(JL,y,p)(g):g===45||g===95||Bn(g)?(c=!0,e.consume(g),m):y(g)}function p(g){return e.consume(g),o=!0,m}function y(g){return c&&o&&Vn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function tI(e,t,n){const s=this;return o;function o(l){return l!==87&&l!==119||!gk.call(s,s.previous)||Wf(s.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(XL,e.attempt(dk,e.attempt(hk,c),n),n)(l))}function c(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function nI(e,t,n){const s=this;let o="",c=!1;return l;function l(g){return(g===72||g===104)&&yk.call(s,s.previous)&&!Wf(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),d):n(g)}function d(g){if(Vn(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const x=o.toLowerCase();if(x==="http"||x==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),c?p:(c=!0,m)):n(g)}function p(g){return g===null||Nc(g)||qt(g)||ws(g)||Bc(g)?n(g):e.attempt(dk,e.attempt(hk,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function rI(e,t,n){let s=0;return o;function o(l){return(l===87||l===119)&&s<3?(s++,e.consume(l),o):l===46&&s===3?(e.consume(l),c):n(l)}function c(l){return l===null?n(l):t(l)}}function iI(e,t,n){let s,o,c;return l;function l(p){return p===46||p===95?e.check(fk,m,d)(p):p===null||qt(p)||ws(p)||p!==45&&Bc(p)?m(p):(c=!0,e.consume(p),l)}function d(p){return p===95?s=!0:(o=s,s=void 0),e.consume(p),l}function m(p){return o||s||!c?n(p):t(p)}}function sI(e,t){let n=0,s=0;return o;function o(l){return l===40?(n++,e.consume(l),o):l===41&&s<n?c(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(fk,t,c)(l):l===null||qt(l)||ws(l)?t(l):(e.consume(l),o)}function c(l){return l===41&&s++,e.consume(l),o}}function aI(e,t,n){return s;function s(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),s):d===38?(e.consume(d),c):d===93?(e.consume(d),o):d===60||d===null||qt(d)||ws(d)?t(d):n(d)}function o(d){return d===null||d===40||d===91||qt(d)||ws(d)?t(d):s(d)}function c(d){return Vn(d)?l(d):n(d)}function l(d){return d===59?(e.consume(d),s):Vn(d)?(e.consume(d),l):n(d)}}function oI(e,t,n){return s;function s(c){return e.consume(c),o}function o(c){return Bn(c)?n(c):t(c)}}function gk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qt(e)}function yk(e){return!Vn(e)}function vk(e){return!(e===47||Vh(e))}function Vh(e){return e===43||e===45||e===46||e===95||Bn(e)}function Wf(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lI={tokenize:gI,partial:!0};function cI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fI,continuation:{tokenize:mI},exit:pI}},text:{91:{name:"gfmFootnoteCall",tokenize:hI},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uI,resolveTo:dI}}}}function uI(e,t,n){const s=this;let o=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let l;for(;o--;){const m=s.events[o][1];if(m.type==="labelImage"){l=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!l||!l._balanced)return n(m);const p=Qr(s.sliceSerialize({start:l.end,end:s.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function dI(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",c,t],["enter",l,t],["exit",l,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...d),e}function hI(e,t,n){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,l;return d;function d(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(g){if(c>999||g===93&&!l||g===null||g===91||qt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return o.includes(Qr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return qt(g)||(l=!0),c++,e.consume(g),g===92?y:p}function y(g){return g===91||g===92||g===93?(e.consume(g),c++,p):p(g)}}function fI(e,t,n){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,l=0,d;return m;function m(C){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(C){return C===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(C)}function y(C){if(l>999||C===93&&!d||C===null||C===91||qt(C))return n(C);if(C===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return c=Qr(s.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return qt(C)||(d=!0),l++,e.consume(C),C===92?g:y}function g(C){return C===91||C===92||C===93?(e.consume(C),l++,y):y(C)}function x(C){return C===58?(e.enter("definitionMarker"),e.consume(C),e.exit("definitionMarker"),o.includes(c)||o.push(c),Lt(e,b,"gfmFootnoteDefinitionWhitespace")):n(C)}function b(C){return t(C)}}function mI(e,t,n){return e.check(Io,t,e.attempt(lI,t,n))}function pI(e){e.exit("gfmFootnoteDefinition")}function gI(e,t,n){const s=this;return Lt(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const l=s.events[s.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(c):n(c)}}function yI(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:o};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function o(l,d){let m=-1;for(;++m<l.length;)if(l[m][0]==="enter"&&l[m][1].type==="strikethroughSequenceTemporary"&&l[m][1]._close){let p=m;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[m][1].end.offset-l[m][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[m][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[m][1].end)},g={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[m][1].start)},x=[["enter",y,d],["enter",l[p][1],d],["exit",l[p][1],d],["enter",g,d]],b=d.parser.constructs.insideSpan.null;b&&kr(x,x.length,0,Uc(b,l.slice(p+1,m),d)),kr(x,x.length,0,[["exit",g,d],["enter",l[m][1],d],["exit",l[m][1],d],["exit",y,d]]),kr(l,p-1,m-p+3,x),m=p+x.length-2;break}}for(m=-1;++m<l.length;)l[m][1].type==="strikethroughSequenceTemporary"&&(l[m][1].type="data");return l}function c(l,d,m){const p=this.previous,y=this.events;let g=0;return x;function x(C){return p===126&&y[y.length-1][1].type!=="characterEscape"?m(C):(l.enter("strikethroughSequenceTemporary"),b(C))}function b(C){const S=la(p);if(C===126)return g>1?m(C):(l.consume(C),g++,b);if(g<2&&!n)return m(C);const N=l.exit("strikethroughSequenceTemporary"),T=la(C);return N._open=!T||T===2&&!!S,N._close=!S||S===2&&!!T,d(C)}}}class vI{constructor(){this.map=[]}add(t,n,s){wI(this,t,n,s)}consume(t){if(this.map.sort(function(c,l){return c[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let o=s.pop();for(;o;){for(const c of o)t.push(c);o=s.pop()}this.map.length=0}}function wI(e,t,n,s){let o=0;if(!(n===0&&s.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...s);return}o+=1}e.map.push([t,n,s])}}function bI(e,t){let n=!1;const s=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function xI(){return{flow:{null:{name:"table",tokenize:kI,resolveAll:SI}}}}function kI(e,t,n){const s=this;let o=0,c=0,l;return d;function d(E){let H=s.events.length-1;for(;H>-1;){const ae=s.events[H][1].type;if(ae==="lineEnding"||ae==="linePrefix")H--;else break}const ee=H>-1?s.events[H][1].type:null,ne=ee==="tableHead"||ee==="tableRow"?F:m;return ne===F&&s.parser.lazy[s.now().line]?n(E):ne(E)}function m(E){return e.enter("tableHead"),e.enter("tableRow"),p(E)}function p(E){return E===124||(l=!0,c+=1),y(E)}function y(E){return E===null?n(E):st(E)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),b):n(E):Nt(E)?Lt(e,y,"whitespace")(E):(c+=1,l&&(l=!1,o+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),l=!0,y):(e.enter("data"),g(E)))}function g(E){return E===null||E===124||qt(E)?(e.exit("data"),y(E)):(e.consume(E),E===92?x:g)}function x(E){return E===92||E===124?(e.consume(E),g):g(E)}function b(E){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(E):(e.enter("tableDelimiterRow"),l=!1,Nt(E)?Lt(e,C,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):C(E))}function C(E){return E===45||E===58?N(E):E===124?(l=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),S):q(E)}function S(E){return Nt(E)?Lt(e,N,"whitespace")(E):N(E)}function N(E){return E===58?(c+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),T):E===45?(c+=1,T(E)):E===null||st(E)?G(E):q(E)}function T(E){return E===45?(e.enter("tableDelimiterFiller"),_(E)):q(E)}function _(E){return E===45?(e.consume(E),_):E===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(E))}function R(E){return Nt(E)?Lt(e,G,"whitespace")(E):G(E)}function G(E){return E===124?C(E):E===null||st(E)?!l||o!==c?q(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):q(E)}function q(E){return n(E)}function F(E){return e.enter("tableRow"),M(E)}function M(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),M):E===null||st(E)?(e.exit("tableRow"),t(E)):Nt(E)?Lt(e,M,"whitespace")(E):(e.enter("data"),D(E))}function D(E){return E===null||E===124||qt(E)?(e.exit("data"),M(E)):(e.consume(E),E===92?U:D)}function U(E){return E===92||E===124?(e.consume(E),D):D(E)}}function SI(e,t){let n=-1,s=!0,o=0,c=[0,0,0,0],l=[0,0,0,0],d=!1,m=0,p,y,g;const x=new vI;for(;++n<e.length;){const b=e[n],C=b[1];b[0]==="enter"?C.type==="tableHead"?(d=!1,m!==0&&(nv(x,t,m,p,y),y=void 0,m=0),p={type:"table",start:Object.assign({},C.start),end:Object.assign({},C.end)},x.add(n,0,[["enter",p,t]])):C.type==="tableRow"||C.type==="tableDelimiterRow"?(s=!0,g=void 0,c=[0,0,0,0],l=[0,n+1,0,0],d&&(d=!1,y={type:"tableBody",start:Object.assign({},C.start),end:Object.assign({},C.end)},x.add(n,0,[["enter",y,t]])),o=C.type==="tableDelimiterRow"?2:y?3:1):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")?(s=!1,l[2]===0&&(c[1]!==0&&(l[0]=l[1],g=Vl(x,t,c,o,void 0,g),c=[0,0,0,0]),l[2]=n)):C.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(l[0]=l[1],g=Vl(x,t,c,o,void 0,g)),c=l,l=[c[1],n,0,0])):C.type==="tableHead"?(d=!0,m=n):C.type==="tableRow"||C.type==="tableDelimiterRow"?(m=n,c[1]!==0?(l[0]=l[1],g=Vl(x,t,c,o,n,g)):l[1]!==0&&(g=Vl(x,t,l,o,n,g)),o=0):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(l[3]=n)}for(m!==0&&nv(x,t,m,p,y),x.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=bI(t.events,n))}return e}function Vl(e,t,n,s,o,c){const l=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(c.end=Object.assign({},na(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const m=na(t.events,n[1]);if(c={type:l,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const p=na(t.events,n[2]),y=na(t.events,n[3]),g={type:d,start:Object.assign({},p),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",g,t]]),s!==2){const x=t.events[n[2]],b=t.events[n[3]];if(x[1].end=Object.assign({},b[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const C=n[2]+1,S=n[3]-n[2]-1;e.add(C,S,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return o!==void 0&&(c.end=Object.assign({},na(t.events,o)),e.add(o,0,[["exit",c,t]]),c=void 0),c}function nv(e,t,n,s,o){const c=[],l=na(t.events,n);o&&(o.end=Object.assign({},l),c.push(["exit",o,t])),s.end=Object.assign({},l),c.push(["exit",s,t]),e.add(n+1,0,c)}function na(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const CI={name:"tasklistCheck",tokenize:NI};function jI(){return{text:{91:CI}}}function NI(e,t,n){const s=this;return o;function o(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return qt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),l):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),l):n(m)}function l(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(m)}function d(m){return st(m)?t(m):Nt(m)?e.check({tokenize:TI},t,n)(m):n(m)}}function TI(e,t,n){return Lt(e,s,"whitespace");function s(o){return o===null?n(o):t(o)}}function PI(e){return Ex([ZL(),cI(),yI(e),xI(),jI()])}const EI={};function Hf(e){const t=this,n=e||EI,s=t.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),l=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(PI(n)),c.push(QL()),l.push(YL(n))}const rv="*** Begin Patch",iv="*** End Patch";function RI(e){const t=e.replace(/\r\n/g,`
|
|
98
|
+
`);if(!t.includes(rv)||!t.includes(iv))return null;const n=t.split(`
|
|
99
|
+
`),s=[];let o=null,c=null;for(const l of n){if(l===rv||l===iv)continue;if(l.startsWith("*** Update File: ")){o=Zd("update",l.slice(17)),s.push(o),c=null;continue}if(l.startsWith("*** Add File: ")){o=Zd("add",l.slice(14)),s.push(o),c={oldLineNumber:0,newLineNumber:1};continue}if(l.startsWith("*** Delete File: ")){o=Zd("delete",l.slice(17)),s.push(o),c=null;continue}if(!o)continue;if(l.startsWith("*** Move to: ")){o.nextPath=l.slice(13),o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("@@")){c=AI(l)??{oldLineNumber:0,newLineNumber:0},o.lines.push({kind:"hunk",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l==="*** End of File"){o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(o.action==="add"&&l.startsWith("+")){o.additions+=1,o.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:(c==null?void 0:c.newLineNumber)??o.additions}),c&&(c.newLineNumber+=1);continue}if(!c){o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("+")){o.additions+=1,o.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:c.newLineNumber}),c.newLineNumber+=1;continue}if(l.startsWith("-")){o.deletions+=1,o.lines.push({kind:"remove",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:null}),c.oldLineNumber+=1;continue}if(l.startsWith(" ")||l.length===0){o.lines.push({kind:"context",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:c.newLineNumber}),c.oldLineNumber+=1,c.newLineNumber+=1;continue}o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null})}return s.length===0?null:{files:s,totalAdditions:s.reduce((l,d)=>l+d.additions,0),totalDeletions:s.reduce((l,d)=>l+d.deletions,0)}}function MI(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Zd(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function AI(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const LI=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,II=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,DI=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,_I=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function So(e){const t=FI(e);return t||wk(e)}function FI(e){const t=e.trim();if(!OI(t))return null;try{const n=JSON.parse(t),s=BI(n);return s.text||s.inlineImages.length>0?s:null}catch{return null}}function OI(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function BI(e){const t=[],n=[];return dc(e,t,n),{text:xk(t.join(`
|
|
100
|
+
|
|
101
|
+
`)),inlineImages:bk(n)}}function dc(e,t,n){if(typeof e=="string"){const l=wk(e);l.text&&t.push(l.text),n.push(...l.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(l=>dc(l,t,n));return}if(typeof e!="object")return;const s=e,o=new Set,c=UI(s);c&&(n.push(c),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(l=>{l in s&&o.add(l)}));for(const l of["image_url","url","src","source"]){const d=s[l];typeof d!="string"||!kk(d)||(n.push(ys(d,Dr(s.alt))),o.add(l))}for(const l of["text","message","content","output","result","summary","caption"])l in s&&(o.add(l),dc(s[l],t,n));o.size>0||Object.values(s).forEach(l=>{dc(l,t,n)})}function wk(e){const t=[];let n=e;return n=n.replace(_I,(s,o,c)=>{const l=qI(o,"name"),d=$I(c);return d!=null&&d.url&&t.push(ys(d.url,d.altText||l)),""}),n=n.replace(II,(s,o,c)=>(t.push(ys(c,o)),"")),n=n.replace(DI,(s,o)=>(t.push(ys(o,null)),"")),n=n.replace(LI,(s,o,c)=>(t.push(ys(s,null,`image/${o}`,Rc(c))),"")),{text:xk(n),inlineImages:bk(t)}}function ys(e,t,n,s){const o=n??zI(e)??"image/png";return{url:e,mimeType:o,altText:Co(t),estimatedBytes:s??WI(e)}}function UI(e){const t=HI(e.source);if(t){const o=Dr(t.type).trim().toLowerCase(),c=av(t.media_type??t.mime_type??t.mimeType),l=sv(t.data);if(o==="base64"&&c&&l)return ys(`data:${c};base64,${l}`,Co(Dr(t.alt)||Dr(t.name)||Dr(e.alt)||Dr(e.name)),c,Rc(l))}const n=av(e.media_type??e.mime_type??e.mimeType),s=sv(e.data);return n&&s?ys(`data:${n};base64,${s}`,Co(Dr(e.alt)||Dr(e.name)),n,Rc(s)):null}function bk(e){const t=new Map;return e.forEach(n=>{t.has(n.url)||t.set(n.url,n)}),[...t.values()]}function xk(e){return e.replace(/\r\n/g,`
|
|
102
|
+
`).replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
|
|
103
|
+
`).replace(/\n{3,}/g,`
|
|
104
|
+
|
|
105
|
+
`).trim()}function kk(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function zI(e){var n;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((n=t==null?void 0:t[1])==null?void 0:n.toLowerCase())??null}function WI(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?Rc(t[1]):null}function Rc(e){const t=e.trim(),n=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-n)}function Co(e){const t=Dr(e).trim();return t.length>0?t:null}function sv(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function av(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function Dr(e){return typeof e=="string"?e:""}function HI(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function $I(e){const t=e.trim();if(t.length===0)return null;try{const n=JSON.parse(t),s=Dr(n.image_url??n.imageUrl).trim(),o=Co(Dr(n.name)||Dr(n.alt));return{url:kk(s)?s:null,altText:o}}catch{const n=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return n?{url:n[1],altText:null}:null}}function qI(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=e.match(new RegExp(`${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return Co((s==null?void 0:s[1])??(s==null?void 0:s[2])??(s==null?void 0:s[3])??(s==null?void 0:s[4])??"")}const VI=480;function Gh(e){return e.kind==="tool_call"||e.kind==="tool_result"}function Sk(e){return e.toolCall?e.toolCall:Gh(e)?{callId:e.rawRef||e.id,name:"tool",input:e.kind==="tool_call"?e.content:"",output:e.kind==="tool_result"&&e.content?e.content:null,error:null,status:e.kind==="tool_call"?"running":"completed"}:null}function GI(e){return e==="shell_command"||e==="tool"?h("conversation.roleTool"):e}function KI(e){if(!e.trim())return null;try{const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function QI(e){const t=KI(e.input),n=t&&typeof t.command=="string"?t.command.trim():"";if(n)return`${h("conversation.toolPreviewCommand")}:${n}`;if(e.name==="read_thread_terminal")return h("conversation.toolPreviewTerminal");const s=e.input||e.error||e.output||h("conversation.toolResultEmpty");return s.length>60?`${s.slice(0,60)}...`:s}function YI(e){const t=e.map(c=>({message:c,tool:Sk(c)})).filter(c=>!!c.tool);if(t.length===0)return null;const n={...t[0].tool};let s=!1,o=!1;for(const{message:c,tool:l}of t)c.kind==="tool_call"&&(s=!0,!n.input&&l.input&&(n.input=l.input)),c.kind==="tool_result"&&(o=!0,n.output=l.output,n.error=l.error,n.status=l.status,!n.input&&l.input&&(n.input=l.input)),!n.name&&l.name&&(n.name=l.name);return{key:t.map(({message:c})=>c.id).join(":"),tool:n,hasRequest:s,hasResult:o}}function XI(e){const t=new Map;for(const n of e){const s=Sk(n);if(!s)continue;const o=t.get(s.callId);if(o){o.messages.push(n);continue}t.set(s.callId,{messages:[n],firstSequence:n.sequence})}return Array.from(t.values()).sort((n,s)=>n.firstSequence-s.firstSequence).map(n=>YI(n.messages)).filter(n=>!!n)}function JI(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n];if(!Gh(s)){t.push({type:"message",key:s.id,message:s});continue}const o=[s];let c=n+1;for(;c<e.length;){const d=e[c];if(!Gh(d))break;o.push(d),c+=1}const l=XI(o);if(l.length===0){t.push({type:"message",key:s.id,message:s}),n=c-1;continue}l.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),n=c-1}return t}function ZI(e,t){if(!AT(null,e))return!1;const n=t.trim();return/AGENTS\.md instructions for/i.test(n)&&/<INSTRUCTIONS>/i.test(n)&&/<\/INSTRUCTIONS>/i.test(n)}function eD(e){const t=e.split(/\r?\n/).map(n=>n.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):h("conversation.rulesMessageTitle")}function Kh(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>Kh(n)).join(""):e&&typeof e=="object"&&"props"in e?Kh(((t=e.props)==null?void 0:t.children)??""):""}function tD(e){const t=Array.isArray(e)?e[0]:e;if(!w.isValidElement(t))return null;const n=t.props,s=typeof n.className=="string"?n.className:"",o=/language-([^\s]+)/.exec(s);return{content:Kh(n.children).replace(/\n$/,""),codeClassName:s||void 0,language:(o==null?void 0:o[1])??null}}function nD(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function rD(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!nD(e))throw new Error(h("conversation.copyContentFailed"))}}function Ck({language:e,codeClassName:t,content:n}){const{showToast:s}=Qn(),o=Kn(),c=(e==null?void 0:e.trim().toLowerCase())??null,l=c==="text",d=c||"code";async function m(){try{await rD(n,o),s({title:h("conversation.copyContentSuccess"),tone:"success"})}catch(p){s({title:p instanceof Error?p.message:h("conversation.copyContentFailed"),tone:"error"})}}return i.jsxs("div",{className:`code-block${l?" text-code-block":""}`,children:[i.jsxs("div",{className:"code-header",children:[i.jsx("span",{className:"code-header-label",children:d}),i.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void m(),children:h("conversation.copyAction")})]}),i.jsx("pre",{className:t,children:i.jsx("code",{children:n})})]})}function hc({content:e,className:t}){return i.jsx("div",{className:t,children:i.jsx(Bf,{remarkPlugins:[Hf],components:{p:({node:n,...s})=>i.jsx("p",{...s}),pre(n){const s=tD(n.children);return s?i.jsx(Ck,{language:s.language,codeClassName:s.codeClassName,content:s.content}):i.jsx("pre",{children:n.children})},code(n){const s=typeof n.className=="string"?n.className:"";return i.jsx("code",{className:s||void 0,children:n.children})}},children:e})})}function ov(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function Gl({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){return i.jsx(iD,{sessionId:e,attachments:n,attachmentPayloads:t,inlineImages:s})}function iD({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){const[o,c]=w.useState({}),[l,d]=w.useState(null),m=w.useMemo(()=>n.map((x,b)=>{const C=ov(x,t==null?void 0:t[b]);if(C)return{id:x.id,fileName:x.fileName,fileSize:x.fileSize,url:C,status:"ready"};const S=o[x.id];return{id:x.id,fileName:x.fileName,fileSize:x.fileSize,url:(S==null?void 0:S.url)??null,status:(S==null?void 0:S.status)??(e?"loading":"error")}}),[t,n,o,e]),p=w.useMemo(()=>s.map((x,b)=>({id:`inline-image-${b}`,fileName:x.altText||`${h("conversation.imageAttachmentLabel")} ${b+1}`,fileSize:x.estimatedBytes,url:x.url,status:"ready"})),[s]),y=w.useMemo(()=>[...p,...m],[m,p]),g=y.find(x=>x.id===l)??null;return w.useEffect(()=>{if(!l)return;function x(b){b.key==="Escape"&&d(null)}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[l]),w.useEffect(()=>{const x=n.filter((S,N)=>!ov(S,t==null?void 0:t[N]));if(!e||x.length===0){c({});return}let b=!1;const C=[];return c(Object.fromEntries(x.map(S=>[S.id,{id:S.id,fileName:S.fileName,fileSize:S.fileSize,url:null,status:"loading"}]))),Promise.all(x.map(async S=>{try{const N=await uT(e,S.id),T=URL.createObjectURL(N);return C.push(T),{id:S.id,fileName:S.fileName,fileSize:S.fileSize,url:T,status:"ready"}}catch{return{id:S.id,fileName:S.fileName,fileSize:S.fileSize,url:null,status:"error"}}})).then(S=>{if(b){C.forEach(N=>URL.revokeObjectURL(N));return}c(Object.fromEntries(S.map(N=>[N.id,N])))}),()=>{b=!0,C.forEach(S=>URL.revokeObjectURL(S))}},[t,n,e]),y.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"message-attachments",children:y.map(x=>{const b=x.status==="loading"?h("conversation.attachmentPreviewLoading"):x.status==="error"?h("conversation.attachmentPreviewUnavailable"):h("conversation.attachmentPreviewOpen");return i.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>x.url&&d(x.id),disabled:!x.url,"aria-label":`${x.fileName} - ${b}`,title:b,children:i.jsx("div",{className:"message-attachment-card",children:x.url?i.jsx("img",{className:"message-attachment-thumbnail",src:x.url,alt:x.fileName||h("conversation.attachmentPreviewAlt"),loading:"lazy"}):i.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:x.status==="loading"?h("conversation.attachmentPreviewLoading"):h("conversation.attachmentPreviewUnavailable")})})},x.id)})}),g!=null&&g.url?i.jsxs("div",{className:"workbench-modal-layer message-image-modal",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("conversation.attachmentPreviewClose"),onClick:()=>d(null)}),i.jsxs("div",{className:"workbench-modal-card surface-card message-image-modal-card",children:[i.jsxs("div",{className:"workbench-modal-header message-image-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("conversation.imagePreviewTitle")}),i.jsx("p",{children:g.fileName})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("conversation.attachmentPreviewClose"),onClick:()=>d(null),children:"x"})]}),i.jsxs("div",{className:"message-image-modal-body",children:[i.jsx("div",{className:"message-image-modal-stage",children:i.jsx("img",{className:"message-image-modal-image",src:g.url,alt:g.fileName||h("conversation.attachmentPreviewAlt")})}),i.jsx("p",{className:"message-image-modal-hint",children:h("conversation.imagePreviewHint")})]})]})]}):null]})}function sD(){return i.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:5},(e,t)=>i.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[i.jsx("div",{className:"timeline-skeleton-avatar"}),i.jsxs("div",{className:"timeline-skeleton-bubble",children:[i.jsx("span",{className:"timeline-skeleton-line long"}),i.jsx("span",{className:"timeline-skeleton-line medium"}),i.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function aD({tool:e,preview:t}){const[n,s]=w.useState(!1);return w.useEffect(()=>{if(!n)return;function o(c){c.key==="Escape"&&s(!1)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((o,c)=>i.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>s(!0),children:[i.jsx("span",{className:"apply-patch-summary-label",children:lv(o.action)}),i.jsx("span",{className:"apply-patch-summary-file",title:eh(o),children:MI(o.nextPath??o.path)}),i.jsxs("span",{className:"apply-patch-summary-stats",children:[i.jsxs("span",{className:"apply-patch-summary-added",children:["+",o.additions]}),i.jsxs("span",{className:"apply-patch-summary-removed",children:["-",o.deletions]})]})]},cv(o,c)))}),n&&typeof document<"u"?Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer apply-patch-modal",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:()=>s(!1)}),i.jsxs("div",{className:"workbench-modal-card surface-card apply-patch-modal-card",children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("conversation.applyPatchDialogTitle")}),i.jsx("p",{children:h("conversation.applyPatchDialogDescription")})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:()=>s(!1),children:"x"})]}),i.jsxs("div",{className:"apply-patch-modal-totals",children:[i.jsxs("span",{className:"apply-patch-stat-pill positive",children:[h("conversation.applyPatchAddedStat")," +",t.totalAdditions]}),i.jsxs("span",{className:"apply-patch-stat-pill negative",children:[h("conversation.applyPatchRemovedStat")," -",t.totalDeletions]})]}),i.jsxs("div",{className:"apply-patch-modal-body",children:[t.files.length===0?i.jsx("p",{className:"status-text",children:h("conversation.applyPatchEmpty")}):t.files.map((o,c)=>i.jsxs("section",{className:"apply-patch-file-panel",children:[i.jsxs("div",{className:"apply-patch-file-panel-header",children:[i.jsxs("div",{className:"apply-patch-file-panel-title",children:[i.jsx("span",{className:"apply-patch-summary-label",children:lv(o.action)}),i.jsx("strong",{children:eh(o)})]}),i.jsxs("div",{className:"apply-patch-summary-stats",children:[i.jsxs("span",{className:"apply-patch-summary-added",children:["+",o.additions]}),i.jsxs("span",{className:"apply-patch-summary-removed",children:["-",o.deletions]})]})]}),i.jsx("div",{className:"apply-patch-diff-view",children:i.jsx("div",{className:"apply-patch-diff-scroll",children:o.lines.map((l,d)=>i.jsxs("div",{className:`apply-patch-diff-line ${lD(l.kind)}`,children:[i.jsx("span",{className:"apply-patch-line-number",children:uv(l.oldLineNumber)}),i.jsx("span",{className:"apply-patch-line-number",children:uv(l.newLineNumber)}),i.jsx("span",{className:"apply-patch-line-content",children:l.text||" "})]},`${eh(o)}:${d}`))})})]},cv(o,c))),e.error?i.jsxs("section",{className:"apply-patch-error-panel",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolResultLabel")}),i.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]})]})]}),document.body):null]})}function oD({group:e}){const[t,n]=w.useState(!1),{tool:s,hasRequest:o,hasResult:c}=e,l=GI(s.name),d=w.useMemo(()=>s.name==="apply_patch"?RI(s.input):null,[s.input,s.name]);if(d)return i.jsx(aD,{tool:s,preview:d});const m=QI(s),p=!!(s.input||s.output||s.error);return i.jsxs("div",{className:`tool-call-item ${c?"tool-result":""}`,children:[i.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>p&&n(y=>!y),children:[i.jsxs("div",{className:"tool-call-info",children:[i.jsx("span",{className:"tool-call-name",children:l}),i.jsx("span",{className:"tool-call-input-preview",children:m})]}),i.jsx("div",{className:"tool-call-meta",children:p&&i.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&p&&i.jsxs("div",{className:"tool-call-output",children:[o&&s.input&&i.jsxs("div",{className:"tool-call-section",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolInputLabel")}),i.jsx("pre",{children:s.input})]}),(c||s.error||s.output)&&i.jsxs("div",{className:"tool-call-section",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolResultLabel")}),i.jsx("pre",{className:s.error?"tool-call-error":void 0,children:s.error||s.output||h("conversation.toolResultEmpty")})]})]})]})}function lv(e){return h(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function eh(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function cv(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function lD(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function uv(e){return e===null||e<=0?"":String(e)}function cD({message:e,tone:t,onRetry:n}){const[s,o]=w.useState(!1),c=eD(e.content),l=t==="user-message";return i.jsxs("article",{className:`message-item ${t} rules-message-row`,children:[i.jsxs("div",{className:"message-content-wrapper",children:[i.jsxs("div",{className:"rules-message-card",children:[i.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":s,onClick:()=>o(d=>!d),children:[i.jsxs("div",{className:"rules-message-heading",children:[i.jsx("span",{className:"rules-message-badge",children:h("conversation.rulesMessageTitle")}),i.jsx("span",{className:"rules-message-summary",children:c})]}),i.jsx("span",{className:"rules-message-action",children:h(s?"conversation.rulesMessageCollapse":"conversation.rulesMessageExpand")})]}),i.jsx("p",{className:"rules-message-hint",children:h("conversation.rulesMessageHint")}),s&&i.jsx("div",{className:"rules-message-body",children:i.jsx(hc,{content:e.content,className:"message-text message-content markdown-content"})})]}),e.deliveryState==="failed"&&e.clientRequestId&&i.jsx("button",{className:"retry-button",type:"button",onClick:()=>n(e.clientRequestId),children:h("conversation.resendButton")})]}),l&&i.jsx("time",{className:"message-time",dateTime:e.timestamp,children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})}function uD({message:e,provider:t,onRetry:n}){const s=e.role==="user",o=e.kind==="thinking",c=e.role==="assistant"&&e.kind==="text",l=ZI(t,e.content),d=w.useMemo(()=>So(e.content),[e.content]),m=d.text,p=d.inlineImages;if(l){const y=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return i.jsx(cD,{message:e,tone:y,onRetry:n})}return s?i.jsxs("article",{className:"message-item user-message",children:[i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Gl,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),m?i.jsx(hc,{content:m,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&i.jsx("button",{className:"retry-button",type:"button",onClick:()=>n(e.clientRequestId),children:h("conversation.resendButton")})]}),i.jsx("time",{className:"message-time",dateTime:e.timestamp,children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}):o?i.jsxs("article",{className:"message-item assistant-message thinking-message-row",children:[i.jsx("div",{className:"message-avatar",children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}),i.jsxs("div",{className:"message-content-wrapper thinking-message-wrapper",children:[i.jsx("div",{className:"thinking-message-label",children:h("conversation.thinkingLabel")}),i.jsx(Gl,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),m&&i.jsx(hc,{content:m,className:"message-text message-content markdown-content thinking-message-text"})]})]}):c?i.jsxs("article",{className:"message-item assistant-message",children:[i.jsx("div",{className:"message-avatar",children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}),i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Gl,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),m&&i.jsx(hc,{content:m,className:"message-text message-content markdown-content"})]})]}):i.jsx("article",{className:"message-item system-message",children:i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Gl,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:p}),m?i.jsx("div",{className:"message-text message-content",children:i.jsx(Ck,{language:"text",content:m})}):null]})})}function jk({sessionId:e="session",messages:t,historyState:n,loadingOlderMessages:s=!1,hasOlderMessages:o=!1,onLoadOlderMessages:c=()=>{},onRetryMessage:l,provider:d}){const{showToast:m}=Qn(),p=w.useRef(null),y=w.useRef(e),g=w.useRef(t.length),x=w.useRef(th(t.at(-1)??null)),b=w.useRef(!0),C=w.useRef(null),S=w.useRef(!1),N=JI(t),T=n==="loading"&&t.length===0;function _(G){return S.current||!o||s||n!=="ready"||G.scrollTop>VI?!1:(S.current=!0,C.current=G.scrollHeight-G.scrollTop,c(),!0)}w.useEffect(()=>{n==="error"&&m({title:h("conversation.historyLoadFailed"),tone:"error"})},[n,m]),w.useEffect(()=>{y.current!==e&&(y.current=e,g.current=0,x.current=null,b.current=!0,C.current=null)},[e]),w.useLayoutEffect(()=>{const G=p.current;if(!G){g.current=t.length,x.current=th(t.at(-1)??null);return}const q=g.current,F=x.current,M=th(t.at(-1)??null);C.current!==null&&t.length>=q?(G.scrollTop=Math.max(0,G.scrollHeight-C.current),C.current=null):b.current&&(q===0||t.length!==q||M!==F)&&(G.scrollTop=G.scrollHeight),g.current=t.length,x.current=M},[t,e]),w.useEffect(()=>{if(!o){S.current=!1;return}!s&&C.current===null&&(S.current=!1)},[o,s,t.length]);function R(){const G=p.current;if(!G)return;const q=G.scrollHeight-G.clientHeight-G.scrollTop;b.current=q<=80,_(G)}return w.useEffect(()=>{const G=p.current;G&&_(G)},[o,n,s,t.length,c]),i.jsxs("section",{className:"message-timeline",children:[n==="loading"&&i.jsx("div",{className:"timeline-status",children:i.jsx("span",{className:"status-text",children:h("conversation.historyLoading")})}),i.jsxs("div",{ref:p,className:"message-list",onScroll:R,children:[T?i.jsx(sD,{}):null,s?i.jsx("div",{className:"timeline-status timeline-status-inline",children:i.jsx("span",{className:"status-text",children:h("conversation.historyLoadingOlder")})}):null,N.length===0&&n==="ready"&&i.jsx("div",{className:"timeline-empty",children:i.jsx("p",{className:"status-text",children:h("conversation.timelineEmpty")})}),N.map(G=>G.type==="tool_group"?i.jsx("article",{className:"message-item tool-message-row",children:i.jsx(oD,{group:G.group})},G.key):i.jsx(uD,{message:G.message,provider:d,onRetry:l},G.key))]})]})}function th(e){return e?JSON.stringify({id:e.id,content:e.content,attachments:e.attachments,timestamp:e.timestamp,deliveryState:e.deliveryState,toolCall:e.toolCall?{status:e.toolCall.status,output:e.toolCall.output,error:e.toolCall.error}:null}):null}function dD({items:e,deletingQueueItemId:t=null,steeringQueueItemId:n=null,canSteer:s=!1,onDelete:o,onSteer:c}){return e.length===0?null:i.jsxs("section",{className:"queued-message-list","aria-label":h("conversation.queueTitle"),children:[i.jsx("div",{className:"queued-message-list__header",children:i.jsx("h2",{children:`${h("conversation.queueTitle")} · ${e.length}`})}),i.jsx("div",{className:"queued-message-list__items",children:e.map((l,d)=>{const m=l.status==="queued"||l.status==="failed",p=s&&typeof c=="function"&&l.status==="queued";return i.jsxs("article",{className:"queued-message-item",children:[i.jsxs("div",{className:"queued-message-item__main",children:[i.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:d+1}),i.jsx("p",{className:"queued-message-item__content",title:l.content||h("conversation.queueImageOnly"),children:l.content||h("conversation.queueImageOnly")}),i.jsx("span",{className:`queued-message-item__status queued-message-item__status--${l.status}`,children:l.status==="failed"?h("conversation.queueStatusFailed"):h("conversation.queueStatusQueued")}),i.jsxs("div",{className:"queued-message-item__actions",children:[p?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void c(l.id),disabled:n===l.id,"aria-label":h("conversation.queueSteer"),title:h("conversation.queueSteer"),children:n===l.id?h("conversation.queueSteering"):h("conversation.queueSteer")}):null,m?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void o(l.id),disabled:t===l.id,"aria-label":h("conversation.queueDelete"),title:h("conversation.queueDelete"),children:t===l.id?"…":"×"}):null]})]}),l.errorDetail?i.jsx("p",{className:"queued-message-item__error",children:l.errorDetail}):null]},l.id)})})]})}function xn(e,t,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function Oi(e,t,n,s,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ls,Lr,Zs,Kl,fc;const or="__TAURI_TO_IPC_KEY__";function Nk(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class Tk{constructor(t){ls.set(this,void 0),Lr.set(this,0),Zs.set(this,[]),Kl.set(this,void 0),Oi(this,ls,t||(()=>{})),this.id=Nk(n=>{const s=n.index;if("end"in n){s==xn(this,Lr,"f")?this.cleanupCallback():Oi(this,Kl,s);return}const o=n.message;if(s==xn(this,Lr,"f")){for(xn(this,ls,"f").call(this,o),Oi(this,Lr,xn(this,Lr,"f")+1);xn(this,Lr,"f")in xn(this,Zs,"f");){const c=xn(this,Zs,"f")[xn(this,Lr,"f")];xn(this,ls,"f").call(this,c),delete xn(this,Zs,"f")[xn(this,Lr,"f")],Oi(this,Lr,xn(this,Lr,"f")+1)}xn(this,Lr,"f")===xn(this,Kl,"f")&&this.cleanupCallback()}else xn(this,Zs,"f")[s]=o})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Oi(this,ls,t)}get onmessage(){return xn(this,ls,"f")}[(ls=new WeakMap,Lr=new WeakMap,Zs=new WeakMap,Kl=new WeakMap,or)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[or]()}}async function ge(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class Pk{get rid(){return xn(this,fc,"f")}constructor(t){fc.set(this,void 0),Oi(this,fc,t)}async close(){return ge("plugin:resources|close",{rid:this.rid})}}fc=new WeakMap;class Ek{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.width=t[0].Logical.width,this.height=t[0].Logical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toPhysical(t){return new mo(this.width*t,this.height*t)}[or](){return{width:this.width,height:this.height}}toJSON(){return this[or]()}}class mo{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.width=t[0].Physical.width,this.height=t[0].Physical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toLogical(t){return new Ek(this.width/t,this.height/t)}[or](){return{width:this.width,height:this.height}}toJSON(){return this[or]()}}class ea{constructor(t){this.size=t}toLogical(t){return this.size instanceof Ek?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof mo?this.size:this.size.toPhysical(t)}[or](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[or]()}}class Rk{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.x=t[0].Logical.x,this.y=t[0].Logical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toPhysical(t){return new Fi(this.x*t,this.y*t)}[or](){return{x:this.x,y:this.y}}toJSON(){return this[or]()}}class Fi{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.x=t[0].Physical.x,this.y=t[0].Physical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toLogical(t){return new Rk(this.x/t,this.y/t)}[or](){return{x:this.x,y:this.y}}toJSON(){return this[or]()}}class Ui{constructor(t){this.position=t}toLogical(t){return this.position instanceof Rk?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof Fi?this.position:this.position.toPhysical(t)}[or](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[or]()}}var vr;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(vr||(vr={}));async function Mk(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await ge("plugin:event|unlisten",{event:e,eventId:t})}async function Ak(e,t,n){var s;const o=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(s=n==null?void 0:n.target)!==null&&s!==void 0?s:{kind:"Any"};return ge("plugin:event|listen",{event:e,target:o,handler:Nk(t)}).then(c=>async()=>Mk(e,c))}async function hD(e,t,n){return Ak(e,s=>{Mk(e,s.id),t(s)},n)}async function fD(e,t){await ge("plugin:event|emit",{event:e,payload:t})}async function mD(e,t,n){await ge("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:n})}class po extends Pk{constructor(t){super(t)}static async new(t,n,s){return ge("plugin:image|new",{rgba:ri(t),width:n,height:s}).then(o=>new po(o))}static async fromBytes(t){return ge("plugin:image|from_bytes",{bytes:ri(t)}).then(n=>new po(n))}static async fromPath(t){return ge("plugin:image|from_path",{path:t}).then(n=>new po(n))}async rgba(){return ge("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return ge("plugin:image|size",{rid:this.rid})}}function ri(e){return e==null?null:typeof e=="string"?e:e instanceof po?e.rid:e}var Qh;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Qh||(Qh={}));class pD{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var dv;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(dv||(dv={}));function $f(){return new Lk(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function nh(){return ge("plugin:window|get_all_windows").then(e=>e.map(t=>new Lk(t,{skip:!0})))}const rh=["tauri://created","tauri://error"];class Lk{constructor(t,n={}){var s;this.label=t,this.listeners=Object.create(null),n!=null&&n.skip||ge("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(s=n.parent)===null||s===void 0?void 0:s.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async o=>this.emit("tauri://error",o))}static async getByLabel(t){var n;return(n=(await nh()).find(s=>s.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return $f()}static async getAll(){return nh()}static async getFocusedWindow(){for(const t of await nh())if(await t.isFocused())return t;return null}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const s=this.listeners[t];s.splice(s.indexOf(n),1)}:Ak(t,n,{target:{kind:"Window",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const s=this.listeners[t];s.splice(s.indexOf(n),1)}:hD(t,n,{target:{kind:"Window",label:this.label}})}async emit(t,n){if(rh.includes(t)){for(const s of this.listeners[t]||[])s({event:t,id:-1,payload:n});return}return fD(t,n)}async emitTo(t,n,s){if(rh.includes(n)){for(const o of this.listeners[n]||[])o({event:n,id:-1,payload:s});return}return mD(t,n,s)}_handleTauriEvent(t,n){return rh.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async scaleFactor(){return ge("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return ge("plugin:window|inner_position",{label:this.label}).then(t=>new Fi(t))}async outerPosition(){return ge("plugin:window|outer_position",{label:this.label}).then(t=>new Fi(t))}async innerSize(){return ge("plugin:window|inner_size",{label:this.label}).then(t=>new mo(t))}async outerSize(){return ge("plugin:window|outer_size",{label:this.label}).then(t=>new mo(t))}async isFullscreen(){return ge("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return ge("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return ge("plugin:window|is_maximized",{label:this.label})}async isFocused(){return ge("plugin:window|is_focused",{label:this.label})}async isDecorated(){return ge("plugin:window|is_decorated",{label:this.label})}async isResizable(){return ge("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return ge("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return ge("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return ge("plugin:window|is_closable",{label:this.label})}async isVisible(){return ge("plugin:window|is_visible",{label:this.label})}async title(){return ge("plugin:window|title",{label:this.label})}async theme(){return ge("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return ge("plugin:window|is_always_on_top",{label:this.label})}async center(){return ge("plugin:window|center",{label:this.label})}async requestUserAttention(t){let n=null;return t&&(t===Qh.Critical?n={type:"Critical"}:n={type:"Informational"}),ge("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(t){return ge("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return ge("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return ge("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return ge("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return ge("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return ge("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return ge("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return ge("plugin:window|maximize",{label:this.label})}async unmaximize(){return ge("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return ge("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return ge("plugin:window|minimize",{label:this.label})}async unminimize(){return ge("plugin:window|unminimize",{label:this.label})}async show(){return ge("plugin:window|show",{label:this.label})}async hide(){return ge("plugin:window|hide",{label:this.label})}async close(){return ge("plugin:window|close",{label:this.label})}async destroy(){return ge("plugin:window|destroy",{label:this.label})}async setDecorations(t){return ge("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return ge("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return ge("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return ge("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return ge("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return ge("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return ge("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return ge("plugin:window|set_size",{label:this.label,value:t instanceof ea?t:new ea(t)})}async setMinSize(t){return ge("plugin:window|set_min_size",{label:this.label,value:t instanceof ea?t:t?new ea(t):null})}async setMaxSize(t){return ge("plugin:window|set_max_size",{label:this.label,value:t instanceof ea?t:t?new ea(t):null})}async setSizeConstraints(t){function n(s){return s?{Logical:s}:null}return ge("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(t==null?void 0:t.minWidth),minHeight:n(t==null?void 0:t.minHeight),maxWidth:n(t==null?void 0:t.maxWidth),maxHeight:n(t==null?void 0:t.maxHeight)}})}async setPosition(t){return ge("plugin:window|set_position",{label:this.label,value:t instanceof Ui?t:new Ui(t)})}async setFullscreen(t){return ge("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return ge("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return ge("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return ge("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return ge("plugin:window|set_icon",{label:this.label,value:ri(t)})}async setSkipTaskbar(t){return ge("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return ge("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return ge("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return ge("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return ge("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return ge("plugin:window|set_cursor_position",{label:this.label,value:t instanceof Ui?t:new Ui(t)})}async setIgnoreCursorEvents(t){return ge("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return ge("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return ge("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return ge("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return ge("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return ge("plugin:window|set_overlay_icon",{label:this.label,value:t?ri(t):void 0})}async setProgressBar(t){return ge("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return ge("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return ge("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return ge("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(vr.WINDOW_RESIZED,n=>{n.payload=new mo(n.payload),t(n)})}async onMoved(t){return this.listen(vr.WINDOW_MOVED,n=>{n.payload=new Fi(n.payload),t(n)})}async onCloseRequested(t){return this.listen(vr.WINDOW_CLOSE_REQUESTED,async n=>{const s=new pD(n);await t(s),s.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const n=await this.listen(vr.DRAG_ENTER,l=>{t({...l,payload:{type:"enter",paths:l.payload.paths,position:new Fi(l.payload.position)}})}),s=await this.listen(vr.DRAG_OVER,l=>{t({...l,payload:{type:"over",position:new Fi(l.payload.position)}})}),o=await this.listen(vr.DRAG_DROP,l=>{t({...l,payload:{type:"drop",paths:l.payload.paths,position:new Fi(l.payload.position)}})}),c=await this.listen(vr.DRAG_LEAVE,l=>{t({...l,payload:{type:"leave"}})});return()=>{n(),o(),s(),c()}}async onFocusChanged(t){const n=await this.listen(vr.WINDOW_FOCUS,o=>{t({...o,payload:!0})}),s=await this.listen(vr.WINDOW_BLUR,o=>{t({...o,payload:!1})});return()=>{n(),s()}}async onScaleChanged(t){return this.listen(vr.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(vr.WINDOW_THEME_CHANGED,t)}}var hv;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(hv||(hv={}));var fv;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(fv||(fv={}));var mv;(function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"})(mv||(mv={}));var pv;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(pv||(pv={}));const gD=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function qf(e){return e instanceof HTMLElement?!e.closest(gD):!0}async function Vf(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await $f().startDragging()}const gv=48;function yD(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function $i(e,t){const n=yD(e)||t,s=n.length>gv?n.slice(0,gv).trimEnd():n;return{fullTitle:n,displayTitle:s}}function vD(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function Ik({session:e}){const t=Kn(),n=w.useCallback(c=>{!t.isDesktop||t.ui.osFamily!=="macos"||c.button!==0||qf(c.target)&&Vf()},[t.isDesktop,t.ui.osFamily]);if(!e)return i.jsx("header",{className:"conversation-header conversation-header-skeleton","aria-hidden":"true","data-window-drag-handle":"conversation-header",onMouseDownCapture:n,children:i.jsxs("div",{className:"conversation-header-main",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx("span",{className:"skeleton-line long"})]})});const s=$i(e.title,h("conversation.titleFallback")),o=vD(s.displayTitle);return i.jsx("header",{className:"conversation-header","data-window-drag-handle":"conversation-header",onMouseDownCapture:n,children:i.jsx("div",{className:"conversation-header-main",children:i.jsx("h1",{className:`conversation-title is-${o}`,title:s.fullTitle,children:s.displayTitle})})})}function Gr(){return"/workspaces"}function ii(e){return`/workspaces/${encodeURIComponent(e)}`}function _o(e){return`${ii(e)}/sessions`}function Gn(e,t){return`${_o(e)}/${encodeURIComponent(t)}`}function ha(e,t){const n=`${ii(e)}/tools`;if(!t)return n;const s=new URLSearchParams({tab:t});return`${n}?${s.toString()}`}function Dk(e){return`${ii(e)}/tools/files`}function _k(e){return`${ii(e)}/tools/git`}function $c(e){return`${ii(e)}/tools/processes`}function ia(e){return`${ii(e)}/terminals`}function Gf(e){return e.flatMap(t=>t.sessions.map(n=>({session:n,workspace:t.workspace}))).sort((t,n)=>(n.session.lastMessageAt??n.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function Fk(e){const t=new Map(e.map(o=>[o.session.sessionId,o])),n=new Map,s=[];for(const o of e){const c=bD(o,t);if(c===o.session.sessionId){s.push(o);continue}const l=n.get(c)??[];n.set(c,[...l,o])}return[...s].sort(yv).map(o=>({entry:o,children:[...n.get(o.session.sessionId)??[]].sort(yv)}))}function Ok(e,t){const n=wD(),s=new URLSearchParams({provider:t});return`${Gn(e,n)}?${s.toString()}`}function wD(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function yv(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function bD(e,t){var o;let n=e;const s=new Set([e.session.sessionId]);for(;;){const c=((o=n.session.parentSessionId)==null?void 0:o.trim())||null;if(!c)return n.session.sessionId;const l=t.get(c);if(!l)return n.session.sessionId;if(s.has(l.session.sessionId))return e.session.sessionId;s.add(l.session.sessionId),n=l}}const xD="mobile.tools.last-primary-tool";function Bk(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(xD)==="git"?"git":"files"}catch{return"files"}}function Kf(e){var s;const t=[{pattern:"/workspaces/:workspaceId/tools/processes",routeKind:"processes"},{pattern:"/workspaces/:workspaceId/tools/files",routeKind:"files"},{pattern:"/workspaces/:workspaceId/tools/git",routeKind:"git"},{pattern:"/workspaces/:workspaceId/tools",routeKind:"home"}];for(const o of t){const c=kn(o.pattern,e),l=((s=c==null?void 0:c.params.workspaceId)==null?void 0:s.trim())??null;if(l)return{workspaceId:l,routeKind:o.routeKind,legacy:!1}}const n=[{pattern:"/tools/processes",routeKind:"processes"},{pattern:"/tools/files",routeKind:"files"},{pattern:"/tools/git",routeKind:"git"},{pattern:"/tools",routeKind:"home"}];for(const o of n)if(kn(o.pattern,e))return{workspaceId:null,routeKind:o.routeKind,legacy:!0};return null}function kD(e,t){const n=Kf(e);if((n==null?void 0:n.routeKind)==="git")return"git";if((n==null?void 0:n.routeKind)==="files")return"files";const s=new URLSearchParams(t).get("tab");return s==="git"?"git":s==="files"?"files":Bk()}function Qf(e,t){const n=Kf(e);return n!=null&&n.workspaceId?ha(n.workspaceId,kD(e,t)):n!=null&&n.legacy?Bk()==="git"?"/tools?tab=git":"/tools?tab=files":null}function Yf({activeEntry:e,presentation:t,pathname:n,search:s,moreButtonLabel:o}){if(t==="conversation-focus"||e!=="tools")return null;const c=Kf(n);return c?c.routeKind==="processes"?{title:h("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:o}:(c.routeKind==="home"||c.routeKind==="files"||c.routeKind==="git",null):null}const Uk=w.createContext({composerPortalTarget:null});function Xf({composerPortalTarget:e,children:t}){return i.jsx(Uk.Provider,{value:{composerPortalTarget:e},children:t})}function zk(){return w.useContext(Uk)}function Jf(e,t,n){const[s,o]=w.useState(void 0);return w.useEffect(()=>{const c=e.current,l=t.current;if(!n||!c||!l){o(void 0),c&&c.style.removeProperty("--mobile-conversation-tabbar-height");return}const d=c,m=l;function p(){if(!e.current||!m.isConnected)return;const g=`${Math.round(m.getBoundingClientRect().height)}px`;d.style.setProperty("--mobile-conversation-tabbar-height",g),o(g)}p();const y=typeof ResizeObserver<"u"?new ResizeObserver(p):null;return y==null||y.observe(m),window.addEventListener("resize",p),()=>{y==null||y.disconnect(),window.removeEventListener("resize",p),d.style.removeProperty("--mobile-conversation-tabbar-height")}},[n,e,t]),s}const SD=3e3,vv=10,wv=84,bv=.36;function Zf({enabled:e,rootRef:t,suspended:n=!1,resetKey:s}){const o=w.useRef(null),c=w.useRef(null),l=w.useRef("visible"),d=w.useRef(1),[m,p]=w.useState("visible"),[y,g]=w.useState(1);w.useEffect(()=>{l.current=m},[m]),w.useEffect(()=>{d.current=y},[y]);function x(){cs(o),o.current=window.setTimeout(()=>{p("hidden"),g(0)},SD)}function b(){p("visible"),g(1),x()}w.useEffect(()=>{if(cs(o),!e){cs(o),p("visible"),g(1);return}if(n){p("hidden"),g(0);return}return b(),()=>{cs(o)}},[e,s,n]),w.useEffect(()=>()=>{cs(o)},[]),w.useEffect(()=>{if(!e||n){c.current=null;return}const S=t.current;if(!S)return;function N(M){if(M.touches.length!==1){c.current=null;return}const D=M.touches[0],U=Sv(M.target);if(!D||!U){c.current=null;return}c.current={startY:D.clientY,pointerType:"touch",initialState:l.current==="visible"?"visible":"hidden",touchId:D.identifier,dragging:!1,latestProgress:d.current},l.current==="visible"&&cs(o)}function T(M){const D=c.current;if(!D||D.pointerType!=="touch")return;const U=ih(M.touches,D.touchId);if(!U)return;const E=U.clientY-D.startY,H=D.initialState==="hidden"?-E:E;H<=vv&&!D.dragging||(jv(M),D.dragging=!0,D.latestProgress=xv(D.initialState,H),p("dragging"),g(D.latestProgress))}function _(M){const D=c.current;if(!(!D||D.pointerType!=="touch"||!ih(M.changedTouches,D.touchId))){if(c.current=null,!D.dragging){D.initialState==="visible"&&x();return}kv(D.initialState,D.latestProgress,b,p,g)}}function R(M){const D=c.current;if(!(!D||D.pointerType!=="touch"||!ih(M.changedTouches,D.touchId))){if(c.current=null,!D.dragging){D.initialState==="visible"&&x();return}if(D.initialState==="visible"){b();return}p("hidden"),g(0)}}function G(M){if(M.pointerType!=="touch")return;if(!Sv(M.target)){c.current=null;return}if(c.current={startY:M.clientY,pointerType:"pointer",initialState:l.current==="visible"?"visible":"hidden",pointerId:M.pointerId,captureTarget:M.target instanceof Element?M.target:null,dragging:!1,latestProgress:d.current},M.target instanceof Element)try{M.target.setPointerCapture(M.pointerId)}catch{}l.current==="visible"&&cs(o)}function q(M){const D=c.current;if(!D||D.pointerType!=="pointer")return;const U=M.clientY-D.startY,E=D.initialState==="hidden"?-U:U;E<=vv&&!D.dragging||(jv(M),D.dragging=!0,D.latestProgress=xv(D.initialState,E),p("dragging"),g(D.latestProgress))}function F(M){const D=c.current;if(!(!D||D.pointerType!=="pointer"||D.pointerId!==M.pointerId)){if(c.current=null,CD(D),!D.dragging){D.initialState==="visible"&&x();return}kv(D.initialState,D.latestProgress,b,p,g)}}return S.addEventListener("touchstart",N,{passive:!0}),S.addEventListener("pointerdown",G,{passive:!0}),window.addEventListener("touchmove",T,{passive:!1}),window.addEventListener("touchend",_),window.addEventListener("touchcancel",R),window.addEventListener("pointermove",q,{passive:!1}),window.addEventListener("pointerup",F),window.addEventListener("pointercancel",F),()=>{S.removeEventListener("touchstart",N),S.removeEventListener("pointerdown",G),window.removeEventListener("touchmove",T),window.removeEventListener("touchend",_),window.removeEventListener("touchcancel",R),window.removeEventListener("pointermove",q),window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",F)}},[e,t,n]);const C=e&&!n?y:e?0:1;return{state:n&&e?"hidden":m,progress:C,isOpen:C>.01}}function cs(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function xv(e,t){return Cv(e==="hidden"?t/wv:1-t/wv,0,1)}function kv(e,t,n,s,o){if(e==="hidden"){if(t>=bv){n();return}s("hidden"),o(0);return}if(t<=1-bv){s("hidden"),o(0);return}n()}function CD(e){if(!(e.pointerType!=="pointer"||typeof e.pointerId!="number"||!(e.captureTarget instanceof Element)))try{e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}catch{}}function ih(e,t){if(typeof t!="number")return e[0]??null;for(let n=0;n<e.length;n+=1){const s=e[n];if((s==null?void 0:s.identifier)===t)return s}return null}function Sv(e){return e instanceof Element?e.closest(".composer-panel"):null}function Cv(e,t,n){return Math.min(Math.max(e,t),n)}function jv(e){e.cancelable&&e.preventDefault()}function Fo({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s}){return e==="compact"?"compact":e==="expanded"&&n&&s?"expanded":t==="tools"&&s?"medium-auxiliary":n?"medium-navigation":s?"medium-auxiliary":"compact"}function Wk(e){return e==="medium-navigation"||e==="expanded"}function Hk(e){return e==="medium-auxiliary"||e==="expanded"}function em({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s,children:o,navigationPanel:c,auxiliaryPanel:l}){const d=Fo({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s}),m=Wk(d)&&c,p=Hk(d)&&l;return i.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":d,children:[m?i.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:c}):null,i.jsx("div",{className:"mobile-adaptive-pane-main",children:o}),p?i.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:l}):null]})}function jD({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:o,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:x}){const b=Kn(),C=Or(),S=Yr(),N=An(),T=w.useRef(null),_=w.useRef(null),[R,G]=w.useState(null),q=t==="conversation-focus",F=Zf({enabled:q,rootRef:T,resetKey:`${S.pathname}${S.search}`}),M=Fo({viewportClass:b.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o}),D=Yf({activeEntry:e,presentation:t,pathname:S.pathname,search:S.search,moreButtonLabel:h("shell.androidMoreAction")}),U=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(PD,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(ED,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(RD,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(MD,{}),onClick:m},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(AD,{}),onClick:x}],E=q?{"--mobile-conversation-tabbar-progress":F.progress.toFixed(4)}:void 0;Jf(T,_,q);function H(){const ne=Qf(S.pathname,S.search);if(!ne){m();return}N(ne,{replace:!0})}const ee=i.jsx("nav",{ref:_,className:"android-workbench-bottom-nav","aria-label":h("shell.title"),children:U.map(ne=>i.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":ne.key===e,"aria-current":ne.key===e?"page":void 0,onClick:()=>{ne.key!==e&&C.trigger("selection"),ne.onClick()},children:[i.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:ne.icon}),i.jsx("span",{className:"android-workbench-bottom-nav-label",children:ne.label})]},ne.key))});return i.jsx(Xf,{composerPortalTarget:q?R:null,children:i.jsxs("div",{ref:T,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":M,"data-tabbar-open":q?F.isOpen:!0,"data-conversation-tabbar-state":q?F.state:"default",style:E,children:[D?i.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[i.jsxs("div",{className:"android-workbench-topbar-leading",children:[D.showBackButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":h("common.back"),onClick:H,children:i.jsx(ND,{})}):null,i.jsx("div",{className:"android-workbench-topbar-copy",children:i.jsx("h1",{children:D.title})})]}),i.jsx("div",{className:"android-workbench-topbar-actions",children:D.showMoreButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":D.moreButtonLabel,onClick:g,children:i.jsx(TD,{})}):null})]}):null,i.jsx("div",{className:"android-workbench-content",children:i.jsx(em,{viewportClass:b.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o,navigationPanel:s,auxiliaryPanel:o,children:n})}),q?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:G,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:ee})]}):ee]})})}function ND(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"m15 18-6-6 6-6"}),i.jsx("path",{d:"M21 12H9"})]})}function TD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function PD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function ED(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function RD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function MD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function AD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}const LD=120,ao={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function Yh(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ID(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable||e.closest("[contenteditable='true']"))return!0;if(e instanceof HTMLTextAreaElement)return!e.readOnly&&!e.disabled;if(e instanceof HTMLInputElement){if(e.readOnly||e.disabled)return!1;const t=(e.type||"text").toLowerCase();return!["button","checkbox","color","file","hidden","image","radio","range","reset","submit"].includes(t)}return!1}function DD(){var t;if(typeof window>"u")return 0;const e=[window.innerHeight,typeof document<"u"?(t=document.documentElement)==null?void 0:t.clientHeight:0].filter(Yh);return e.length>0?Math.max(...e):0}function Nv(){if(typeof window>"u")return ao;const e=window.visualViewport,t=DD(),n=(e==null?void 0:e.height)??t,s=Yh(n)?Math.round(n):null,o=Yh(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,c=s===null?0:Math.max(0,Math.round(t-s-o));return{viewportHeight:s,keyboardInset:c,keyboardOpen:ID(typeof document<"u"?document.activeElement:null)&&c>=LD}}function sh(e,t){if(typeof document>"u")return;[document.documentElement,document.body].filter(s=>s instanceof HTMLElement).forEach(s=>{if(!e){delete s.dataset.mobileKeyboardOpen,delete s.dataset.mobileViewportBound,s.style.removeProperty("--mobile-shell-viewport-height"),s.style.removeProperty("--mobile-shell-keyboard-inset");return}s.dataset.mobileKeyboardOpen=String(t.keyboardOpen),s.dataset.mobileViewportBound="true",t.viewportHeight===null?s.style.removeProperty("--mobile-shell-viewport-height"):s.style.setProperty("--mobile-shell-viewport-height",`${t.viewportHeight}px`),s.style.setProperty("--mobile-shell-keyboard-inset",`${t.keyboardInset}px`)})}function _D(e){const[t,n]=w.useState(()=>e?Nv():ao),s=w.useRef(null);return w.useEffect(()=>{if(!e){n(ao),sh(!1,ao);return}function o(){n(Nv())}function c(){s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{s.current=null,o()},0)}o();const l=window.visualViewport;return window.addEventListener("resize",o),window.addEventListener("orientationchange",o),l==null||l.addEventListener("resize",o),l==null||l.addEventListener("scroll",o),document.addEventListener("focusin",o),document.addEventListener("focusout",c),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l==null||l.removeEventListener("resize",o),l==null||l.removeEventListener("scroll",o),document.removeEventListener("focusin",o),document.removeEventListener("focusout",c),sh(!1,ao)}},[e]),w.useEffect(()=>{sh(e,t)},[e,t]),t}function FD({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:o,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:x}){const b=Kn(),C=Or(),S=Yr(),N=An(),T=w.useRef(null),_=w.useRef(null),[R,G]=w.useState(null),q=t==="conversation-focus",F=Zf({enabled:q,rootRef:T,resetKey:`${S.pathname}${S.search}`}),M=Fo({viewportClass:b.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o}),D=Yf({activeEntry:e,presentation:t,pathname:S.pathname,search:S.search,moreButtonLabel:h("shell.iosMoreAction")}),U=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(UD,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(zD,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(WD,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(HD,{}),onClick:m},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx($D,{}),onClick:x}],E=q?{"--mobile-conversation-tabbar-progress":F.progress.toFixed(4)}:void 0;Jf(T,_,q);function H(){const ne=Qf(S.pathname,S.search);if(!ne){m();return}N(ne,{replace:!0})}const ee=i.jsx("nav",{ref:_,className:"ios-workbench-tabbar","aria-label":h("shell.title"),children:U.map(ne=>i.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":ne.key===e,"aria-current":ne.key===e?"page":void 0,onClick:()=>{ne.key!==e&&C.trigger("selection"),ne.onClick()},children:[i.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:ne.icon}),i.jsx("span",{className:"ios-workbench-tabbar-label",children:ne.label})]},ne.key))});return i.jsx(Xf,{composerPortalTarget:q?R:null,children:i.jsxs("div",{ref:T,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":M,"data-tabbar-open":q?F.isOpen:!0,"data-conversation-tabbar-state":q?F.state:"default",style:E,children:[D?i.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[i.jsx("div",{className:"ios-workbench-nav-leading",children:D.showBackButton?i.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":h("common.back"),onClick:H,children:[i.jsx(OD,{}),i.jsx("span",{children:h("common.back")})]}):null}),i.jsx("div",{className:"ios-workbench-nav-copy",children:i.jsx("h1",{children:D.title})}),i.jsx("div",{className:"ios-workbench-nav-actions",children:D.showMoreButton?i.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":D.moreButtonLabel,onClick:g,children:i.jsx(BD,{})}):null})]}):null,i.jsx("div",{className:"ios-workbench-content",children:i.jsx(em,{viewportClass:b.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o,navigationPanel:s,auxiliaryPanel:o,children:n})}),q?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:G,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:ee})]}):ee]})})}function OD(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:i.jsx("path",{d:"m15 18-6-6 6-6"})})}function BD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function UD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function zD(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function WD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function HD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function $D(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function qD(e){const t=Kn();return t.platform==="ios"?i.jsx(FD,{...e}):t.platform==="android"?i.jsx(jD,{...e}):i.jsx(VD,{...e})}function VD({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:o,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:x}){const b=Kn(),C=Or(),S=Yr(),N=An(),T=w.useRef(null),_=w.useRef(null),[R,G]=w.useState(null),q=_D(b.platform==="web"),F=b.platform==="web"&&q.keyboardOpen,M=t==="conversation-focus",D=Zf({enabled:M,rootRef:T,suspended:F,resetKey:`${S.pathname}${S.search}`}),U=Fo({viewportClass:b.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o}),E=Yf({activeEntry:e,presentation:t,pathname:S.pathname,search:S.search,moreButtonLabel:h("shell.iosMoreAction")}),H=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(QD,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(YD,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(XD,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(JD,{}),onClick:m},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(ZD,{}),onClick:x}],ee=M?{"--mobile-conversation-tabbar-progress":D.progress.toFixed(4)}:void 0;Jf(T,_,M);function ne(){const te=Qf(S.pathname,S.search);if(!te){m();return}N(te,{replace:!0})}const ae=i.jsx("nav",{ref:_,className:"mobile-workbench-tabbar","aria-label":h("shell.title"),hidden:F,children:H.map(te=>i.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":te.key===e,"aria-current":te.key===e?"page":void 0,onClick:()=>{te.key!==e&&C.trigger("selection"),te.onClick()},children:[i.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:te.icon}),i.jsx("span",{className:"mobile-workbench-tabbar-label",children:te.label})]},te.key))});return i.jsx(Xf,{composerPortalTarget:M?R:null,children:i.jsxs("div",{ref:T,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":b.platform,"data-mobile-keyboard-open":F,"data-pane-layout":U,"data-tabbar-open":F?!1:M?D.isOpen:!0,"data-conversation-tabbar-state":M?D.state:"default",style:ee,children:[E?i.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[i.jsxs("div",{className:"mobile-workbench-header-leading",children:[E.showBackButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":h("common.back"),onClick:ne,children:i.jsx(GD,{})}):null,i.jsx("div",{className:"mobile-workbench-header-copy",children:i.jsx("h1",{children:E.title})})]}),i.jsx("div",{className:"mobile-workbench-header-actions",children:E.showMoreButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":E.moreButtonLabel,onClick:g,children:i.jsx(KD,{})}):null})]}):null,i.jsx("div",{className:"mobile-workbench-content",children:i.jsx(em,{viewportClass:b.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o,navigationPanel:s,auxiliaryPanel:o,children:n})}),M?i.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[i.jsx("div",{ref:G,className:"mobile-conversation-bottom-layer-composer-slot"}),i.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:ae})]}):ae]})})}function GD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"m15 18-6-6 6-6"}),i.jsx("path",{d:"M21 12H9"})]})}function KD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function QD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function YD(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function XD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function JD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function ZD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}class $k{constructor(t){Ze(this,"maxAttempts");Ze(this,"baseDelayMs");Ze(this,"reconnectAttempts",0);Ze(this,"reconnectTimer",null);Ze(this,"disposed",!1);this.options=t,this.maxAttempts=t.maxAttempts??4,this.baseDelayMs=t.baseDelayMs??300}start(){this.options.onReconnect(!1)}markConnected(){this.reconnectAttempts=0,this.options.onStateChange("connected")}markTransientFailure(){this.disposed||this.reconnectAttempts>0||this.options.onStateChange("reconnecting")}markDisconnected(){if(this.disposed)return;if(!cn.getState().autoReconnect){this.options.onStateChange("reconnect_failed");return}if(this.reconnectAttempts+=1,this.reconnectAttempts>this.maxAttempts){this.options.onStateChange("reconnect_failed");return}this.options.onStateChange("reconnecting");const t=this.baseDelayMs*this.reconnectAttempts;this.reconnectTimer=window.setTimeout(()=>{this.options.onReconnect(!0)},t)}reconnectNow(){this.reconnectAttempts=0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onReconnect(!0)}close(){this.disposed=!0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onStateChange("closed")}}class e2{constructor(t){Ze(this,"socket",null);Ze(this,"disposed",!1);Ze(this,"authRecoveryInFlight",!1);Ze(this,"pendingRefresh",!1);Ze(this,"fileTreeSubscription",null);Ze(this,"gitWorkspaceId",null);Ze(this,"terminalManagerWorkspaceId",null);Ze(this,"workspaceManagementWorkspaceId",null);Ze(this,"pendingFileTreeRefresh",null);Ze(this,"pendingGitRefreshWorkspaceId",null);Ze(this,"pendingTerminalManagerRefreshWorkspaceId",null);Ze(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);Ze(this,"fileTreeListeners",new Set);Ze(this,"gitListeners",new Set);Ze(this,"terminalManagerListeners",new Set);Ze(this,"workspaceManagementListeners",new Set);Ze(this,"connectionManager");this.options=t,this.connectionManager=new $k({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!Tv(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,n){this.fileTreeSubscription={workspaceId:t,paths:Pv(n)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,n){const s=Pv(n),o={type:"fileTree.refresh",workspaceId:t,paths:s};this.sendWhenReady(o)?this.pendingFileTreeRefresh=null:this.pendingFileTreeRefresh={workspaceId:t,paths:s}}subscribeGit(t){this.gitWorkspaceId=t,this.sendWhenReady({type:"git.subscribe",workspaceId:t})}requestGitRefresh(t){this.sendWhenReady({type:"git.refresh",workspaceId:t})?this.pendingGitRefreshWorkspaceId=null:this.pendingGitRefreshWorkspaceId=t}subscribeTerminalManager(t){this.terminalManagerWorkspaceId=t,this.sendWhenReady({type:"terminalManager.subscribe",workspaceId:t})}requestTerminalManagerRefresh(t){this.sendWhenReady({type:"terminalManager.refresh",workspaceId:t})?this.pendingTerminalManagerRefreshWorkspaceId=null:this.pendingTerminalManagerRefreshWorkspaceId=t}subscribeWorkspaceManagement(t){this.workspaceManagementWorkspaceId=t,this.sendWhenReady({type:"workspaceManagement.subscribe",workspaceId:t})}requestWorkspaceManagementRefresh(t){this.sendWhenReady({type:"workspaceManagement.refresh",workspaceId:t})?this.pendingWorkspaceManagementRefreshWorkspaceId=null:this.pendingWorkspaceManagementRefreshWorkspaceId=t}addFileTreeSnapshotListener(t){return this.fileTreeListeners.add(t),()=>{this.fileTreeListeners.delete(t)}}addGitSnapshotListener(t){return this.gitListeners.add(t),()=>{this.gitListeners.delete(t)}}addTerminalManagerSnapshotListener(t){return this.terminalManagerListeners.add(t),()=>{this.terminalManagerListeners.delete(t)}}addWorkspaceManagementSnapshotListener(t){return this.workspaceManagementListeners.add(t),()=>{this.workspaceManagementListeners.delete(t)}}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=Sn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${nx("/ws")}?access_token=${encodeURIComponent(n)}`,o=new WebSocket(s);this.socket=o,o.addEventListener("open",()=>{o.send(JSON.stringify({type:"workbench.subscribe"})),this.pendingRefresh&&this.requestRefresh(),this.fileTreeSubscription&&o.send(JSON.stringify({type:"fileTree.subscribe",workspaceId:this.fileTreeSubscription.workspaceId,paths:this.fileTreeSubscription.paths})),this.pendingFileTreeRefresh&&this.requestFileTreeRefresh(this.pendingFileTreeRefresh.workspaceId,this.pendingFileTreeRefresh.paths),this.gitWorkspaceId&&o.send(JSON.stringify({type:"git.subscribe",workspaceId:this.gitWorkspaceId})),this.pendingGitRefreshWorkspaceId&&this.requestGitRefresh(this.pendingGitRefreshWorkspaceId),this.terminalManagerWorkspaceId&&o.send(JSON.stringify({type:"terminalManager.subscribe",workspaceId:this.terminalManagerWorkspaceId})),this.pendingTerminalManagerRefreshWorkspaceId&&this.requestTerminalManagerRefresh(this.pendingTerminalManagerRefreshWorkspaceId),this.workspaceManagementWorkspaceId&&o.send(JSON.stringify({type:"workspaceManagement.subscribe",workspaceId:this.workspaceManagementWorkspaceId})),this.pendingWorkspaceManagementRefreshWorkspaceId&&this.requestWorkspaceManagementRefresh(this.pendingWorkspaceManagementRefreshWorkspaceId)}),o.addEventListener("message",l=>{var m,p,y,g,x,b,C,S;const d=JSON.parse(l.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.error"){d.error_code==="UNAUTHORIZED"&&this.handleUnauthorized();return}if(d.type==="fileTree.snapshot"){(p=(m=this.options).onFileTreeSnapshot)==null||p.call(m,d.snapshot),this.fileTreeListeners.forEach(N=>N(d.snapshot));return}if(d.type==="git.snapshot"){(g=(y=this.options).onGitSnapshot)==null||g.call(y,d.snapshot),this.gitListeners.forEach(N=>N(d.snapshot));return}if(d.type==="terminalManager.snapshot"){(b=(x=this.options).onTerminalManagerSnapshot)==null||b.call(x,d.snapshot),this.terminalManagerListeners.forEach(N=>N(d.snapshot));return}if(d.type==="workspaceManagement.snapshot"){(S=(C=this.options).onWorkspaceManagementSnapshot)==null||S.call(C,d.snapshot),this.workspaceManagementListeners.forEach(N=>N(d.snapshot));return}d.type==="workbench.snapshot"&&t2(d.snapshot)&&this.options.onSnapshot(d.snapshot)}),o.addEventListener("close",()=>{this.disposed||this.socket!==o||this.connectionManager.markDisconnected()}),o.addEventListener("error",()=>{this.disposed||this.socket!==o||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),Sn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendWhenReady(t){const n=this.socket;return Tv(n)?(n.send(JSON.stringify(t)),!0):!1}}function Tv(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function t2(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function Pv(e){const t=new Set;for(const n of e??[""])t.add(n.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}var mc,pc;function qk(e){var t;if("items"in e)e.items=(t=e.items)===null||t===void 0?void 0:t.map(n=>"rid"in n?n:qk(n));else if("action"in e&&e.action){const n=new Tk;return n.onmessage=e.action,delete e.action,{...e,handler:n}}return e}async function fa(e,t){const n=new Tk;if(t&&typeof t=="object"&&("action"in t&&t.action&&(n.onmessage=t.action,delete t.action),"item"in t&&t.item&&typeof t.item=="object"&&"About"in t.item&&t.item.About&&typeof t.item.About=="object"&&"icon"in t.item.About&&t.item.About.icon&&(t.item.About.icon=ri(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=ri(t.icon)),"items"in t&&t.items)){let s=function(o){var c;return"rid"in o?[o.rid,o.kind]:("item"in o&&typeof o.item=="object"&&(!((c=o.item.About)===null||c===void 0)&&c.icon)&&(o.item.About.icon=ri(o.item.About.icon)),"icon"in o&&o.icon&&(o.icon=ri(o.icon)),"items"in o&&o.items&&(o.items=o.items.map(s)),qk(o))};t.items=t.items.map(s)}return ge("plugin:menu|new",{kind:e,options:t,handler:n})}class ma extends Pk{get id(){return xn(this,mc,"f")}get kind(){return xn(this,pc,"f")}constructor(t,n,s){super(t),mc.set(this,void 0),pc.set(this,void 0),Oi(this,mc,n),Oi(this,pc,s)}}mc=new WeakMap,pc=new WeakMap;class tm extends ma{constructor(t,n){super(t,n,"MenuItem")}static async new(t){return fa("MenuItem",t).then(([n,s])=>new tm(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ge("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class nm extends ma{constructor(t,n){super(t,n,"Check")}static async new(t){return fa("Check",t).then(([n,s])=>new nm(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ge("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return ge("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return ge("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var Ev;(function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"})(Ev||(Ev={}));class rm extends ma{constructor(t,n){super(t,n,"Icon")}static async new(t){return fa("Icon",t).then(([n,s])=>new rm(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ge("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return ge("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:ri(t)})}}class im extends ma{constructor(t,n){super(t,n,"Predefined")}static async new(t){return fa("Predefined",t).then(([n,s])=>new im(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}function oa([e,t,n]){switch(n){case"Submenu":return new sm(e,t);case"Predefined":return new im(e,t);case"Check":return new nm(e,t);case"Icon":return new rm(e,t);case"MenuItem":default:return new tm(e,t)}}class sm extends ma{constructor(t,n){super(t,n,"Submenu")}static async new(t){return fa("Submenu",t).then(([n,s])=>new sm(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return ge("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ge("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ge("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:n})}async remove(t){return ge("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ge("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(oa)}async items(){return ge("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(oa))}async get(t){return ge("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?oa(n):null)}async popup(t,n){var s;return ge("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=n==null?void 0:n.label)!==null&&s!==void 0?s:null,at:t instanceof Ui?t:t?new Ui(t):null})}async setAsWindowsMenuForNSApp(){return ge("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return ge("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return ge("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:ri(t)})}}class sa extends ma{constructor(t,n){super(t,n,"Menu")}static async new(t){return fa("Menu",t).then(([n,s])=>new sa(n,s))}static async default(){return ge("plugin:menu|create_default").then(([t,n])=>new sa(t,n))}async append(t){return ge("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ge("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ge("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:n})}async remove(t){return ge("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ge("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(oa)}async items(){return ge("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(oa))}async get(t){return ge("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?oa(n):null)}async popup(t,n){var s;return ge("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=n==null?void 0:n.label)!==null&&s!==void 0?s:null,at:t instanceof Ui?t:t?new Ui(t):null})}async setAsAppMenu(){return ge("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new sa(t[0],t[1]):null)}async setAsWindowMenu(t){var n;return ge("plugin:menu|set_as_window_menu",{rid:this.rid,window:(n=t==null?void 0:t.label)!==null&&n!==void 0?n:null}).then(s=>s?new sa(s[0],s[1]):null)}}async function n2(e){if(e.length===0)return;await(await sa.new({items:e.map(n=>({id:n.id,text:n.label,enabled:!n.disabled,accelerator:n.accelerator,action:()=>{n.onSelect()}}))})).popup(void 0,$f())}const oo=new Map;function Vk(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function Rv(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Cn(e,t){const n=oo.get(e);if(n&&!Rv(n.savedAt,t))return n.value;if(!Vk())return null;const s=window.sessionStorage.getItem(e);if(!s)return null;try{const o=JSON.parse(s);return!o||Rv(o.savedAt,t)?(window.sessionStorage.removeItem(e),oo.delete(e),null):(oo.set(e,o),o.value)}catch{return window.sessionStorage.removeItem(e),oo.delete(e),null}}function xr(e,t){const n={savedAt:Date.now(),value:t};if(oo.set(e,n),!!Vk())try{window.sessionStorage.setItem(e,JSON.stringify(n))}catch{}}const r2="codingns.debug.perf";function i2(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(r2)==="1"}catch{return!1}}function jt(e,t){if(!i2()||typeof performance>"u")return;const n=Math.round(performance.now());if(t&&Object.keys(t).length>0){console.info(`[perf-ui] ${e} ${n}ms`,t);return}console.info(`[perf-ui] ${e} ${n}ms`)}function s2(e,t,n,s){return et.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:n,expectedVersion:s??void 0})})}function a2(e){return et.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function o2(e){return et.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function l2(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return et.request(`/api/files/download?${n.toString()}`)}function Xh(e,t,n=1,s=20){const o=new URLSearchParams({workspaceId:e,keyword:t,page:String(n),pageSize:String(s)});return et.request(`/api/files/search?${o.toString()}`)}function Mv(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return et.request(`/api/files/preview?${n.toString()}`)}const ah=5,oh=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function Gk(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function Kk(e,t){const n=e.reduce((d,m)=>d+m.count,0);if(n<=0)return[];const o=e.slice(0,ah).map((d,m)=>({...d,key:d.type,ratio:d.count/n,color:oh[m]??oh[0]})),c=e.slice(ah);if(c.length===0)return o;const l=c.reduce((d,m)=>d+m.count,0);return o.push({key:"other",type:t,count:l,ratio:l/n,color:oh[ah]}),o}function c2(e){if(e.length===0)return"conic-gradient(color-mix(in srgb, var(--border-primary) 78%, transparent) 0% 100%)";let t=0;return`conic-gradient(${e.map((s,o)=>{const c=t,l=o===e.length-1?1:Math.min(1,t+s.ratio);return t=l,`${s.color} ${Av(c)} ${Av(l)}`}).join(", ")})`}function Qk(e){return{"--workbench-manage-chart-background":c2(e)}}function Av(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}const u2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAbGSURBVHgBzZo/bBtVHMd/ZzuJA0gYCYlsOFO7xRFDy1R3olucqd0SJtiSjiCknBckpjZjBxRn7BR3owOqs5Wp7tZKoDgSQysh4UqUOCG2eZ/3/Oznv/fObqJ+pfPZd+/ufn++vz/vnQN5FwjbGZFGQSRYUb+yIu2c2tSxIOOMqpktqKpzz9X3ioSLNZkRgUwLhA4aW9KWvPqVl6mgldmVGZSJr0BX8Pb2gIVnRUltxbiKxFOgeLJzAYL3I5BQdhaL/sN9EJ5k1dADw+1LQU1tN328kYgaIMWzDSX4s0sUHmSVwZ5JeFqIGjhZgeKpokyzdKGUGQuyWOtA03YCxlNIC98K5X3AhLgYrYB2ndLeE5l0IFvXklK4mpRsxvyuvmqrrSX71aZUjlsyM4LkpuzM7w8dHhqoAxbO+9Fm63pSwhspLTSo1dt6n830bl1SStx9fK6/Z9LmWL3B1hZ/BHUl1+pgYI9S4Eh0EEVjJ5/SwiPI7m9Nuf+02SfUZi4pO+o8ynDcKmlRqRkPlZ43xQ+q8IXpVfdIsu88vJd2ZOSD/OcJKRXmtMW//PlMyi9a0jjvH5NZCDStEDydCjSlfvm9pa/hd24poc+zf/zH8PUjsCT57wOp/FjpqtQ9pakjR+KJo60Fbdnl3dMubSw4vrc2J/msSXLlF4ZCg+M4zzjGEzM39888aAWVFpYlZN+fRnfEE1iMh8JtVygsDWWefTOvhYMiCLX+8L8h4QHnVx+cas/klgLZvpb0eDrp9d/trjr609P6brbhgesPDXXA5kpS7t0ywYwVi4fERD8noJ1WfIDzBDYeRRw8GscL1gP5iCv0g7FsqAIX4UH9pHeegEb44uG5EuKsT3iuPbg9J08252VPxQ3CoowFGYlgRhEMEY2eFzp3CbbEQ3j28BnXjwI0CSvnXQu6lMJrnOd67qOV6fAf2HuuLPn2l4kbRgGT9yf2OU825o11lXDw+bgenb8LV5JdjwE8s/rAxMPXj0xMkGbxBkpWX8epCRp5WvuERNAHl9qADQ+j8xz0QuGDOz3rIizXW8/wHa7bzISSKAveNCQGGoVElPU3coaTcDQKhmoL3QxEkLMna2FplzKAOCFLGf6b4x+nJQbauURnHjsWWJQg8+1nsChCsZGh2LuUwTvb11J94zfVeVtPGOOej4CuNNlJI2xa9BUeQQaD3FKG83iAdItHClcSQ4rzLJvRohGsRCowqoexyCxKbNiUqVPrnf5MhBL0VKRTv6IWZCJnZJR4bujm7eprY+GD2/M6g/hZyypgKENGspThHha2fqxdjZ4sUg8iRz16aYLXBrN5SLPLa5tBMrGCT3T7wD0GgYcM1XwU0IWsXZ80wPY7WMpVguM2g0ABvMDmZhkXZox4w3dswvQV44FFSIe4vqT46rrbzSAEru1pXF6j1L2vTND6Us10p15Zr5Ywq2OTQRwUO0UMyiCM27PYDDKYLomRoy2VNq+n9HGfbGbvyzM9FWgd+4zMfWY4iaV1v6+assHCZNOl7XcKnUC0bUQ9osrq3qnTevgUTtZYUz4ecGEDDwtjaTYER8jsx0YAO5Gxc2EfyyP83lqq27b4Fc6gqhRolEXSe1FDrRBUZioslrYpkD3WthzHSyg0WNCIkVFeoNWw3S7UsQsAHqiobvQTgrgSNbL80gizdmU4EyEswsNzPMQxV3hqiO1oR3kDoyD87tOm57QStKusUNiUcigRXSlZQRchZW2qpc0Sdg5AbQDuw3XboDIQcwGAUm7uh3LWEPvPx88zRiNgWd5OaBr3o+oBrmeaCJhdDeZ7BB83kbETdjZ3bmzryii6eaDCR8c0PzUk/wOdTX7SFU//bEmg5EYoUiOCvv5H5NXbnuDffpHUGYoxLJN892uvarsgXXIPa/14SJTU+pBepXOWVf5W88yFI58VOWqBW9DAYNM3KQMRE0x4gO2JYmLZrtD1ItLTC3ooK2rKasdvzAIVwNp2PfTqpwmdWZY+CswMKzDeYZp579acNgDjodSLv+IK31JvcT4o218jlhYbM78LcJcUR8EG8xSWrynLL7sHZl7cnQQUoYKvLJn0eVwnHTenCVgxSSbwWNwF4cmm+owsbpeLxLqEC+WhoyPHhosl4Y3hewN4Pyw8mNzfhiehxFgzvRgg/IfhuLPRDXr4ljfwe5f/nkxz/m6HDWMR4zWrPBHPFx+zQ7/BX/d5zRrvRfeFU0pbfVcJHvpeMcVfDfAGby8TG/LO0BFc0vftiwtfzPBnD02rvFnZnrrwVUR3wvEFt5heARddZVDE/uXGjRdt4bru4UWODcfT5WmFdvE/Jeqz44iuBr4AAAAASUVORK5CYII=",d2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",h2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",f2=[{provider:"codex"},{provider:"claude-code"},{provider:"opencode"}];function Yk({disabled:e=!1,pendingProvider:t=null,onSelect:n}){const s=Or();return i.jsx("div",{className:"session-provider-grid",children:f2.map(o=>{const c=m2(o.provider),l=t===o.provider;return i.jsxs("button",{type:"button",className:"session-provider-card","data-provider":o.provider,"data-pending":l?"true":"false","aria-label":c,disabled:e,onClick:()=>{s.trigger("action"),n(o.provider)},children:[i.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:i.jsx("img",{src:p2(o.provider),alt:"",loading:"lazy"})}),i.jsxs("span",{className:"session-provider-card-copy",children:[i.jsx("strong",{children:c}),l?i.jsx("span",{className:"session-provider-card-status",children:h("shell.startingSession")}):null]})]},o.provider)})})}function m2(e){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?"shell.providerClaudeCode":"conversation.providerOpenCode")}function p2(e){return e==="codex"?u2:e==="claude-code"?d2:h2}const Ql={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function Xk({open:e,onClose:t,onCloned:n}){const{showToast:s}=Qn(),[o,c]=w.useState(!1),[l,d]=w.useState(Ql),[m,p]=w.useState(!1),[y,g]=w.useState(!1),[x,b]=w.useState(null),[C,S]=w.useState(""),[N,T]=w.useState(""),[_,R]=w.useState(null),[G,q]=w.useState([]),[F,M]=w.useState([]),D=o||y;w.useEffect(()=>{!e&&!o&&(d(Ql),p(!1),b(null))},[o,e]);const U=w.useCallback(async ye=>{g(!0),b(null);try{const J=await lx(ye);S(J.currentPath),T(J.currentPath),R(J.parentPath),q(J.roots),M(J.items),d(K=>({...K,parentPath:J.currentPath}))}catch(J){S(""),R(null),M([]),b(J instanceof Error?J.message:h("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function E(){o||(p(!1),b(null),d(Ql),t())}function H(){p(!0),U(l.parentPath||void 0)}function ee(){o||(p(!1),b(null))}async function ne(ye){ye.preventDefault(),await U(N)}function ae(){d(ye=>({...ye,parentPath:C})),p(!1),b(null)}async function te(ye){ye.preventDefault();const J=l.repositoryUrl.trim(),K=l.parentPath.trim();if(!J){s({title:h("shell.cloneRepoRequired"),tone:"error"});return}if(!K){s({title:h("shell.clonePathRequired"),tone:"error"});return}c(!0);try{const ue=await ZN({repositoryUrl:J,parentPath:K,directoryName:l.directoryName.trim()||void 0,name:l.name.trim()||void 0,auth:l.authMode==="none"?{mode:"none"}:l.authMode==="basic"?{mode:"basic",username:l.username.trim(),password:l.password}:{mode:"token",username:l.username.trim()||void 0,token:l.token}});await(n==null?void 0:n(ue)),d(Ql),p(!1),s({title:h("shell.cloneSuccess"),description:ue.path,tone:"success"}),t()}catch(ue){s({title:ue instanceof Error?ue.message:h("shell.cloneFailed"),tone:"error"})}finally{c(!1)}}return i.jsxs(i.Fragment,{children:[i.jsx(Fr,{open:e,title:h("shell.cloneWorkspaceTitle"),description:h("shell.cloneWorkspaceHint"),onClose:E,children:i.jsxs("form",{className:"workbench-clone-form",onSubmit:ye=>void te(ye),children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneRepositoryLabel")}),i.jsx("input",{type:"text",value:l.repositoryUrl,placeholder:h("shell.cloneRepositoryPlaceholder"),onChange:ye=>d(J=>({...J,repositoryUrl:ye.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneParentPathLabel")}),i.jsxs("div",{className:"workbench-modal-inline-field",children:[i.jsx("input",{type:"text",value:l.parentPath,placeholder:h("shell.cloneParentPathPlaceholder"),onChange:ye=>d(J=>({...J,parentPath:ye.target.value}))}),i.jsx("button",{type:"button",className:"secondary-button",disabled:o,onClick:H,children:h("shell.clonePickDirectory")})]})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneDirectoryNameLabel")}),i.jsx("input",{type:"text",value:l.directoryName,placeholder:h("shell.cloneDirectoryNamePlaceholder"),onChange:ye=>d(J=>({...J,directoryName:ye.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importNameLabel")}),i.jsx("input",{type:"text",value:l.name,placeholder:h("shell.importNamePlaceholder"),onChange:ye=>d(J=>({...J,name:ye.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneAuthModeLabel")}),i.jsxs("select",{value:l.authMode,onChange:ye=>d(J=>({...J,authMode:ye.target.value})),children:[i.jsx("option",{value:"none",children:h("shell.cloneAuthModeNone")}),i.jsx("option",{value:"basic",children:h("shell.cloneAuthModeBasic")}),i.jsx("option",{value:"token",children:h("shell.cloneAuthModeToken")})]})]}),l.authMode==="basic"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneUsernameLabel")}),i.jsx("input",{type:"text",value:l.username,placeholder:h("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:ye=>d(J=>({...J,username:ye.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.clonePasswordLabel")}),i.jsx("input",{type:"password",value:l.password,placeholder:h("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:ye=>d(J=>({...J,password:ye.target.value}))})]})]}):null,l.authMode==="token"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneUsernameLabel")}),i.jsx("input",{type:"text",value:l.username,placeholder:h("shell.cloneTokenUsernamePlaceholder"),onChange:ye=>d(J=>({...J,username:ye.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneTokenLabel")}),i.jsx("input",{type:"password",value:l.token,placeholder:h("shell.cloneTokenPlaceholder"),onChange:ye=>d(J=>({...J,token:ye.target.value}))})]})]}):null,i.jsx("p",{className:"workbench-import-hint",children:h("shell.cloneHint")}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:o,onClick:E,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:o,children:h(o?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),i.jsxs(Fr,{open:e&&m,title:h("shell.cloneBrowserTitle"),description:h("shell.cloneBrowserDescription"),onClose:ee,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:ne,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCurrentPath")}),i.jsx("input",{type:"text",value:N,placeholder:h("shell.importPathPlaceholder"),onChange:ye=>T(ye.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:D||!_,onClick:()=>{_&&U(_)},children:h("shell.importBrowserOpenParent")}),i.jsx("button",{type:"submit",className:"secondary-button",disabled:D,children:h("shell.importBrowserOpenPath")})]})]}),i.jsxs("section",{className:"workbench-directory-browser-panel",children:[i.jsxs("div",{className:"workbench-directory-browser-section",children:[i.jsx("span",{className:"workbench-directory-browser-section-title",children:h("shell.importBrowserRoots")}),i.jsx("div",{className:"workbench-directory-browser-root-list",children:G.map(ye=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:D,onClick:()=>{U(ye.path)},children:ye.name},ye.path))})]}),i.jsx("div",{className:"workbench-directory-browser-current-path",children:C}),x?i.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:x}):null,y?i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("common.loading")}):F.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:F.map(ye=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:D,onClick:()=>{U(ye.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:ye.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:ye.path})]},ye.path))}):i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("shell.importBrowserEmpty")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:o,onClick:ee,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:D||!C,onClick:ae,children:h("shell.cloneBrowserSubmit")})]})]})]})}function Jk({open:e,onClose:t,onImported:n}){const{showToast:s}=Qn(),[o,c]=w.useState(!1),[l,d]=w.useState(!1),[m,p]=w.useState(!1),[y,g]=w.useState(null),[x,b]=w.useState(""),[C,S]=w.useState(""),[N,T]=w.useState(null),[_,R]=w.useState([]),[G,q]=w.useState([]),[F,M]=w.useState(!1),[D,U]=w.useState(""),E=o||l||m,H=w.useCallback(async K=>{c(!0),g(null);try{const ue=await lx(K);b(ue.currentPath),S(ue.currentPath),T(ue.parentPath),R(ue.roots),q(ue.items)}catch(ue){b(""),T(null),q([]),g(ue instanceof Error?ue.message:h("shell.importBrowserBrowseFailed"))}finally{c(!1)}},[]);w.useEffect(()=>{if(!e){M(!1),U(""),g(null);return}H(x||void 0)},[H,e]);function ee(){E||(M(!1),U(""),t())}async function ne(K){K.preventDefault(),await H(C)}function ae(){!x||E||(U(""),M(!0))}function te(){l||(M(!1),U(""))}async function ye(K){K==null||K.preventDefault();const ue=D.trim();if(!(!x||!ue||E)){d(!0),g(null);try{const A=await eT({parentPath:x,directoryName:ue});s({title:h("shell.importBrowserCreateDirectorySuccess"),description:A.path,tone:"success"}),M(!1),U(""),await H(A.path)}catch(A){const z=A instanceof Error?A.message:h("shell.importBrowserCreateDirectoryFailed");g(z),s({title:z,tone:"error"})}finally{d(!1)}}}async function J(){const K=x.trim();if(!(!K||E)){p(!0);try{const ue=await JN({path:K});await(n==null?void 0:n(ue)),s({title:h("shell.importSuccess"),description:ue.path,tone:"success"}),t()}catch(ue){s({title:ue instanceof Error?ue.message:h("shell.importFailed"),tone:"error"})}finally{p(!1)}}}return i.jsxs(i.Fragment,{children:[i.jsxs(Fr,{open:e,title:h("shell.importBrowserTitle"),description:h("shell.importBrowserDescription"),onClose:ee,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:ne,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCurrentPath")}),i.jsx("input",{type:"text",value:C,placeholder:h("shell.importPathPlaceholder"),onChange:K=>S(K.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:E||!N,onClick:()=>{N&&H(N)},children:h("shell.importBrowserOpenParent")}),i.jsx("button",{type:"submit",className:"secondary-button",disabled:E,children:h("shell.importBrowserOpenPath")}),i.jsx("button",{type:"button",className:"secondary-button",disabled:E||!x,onClick:ae,children:h("shell.importBrowserCreateDirectory")})]})]}),i.jsxs("section",{className:"workbench-directory-browser-panel",children:[i.jsxs("div",{className:"workbench-directory-browser-section",children:[i.jsx("span",{className:"workbench-directory-browser-section-title",children:h("shell.importBrowserRoots")}),i.jsx("div",{className:"workbench-directory-browser-root-list",children:_.map(K=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:E,onClick:()=>{H(K.path)},children:K.name},K.path))})]}),i.jsx("div",{className:"workbench-directory-browser-current-path",children:x}),y?i.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:y}):null,o?i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("common.loading")}):G.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:G.map(K=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:E,onClick:()=>{H(K.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:K.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:K.path})]},K.path))}):i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("shell.importBrowserEmpty")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:E,onClick:ee,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:E||!x,onClick:()=>{J()},children:h(m?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),i.jsx(Fr,{open:e&&F,title:h("shell.importBrowserCreateDirectoryTitle"),description:h("shell.importBrowserCreateDirectoryDescription"),onClose:te,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:K=>void ye(K),children:[i.jsx("div",{className:"workbench-directory-browser-current-path",children:x}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCreateDirectoryLabel")}),i.jsx("input",{type:"text",value:D,placeholder:h("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:K=>U(K.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:l,onClick:te,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:l||!D.trim(),children:h(l?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const Lv="workbench.left.width",Iv="workbench.right.width",Dv="workbench.left.collapsed",_v="workbench.right.collapsed",lh="workbench.last.session.path",Fv="workbench.workspace.collapsed.ids",ch="workbench.workspace.selected.id",Zk="workbench.navigation.snapshot",g2=280,y2=320,Yl=208,Ov=520,Bv=560,v2=200,uh=20,Xl=40,Jl=5,w2=1800*1e3,Uv=60*1e3,b2="workbench:focus-composer";function zv(e,t){var l,d;const n=["/workspaces/:workspaceId","/workspaces/:workspaceId/sessions","/workspaces/:workspaceId/sessions/:sessionId","/workspaces/:workspaceId/tools","/workspaces/:workspaceId/tools/files","/workspaces/:workspaceId/tools/git","/workspaces/:workspaceId/tools/processes","/workspaces/:workspaceId/terminals"];for(const m of n){const p=kn(m,e),y=(l=p==null?void 0:p.params.workspaceId)==null?void 0:l.trim();if(y)return y}const s=go(e),o=(s==null?void 0:s.sessionId)??null;return!o||!hS(o)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function x2(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function k2(e){return e==="mobile"?Gr():"/landing"}function go(e){var c,l,d;const t=kn("/workspaces/:workspaceId/sessions/:sessionId",e),n=(c=t==null?void 0:t.params.sessionId)==null?void 0:c.trim();if(n)return{sessionId:n,workspaceId:((l=t==null?void 0:t.params.workspaceId)==null?void 0:l.trim())??null};const s=kn("/sessions/:sessionId",e),o=(d=s==null?void 0:s.params.sessionId)==null?void 0:d.trim();return o?{sessionId:o,workspaceId:null}:null}function S2(e){return!!(kn("/sessions",e)||kn("/workspaces/:workspaceId/sessions",e))}function Wv(e){return!!go(e)}function C2(e){return!!(kn("/tools",e)||kn("/tools/files",e)||kn("/tools/git",e)||kn("/tools/processes",e)||kn("/workspaces/:workspaceId/tools",e)||kn("/workspaces/:workspaceId/tools/files",e)||kn("/workspaces/:workspaceId/tools/git",e)||kn("/workspaces/:workspaceId/tools/processes",e))}function Hv(e){return!!(kn("/terminals",e)||kn("/workspaces/:workspaceId/terminals",e))}const j2=w.lazy(async()=>({default:(await Oc(()=>Promise.resolve().then(()=>JO),void 0)).FileContextPanel})),N2=w.lazy(async()=>({default:(await Oc(()=>Promise.resolve().then(()=>sB),void 0)).GitSidebar})),T2=w.lazy(async()=>({default:(await Oc(()=>Promise.resolve().then(()=>OF),void 0)).TerminalManagerPanel}));function P2(e){return!!(e!=null&&e.session)}function ps(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function no(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(P2):[]}const eS=w.createContext(null);function Mc(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function Jh(e){return e.isSubagent===!0}function ro(e){return e.isArchived===!0}function Zh(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function E2(e,t){let n=e;const s=new Set([e.sessionId]);for(;;){const o=Zh(n);if(!o)return n.sessionId;const c=t.get(o);if(!c)return n.sessionId;if(s.has(c.sessionId))return e.sessionId;s.add(c.sessionId),n=c}}function tS(e){const t=new Map(e.map(o=>[o.sessionId,o])),n=new Map,s=[];for(const o of e){const c=E2(o,t);if(c===o.sessionId){s.push(o);continue}const l=n.get(c)??[];n.set(c,[...l,o])}return[...s].sort(Mc).map(o=>({session:o,children:[...n.get(o.sessionId)??[]].sort(Mc)}))}function R2(e){return e.flatMap(t=>[t.session,...ps(t)])}function dh(e,t,n,s=-1){if(e<=0)return 0;const o=s>=0?Math.max(t,s+1):t;return Math.min(e,Math.max(n??0,o))}function $v(e,t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length?!1:n.every(o=>e[o]===t[o])}function M2(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function qc(e,t="compact"){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?t==="full"?"shell.providerClaudeCode":"conversation.providerClaude":e==="opencode"?"conversation.providerOpenCode":t==="full"?"shell.providerClaudeCode":"conversation.providerClaude")}const A2={position:"relative",zIndex:0},L2={zIndex:1};function nS(e,t,n){const s=[];n&&s.push(t.name);const o=M2(e);return o&&s.push(o),s.join(" · ")||t.name}function qv(e,t){return t!=null&&t.hasSubagents?e.activityState==="running"||t.isActive?"session-state-indicator is-subagent-running":"session-state-indicator is-subagent":e.activityState==="running"?e.activitySource==="inferred"?"session-state-indicator is-running-inferred":"session-state-indicator is-running":e.activityState==="completed_unread"?"session-state-indicator is-unread":"session-state-indicator is-idle"}function Vv(e,t){try{const n=window.localStorage.getItem(e),s=n?Number(n):Number.NaN;return Number.isFinite(s)?s:t}catch{return t}}function Gv(e,t){try{const n=window.localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function I2(e){try{const t=window.localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);if(!Array.isArray(n))return[];const s=[];for(const o of n)typeof o=="string"&&!s.includes(o)&&s.push(o);return s}catch{return[]}}function D2(e){var t;try{const n=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return n||null}catch{return null}}function us(e,t){try{window.localStorage.setItem(e,t)}catch{}}function _2(e){try{window.localStorage.removeItem(e)}catch{}}function Zl(e,t,n){return Math.max(t,Math.min(n,e))}function F2(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function O2(){typeof window>"u"||window.dispatchEvent(new CustomEvent(b2))}function Kv(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort(Mc)}))}function B2(){return Cn(Zk,w2)}function U2(e,t){let n=!1;const s=e.map(o=>{if(o.workspace.id!==t.workspaceId)return o;const c=o.sessions.findIndex(d=>d.sessionId===t.sessionId),l=c>=0?o.sessions.map((d,m)=>m===c?t:d):[t,...o.sessions];return n=!0,{...o,sessions:[...l].sort(Mc)}});return n?s:e}function z2(e,t,n){let s=!1;const o=e.map(c=>{let l=!1;const d=c.sessions.map(m=>m.sessionId!==t?m:(s=!0,l=!0,{...m,lastSeenAt:m.lastSeenAt&&m.lastSeenAt>n?m.lastSeenAt:n,activityState:m.activityState==="completed_unread"?"idle":m.activityState}));return l?{...c,sessions:d}:c});return s?o:e}function Qv(e,t,n){let s=!1;const o=e.map(c=>{let l=!1;const d=c.sessions.map(m=>m.sessionId!==t||m.isArchived===n?m:(s=!0,l=!0,{...m,isArchived:n}));return l?{...c,sessions:d}:c});return s?o:e}function Yv(e,t,n){let s=!1;const o=e.map(c=>{let l=!1;const d=c.sessions.map(m=>m.sessionId!==t||m.isFavorite===!0===n?m:(s=!0,l=!0,{...m,isFavorite:n}));return l?{...c,sessions:d}:c});return s?o:e}function ef(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function rS(e,t){const n=e.filter(s=>t.has(s));return n.length===e.length?e:n}function tf(e){return`workspace-management.summary.${e}`}function iS(e){return`git-sidebar.snapshot.${e}`}function sS(e,t){const n=e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:!!n,repoRoot:n,currentBranch:null,commitCount:null,remotes:[],error:null},codeComposition:{scannedFileCount:0,truncated:!1,items:[],error:null}}}function aS(e,t){const n=e.git.repoRoot??t.repoRoot??null;return{...e,workspaceId:t.id,name:t.name,path:t.path,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n}}}function oS(e,t){var o,c,l;const n=((o=t.status)==null?void 0:o.snapshot.repoRoot)??e.git.repoRoot,s=((c=t.status)==null?void 0:c.snapshot.branch)??((l=t.branches)==null?void 0:l.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n,currentBranch:s,error:null}}}function lS({count:e,className:t="workbench-skeleton-lines"}){return i.jsx("div",{className:t,"aria-hidden":"true",children:Array.from({length:e},(n,s)=>i.jsx("span",{className:"skeleton-line"},s))})}function W2(){return i.jsx("div",{className:"workbench-nav-loading","aria-hidden":"true",children:Array.from({length:3},(e,t)=>i.jsxs("section",{className:"workbench-skeleton-card",children:[i.jsxs("div",{className:"workbench-skeleton-heading",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx("span",{className:"skeleton-line tiny"})]}),i.jsx("div",{className:"workbench-skeleton-list",children:Array.from({length:3},(n,s)=>i.jsxs("div",{className:"workbench-skeleton-session",children:[i.jsx("span",{className:"workbench-skeleton-dot"}),i.jsx(lS,{count:2,className:"workbench-skeleton-lines compact"})]},s))})]},t))})}function ec(){return i.jsx("section",{className:"workbench-info-skeleton","aria-hidden":"true",children:Array.from({length:4},(e,t)=>i.jsxs("article",{className:"workbench-info-skeleton-card",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx(lS,{count:3})]},t))})}function H2({side:e,collapsed:t}){const n=e==="left"?8.5:15.5,s=e==="left"?t?"12 9 15 12 12 15":"15 9 12 12 15 15":t?"12 9 9 12 12 15":"9 9 12 12 9 15";return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:n,y1:"4",x2:n,y2:"20"}),i.jsx("polyline",{points:s})]})}function Xv({ariaLabel:e,side:t,collapsed:n,className:s="panel-icon-button",onClick:o}){return i.jsx("button",{className:s,type:"button","aria-label":e,title:e,onClick:o,children:i.jsx(H2,{side:t,collapsed:n})})}function Jv({expanded:e}){return i.jsx("svg",{className:e?"workbench-chevron":"workbench-chevron collapsed",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})}function $2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function q2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),i.jsx("line",{x1:"8",y1:"14",x2:"12",y2:"14"}),i.jsx("circle",{cx:"17.5",cy:"15.5",r:"2.5"})]})}function V2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function G2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("line",{x1:"20",y1:"20",x2:"16.65",y2:"16.65"})]})}function K2(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Q2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("path",{d:"M7 9l3 3-3 3"}),i.jsx("path",{d:"M13 15h4"})]})}function cS(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"15 18 9 12 15 6"})})}function am(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})}function uS(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),i.jsx("polyline",{points:"14 9 11 12 14 15"})]})}function Y2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"18",cy:"6",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("path",{d:"M6 9v6a3 3 0 0 0 3 3h3"}),i.jsx("line",{x1:"18",y1:"9",x2:"18",y2:"15"})]})}function X2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function J2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"5",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"14",y:"5",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"4",y:"13",width:"6",height:"6",rx:"1.5"}),i.jsx("path",{d:"M14 16l2 2 4-4"})]})}function Z2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"6",width:"10",height:"12",rx:"2"}),i.jsx("path",{d:"M10 12h8"}),i.jsx("path",{d:"M15 8l4 4-4 4"})]})}function e_({selected:e}){return e?i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),i.jsx("path",{d:"M8 12.5l2.8 2.8L16.5 9.5"})]}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})})}function dS({active:e}){return e?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:i.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})})}function t_(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M3 7h18"}),i.jsx("path",{d:"M5 7l1 12h12l1-12"}),i.jsx("path",{d:"M9 11h6"}),i.jsx("path",{d:"M8 4h8l1 3H7l1-3z"})]})}function n_(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M12 20h9"}),i.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function r_(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M9 13h6"})]})}function i_(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"})]})}function s_(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[i.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function a_({open:e,mode:t,keyword:n,codeWorkspaceId:s,codeResults:o,codeLoading:c,codeError:l,workspaceOptions:d,sessionResults:m,onClose:p,onModeChange:y,onKeywordChange:g,onCodeWorkspaceChange:x,onCodeSearch:b,onOpenSession:C}){const S=n.trim().length>0&&s.trim().length>0;return i.jsx(Fr,{open:e,title:h("shell.searchModalTitle"),description:h("shell.searchModalDescription"),onClose:p,children:i.jsxs("div",{className:"workbench-search-modal",children:[i.jsxs("div",{className:"workbench-search-mode-switch",role:"tablist","aria-label":h("shell.searchModeLabel"),children:[i.jsx("button",{type:"button",className:t==="sessions"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="sessions",onClick:()=>y("sessions"),children:h("shell.searchModeSessions")}),i.jsx("button",{type:"button",className:t==="code"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="code",onClick:()=>y("code"),children:h("shell.searchModeCode")})]}),t==="sessions"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchKeywordLabel")}),i.jsx("input",{type:"text",value:n,placeholder:h("shell.searchSessionPlaceholder"),autoFocus:!0,onChange:N=>g(N.target.value)})]}),i.jsx("div",{className:"workbench-search-results",children:n.trim().length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchSessionHint")}):m.length>0?m.map(N=>{const T=$i(N.session.title,h("common.unknown"));return i.jsxs("button",{type:"button",className:"workbench-search-result-item",onClick:()=>C(N.session.sessionId),children:[i.jsx("span",{className:"workbench-search-result-title",title:T.fullTitle,children:T.displayTitle}),i.jsxs("span",{className:"workbench-search-result-meta",children:[N.workspace.name," · ",qc(N.session.provider,"full")]})]},N.session.sessionId)}):i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchSessionEmpty")})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchWorkspaceLabel")}),i.jsx("select",{value:s,onChange:N=>x(N.target.value),children:d.map(N=>i.jsx("option",{value:N.id,children:N.name},N.id))})]}),i.jsxs("form",{className:"workbench-search-code-form",onSubmit:N=>{N.preventDefault(),b()},children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchKeywordLabel")}),i.jsx("input",{type:"text",value:n,placeholder:h("shell.searchCodePlaceholder"),autoFocus:!0,onChange:N=>g(N.target.value)})]}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!S||c,children:h(c?"common.loading":"shell.searchSubmit")})]}),i.jsxs("div",{className:"workbench-search-results",children:[l?i.jsx("p",{className:"status-text","data-tone":"error",children:l}):null,!l&&n.trim().length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchCodeHint")}):null,!l&&n.trim().length>0&&!c&&o.length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchCodeEmpty")}):null,o.map(N=>i.jsxs("div",{className:"workbench-search-result-item static",children:[i.jsx("span",{className:"workbench-search-result-title",children:N.name}),i.jsx("span",{className:"workbench-search-result-meta",children:N.path})]},`${N.path}-${N.kind}`))]})]})]})})}function tc({menuKey:e,session:t,workspace:n,isActive:s,isFavorite:o,menuOpen:c,showWorkspaceName:l,depth:d=0,showActions:m=!0,hasSubagents:p=!1,subagentListExpanded:y=!1,selectionMode:g=!1,selected:x=!1,onToggleSelect:b,onToggleSubagents:C,onOpen:S,onRename:N,onToggleMenu:T,onToggleFavorite:_,onArchive:R,onCloseMenu:G,onContextMenu:q}){var ee;const F=((ee=t.subagentLabel)==null?void 0:ee.trim())||(Jh(t)?h("shell.subagentBadge"):null),M=$i(t.title,h("common.unknown")),D=w.useRef(null),[U,E]=w.useState(null);w.useLayoutEffect(()=>{if(!c){E(null);return}const ne=()=>{const ae=D.current;if(!ae)return;const te=ae.getBoundingClientRect();E({top:`${te.bottom}px`,left:`${te.right}px`})};return ne(),window.addEventListener("resize",ne),window.addEventListener("scroll",ne,!0),()=>{window.removeEventListener("resize",ne),window.removeEventListener("scroll",ne,!0)}},[c]);const H=c&&typeof document<"u"&&U?Mn.createPortal(i.jsxs("div",{className:"workbench-session-menu","data-menu-key":e,onClick:ne=>ne.stopPropagation(),style:U,children:[i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{N(),G()},children:[i.jsx(n_,{}),i.jsx("span",{children:h("shell.renameAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{_(),G()},children:[i.jsx(dS,{active:o}),i.jsx("span",{children:h(o?"shell.unfavoriteAction":"shell.favoriteAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{R(),G()},children:[i.jsx(t_,{}),i.jsx("span",{children:h("shell.archiveAction")})]})]}),document.body):null;return i.jsxs("article",{className:"workbench-session-card","data-active":s,"data-depth":d,"data-subagent":Jh(t),"data-has-subagents":p,"data-selecting":g,"data-selected":x,onContextMenu:ne=>{g||!q||(ne.preventDefault(),q())},children:[i.jsxs("div",{className:"workbench-session-main",children:[g?i.jsx("span",{className:"workbench-session-selection-indicator","data-selected":x,"aria-hidden":"true",children:i.jsx(e_,{selected:x})}):p?i.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:L2,"aria-label":h(y?"shell.subagentCollapse":"shell.subagentExpand"),title:h(y?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":y,onClick:ne=>{ne.stopPropagation(),C==null||C()},children:[i.jsx("span",{className:qv(t,{hasSubagents:!0,isActive:s}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("span",{className:"workbench-session-subagent-toggle-icon","aria-hidden":"true",children:y?i.jsx(i_,{}):i.jsx(am,{})})]}):i.jsx("span",{className:qv(t,{isActive:s}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("button",{type:"button",className:"workbench-session-link",style:p?A2:void 0,"data-active":s,"aria-pressed":g?x:void 0,onClick:g?b:S,children:i.jsxs("div",{className:"workbench-session-link-copy",children:[i.jsxs("div",{className:"session-title-row",children:[i.jsx("span",{className:"session-title",title:M.fullTitle,children:M.displayTitle}),F?i.jsx("span",{className:"session-subagent-badge",children:F}):null]}),i.jsxs("div",{className:"session-meta-row",children:[i.jsx("span",{className:"session-meta",children:nS(t,n,l)}),i.jsx("span",{className:`session-provider-badge ${t.provider}`,children:qc(t.provider)})]})]})})]}),m&&!g?i.jsx("div",{className:"workbench-session-actions","data-open":c,children:i.jsx("button",{ref:D,type:"button",className:"workbench-session-menu-trigger","data-open":c,"aria-label":h("shell.sessionMoreAction"),title:h("shell.sessionMoreAction"),"aria-expanded":c,onClick:ne=>{ne.stopPropagation(),T()},children:i.jsx(s_,{})})}):null,H]})}function Zv({workspaceGroups:e,favoriteSessions:t,favoriteSessionIds:n,activeWorkspaceId:s,isConversationActive:o,isTerminalActive:c,isSearchOpen:l,navigationLoading:d,navigationError:m,activeSessionId:p,onRefreshNavigation:y,onSessionUpdated:g,onNavigateConversation:x,onNavigateTerminals:b,onOpenSearch:C,onOpenSettings:S,onSelectWorkspace:N,onToggleWorkspaceCollapse:T,subscribeGitSnapshot:_,requestGitRefresh:R,subscribeWorkspaceManagementSnapshot:G,requestWorkspaceManagementRefresh:q,onToggleFavoriteSession:F,onArchiveSession:M,onUnarchiveSession:D,workspaceManagementStateById:U,setWorkspaceManagementStateById:E,onClose:H,onToggleCollapse:ee}){var Jn;const ne=An(),ae=Kn(),{showToast:te}=Qn(),ye=w.useCallback(Y=>{!ae.isDesktop||ae.ui.osFamily!=="macos"||Y.button!==0||qf(Y.target)&&Vf()},[ae.isDesktop,ae.ui.osFamily]),[J,K]=w.useState(!1),[ue,A]=w.useState(!1),[z,le]=w.useState(!1),[P,ve]=w.useState([]),[je,Se]=w.useState(null),[De,Re]=w.useState(null),[We,ct]=w.useState(null),[Tt,qe]=w.useState(null),[ft,Ue]=w.useState(null),[Ht,vt]=w.useState(null),[Ge,yt]=w.useState(null),[Rt,zt]=w.useState(uh),[gt,Mt]=w.useState({}),[Vt,bt]=w.useState({}),[It,de]=w.useState([]),[xe,_e]=w.useState(null),[Ve,Qe]=w.useState(""),[dt,At]=w.useState(null),[at,be]=w.useState(null),[W,Pe]=w.useState([]),[nt,ot]=w.useState(!1),Pt=((Jn=e.find(Y=>Y.workspace.id===ft))==null?void 0:Jn.workspace)??null,Ot=e.find(Y=>Y.workspace.id===Ht)??null,St=e.find(Y=>Y.workspace.id===at)??null,Jt=w.useMemo(()=>St?R2(no(St)):[],[St]),Gt=w.useMemo(()=>Jt.map(Y=>Y.sessionId),[Jt]),nn=w.useMemo(()=>new Set(Gt),[Gt]),vn=w.useMemo(()=>new Set(W),[W]),Pn=Gt.length>0&&W.length===Gt.length;w.useEffect(()=>{E(Y=>{const we=new Set(e.map(ze=>ze.workspace.id)),pe={};Object.entries(Y).forEach(([ze,Wt])=>{we.has(ze)&&(pe[ze]=Wt)}),e.forEach(ze=>{const Wt=Cn(tf(ze.workspace.id),Uv),Bt=Cn(iS(ze.workspace.id),Uv),ur=pe[ze.workspace.id];let dn=aS((ur==null?void 0:ur.detail)??Wt??sS(ze.workspace),ze.workspace);(Bt!=null&&Bt.status||Bt!=null&&Bt.branches)&&(dn=oS(dn,{workspaceId:ze.workspace.id,status:Bt.status??null,branches:Bt.branches??null})),pe[ze.workspace.id]={detail:dn,loading:!1,error:null}});const lt=Object.keys(Y),mt=Object.keys(pe);return lt.length===mt.length&&mt.every(ze=>Y[ze]===pe[ze])?Y:pe})},[e]);const mn=w.useCallback(async Y=>{await y(),await ae.bridge.showNotification(h("shell.importSuccess"),Y.path)},[y,ae.bridge]),an=w.useCallback(async Y=>{await y(),await ae.bridge.showNotification(h("shell.cloneSuccess"),Y.path)},[y,ae.bridge]);function Ln(Y){if(P.includes(Y)){ve(pe=>pe.filter(lt=>lt!==Y));return}ve(pe=>[...pe,Y]),_(Y),R(Y),G(Y),q(Y)}async function re(){if(!(!je||De)){Re(je.id);try{await ox(je.id),ve(Y=>Y.filter(we=>we!==je.id)),E(Y=>{const we={...Y};return delete we[je.id],we}),Se(null),await y(),te({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(Y){te({title:Y instanceof Error?Y.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{Re(null)}}}w.useEffect(()=>{if(!Ge)return;function Y(we){const pe=we.target;pe instanceof HTMLElement&&(pe.closest(".workbench-session-actions")||pe.closest(".workbench-session-menu"))||yt(null)}return window.addEventListener("pointerdown",Y),()=>{window.removeEventListener("pointerdown",Y)}},[Ge]),w.useEffect(()=>{if(!at){W.length>0&&Pe([]);return}if(!St){be(null),Pe([]);return}Pe(Y=>rS(Y,nn))},[St,nn,at,W.length]),w.useEffect(()=>{at&&Gt.length===0&&(be(null),Pe([]))},[Gt.length,at]),w.useEffect(()=>{const Y=new Set(e.map(we=>we.workspace.id));ve(we=>we.filter(pe=>Y.has(pe))),Se(we=>we&&Y.has(we.id)?we:null)},[e]),w.useEffect(()=>{const Y=t.findIndex(we=>we.session.sessionId===p);zt(we=>{const pe=dh(t.length,uh,we,Y);return pe===we?we:pe})},[p,t]),w.useEffect(()=>{Mt(Y=>{const we={};for(const pe of e){const lt=no(pe),mt=lt.findIndex(ze=>ze.session.sessionId===p||ps(ze).some(Wt=>Wt.sessionId===p));we[pe.workspace.id]=dh(lt.length,Xl,Y[pe.workspace.id],mt)}return $v(Y,we)?Y:we})},[p,e]),w.useEffect(()=>{bt(Y=>{const we={};for(const pe of e)for(const lt of no(pe)){const mt=ps(lt);if(mt.length===0)continue;const ze=mt.findIndex(Wt=>Wt.sessionId===p);we[lt.session.sessionId]=dh(mt.length,Jl,Y[lt.session.sessionId],ze)}return $v(Y,we)?Y:we})},[p,e]),w.useEffect(()=>{if(!p)return;const Y=e.flatMap(we=>no(we).filter(pe=>ps(pe).some(lt=>lt.sessionId===p)).map(pe=>pe.session.sessionId));Y.length!==0&&de(we=>{const pe=new Set(we);let lt=!1;for(const mt of Y)pe.has(mt)||(pe.add(mt),lt=!0);return lt?Array.from(pe):we})},[p,e]);function I(){K(!0)}function $(){A(!0)}function L(Y){return Vt[Y]??Jl}function X(Y){return It.includes(Y)}function ce(Y){return gt[Y]??Xl}function ke(){zt(Y=>Math.min(t.length,Y+uh))}function Fe(Y,we){Mt(pe=>({...pe,[Y]:Math.min(we,(pe[Y]??Xl)+Xl)}))}function Ne(Y){bt(we=>({...we,[Y]:(we[Y]??Jl)+Jl}))}function Me(Y){de(we=>we.includes(Y)?we.filter(pe=>pe!==Y):[...we,Y])}function Ie(Y){for(const we of e){const pe=tS(we.visibleSessions).find(lt=>lt.session.sessionId===Y);if(pe)return ps(pe)}return[]}function O(Y){yt(null),be(Y),Pe([])}function me(){be(null),Pe([])}function ie(Y){Pe(we=>ef(we,Y))}function Be(){Pe(Y=>Y.length===Gt.length?[]:Gt)}async function Oe(Y,we){ct(Y),qe(we);try{Ue(null),ne(Ok(Y,we)),H==null||H()}catch(pe){te({title:pe instanceof Error?pe.message:h("shell.startSessionFailed"),tone:"error"})}finally{ct(null),qe(null)}}async function He(Y){const we=n.has(Y);yt(null);try{await F(Y),te({title:h(we?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(pe){te({title:pe instanceof Error?pe.message:h("shell.favoriteToggleFailed"),tone:"error"})}}async function ut(Y){yt(null);try{await M(Y),te({title:h("shell.archiveAdded"),tone:"success"})}catch(we){te({title:we instanceof Error?we.message:h("shell.navigationLoadFailed"),tone:"error"})}}async function un(){if(!(W.length===0||nt)){yt(null),ot(!0);try{const Y=[...W],we=await Promise.allSettled(Y.map(async mt=>({sessionId:mt,session:await ux(mt,!0)}))),pe=[];let lt=0;for(const mt of we){if(mt.status==="fulfilled"){pe.push(mt.value.sessionId),g(mt.value.session);continue}lt+=1}pe.length>0&&(await y(),Pe(mt=>mt.filter(ze=>!pe.includes(ze)))),lt>0?te({title:pe.length>0?h("shell.batchArchivePartialFailed"):h("shell.batchArchiveFailed"),tone:"error"}):te({title:h("shell.batchArchiveSuccess"),tone:"success"})}catch(Y){te({title:Y instanceof Error?Y.message:h("shell.batchArchiveFailed"),tone:"error"})}finally{ot(!1)}}}async function In(Y){yt(null);try{await D(Y),te({title:h("shell.archiveRestored"),tone:"success"})}catch(we){te({title:we instanceof Error?we.message:h("shell.navigationLoadFailed"),tone:"error"})}}function on(Y,we){yt(null),_e({session:Y,workspace:we}),Qe(Y.title)}async function kt(Y){if(Y.preventDefault(),!xe)return;const we=Ve.trim();if(we){At(xe.session.sessionId);try{const pe=await cx(xe.session.sessionId,we);g(pe),_e(null),Qe(""),te({title:h("shell.renameSuccess"),tone:"success"})}catch(pe){te({title:pe instanceof Error?pe.message:h("shell.renameFailed"),tone:"error"})}finally{At(null)}}}async function Sr(Y){if(!ae.isDesktop)return;const we=n.has(Y.session.sessionId);await n2([{id:`open-${Y.session.sessionId}`,label:h("shell.contextOpenSession"),onSelect:()=>{ne(Gn(Y.workspace.id,Y.session.sessionId)),H==null||H()}},{id:`rename-${Y.session.sessionId}`,label:h("shell.renameAction"),onSelect:()=>on(Y.session,Y.workspace)},{id:`favorite-${Y.session.sessionId}`,label:h(we?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:()=>He(Y.session.sessionId)},{id:`archive-${Y.session.sessionId}`,label:h("shell.archiveAction"),onSelect:()=>{ut(Y.session.sessionId)}}])}const Yn=t.slice(0,Rt),Xn=Yn.length<t.length;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:ye,children:i.jsxs("div",{className:"workbench-nav-toolbar",children:[ee?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideSessionSidebar"),title:h("shell.hideSessionSidebar"),onClick:ee,children:i.jsx(uS,{})}):null,i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>ne(-1),children:i.jsx(cS,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>ne(1),children:i.jsx(am,{})})]})}),i.jsxs("div",{className:"workbench-nav-body",children:[i.jsxs("div",{className:"workbench-nav-segment",role:"tablist","aria-label":h("shell.centerTabsLabel"),children:[i.jsxs("button",{type:"button",className:o?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":o,onClick:x,children:[i.jsx(K2,{}),h("shell.conversationEntry")]}),i.jsxs("button",{type:"button",className:c?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":c,onClick:b,children:[i.jsx(Q2,{}),h("shell.terminalsEntry")]}),i.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":l,"aria-haspopup":"dialog","aria-expanded":l,onClick:C,children:[i.jsx(G2,{}),i.jsx("span",{children:h("shell.searchEntry")})]})]}),m?i.jsx("div",{className:"workbench-status-row",children:i.jsx("p",{className:"status-text","data-tone":"error",children:m})}):null,t.length>0?i.jsxs("section",{className:"workbench-section-block",children:[i.jsxs("div",{className:"workbench-section-heading",children:[i.jsxs("div",{className:"workbench-section-heading-main",children:[i.jsx(dS,{active:!0}),i.jsx("span",{children:h("shell.favoriteSectionTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:t.length})]}),i.jsxs("div",{className:"workbench-session-list",children:[Yn.map(Y=>{const we=Ie(Y.session.sessionId),pe=X(Y.session.sessionId),lt=pe?we.slice(0,L(Y.session.sessionId)):[],mt=pe&<.length<we.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(tc,{menuKey:`favorite:${Y.session.sessionId}`,session:Y.session,workspace:Y.workspace,isActive:Y.session.sessionId===p,isFavorite:n.has(Y.session.sessionId),menuOpen:Ge===`favorite:${Y.session.sessionId}`,showWorkspaceName:!0,hasSubagents:we.length>0,subagentListExpanded:pe,onToggleSubagents:()=>Me(Y.session.sessionId),onOpen:()=>{ne(Gn(Y.workspace.id,Y.session.sessionId)),H==null||H()},onRename:()=>on(Y.session,Y.workspace),onToggleMenu:()=>yt(ze=>ze===`favorite:${Y.session.sessionId}`?null:`favorite:${Y.session.sessionId}`),onToggleFavorite:()=>He(Y.session.sessionId),onArchive:()=>ut(Y.session.sessionId),onCloseMenu:()=>yt(null),onContextMenu:ae.isDesktop?()=>{Sr(Y)}:void 0}),we.length>0&&pe?i.jsxs("div",{className:"workbench-subsession-list",children:[lt.map(ze=>i.jsx(tc,{menuKey:`favorite:${ze.sessionId}`,session:ze,workspace:Y.workspace,isActive:ze.sessionId===p,isFavorite:!1,menuOpen:!1,showWorkspaceName:!0,depth:1,showActions:!1,onOpen:()=>{ne(Gn(Y.workspace.id,ze.sessionId)),H==null||H()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:ae.isDesktop?()=>{Sr({session:ze,workspace:Y.workspace})}:void 0},ze.sessionId)),mt?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ne(Y.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},Y.session.sessionId)}),Xn?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:ke,children:h("shell.favoriteExpandMore")}):null]})]}):null,d&&e.length===0?i.jsx(W2,{}):null,!d&&!m&&e.length===0?i.jsx("div",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})}):null,i.jsxs("section",{className:"workbench-section-block workbench-workspace-section",children:[i.jsxs("div",{className:"workbench-section-heading",children:[i.jsx("div",{className:"workbench-section-heading-main",children:i.jsx("span",{children:h("shell.workspaceSectionTitle")})}),i.jsxs("div",{className:"workbench-section-actions",children:[i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.manageWorkspaceAction"),title:h("shell.manageWorkspaceAction"),onClick:()=>le(!0),children:i.jsx(q2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.importWorkspaceTitle"),title:h("shell.importWorkspaceTitle"),onClick:I,children:i.jsx($2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.cloneWorkspaceTitle"),title:h("shell.cloneWorkspaceTitle"),onClick:$,children:i.jsx(Y2,{})})]})]}),e.map(Y=>{const we=no(Y);return i.jsxs("section",{className:"workbench-workspace-group","data-batch-active":at===Y.workspace.id,children:[i.jsxs("div",{className:"workbench-workspace-header minimal",children:[i.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":Y.isCollapsed?h("shell.workspaceExpand"):h("shell.workspaceCollapse"),onClick:()=>T(Y.workspace.id),children:[i.jsx(Jv,{expanded:!Y.isCollapsed}),i.jsx("strong",{children:Y.workspace.name})]}),at===Y.workspace.id?i.jsxs("div",{className:"workbench-workspace-batch-toolbar",children:[i.jsx("span",{className:"workbench-workspace-batch-label",children:h("shell.batchSelectionMode")}),i.jsxs("span",{className:"workbench-workspace-batch-counter",children:[W.length,"/",Gt.length]}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:Be,children:h(Pn?"shell.clearSelectedSessions":"shell.selectAllSessions")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:W.length===0||nt,onClick:()=>{un()},children:h(nt?"shell.batchArchiving":"shell.batchArchiveAction")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:me,children:h("common.cancel")})]}):i.jsxs("div",{className:"workbench-workspace-actions",children:[i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.switchWorkspace"),title:h("shell.switchWorkspace"),"aria-pressed":s===Y.workspace.id,onClick:()=>{N(Y.workspace.id),H==null||H()},children:i.jsx(Z2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.batchSelectSessions"),title:h("shell.batchSelectSessions"),onClick:()=>O(Y.workspace.id),children:i.jsx(J2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":h("shell.createSession"),title:h("shell.createSession"),onClick:()=>Ue(Y.workspace.id),children:i.jsx(V2,{})})]})]}),Y.isCollapsed?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-session-list",children:[we.length===0?i.jsx("p",{className:"workbench-session-empty",children:h("shell.emptyWorkspaceSessions")}):we.slice(0,ce(Y.workspace.id)).map(pe=>{const lt=ps(pe),mt=X(pe.session.sessionId),ze=mt?lt.slice(0,L(pe.session.sessionId)):[],Wt=mt&&ze.length<lt.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(tc,{menuKey:`workspace:${Y.workspace.id}:${pe.session.sessionId}`,session:pe.session,workspace:Y.workspace,isActive:pe.session.sessionId===p,isFavorite:n.has(pe.session.sessionId),menuOpen:Ge===`workspace:${Y.workspace.id}:${pe.session.sessionId}`,showWorkspaceName:!1,hasSubagents:lt.length>0,subagentListExpanded:mt,selectionMode:at===Y.workspace.id,selected:vn.has(pe.session.sessionId),onToggleSelect:()=>ie(pe.session.sessionId),onToggleSubagents:()=>Me(pe.session.sessionId),onOpen:()=>{ne(Gn(Y.workspace.id,pe.session.sessionId)),H==null||H()},onRename:()=>on(pe.session,Y.workspace),onToggleMenu:()=>yt(Bt=>Bt===`workspace:${Y.workspace.id}:${pe.session.sessionId}`?null:`workspace:${Y.workspace.id}:${pe.session.sessionId}`),onToggleFavorite:()=>He(pe.session.sessionId),onArchive:()=>ut(pe.session.sessionId),onCloseMenu:()=>yt(null),onContextMenu:ae.isDesktop?()=>{Sr({session:pe.session,workspace:Y.workspace})}:void 0}),lt.length>0&&mt?i.jsxs("div",{className:"workbench-subsession-list",children:[ze.map(Bt=>i.jsx(tc,{menuKey:`workspace:${Y.workspace.id}:${Bt.sessionId}`,session:Bt,workspace:Y.workspace,isActive:Bt.sessionId===p,isFavorite:!1,menuOpen:!1,showWorkspaceName:!1,depth:1,showActions:!1,selectionMode:at===Y.workspace.id,selected:vn.has(Bt.sessionId),onToggleSelect:()=>ie(Bt.sessionId),onOpen:()=>{ne(Gn(Y.workspace.id,Bt.sessionId)),H==null||H()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:ae.isDesktop?()=>{Sr({session:Bt,workspace:Y.workspace})}:void 0},Bt.sessionId)),Wt?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ne(pe.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},pe.session.sessionId)}),we.length>ce(Y.workspace.id)?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Fe(Y.workspace.id,we.length),children:h("shell.sessionExpandMore")}):null]}),i.jsxs("button",{type:"button",className:"workbench-archive-folder",onClick:()=>vt(Y.workspace.id),children:[i.jsxs("span",{className:"workbench-archive-folder-main",children:[i.jsx(r_,{}),i.jsx("span",{children:h("shell.archiveFolderLabel")})]}),i.jsx("span",{className:"workbench-section-counter",children:Y.archivedSessions.length})]})]})]},Y.workspace.id)})]})]}),i.jsx("div",{className:"workbench-nav-footer minimal",children:i.jsxs("button",{className:"settings-entry-button workbench-nav-settings-button",type:"button",onClick:S,title:h("settings.title"),children:[i.jsx(X2,{}),i.jsx("span",{className:"settings-entry-label",children:h("settings.title")})]})}),i.jsx(Fr,{open:z,title:h("shell.manageWorkspaceTitle"),description:h("shell.manageWorkspaceDescription"),onClose:()=>{De||le(!1)},children:e.length>0?i.jsx("div",{className:"workbench-manage-list",children:e.map(Y=>{var ur;const we=P.includes(Y.workspace.id),pe=U[Y.workspace.id]??{detail:null,loading:!1,error:null},lt=De===Y.workspace.id,mt=(ur=pe.detail)!=null&&ur.git.remotes.length?pe.detail.git.remotes.map(dn=>`${dn.name}: ${dn.url}`).join(" · "):h("shell.manageWorkspaceNoRemote"),ze=Y.visibleSessions.length+Y.archivedSessions.length,Wt=pe.detail?Kk(pe.detail.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],Bt=Wt.length>0?Qk(Wt):void 0;return i.jsxs("article",{className:"workbench-manage-item",children:[i.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":we,onClick:()=>Ln(Y.workspace.id),children:[i.jsxs("span",{className:"workbench-manage-item-heading",children:[i.jsx(Jv,{expanded:we}),i.jsx("strong",{children:Y.workspace.name})]}),i.jsx("span",{className:"workbench-section-counter",children:ze})]}),we?i.jsxs("div",{className:"workbench-manage-item-body",children:[i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspacePathLabel")}),i.jsx("p",{className:"workbench-manage-detail-value",children:Y.workspace.path})]}),pe.loading&&pe.detail===null?i.jsx("p",{className:"workbench-manage-status status-text",children:h("shell.manageWorkspaceLoading")}):null,pe.error?i.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:pe.error}):null,pe.detail?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-manage-detail-block",children:i.jsxs("div",{className:"workbench-manage-detail-header",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitCommitCount")}),i.jsx("strong",{className:"workbench-manage-detail-accent",children:pe.detail.git.commitCount??"--"})]})}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitInfoLabel")}),pe.detail.git.isRepository?i.jsxs("div",{className:"workbench-manage-kv-list",children:[i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRepoRoot")}),i.jsx("span",{children:pe.detail.git.repoRoot??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("span",{children:pe.detail.git.currentBranch??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRemoteLabel")}),i.jsx("span",{children:mt})]})]}):i.jsx("p",{className:"workbench-section-empty",children:pe.detail.git.error??h("shell.manageWorkspaceNotGit")})]}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceCodeCompositionLabel")}),Wt.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:Bt,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:pe.detail.codeComposition.scannedFileCount}),i.jsx("span",{className:"workbench-manage-type-chart-caption",children:h("shell.manageWorkspaceCodeCompositionFiles")})]}),i.jsx("div",{className:"workbench-manage-type-list",children:Wt.map(dn=>i.jsxs("div",{className:"workbench-manage-type-item",children:[i.jsxs("span",{className:"workbench-manage-type-meta",children:[i.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:dn.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:dn.type})]}),i.jsxs("span",{children:[dn.count," · ",Gk(dn)]})]},dn.key))})]}):i.jsx("p",{className:"workbench-section-empty",children:pe.detail.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}),pe.detail.codeComposition.truncated?i.jsx("p",{className:"workbench-manage-hint",children:h("shell.manageWorkspaceCodeTruncated",{count:pe.detail.codeComposition.scannedFileCount})}):null]})]}):null,i.jsx("div",{className:"workbench-modal-actions",children:i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!De,onClick:()=>Se(Y.workspace),children:h(lt?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})})]}):null]},Y.workspace.id)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.manageWorkspaceEmpty")})}),i.jsxs(Fr,{open:je!==null,title:h("shell.manageWorkspaceRemoveConfirmTitle"),description:h("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{De||Se(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:je?h("shell.manageWorkspaceRemoveConfirmTarget",{name:je.name}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!De,onClick:()=>Se(null),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!De,onClick:()=>{re()},children:h(De?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),i.jsx(Xk,{open:ue,onClose:()=>A(!1),onCloned:an}),i.jsx(Jk,{open:J,onClose:()=>K(!1),onImported:mn}),i.jsx(Fr,{open:Pt!==null,title:h("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:Pt?`${h("shell.createSessionTarget")} · ${Pt.name}`:h("shell.createSessionModalDescription"),onClose:()=>Ue(null),children:i.jsx(Yk,{disabled:!!We,pendingProvider:We===(Pt==null?void 0:Pt.id)?Tt??null:null,onSelect:Y=>{Pt&&Oe(Pt.id,Y)}})}),i.jsx(Fr,{open:Ot!==null,title:h("shell.archiveModalTitle"),description:Ot?`${Ot.workspace.name} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription"),onClose:()=>vt(null),children:Ot&&Ot.archivedSessions.length>0?i.jsx("div",{className:"workbench-archive-list",children:Ot.archivedSessions.map(Y=>{const we=$i(Y.title,h("common.unknown"));return i.jsxs("article",{className:"workbench-archive-item",children:[i.jsxs("div",{className:"workbench-archive-item-main",children:[i.jsx("strong",{title:we.fullTitle,children:we.displayTitle}),i.jsxs("p",{children:[nS(Y,Ot.workspace,!1)," ·"," ",qc(Y.provider)]})]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>In(Y.sessionId),children:h("shell.unarchiveAction")})]},Y.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})}),i.jsx(Fr,{open:xe!==null,title:h("shell.renameModalTitle"),description:h("shell.renameModalDescription"),onClose:()=>{dt||(_e(null),Qe(""))},children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:kt,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.renameInputLabel")}),i.jsx("input",{type:"text",value:Ve,placeholder:h("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:Y=>Qe(Y.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!dt,onClick:()=>{_e(null),Qe("")},children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!Ve.trim()||dt===(xe==null?void 0:xe.session.sessionId),children:dt===(xe==null?void 0:xe.session.sessionId)?h("shell.renamingSession"):h("common.save")})]})]})})]})}function ew({panelReady:e,activeTab:t,onTabChange:n,onToggleCollapse:s,currentSessionId:o,activeWorkspaceId:c,navigationGroups:l}){var y;const d=c??((y=l[0])==null?void 0:y.workspace.id)??null,m=Kn(),p=w.useCallback(g=>{!m.isDesktop||m.ui.osFamily!=="macos"||g.button!==0||qf(g.target)&&Vf()},[m.isDesktop,m.ui.osFamily]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-auxiliary-header","data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:p,children:[s?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideInfoSidebar"),title:h("shell.hideInfoSidebar"),onClick:s,children:i.jsx(uS,{})}):null,i.jsxs("div",{className:"workbench-info-tabs",role:"tablist","aria-label":h("shell.infoTabsLabel"),children:[i.jsx("button",{className:t==="files"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="files",onClick:()=>n("files"),children:h("shell.filesEntry")}),i.jsx("button",{className:t==="git"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="git",onClick:()=>n("git"),children:h("shell.gitEntry")}),i.jsx("button",{className:t==="terminals"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="terminals",onClick:()=>n("terminals"),children:h("shell.terminalManagerEntry")})]})]}),i.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:i.jsx(ec,{}),e&&t==="files"?c?i.jsx(w.Suspense,{fallback:i.jsx(ec,{}),children:i.jsx(j2,{sessionId:o,workspaceId:c})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.filesPanelEmpty")})}):null,e&&t==="git"?d?i.jsx(w.Suspense,{fallback:i.jsx(ec,{}),children:i.jsx(N2,{workspaceId:d})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.gitPanelEmpty")})}):null,e&&t==="terminals"?i.jsx(w.Suspense,{fallback:i.jsx(ec,{}),children:i.jsx(T2,{currentWorkspaceId:c,navigationGroups:l})}):null]})]})}function o_({shellMode:e="desktop"}){var Ts,_t,ya;const t=Yr(),n=An(),s=Kn(),{showToast:o}=Qn(),c=w.useRef(B2()),l=w.useRef(0),d=w.useRef((((_t=(Ts=c.current)==null?void 0:Ts.items)==null?void 0:_t.length)??0)>0),m=w.useRef(!1),p=w.useRef(null),y=w.useRef(null),g=w.useRef(null),x=w.useRef(new Set),b=w.useRef(new Set),C=w.useRef(new Set),S=w.useRef(new Set),N=w.useRef(null),T=w.useRef(null),_=w.useRef(null),R=w.useRef(null),G=w.useRef(null),q=w.useRef(null),F=w.useRef(null),M=w.useRef(null),D=w.useRef(o),[U,E]=w.useState(()=>Kv(c.current)),[H,ee]=w.useState(()=>{var Q,fe;return(((fe=(Q=c.current)==null?void 0:Q.items)==null?void 0:fe.length)??0)===0}),[ne,ae]=w.useState(null),[te,ye]=w.useState(()=>Zl(Vv(Lv,g2),Yl,Ov)),[J,K]=w.useState(()=>Zl(Vv(Iv,y2),Yl,Bv)),[ue,A]=w.useState(()=>Gv(Dv,!1)),[z,le]=w.useState(()=>Gv(_v,!1)),[P,ve]=w.useState(()=>I2(Fv)),[je,Se]=w.useState(()=>D2(ch)),[De,Re]=w.useState(!1),[We,ct]=w.useState("files"),[Tt,qe]=w.useState(!1),[ft,Ue]=w.useState(!1),[Ht,vt]=w.useState({}),[Ge,yt]=w.useState(!1),[Rt,zt]=w.useState("sessions"),[gt,Mt]=w.useState(""),[Vt,bt]=w.useState(""),[It,de]=w.useState(!1),[xe,_e]=w.useState(null),[Ve,Qe]=w.useState([]),[dt,At]=w.useState({});w.useEffect(()=>{D.current=o},[o]),w.useEffect(()=>{jt("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),w.useEffect(()=>{var Q,fe;jt("workbench.cached_snapshot_loaded",{cached:!!c.current,workspaceCount:((Q=c.current)==null?void 0:Q.items.length)??0,sessionCount:((fe=c.current)==null?void 0:fe.items.reduce((Xe,pt)=>Xe+pt.sessions.length,0))??0})},[]);function at(Q){var fe;!Q||!Array.isArray(Q.items)||(jt("workbench.apply_snapshot",{workspaceCount:Q.items.length,sessionCount:Q.items.reduce((Xe,pt)=>Xe+pt.sessions.length,0),currentSessionId:((fe=go(t.pathname))==null?void 0:fe.sessionId)??null}),xr(Zk,Q),E(Kv(Q)),ae(null))}const be=w.useCallback(async()=>{const Q=l.current+1;l.current=Q,ee(fe=>fe||!d.current),jt("workbench.refresh_navigation.start",{requestId:Q,hasNavigationData:d.current});try{const fe=await XN();if(Q!==l.current){jt("workbench.refresh_navigation.stale",{requestId:Q});return}at(fe)}catch(fe){if(Q!==l.current)return;ae(fe instanceof Error?fe.message:h("shell.navigationLoadFailed")),D.current({title:fe instanceof Error?fe.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{jt("workbench.refresh_navigation.end",{requestId:Q,success:Q===l.current}),Q===l.current&&ee(!1)}},[]),W=w.useCallback(Q=>{E(fe=>U2(fe,Q))},[]),Pe=w.useCallback(()=>{var Q;(Q=g.current)==null||Q.requestRefresh()},[]),nt=w.useCallback((Q,fe)=>{var Xe;N.current={workspaceId:Q,paths:fe},(Xe=g.current)==null||Xe.subscribeFileTree(Q,fe)},[]),ot=w.useCallback((Q,fe)=>{var Xe;T.current={workspaceId:Q,paths:fe},(Xe=g.current)==null||Xe.requestFileTreeRefresh(Q,fe)},[]),Pt=w.useCallback(Q=>(x.current.add(Q),()=>{x.current.delete(Q)}),[]),Ot=w.useCallback(Q=>{var fe;_.current=Q,(fe=g.current)==null||fe.subscribeGit(Q)},[]),St=w.useCallback(Q=>{var fe;R.current=Q,(fe=g.current)==null||fe.requestGitRefresh(Q)},[]),Jt=w.useCallback(Q=>(b.current.add(Q),()=>{b.current.delete(Q)}),[]),Gt=w.useCallback(Q=>{var fe;G.current=Q,(fe=g.current)==null||fe.subscribeWorkspaceManagement(Q)},[]),nn=w.useCallback(Q=>{var fe;q.current=Q,At(Xe=>{var pt;return{...Xe,[Q]:{detail:((pt=Xe[Q])==null?void 0:pt.detail)??null,loading:!0,error:null}}}),(fe=g.current)==null||fe.requestWorkspaceManagementRefresh(Q)},[]),vn=w.useCallback(Q=>(C.current.add(Q),()=>{C.current.delete(Q)}),[]),Pn=w.useCallback(Q=>{var fe;F.current=Q,(fe=g.current)==null||fe.subscribeTerminalManager(Q)},[]),mn=w.useCallback(Q=>{var fe;M.current=Q,(fe=g.current)==null||fe.requestTerminalManagerRefresh(Q)},[]),an=w.useCallback(Q=>(S.current.add(Q),()=>{S.current.delete(Q)}),[]),Ln=w.useCallback((Q,fe)=>{E(Xe=>z2(Xe,Q,fe??new Date().toISOString()))},[]),re=w.useCallback(async(Q,fe)=>{E(Xe=>Qv(Xe,Q,fe));try{const Xe=await ux(Q,fe);W(Xe),Pe()}catch(Xe){throw E(pt=>Qv(pt,Q,!fe)),Xe}},[Pe,W]),I=w.useCallback((Q,fe)=>{jt("workbench.set_session_workspace",{sessionId:Q,workspaceId:fe}),vt(Xe=>{if(!fe){if(!(Q in Xe))return Xe;const pt={...Xe};return delete pt[Q],pt}return Xe[Q]===fe?Xe:{...Xe,[Q]:fe}})},[]);w.useEffect(()=>{d.current=U.length>0},[U]),w.useEffect(()=>{jt("workbench.navigation_state",{navigationLoading:H,workspaceCount:U.length,sessionCount:U.reduce((Q,fe)=>Q+fe.sessions.length,0)})},[U,H]),w.useEffect(()=>{y.current!==null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{var xt;y.current=null,!(m.current||d.current)&&(jt("workbench.refresh_navigation.ws_fallback_triggered"),(xt=g.current)==null||xt.requestRefresh())},1200);const Q=new e2({onConnectionChange:xt=>{xt==="reconnect_failed"&&!d.current&&(ae(h("shell.navigationLoadFailed")),D.current({id:"workbench-navigation-connection",title:h("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:xt=>{m.current=!0,jt("workbench.ws_snapshot_received",{workspaceCount:xt.items.length,sessionCount:xt.items.reduce((hn,Br)=>hn+Br.sessions.length,0)}),y.current!==null&&(window.clearTimeout(y.current),y.current=null),at(xt),ee(!1)},onFileTreeSnapshot:xt=>{x.current.forEach(hn=>hn(xt))},onGitSnapshot:xt=>{xr(iS(xt.workspaceId),{status:xt.status,history:xt.history,historyTotalCount:xt.historyTotalCount,historyNextCursor:xt.historyNextCursor,branches:xt.branches}),At(hn=>{var va;const Br=((va=U.find(Ki=>Ki.workspace.id===xt.workspaceId))==null?void 0:va.workspace)??null;if(!Br)return hn;const Nr=hn[xt.workspaceId],Uo=oS(aS((Nr==null?void 0:Nr.detail)??sS(Br),Br),xt);return xr(tf(xt.workspaceId),Uo),{...hn,[xt.workspaceId]:{detail:Uo,loading:!1,error:null}}}),b.current.forEach(hn=>hn(xt))},onWorkspaceManagementSnapshot:xt=>{xr(tf(xt.workspaceId),xt),At(hn=>({...hn,[xt.workspaceId]:{detail:xt,loading:!1,error:null}})),C.current.forEach(hn=>hn(xt))},onTerminalManagerSnapshot:xt=>{S.current.forEach(hn=>hn(xt))},onUnauthorized:()=>{Sn.clear(),n("/login",{replace:!0})}});g.current=Q;const fe=N.current,Xe=T.current,pt=_.current,$t=R.current,Wn=G.current,Cr=q.current,jr=F.current,dr=M.current;return fe&&Q.subscribeFileTree(fe.workspaceId,fe.paths),pt&&Q.subscribeGit(pt),Wn&&Q.subscribeWorkspaceManagement(Wn),jr&&Q.subscribeTerminalManager(jr),Xe&&Q.requestFileTreeRefresh(Xe.workspaceId,Xe.paths),$t&&Q.requestGitRefresh($t),Cr&&Q.requestWorkspaceManagementRefresh(Cr),dr&&Q.requestTerminalManagerRefresh(dr),Q.start(),()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null),g.current===Q&&(g.current=null),Q.close()}},[n]),w.useEffect(()=>{us(Lv,String(te))},[te]),w.useEffect(()=>{us(Iv,String(J))},[J]),w.useEffect(()=>{us(Dv,String(ue))},[ue]),w.useEffect(()=>{us(_v,String(z))},[z]),w.useEffect(()=>{us(Fv,JSON.stringify(P))},[P]),w.useEffect(()=>{if(!je){_2(ch);return}us(ch,je)},[je]),w.useEffect(()=>{if(De||z)return;const Q=window.setTimeout(()=>{Re(!0)},v2);return()=>{window.clearTimeout(Q)}},[De,z]);const $=go(t.pathname),L=($==null?void 0:$.sessionId)??null,X=L?hS(L):!1,ce=w.useMemo(()=>Gf(U),[U]),ke=w.useMemo(()=>new Set(P),[P]),Fe=w.useMemo(()=>ce.filter(Q=>Q.session.isFavorite===!0).map(Q=>Q.session.sessionId),[ce]),Ne=w.useMemo(()=>new Set(Fe),[Fe]);w.useEffect(()=>{if(H&&U.length===0)return;const Q=new Set(U.map(fe=>fe.workspace.id));ve(fe=>rS(fe,Q)),Se(fe=>fe&&Q.has(fe)?fe:null)},[U,H]);const Me=ce.find(Q=>Q.session.sessionId===L)??null,Ie=(Me==null?void 0:Me.workspace.id)??(L?Ht[L]??null:null),O=zv(t.pathname,t.search),me=Ie??O??je??null,ie=me??((ya=U[0])==null?void 0:ya.workspace.id)??null;w.useEffect(()=>{Ie&&Se(Q=>Q===Ie?Q:Ie)},[Ie]),w.useEffect(()=>{jt("workbench.current_workspace_resolved",{currentSessionId:L,sessionWorkspaceId:Ie,routeWorkspaceId:O,currentWorkspaceId:ie,source:Ie?Me?"navigation":"sessionWorkspaceMap":O?"route":je?"workspaceSelection":"navigationFallback"})},[Me,L,ie,O,je,Ie]),w.useEffect(()=>{jt("workbench.info_panel_state",{infoPanelReady:De,rightCollapsed:z,currentWorkspaceId:ie,sessionWorkspaceId:Ie,currentSessionId:L})},[L,ie,De,z,Ie]);const Be=Hv(t.pathname)?"terminals":"conversation",Oe=e==="mobile",He=k2(e),ut=w.useMemo(()=>U.map(Q=>({workspace:Q.workspace,visibleSessions:Q.sessions.filter(fe=>!ro(fe)),archivedSessions:Q.sessions.filter(fe=>ro(fe)&&!Zh(fe)),visibleSessionTree:tS(Q.sessions.filter(fe=>{if(ro(fe))return!1;const Xe=Zh(fe);if(!Xe)return!0;const pt=Q.sessions.find($t=>$t.sessionId===Xe);return!pt||!ro(pt)})).filter(fe=>!Ne.has(fe.session.sessionId)&&!ps(fe).some(Xe=>Ne.has(Xe.sessionId))),isCollapsed:ke.has(Q.workspace.id)})),[ke,Ne,U]),un=w.useMemo(()=>ce.filter(Q=>Ne.has(Q.session.sessionId)&&!ro(Q.session)&&!Jh(Q.session)),[Ne,ce]),In=t.pathname.startsWith("/settings")?"settings":Hv(t.pathname)?"terminals":C2(t.pathname)?"tools":S2(t.pathname)||Wv(t.pathname)?"sessions":"workspaces",on=Oe&&In==="sessions"&&Wv(t.pathname),kt=Fo({viewportClass:s.viewportClass,activeEntry:In,hasNavigationPanel:Oe,hasAuxiliaryPanel:Oe}),Sr=Oe&&Wk(kt),Yn=Oe&&Hk(kt),Xn=w.useMemo(()=>U.map(Q=>Q.workspace),[U]),Jn=w.useMemo(()=>{const Q=gt.trim().toLowerCase();return Q?ce.filter(fe=>{const Xe=(fe.session.title||"").toLowerCase(),pt=fe.workspace.name.toLowerCase(),$t=qc(fe.session.provider,"full").toLowerCase();return Xe.includes(Q)||pt.includes(Q)||$t.includes(Q)}):[]},[ce,gt]);w.useEffect(()=>{var fe;const Q=ie??((fe=U[0])==null?void 0:fe.workspace.id)??"";Q&&bt(Xe=>Xe&&U.some($t=>$t.workspace.id===Xe)?Xe:Q)},[ie,U]),w.useEffect(()=>{L&&!X&&us(lh,`${t.pathname}${t.search}`)},[L,X,t.pathname,t.search]),w.useEffect(()=>{if(L&&X){p.current=`${t.pathname}${t.search}`;return}L&&!X&&(p.current=null)},[L,X,t.pathname,t.search]),w.useEffect(()=>{Oe||(qe(!1),Ue(!1))},[Oe]),w.useEffect(()=>{!Oe||H||!x2(t.pathname)||me||(qe(!1),Ue(!1),n(He,{replace:!0}))},[me,Oe,t.pathname,n,H,He]);function Y(){if(Oe){qe(!0);return}A(!1)}function we(){if(mt(),Oe){Ue(!0);return}le(!1)}function pe(){if(Oe){qe(Q=>!Q);return}A(Q=>!Q)}function lt(){if(mt(),Oe){Ue(Q=>!Q);return}le(Q=>!Q)}function mt(){Re(!0)}function ze(Q){Se(Q),mt(),L&&Ie!==Q&&n(He)}const Wt=w.useCallback(async Q=>{var pt;const fe=((pt=ce.find($t=>$t.session.sessionId===Q))==null?void 0:pt.session)??null,Xe=(fe==null?void 0:fe.isFavorite)!==!0;E($t=>Yv($t,Q,Xe));try{const $t=await sT(Q,Xe);W($t),Pe()}catch($t){throw E(Wn=>Yv(Wn,Q,!Xe)),$t}},[ce,Pe,W]),Bt=w.useCallback((Q,fe)=>{n(Ok(Q,fe))},[n]),ur=w.useCallback(async(Q,fe)=>{const Xe=await cx(Q,fe.trim());return W(Xe),Xe},[W]);function dn(Q){yt(!0)}function qi(){yt(!1),zt("sessions"),Mt(""),_e(null),Qe([]),de(!1)}async function Vi(){const Q=gt.trim();if(!Q||!Vt.trim()){Qe([]),_e(null);return}de(!0),_e(null);try{const fe=await Xh(Vt,Q);Qe(fe.items)}catch(fe){Qe([]),_e(fe instanceof Error?fe.message:h("shell.searchCodeFailed"))}finally{de(!1)}}function Gi(Q,fe){const Xe=Q==="left"?te:J;function pt(Wn){const Cr=Wn.clientX-fe;if(Q==="left"){ye(Zl(Xe+Cr,Yl,Ov));return}K(Zl(Xe-Cr,Yl,Bv))}function $t(){document.removeEventListener("mousemove",pt),document.removeEventListener("mouseup",$t)}document.addEventListener("mousemove",pt),document.addEventListener("mouseup",$t)}function js(){if(Ns())return;if(ce.length===0){n(He);return}const Q=Gn(ce[0].workspace.id,ce[0].session.sessionId);n(Q)}function Qc(){if(!Ns(ie)){if(ie){n(_o(ie));return}n(He)}}function Ns(Q){if(L)return Q&&Ie&&Ie!==Q?!1:(n(`${t.pathname}${t.search}`),!0);if(p.current){if(Q){const[Xe,pt=""]=p.current.split("?"),$t=zv(Xe??p.current,pt?`?${pt}`:"");if($t&&$t!==Q)return!1}return n(p.current),!0}const fe=typeof window>"u"?null:window.localStorage.getItem(lh);if(fe){const Xe=fe.split("?")[0]??fe,pt=go(Xe);if(pt){const $t=pt.sessionId,Wn=ce.find(dr=>dr.session.sessionId===$t)??null,Cr=pt.workspaceId??(Wn==null?void 0:Wn.workspace.id)??null;if(Wn!==null&&(!Q||Cr===Q))return n(fe),!0}window.localStorage.removeItem(lh)}return!1}w.useEffect(()=>{if(typeof window>"u")return;function Q(fe){if(!(fe.metaKey||fe.ctrlKey)){fe.key==="Escape"&&(qe(!1),Ue(!1));return}if(F2(fe.target))return;const pt=fe.key.toLowerCase();if(!fe.shiftKey&&pt==="b"){fe.preventDefault(),pe();return}if(fe.shiftKey&&pt==="i"){fe.preventDefault(),lt();return}if(!fe.shiftKey&&pt===","){fe.preventDefault(),n("/settings");return}if(!fe.shiftKey&&pt==="1"){fe.preventDefault(),js();return}if(!fe.shiftKey&&pt==="2"){fe.preventDefault(),n(ie?ia(ie):Gr());return}if(!fe.shiftKey&&pt==="k"){fe.preventDefault(),O2();return}fe.shiftKey&&pt==="r"&&(fe.preventDefault(),be())}return window.addEventListener("keydown",Q),()=>{window.removeEventListener("keydown",Q)}},[n,be,Oe,js]);const Oo=w.useMemo(()=>({shellMode:e,navigationGroups:U,navigationLoading:H,navigationError:ne,currentWorkspaceId:ie,currentSessionId:L,favoriteSessionIds:Fe,favoriteSessions:un,refreshNavigation:be,requestNavigationRefresh:Pe,subscribeFileTree:nt,requestFileTreeRefresh:ot,addFileTreeSnapshotListener:Pt,subscribeGitSnapshot:Ot,requestGitRefresh:St,addGitSnapshotListener:Jt,subscribeWorkspaceManagementSnapshot:Gt,requestWorkspaceManagementRefresh:nn,addWorkspaceManagementSnapshotListener:vn,workspaceManagementStateById:dt,subscribeTerminalManagerSnapshot:Pn,requestTerminalManagerRefresh:mn,addTerminalManagerSnapshotListener:an,selectWorkspace:ze,toggleFavoriteSession:Wt,archiveSession:Q=>re(Q,!0),unarchiveSession:Q=>re(Q,!1),renameSession:ur,startDraftSession:Bt,markNavigationSessionSeen:Ln,upsertNavigationSession:W,setSessionWorkspace:I}),[Pt,Jt,vn,an,re,L,ie,Fe,un,ze,Ln,ne,U,H,ot,St,nn,be,Pe,mn,ur,dt,e,Bt,I,nt,Ot,Gt,Pn,Wt,W]),ga={"--workbench-left-width":`${te}px`,"--workbench-left-current-width":ue?"0px":`${te}px`,"--workbench-right-width":`${J}px`,"--workbench-right-current-width":z?"0px":`${J}px`},vi=Oe?i.jsx(Zv,{workspaceGroups:ut,favoriteSessions:un,favoriteSessionIds:Ne,activeWorkspaceId:ie,isConversationActive:Be==="conversation",isTerminalActive:Be==="terminals",isSearchOpen:Ge,navigationLoading:H,navigationError:ne,activeSessionId:L,onRefreshNavigation:be,onSessionUpdated:W,onNavigateConversation:js,onNavigateTerminals:()=>{qe(!1),n(ie?ia(ie):Gr())},onOpenSearch:()=>{qe(!1),dn()},onOpenSettings:()=>{qe(!1),n("/settings")},onSelectWorkspace:ze,onToggleWorkspaceCollapse:Q=>ve(fe=>ef(fe,Q)),subscribeGitSnapshot:Ot,requestGitRefresh:St,subscribeWorkspaceManagementSnapshot:Gt,requestWorkspaceManagementRefresh:nn,onToggleFavoriteSession:Wt,onArchiveSession:Q=>re(Q,!0),onUnarchiveSession:Q=>re(Q,!1),workspaceManagementStateById:dt,setWorkspaceManagementStateById:At,onClose:()=>qe(!1)}):null,Bo=Oe?i.jsx(ew,{panelReady:De,activeTab:We,onTabChange:Q=>{mt(),ct(Q)},currentSessionId:X?null:L,activeWorkspaceId:ie,navigationGroups:U}):null;return i.jsxs(eS.Provider,{value:Oo,children:[Oe?i.jsx(i.Fragment,{children:i.jsx(qD,{activeEntry:In,presentation:on?"conversation-focus":"default",navigationPanel:vi,auxiliaryPanel:Bo,onOpenNavigation:()=>{Ue(!1),qe(!0)},onOpenSearch:()=>{qe(!1),Ue(!1),dn()},onOpenAuxiliary:()=>{mt(),qe(!1),Ue(!0)},onNavigateWorkspaces:()=>{qe(!1),Ue(!1),n(Gr())},onNavigateTerminals:()=>{qe(!1),Ue(!1),n(ie?ia(ie):Gr())},onNavigateSessions:()=>{qe(!1),Ue(!1),Qc()},onNavigateTools:()=>{qe(!1),Ue(!1),n(ie?ha(ie):Gr())},onNavigateToolFiles:()=>{qe(!1),Ue(!1),n(ie?Dk(ie):Gr())},onNavigateToolGit:()=>{qe(!1),Ue(!1),n(ie?_k(ie):Gr())},onNavigateToolProcesses:()=>{qe(!1),Ue(!1),n(ie?$c(ie):Gr())},onNavigateSettings:()=>{qe(!1),Ue(!1),n("/settings")},children:i.jsx(Ih,{})})}):i.jsx("div",{className:"workbench-shell",style:ga,"data-nav-loading":H,"data-left-collapsed":ue,"data-right-collapsed":z,"data-info-ready":De,"data-runtime-platform":s.platform,"data-os-family":s.ui.osFamily,"data-overlay-titlebar":s.ui.prefersOverlayTitlebar,children:i.jsxs("div",{className:"workbench-body-shell",children:[i.jsx("aside",{className:"workbench-nav surface-card","data-collapsed":ue,children:i.jsx(Zv,{workspaceGroups:ut,favoriteSessions:un,favoriteSessionIds:Ne,activeWorkspaceId:ie,isConversationActive:Be==="conversation",isTerminalActive:Be==="terminals",isSearchOpen:Ge,navigationLoading:H,navigationError:ne,activeSessionId:L,onRefreshNavigation:be,onSessionUpdated:W,onNavigateConversation:js,onNavigateTerminals:()=>n(ie?ia(ie):Gr()),onOpenSearch:()=>dn(),onOpenSettings:()=>n("/settings"),onSelectWorkspace:ze,onToggleWorkspaceCollapse:Q=>ve(fe=>ef(fe,Q)),subscribeGitSnapshot:Ot,requestGitRefresh:St,subscribeWorkspaceManagementSnapshot:Gt,requestWorkspaceManagementRefresh:nn,onToggleFavoriteSession:Wt,onArchiveSession:Q=>re(Q,!0),onUnarchiveSession:Q=>re(Q,!1),workspaceManagementStateById:dt,setWorkspaceManagementStateById:At,onToggleCollapse:()=>A(!0)})}),i.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":ue,role:"separator","aria-label":h("shell.leftResizerLabel"),onMouseDown:ue?void 0:Q=>Gi("left",Q.clientX)}),i.jsxs("div",{className:"workbench-main-shell",children:[i.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!ue&&!z,children:[i.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":ue,children:[i.jsx(Xv,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:Y}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>n(-1),children:i.jsx(cS,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>n(1),children:i.jsx(am,{})})]}),i.jsx("div",{className:"workbench-collapsed-controls right","data-visible":z,children:i.jsx(Xv,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:we})})]}),i.jsx(Ih,{})]}),i.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":z,role:"separator","aria-label":h("shell.rightResizerLabel"),onMouseDown:z?void 0:Q=>Gi("right",Q.clientX)}),i.jsx("aside",{className:"workbench-auxiliary surface-card","data-collapsed":z,children:i.jsx(ew,{panelReady:De,activeTab:We,onTabChange:Q=>{mt(),ct(Q)},onToggleCollapse:()=>le(!0),currentSessionId:X?null:L,activeWorkspaceId:ie,navigationGroups:U})})]})}),i.jsx(a_,{open:Ge,mode:Rt,keyword:gt,codeWorkspaceId:Vt,codeResults:Ve,codeLoading:It,codeError:xe,workspaceOptions:Xn,sessionResults:Jn,onClose:qi,onModeChange:Q=>{zt(Q),_e(null),Qe([])},onKeywordChange:Q=>{Mt(Q),Rt==="code"&&!Q.trim()&&(Qe([]),_e(null))},onCodeWorkspaceChange:Q=>bt(Q),onCodeSearch:()=>{Vi()},onOpenSession:Q=>{qi();const fe=ce.find(Xe=>Xe.session.sessionId===Q)??null;n(fe?Gn(fe.workspace.id,Q):Gr())}}),Oe?i.jsxs(i.Fragment,{children:[Sr?null:i.jsx(tw,{isOpen:Tt,side:"left",onClose:()=>qe(!1),children:vi}),Yn?null:i.jsx(tw,{isOpen:ft,side:"right",onClose:()=>Ue(!1),children:Bo})]}):null]})}function tw({isOpen:e,side:t,onClose:n,children:s,className:o,overlayClassName:c}){if(!e)return null;const l=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:["mobile-nav-overlay","open",c].filter(Boolean).join(" "),onClick:n,role:"button",tabIndex:0,"aria-label":h("common.back"),onKeyDown:d=>{d.key==="Escape"&&n()}}),i.jsx("div",{className:["mobile-nav-drawer",t,"open",o].filter(Boolean).join(" "),children:s})]});return typeof document>"u"?l:Mn.createPortal(l,document.body)}function cr(){return w.useContext(eS)??{navigationGroups:[],navigationLoading:!1,navigationError:null,shellMode:"desktop",currentWorkspaceId:null,currentSessionId:null,favoriteSessionIds:[],favoriteSessions:[],refreshNavigation:async()=>{},requestNavigationRefresh:()=>{},subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{},subscribeWorkspaceManagementSnapshot:()=>{},requestWorkspaceManagementRefresh:()=>{},addWorkspaceManagementSnapshotListener:()=>()=>{},workspaceManagementStateById:{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{},selectWorkspace:()=>{},toggleFavoriteSession:async()=>{},archiveSession:async()=>{},unarchiveSession:async()=>{},renameSession:async()=>{throw new Error("workbench shell unavailable")},startDraftSession:()=>{},setSessionWorkspace:()=>{},upsertNavigationSession:()=>{},markNavigationSessionSeen:()=>{}}}function hS(e){return e.startsWith("draft-")}class l_{constructor(t){Ze(this,"socket",null);Ze(this,"disposed",!1);Ze(this,"authRecoveryInFlight",!1);Ze(this,"latestCursor");Ze(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new $k({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(t,n){return!this.socket||this.socket.readyState!==WebSocket.OPEN?!1:(this.socket.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:t,limit:n})),!0)}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=Sn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${nx("/ws")}?access_token=${encodeURIComponent(n)}`,o=new WebSocket(s);this.socket=o,o.addEventListener("open",()=>{o.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit}))}),o.addEventListener("message",l=>{const d=JSON.parse(l.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.subscribed"){this.options.onSubscribed();return}if(d.type==="session.error"){if(d.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(d);return}if(d.type==="session.runtime_status"){this.options.onRuntimeStatus(d);return}if(d.type==="session.history_older"){this.options.onOlderHistory(d);return}if(d.type==="session.runtime_message"){this.options.onRuntimeMessage(d);return}if(d.type==="session.runtime_error"){this.options.onRuntimeError(d);return}if(d.type==="session.interrupted"){this.options.onInterrupted(d);return}this.latestCursor=d.cursor,this.options.onEnvelope(d)}),o.addEventListener("close",()=>{this.disposed||this.socket!==o||this.connectionManager.markDisconnected()}),o.addEventListener("error",()=>{this.disposed||this.socket!==o||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),Sn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}}function nw(e){return{session:(e==null?void 0:e.session)??null,capabilities:(e==null?void 0:e.capabilities)??null,runtimeHasActiveRun:(e==null?void 0:e.runtimeHasActiveRun)??null,runtimeCanInterrupt:(e==null?void 0:e.runtimeCanInterrupt)??null,contextUsage:(e==null?void 0:e.contextUsage)??null,messages:(e==null?void 0:e.messages)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??[],historyState:"idle",loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:!1,connectionState:"closed",lastCursor:null,pagesLoaded:0,errorCode:null,errorDetail:null}}function fS(e,t,n="sent",s=null){const o=t.kind??(t.role==="tool"?"tool_result":"text"),c=t.toolCall??(o==="tool_call"||o==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:o==="tool_call"?t.content:"",output:o==="tool_result"&&t.content?t.content:null,error:null,status:o==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:o,content:t.content,toolCall:c,attachments:t.attachments??[],attachmentPayloads:null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:n,clientRequestId:s}}function mS(e,t,n,s=[],o=[],c=Number.MAX_SAFE_INTEGER){return{id:`pending-${n}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:s,attachmentPayloads:o,timestamp:new Date().toISOString(),sequence:c,rawRef:`pending://${n}`,deliveryState:"sending",clientRequestId:n}}function io(e,t,n){const s=new Map;for(const o of e)s.set(o.id,o);for(const o of n){const c=fS(t,o),l=N_(s,c);if(l&&l!==c.id)continue;const d=j_(s,c);d&&d!==c.id&&s.delete(d);const m=s.get(o.messageId)??null;s.set(o.messageId,m?m_(m,c):c)}return pS(Array.from(s.values()))}function rw(e,t,n,s){const o=s===null?null:e.find(m=>m.clientRequestId===s)??null,c=e.filter(m=>m.clientRequestId!==s),l=fS(t,n,"sent",s),d=f_(l,o);return pS([...c.filter(m=>m.id!==d.id),d])}function nf(e,t){return e.map(n=>n.clientRequestId===t?{...n,deliveryState:"failed"}:n)}function c_(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!g_(s,n)){t.push(n);continue}t[t.length-1]=w_(s,n)}return t}function u_(e){const t=[];let n=null,s=!1;for(const o of e)if(!y_(n,o,s)){if(t.push(o),jo(o)){n=o,s=!1;continue}n&&rf(o)&&(s=!0)}return t}function d_(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!gS(s,n)){t.push(n);continue}t[t.length-1]=yS(s,n)}return t}function h_(e){const t=[];for(const n of e){if(t.push(n),t.length<4)continue;const s=t[t.length-4],o=t[t.length-3],c=t[t.length-2],l=t[t.length-1];v_(s,o,c,l)&&t.splice(t.length-3,3,yS(o,l))}return t}function pS(e){const t=[...e].sort((n,s)=>n.sequence!==s.sequence?n.sequence-s.sequence:n.timestamp.localeCompare(s.timestamp));return u_(h_(d_(c_(t))))}function f_(e,t){if(!t||!p_(t,e))return e;const n=e.attachments??[];return{...e,sequence:t.sequence,timestamp:t.timestamp,attachments:n.length>0?n:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function m_(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return sf(e,t);const n=b_(e.toolCall,t.toolCall),s=k_(e.content,t.content,e.timestamp,t.timestamp),o=S_(e.attachments,t.attachments);return{...sf(e,t),content:s,toolCall:n,attachments:o,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,timestamp:e.timestamp.localeCompare(t.timestamp)>=0?e.timestamp:t.timestamp,sequence:Math.max(e.sequence,t.sequence)}}function p_(e,t){return Vc(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function g_(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const n=So(e.content),s=So(t.content);return P_(e.timestamp,t.timestamp)&&Un(n.text)===Un(s.text)&&C_(n.inlineImages,s.inlineImages)}function y_(e,t,n){return!e||n||!jo(e)||!jo(t)?!1:om(e.timestamp,t.timestamp,120*1e3)&&Un(e.content)===Un(t.content)}function jo(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function rf(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function gS(e,t){return rf(e)&&rf(t)&&om(e.timestamp,t.timestamp,120*1e3)&&Un(e.content)===Un(t.content)}function v_(e,t,n,s){return!e||!t||!n||!s||!jo(e)||!jo(n)?!1:gS(t,s)&&om(e.timestamp,n.timestamp,120*1e3)&&Un(e.content)===Un(n.content)}function yS(e,t){var l,d;const n=((l=e.attachments)==null?void 0:l.length)??0,s=((d=t.attachments)==null?void 0:d.length)??0;if(n!==s)return n>s?e:t;const o=Un(e.content).length,c=Un(t.content).length;return o!==c?o>c?e:t:sf(e,t)}function w_(e,t){var m,p;const n=((m=e.attachments)==null?void 0:m.length)??0,s=((p=t.attachments)==null?void 0:p.length)??0;if(n!==s)return n>s?e:t;const o=So(e.content).inlineImages.length,c=So(t.content).inlineImages.length;if(o!==c)return o>c?e:t;const l=e.content!==Un(e.content),d=t.content!==Un(t.content);return l!==d?l?t:e:t}function b_(e,t){return e?t?{...x_(e,t),input:vS(e.input,t.input),output:sw(e.output,t.output),error:sw(e.error,t.error)}:e:t}function x_(e,t){const n=iw(e.status),s=iw(t.status);return s!==n?s>n?t:e:t}function iw(e){return e==="running"?0:1}function k_(e,t,n,s){const o=Un(e),c=Un(t);return o===c?e.length>=t.length?e:t:o.length>c.length&&o.includes(c)?e:c.length>o.length&&c.includes(o)||s.localeCompare(n)>=0?t:e}function S_(e,t){const n=(e==null?void 0:e.length)??0,s=(t==null?void 0:t.length)??0;return s!==n?s>n?t:e:t??e}function vS(e,t){return t.length>e.length?t:e}function sw(e,t){return e===null?t:t===null?e:vS(e,t)}function sf(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function Un(e){return e.replace(/\r\n/g,`
|
|
106
|
+
`).trimEnd()}function C_(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((n,s)=>{var o;return n.url===((o=t[s])==null?void 0:o.url)})}function j_(e,t){return bS(t)?wS(e,t,"optimistic"):null}function N_(e,t){return Vc(t)?wS(e,t,"authoritative"):null}function wS(e,t,n){const s=ca(t.timestamp),o=Un(t.content);let c=null,l=Number.POSITIVE_INFINITY;for(const[d,m]of e.entries()){if(!(n==="optimistic"?Vc(m):bS(m))||Un(m.content)!==o)continue;const y=ca(m.timestamp),g=Math.abs(y-s);g>300*1e3||g<l&&(c=d,l=g)}return c}function Vc(e){return e.role!=="user"||e.kind!=="text"||e.deliveryState==="failed"?!1:e.rawRef.startsWith("pending://")||e.rawRef.startsWith("synthetic://")||e.rawRef.includes("#synthetic")}function bS(e){return e.role==="user"&&e.kind==="text"&&!Vc(e)}function ca(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function T_(e){return e.reduce((n,s)=>Number.isFinite(s.sequence)&&s.sequence>n?s.sequence:n,0)+1}function P_(e,t){return Math.abs(ca(e)-ca(t))<=1e3}function om(e,t,n){return Math.abs(ca(e)-ca(t))<=n}const xS=30,kS=40,aw=300*1e3,E_=600,R_=5e3,M_=1e4;function ow(){const e=cn.getState().defaultPermissionMode;return e==="default"?null:e}class A_{constructor(t,n={}){Ze(this,"state");Ze(this,"listeners",new Set);Ze(this,"realtimeClient",null);Ze(this,"historyBootstrapReadyTimer",null);Ze(this,"markSeenTimer",null);Ze(this,"markSeenInFlight",!1);Ze(this,"lastMarkSeenRequestAt",0);Ze(this,"seenWatermark",null);Ze(this,"runtimeRefreshTimer",null);Ze(this,"runtimeRefreshMode",null);Ze(this,"replaceSnapshotSeedOnBackfill",!1);Ze(this,"hasAuthoritativeBootstrapMessages");Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);var l;this.sessionId=t,this.options=n;const s=Cn(fh(t),aw);this.hasAuthoritativeBootstrapMessages=(((l=n.bootstrapMessages)==null?void 0:l.length)??0)>0;const o=nc(n.initialSession??null,(s==null?void 0:s.session)??null),c=io((s==null?void 0:s.messages)??[],this.sessionId,n.bootstrapMessages??[]);this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((s==null?void 0:s.messages.length)??0)>0,this.state=nw({session:o,capabilities:(s==null?void 0:s.capabilities)??null,runtimeHasActiveRun:(s==null?void 0:s.runtimeHasActiveRun)??null,runtimeCanInterrupt:(s==null?void 0:s.runtimeCanInterrupt)??null,contextUsage:(s==null?void 0:s.contextUsage)??null,messages:c,queuedMessages:(s==null?void 0:s.queuedMessages)??[]}),this.seenWatermark=(o==null?void 0:o.lastSeenAt)??null}async initialize(){const t=this.options.bootstrapMessages??[],n=io(this.state.messages,this.sessionId,t),s=this.hasAuthoritativeBootstrapMessages;this.patch({messages:n,historyState:L_(this.state.session,s?n.length:0),loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:ta(this.state.session,n.length),pagesLoaded:s?Math.max(this.state.pagesLoaded,1):0,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshQueue();try{this.startRealtime(),s?this.scheduleMarkSeen():this.state.historyState==="loading"&&this.scheduleHistoryBootstrapReady()}catch(o){this.handleError(o)}}async reload(){var n,s;this.clearHistoryBootstrapReadyTimer(),(n=this.realtimeClient)==null||n.close(),this.realtimeClient=null;const t=Cn(fh(this.sessionId),aw);this.state=nw({session:nc(this.options.initialSession??null,(t==null?void 0:t.session)??null),capabilities:(t==null?void 0:t.capabilities)??null,runtimeHasActiveRun:(t==null?void 0:t.runtimeHasActiveRun)??null,runtimeCanInterrupt:(t==null?void 0:t.runtimeCanInterrupt)??null,contextUsage:(t==null?void 0:t.contextUsage)??null,messages:io((t==null?void 0:t.messages)??[],this.sessionId,this.options.bootstrapMessages??[]),queuedMessages:(t==null?void 0:t.queuedMessages)??[]}),this.seenWatermark=((s=this.state.session)==null?void 0:s.lastSeenAt)??null,this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((t==null?void 0:t.messages.length)??0)>0,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const n=nc(this.state.session,t);n!==this.state.session&&this.patch({session:n,hasOlderMessages:ta(n,this.state.messages.length)})}async sendMessage(t,n){const s=hw(),o=mS(this.sessionId,t,s,(n==null?void 0:n.attachmentMeta)??[],(n==null?void 0:n.attachments)??[],T_(this.state.messages));this.patch({messages:[...this.state.messages,o],session:Ir(this.state.session,"running"),runtimeHasActiveRun:fw(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:mw(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const c=await this.sendMessageWithFallback(t,s,n);this.patch({messages:rw(this.state.messages,this.sessionId,c.message,s)})}catch(c){throw this.patch({messages:nf(this.state.messages,s),session:Ir(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),c}}async retryMessage(t){const n=this.state.messages.find(s=>s.clientRequestId===t);if(n){this.patch({messages:this.state.messages.map(s=>s.clientRequestId===t?{...s,deliveryState:"sending"}:s),runtimeHasActiveRun:fw(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:mw(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const s=await this.sendMessageWithFallback(n.content,t,{attachments:n.attachmentPayloads??[],attachmentMeta:n.attachments});this.patch({messages:rw(this.state.messages,this.sessionId,s.message,t)})}catch(s){throw this.patch({messages:nf(this.state.messages,t),session:Ir(this.state.session,"failed")}),s}}}async enqueueMessage(t,n){const s=hw();try{const o=await pT(this.sessionId,{content:t,clientRequestId:s,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:ow(),attachments:(n==null?void 0:n.attachments)??[]});this.patch({queuedMessages:__(this.state.queuedMessages,o)}),await this.refreshQueue()}catch(o){throw o}}async deleteQueuedMessage(t){await gT(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await yT(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await vT(this.sessionId),this.patch({session:Ir(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:null,errorDetail:null})}reconnect(){var t;(t=this.realtimeClient)==null||t.reconnectNow()}async loadOlderMessages(){var t;if(!(this.state.historyState!=="ready"||this.state.loadingOlderMessages||!this.state.olderCursor)){this.patch({loadingOlderMessages:!0,errorCode:null,errorDetail:null});try{if(!((t=this.realtimeClient)==null?void 0:t.requestOlderMessages(this.state.olderCursor,xS)))throw new Error("REALTIME_NOT_CONNECTED")}catch(n){const s=n instanceof Error?n.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:s})}}}destroy(){var t;this.clearHistoryBootstrapReadyTimer(),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.markSeenTimer!==null&&(window.clearTimeout(this.markSeenTimer),this.markSeenTimer=null),this.runtimeRefreshTimer!==null&&(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null),this.runtimeRefreshMode=null}startRealtime(){var n;if(!((n=Sn.getState().session)==null?void 0:n.accessToken)){Sn.clear();return}this.realtimeClient=new l_({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:kS,onSubscribed:()=>{this.patch({connectionState:"connected",historyState:this.state.historyState==="loading"&&lm(this.state.session)===0?"ready":this.state.historyState,hasOlderMessages:ta(this.state.session,this.state.messages.length)}),this.scheduleHistoryBootstrapReady()},onConnectionChange:s=>{var c;const o=this.state.connectionState;if(this.patch({connectionState:s,session:s==="reconnecting"&&hs((c=this.state.session)==null?void 0:c.runningState)?Ir(this.state.session,"reconnecting"):this.state.session}),s==="connected"){this.clearRuntimeRefreshTimer("poll"),o!=="closed"&&o!=="connected"&&this.patch({errorCode:null,errorDetail:null});return}this.scheduleRuntimeRefresh("poll","connection_state_change")},onEnvelope:s=>{var c,l;this.clearHistoryBootstrapReadyTimer();const o=this.mergeHistoryMessages(s.messages,s.type==="session.backfill");this.patch({messages:o,lastCursor:s.cursor,historyState:"ready",olderCursor:s.olderCursor??this.state.olderCursor,hasOlderMessages:s.type==="session.backfill"?!!s.olderCursor:ta(this.state.session,o.length),pagesLoaded:s.type==="session.backfill"?Math.max(this.state.pagesLoaded,o.length>0?1:0):this.state.pagesLoaded,session:Ir(this.state.session,uw(s.type,(c=this.state.session)==null?void 0:c.runningState))}),(l=this.realtimeClient)==null||l.updateCursor(s.cursor),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()},onOlderHistory:s=>{const o=this.mergeHistoryMessages(s.messages,!1);this.patch({messages:o,historyState:"ready",loadingOlderMessages:!1,olderCursor:s.olderCursor,hasOlderMessages:!!s.olderCursor,pagesLoaded:this.state.pagesLoaded+1,errorCode:null,errorDetail:null})},onRuntimeMessage:s=>{this.handleRuntimeMessage(s)},onRuntimeStatus:s=>{this.handleRuntimeStatus(s)},onRuntimeError:s=>{this.handleRuntimeError(s)},onInterrupted:s=>{this.handleInterrupted(s)},onError:s=>{this.patch({loadingOlderMessages:!1,errorCode:s.error_code,errorDetail:s.detail})},onUnauthorized:()=>{Sn.clear()}}),this.realtimeClient.start()}patch(t){let n=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),n={...t,session:this.applySeenWatermark(t.session??null)}),this.state={...this.state,...n},(Object.prototype.hasOwnProperty.call(n,"session")||Object.prototype.hasOwnProperty.call(n,"capabilities")||Object.prototype.hasOwnProperty.call(n,"contextUsage")||Object.prototype.hasOwnProperty.call(n,"messages")||Object.prototype.hasOwnProperty.call(n,"queuedMessages"))&&this.persistSnapshot(),this.emit()}mergeHistoryMessages(t,n){const s=n&&this.replaceSnapshotSeedOnBackfill?this.state.messages.filter(c=>c.deliveryState!=="sent"):this.state.messages,o=io(s,this.sessionId,t);return n&&(this.replaceSnapshotSeedOnBackfill=!1),o}handleError(t){this.clearHistoryBootstrapReadyTimer();const n=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:n})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const n=this.getMarkSeenThrottleDelayMs(),s=Math.max(E_,n);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const o=this.getTargetSeenAt();o!==null&&(jt("session_seen.start",{sessionId:this.sessionId,targetSeenAt:o,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),iT(this.sessionId).then(()=>{var c,l;this.bumpSeenWatermark(o),this.patch({session:lw(this.state.session,o)}),(l=(c=this.options).onSeen)==null||l.call(c,this.sessionId,o),jt("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{jt("session_seen.error",{sessionId:this.sessionId,targetSeenAt:o})}).finally(()=>{this.markSeenInFlight=!1,this.shouldMarkSeen()&&this.scheduleMarkSeen()}))},s)}clearRuntimeRefreshTimer(t){this.runtimeRefreshTimer!==null&&(t&&this.runtimeRefreshMode!==t||(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null))}scheduleHistoryBootstrapReady(){if(this.state.historyState!=="loading"){this.clearHistoryBootstrapReadyTimer();return}this.historyBootstrapReadyTimer===null&&(this.historyBootstrapReadyTimer=window.setTimeout(()=>{this.historyBootstrapReadyTimer=null,this.state.historyState==="loading"&&this.patch({historyState:"ready",hasOlderMessages:ta(this.state.session,this.state.messages.length),pagesLoaded:this.state.messages.length>0?Math.max(this.state.pagesLoaded,1):0})},500))}clearHistoryBootstrapReadyTimer(){this.historyBootstrapReadyTimer!==null&&(window.clearTimeout(this.historyBootstrapReadyTimer),this.historyBootstrapReadyTimer=null)}scheduleRuntimeRefresh(t,n){var s,o;if(!hs((s=this.state.session)==null?void 0:s.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,jt("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((o=this.state.session)==null?void 0:o.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const c=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(c,n)},t==="poll"?M_:1200))}async refreshRuntimeState(t,n){var s,o,c,l,d;jt("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((s=this.state.session)==null?void 0:s.runningState)??null});try{const m=await uy(this.sessionId),p=dw(m);this.patch({session:Ir(this.state.session,m.runningState),runtimeHasActiveRun:m.hasActiveRun,runtimeCanInterrupt:m.canInterrupt,contextUsage:m.contextUsage,errorCode:p.errorCode,errorDetail:p.errorDetail}),await this.refreshQueue();const y=t==="poll"&&this.state.connectionState!=="connected"&&hs((o=this.state.session)==null?void 0:o.runningState);jt("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,continuePolling:y}),y&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(m){jt("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((l=this.state.session)==null?void 0:l.runningState)??null,message:m instanceof Error?m.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&hs((d=this.state.session)==null?void 0:d.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(nT(this.sessionId).then(n=>{this.patch({session:nc(n,this.state.session)})}).catch(()=>{})),cw(this.state.capabilities)&&t.push(aT(this.sessionId).then(n=>{this.patch({capabilities:n})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}shouldRefreshSessionDetail(){return this.state.session===null||cw(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){jt("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const n=await uy(this.sessionId),s=dw(n);this.patch({session:Ir(this.state.session,n.runningState),runtimeHasActiveRun:n.hasActiveRun,runtimeCanInterrupt:n.canInterrupt,contextUsage:n.contextUsage,errorCode:s.errorCode,errorDetail:s.errorDetail}),await this.refreshQueue(),jt("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:n.contextUsage!==null})}catch(n){jt("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:n instanceof Error?n.message:"unknown"})}}async refreshQueue(){try{const t=await mT(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,n,s){var o;try{return await fT(this.sessionId,{content:t,clientRequestId:n,model:(s==null?void 0:s.model)??null,reasoningLevel:(s==null?void 0:s.reasoningLevel)??null,permissionMode:ow(),attachments:(s==null?void 0:s.attachments)??[]})}catch(c){if(!(c instanceof qn)||c.status!==404&&c.status!==405||(((o=s==null?void 0:s.attachments)==null?void 0:o.length)??0)>0)throw c;return dT(this.sessionId,{content:t,clientRequestId:n})}}handleRuntimeStatus(t){var s;const n=hh((s=this.state.session)==null?void 0:s.runningState,t.status);this.patch({session:Ir(this.state.session,n),runtimeHasActiveRun:hs(n)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:hs(n)?this.state.runtimeCanInterrupt:!1,errorCode:null,errorDetail:n===t.status?t.detail:this.state.errorDetail}),SS(n)&&(this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleRuntimeMessage(t){var s;this.clearHistoryBootstrapReadyTimer();const n=io(this.state.messages,this.sessionId,[t.message]);this.patch({messages:n,historyState:"ready",hasOlderMessages:ta(this.state.session,n.length),session:Ir(this.state.session,uw("session.delta",(s=this.state.session)==null?void 0:s.runningState))}),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()}handleRuntimeError(t){var s;const n=hh((s=this.state.session)==null?void 0:s.runningState,"failed");this.clearRuntimeRefreshTimer(),this.patch({session:Ir(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="failed"?t.error_code:this.state.errorCode,errorDetail:n==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var s;const n=hh((s=this.state.session)==null?void 0:s.runningState,"interrupted");this.clearRuntimeRefreshTimer(),this.patch({session:Ir(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="interrupted"?null:this.state.errorCode,errorDetail:n==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}shouldMarkSeen(){return this.getTargetSeenAt()!==null}getTargetSeenAt(){const t=[...this.state.messages].reverse().find(s=>s.role!=="user");if(!t)return null;const n=this.seenWatermark;return n?t.timestamp>n?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,R_-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:lw(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){xr(fh(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:D_(this.state.messages),queuedMessages:this.state.queuedMessages})}}function gr(e,t){const[n,s]=w.useState(()=>t(e.getState()));return w.useEffect(()=>e.subscribe(()=>{s(t(e.getState()))}),[t,e]),n}function lm(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function L_(e,t){return t>0||lm(e)===0?"ready":"loading"}function ta(e,t){const n=lm(e);return n!==null?n>t:t>=kS}function Ir(e,t){return e&&{...e,runningState:t,activityState:I_(e.activityState,t)}}function lw(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function I_(e,t){return hs(t)?"running":e==="running"?"idle":e}function hs(e){return e==="starting"||e==="running"||e==="reconnecting"}function SS(e){return e==="completed"||e==="interrupted"||e==="failed"}function cw(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(n=>n.usesProviderDefault===!0)}function uw(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function hh(e,t){return SS(e)?e:t}function dw(e){return e.runningState==="failed"?{errorCode:e.errorCode,errorDetail:e.errorDetail??e.detail}:e.runningState==="interrupted"?{errorCode:null,errorDetail:e.detail}:e.runningState==="completed"?{errorCode:null,errorDetail:e.detail}:{errorCode:null,errorDetail:null}}function hw(){var e,t;if(typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function")return globalThis.crypto.randomUUID();if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function"){const n=new Uint8Array(16);globalThis.crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const s=Array.from(n,o=>o.toString(16).padStart(2,"0")).join("");return`${s.slice(0,8)}-${s.slice(8,12)}-${s.slice(12,16)}-${s.slice(16,20)}-${s.slice(20)}`}return`fallback-${Date.now()}-${Math.random().toString(16).slice(2,10)}`}function fw(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:e.provider==="codex"||e.provider==="claude-code"||e.provider==="opencode":!1}function mw(e,t){return e?t&&e.provider===t.provider?!(!t.supportsInterrupt||e.provider==="claude-code"&&e.activitySource==="inferred"):e.provider==="codex"||e.provider==="opencode"?!0:e.provider==="claude-code"&&e.activitySource!=="inferred":!1}function fh(e){return`session-runtime.snapshot.${e}`}function D_(e){return e.filter(t=>t.deliveryState==="sent").slice(-xS)}function __(e,t){const n=e.filter(s=>s.id!==t.id);return n.push(t),n.sort((s,o)=>s.orderIndex-o.orderIndex),n}function nc(e,t){if(!e)return t;if(!t)return e;const n=Date.parse(e.updatedAt||e.lastMessageAt||e.createdAt),s=Date.parse(t.updatedAt||t.lastMessageAt||t.createdAt);return!Number.isFinite(n)||!Number.isFinite(s)?t:n>=s?e:t}function CS({children:e,className:t,frameRef:n}){return i.jsx("div",{ref:n,className:["mobile-top-header-frame",t].filter(Boolean).join(" "),children:e})}function pa({currentWorkspace:e,workspaces:t,onSelectWorkspace:n,className:s,containerRef:o,heading:c,content:l,sheetContent:d,triggerLabel:m,triggerAriaLabel:p,onTriggerClick:y,trailing:g}){const[x,b]=w.useState(!1),C=Or();return e?i.jsxs(i.Fragment,{children:[i.jsx(CS,{className:s,frameRef:o,children:i.jsxs("section",{className:"mobile-workspace-home-header",children:[i.jsx("h1",{className:"mobile-workspace-switcher-heading",children:c??e.name}),i.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":p??h("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(y){y();return}C.trigger("selection"),b(!0)},children:[i.jsx("span",{className:"mobile-workspace-home-switcher-label",children:m??e.name}),i.jsx(B_,{})]}),i.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:g})]}),i.jsx("p",{className:"mobile-workspace-home-path",children:e.path}),l]})}),x&&!y?F_(i.jsxs(O_,{title:h("shell.workspaceHomeSwitcherTitle"),onClose:()=>b(!1),children:[i.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:t.map(S=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{S.id!==e.id&&C.trigger("selection"),n==null||n(S.id),b(!1)},children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:S.name}),i.jsx("span",{className:"mobile-workspace-home-session-meta",children:S.path})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:S.id===e.id?i.jsx(z_,{}):i.jsx(U_,{})})]},S.id))}),d?d(()=>b(!1)):null]})):null]}):null}function F_(e){return typeof document>"u"?null:Mn.createPortal(e,document.body)}function O_({title:e,onClose:t,children:n}){return i.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:t,children:i.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":e,onClick:s=>s.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[i.jsx("div",{className:"mobile-workspace-home-sheet-header",children:i.jsx("strong",{children:e})}),n]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:h("common.cancel")})]})})}function B_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function U_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function z_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const jS="mobile.conversation.preview.mode";function mh(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(jS)==="immersive"?"immersive":"preview"}catch{return"preview"}}function bs(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jS,e)}catch{}}const W_=15e3,pw=.6,ph=.6,gw=12,H_=60,$_=48,q_=44;function V_(){const{sessionId:e="",workspaceId:t}=xf(),n=Yr(),s=An(),o=w.useMemo(()=>new URLSearchParams(n.search),[n.search]),c=(t==null?void 0:t.trim())||null,l=w.useMemo(()=>Y_(e,c,o),[c,o,e]),d=w.useMemo(()=>sF(e,n.state),[n.state,e]);return l?i.jsx(Q_,{draft:l,navigate:s}):i.jsx(G_,{sessionId:e,bootstrapMessages:d})}function G_({sessionId:e,bootstrapMessages:t}){var at;const{shellMode:n,navigationGroups:s,requestNavigationRefresh:o,selectWorkspace:c,setSessionWorkspace:l,markNavigationSessionSeen:d,favoriteSessions:m,archiveSession:p,unarchiveSession:y}=cr(),g=An(),x=w.useRef(null),b=w.useRef(null),[C,S]=w.useState(!1),[N,T]=w.useState(!1),[_,R]=w.useState(!1),[G,q]=w.useState(null),[F,M]=w.useState(!1),D=w.useMemo(()=>s.flatMap(be=>be.sessions).find(be=>be.sessionId===e)??null,[s,e]);(!x.current||b.current!==e)&&((at=x.current)==null||at.destroy(),x.current=new A_(e,{initialSession:D,bootstrapMessages:t,onSeen:(be,W)=>{d(be,W)}}),b.current=e);const U=x.current,{showToast:E,dismissToast:H}=Qn(),ee=Or(),ne=w.useRef(null),ae=w.useRef(null),te=w.useRef(null),ye=w.useRef((D==null?void 0:D.runningState)??null),J=gr(U,be=>be.session),K=gr(U,be=>be.capabilities),ue=gr(U,be=>be.runtimeHasActiveRun),A=gr(U,be=>be.runtimeCanInterrupt),z=gr(U,be=>be.messages),le=gr(U,be=>be.queuedMessages),P=gr(U,be=>be.contextUsage),ve=gr(U,be=>be.historyState),je=gr(U,be=>be.errorCode),Se=gr(U,be=>be.errorDetail),De=gr(U,be=>be.loadingOlderMessages),Re=gr(U,be=>be.hasOlderMessages),We=gr(U,be=>be.connectionState),[ct,Tt]=w.useState(null),[qe,ft]=w.useState(null),Ue=rF(J),Ht=Ue&&hx(K)&&(J==null?void 0:J.provider)===(K==null?void 0:K.provider),vt=le.some(be=>be.status==="queued"||be.status==="dispatching"),Ge=n!=="mobile",yt=RS(!Ge),Rt=(J==null?void 0:J.workspaceId)??(D==null?void 0:D.workspaceId)??null,zt=w.useMemo(()=>new Set(m.map(be=>be.session.sessionId)),[m]),gt=w.useMemo(()=>s.map(be=>be.workspace),[s]),Mt=w.useMemo(()=>NS(s,(J==null?void 0:J.workspaceId)??(D==null?void 0:D.workspaceId)??null,zt),[zt,s,D==null?void 0:D.workspaceId,J==null?void 0:J.workspaceId]),Vt=w.useMemo(()=>TS(m),[m]),bt=w.useMemo(()=>Rt?s.find(be=>be.workspace.id===Rt)??null:null,[Rt,s]),It=w.useMemo(()=>{var be;return $i(((be=J??D)==null?void 0:be.title)??null,h("conversation.titleFallback"))},[D,J]),de=w.useMemo(()=>(bt==null?void 0:bt.sessions.filter(be=>{var W;return be.isArchived===!0&&!((W=be.parentSessionId)!=null&&W.trim())}))??[],[bt]),xe=w.useRef(null),_e=w.useRef(null),Ve=w.useRef(null),[Qe,dt]=w.useState(null),{composerPortalTarget:At}=zk();return w.useEffect(()=>{U.applyNavigationSession(D)},[D,U]),w.useEffect(()=>(U.initialize(),()=>{U.destroy()}),[U]),w.useEffect(()=>(l(e,(J==null?void 0:J.workspaceId)??null),()=>{l(e,null)}),[J==null?void 0:J.workspaceId,e,l]),w.useEffect(()=>()=>{te.current!==null&&(window.clearTimeout(te.current),te.current=null)},[]),w.useEffect(()=>{if(!je||!Se){te.current!==null&&(window.clearTimeout(te.current),te.current=null),ae.current=null,ne.current=null,H("conversation-runtime-error");return}const be=`${je}:${Se}`;if(!(ne.current===be||ae.current===be)){if(te.current!==null&&(window.clearTimeout(te.current),te.current=null),K_((J==null?void 0:J.provider)??null,je,Se)){ae.current=be,te.current=window.setTimeout(()=>{ae.current=null,te.current=null,ne.current=be,E({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:Se,tone:"error",durationMs:null})},W_);return}ae.current=null,ne.current=be,E({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:Se,tone:"error",durationMs:null})}},[H,je,Se,J==null?void 0:J.provider,E]),w.useEffect(()=>{const be=ye.current,W=(J==null?void 0:J.runningState)??null;(be==="starting"||be==="running"||be==="reconnecting")&&W==="completed"&&ee.trigger("success"),ye.current=W},[ee,J==null?void 0:J.runningState]),PS(_e,Qe,!Ge,e),ES(_e,Ve,!Ge,e),i.jsxs(i.Fragment,{children:[i.jsxs("main",{ref:_e,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!Ge,"data-preview-mode":Ge?void 0:yt.displayMode,"data-preview-dragging":Ge?void 0:yt.isDragging,style:Ge?void 0:yt.pageStyle,children:[Ge?i.jsx(Ik,{session:J??D}):null,Ge?null:i.jsx(pa,{containerRef:Ve,className:"mobile-conversation-page-header",currentWorkspace:(bt==null?void 0:bt.workspace)??gt[0]??null,workspaces:gt,heading:It.fullTitle,triggerAriaLabel:yt.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{yt.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:It.fullTitle,children:It.displayTitle})}),Ge?null:i.jsx(MS,{visible:yt.isVisible,widthPx:yt.previewWidthPx,isDragging:yt.isDragging,gestureHandlers:yt.railGestureHandlers,activeSessionId:e,favoriteItems:Vt,items:Mt,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),archiveCurrentActionLabel:h("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:h("shell.archiveFolderAction"),onArchiveActiveSession:()=>{T(!0)},onOpenArchiveFolder:()=>{R(!0)},onActivate:be=>{bs("preview"),g(Gn(be.workspace.id,be.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...Ge?{}:yt.mainGestureHandlers,children:i.jsxs("div",{ref:xe,className:"mobile-conversation-main",children:[i.jsx(dx,{connectionState:We,onReconnect:()=>U.reconnect()}),i.jsx(jk,{sessionId:e,messages:z,historyState:ve,loadingOlderMessages:De,hasOlderMessages:Re,provider:(J==null?void 0:J.provider)??null,onLoadOlderMessages:()=>{U.loadOlderMessages()},onRetryMessage:be=>{U.retryMessage(be)}}),i.jsx(dD,{items:le,deletingQueueItemId:ct,steeringQueueItemId:qe,canSteer:Ht,onDelete:async be=>{Tt(be);try{await U.deleteQueuedMessage(be)}finally{Tt(null)}},onSteer:async be=>{ft(be);try{await U.steerQueuedMessage(be),o()}finally{ft(null)}}}),i.jsx(mx,{capabilities:K,draftStorageId:e,panelRef:Ge?void 0:dt,portalContainer:Ge?null:At,hasActiveRun:ue,contextUsage:P,hasPendingQueuedMessages:vt,canInterrupt:A,isSubmitting:C,isRunning:Ue,onInterrupt:async()=>{await U.interrupt(),o()},onSend:async(be,W)=>{S(!0);try{await U.sendMessage(be,{model:W==null?void 0:W.model,reasoningLevel:W==null?void 0:W.reasoningLevel,attachments:W==null?void 0:W.attachments,attachmentMeta:W==null?void 0:W.attachmentMeta}),o()}finally{S(!1)}},onQueueSend:async(be,W)=>{S(!0);try{await U.enqueueMessage(be,{model:W==null?void 0:W.model,reasoningLevel:W==null?void 0:W.reasoningLevel,attachments:W==null?void 0:W.attachments,attachmentMeta:W==null?void 0:W.attachmentMeta})}finally{S(!1)}}})]})})]}),i.jsx(tF,{open:N,busy:F,onClose:()=>{F||T(!1)},onConfirm:async()=>{if(!F){M(!0);try{if(await p(e),T(!1),E({title:h("shell.archiveAdded"),tone:"success"}),Rt){c(Rt),bs("preview"),g(_o(Rt));return}g("/workspaces")}catch(be){E({title:be instanceof Error?be.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{M(!1)}}}}),i.jsx(nF,{open:_,workspaceName:(bt==null?void 0:bt.workspace.name)??null,sessions:de,restoringSessionId:G,onClose:()=>{G||R(!1)},onRestore:async be=>{q(be);try{await y(be),E({title:h("shell.archiveRestored"),tone:"success"})}catch(W){E({title:W instanceof Error?W.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{q(null)}}})]})}function K_(e,t,n){return e!=="opencode"?!1:t==="OPENCODE_REQUEST_TIMEOUT"||t==="PROVIDER_RUNTIME_TIMEOUT"||/\bSERVER_TIMEOUT\b/i.test(n)||/timeout/i.test(n)||/超时/.test(n)}function Q_({draft:e,navigate:t}){const{shellMode:n,navigationGroups:s,requestNavigationRefresh:o,selectWorkspace:c,setSessionWorkspace:l,upsertNavigationSession:d,favoriteSessions:m}=cr(),[p,y]=w.useState(!1),[g,x]=w.useState([]),b=w.useMemo(()=>jT(e.provider),[e.provider]),[C,S]=w.useState(b),N=n!=="mobile",T=RS(!N),_=w.useMemo(()=>X_(e),[e]),R=w.useMemo(()=>new Set(m.map(ae=>ae.session.sessionId)),[m]),G=w.useMemo(()=>s.map(ae=>ae.workspace),[s]),q=w.useMemo(()=>$i(_.title??null,h("conversation.titleFallback")),[_]),F=w.useMemo(()=>NS(s,e.workspaceId,R),[e.workspaceId,R,s]),M=w.useMemo(()=>TS(m),[m]),D=w.useRef(null),U=w.useRef(null),E=w.useRef(null),[H,ee]=w.useState(null),{composerPortalTarget:ne}=zk();return w.useEffect(()=>(l(e.sessionId,e.workspaceId),()=>{l(e.sessionId,null)}),[e.sessionId,e.workspaceId,l]),w.useEffect(()=>{let ae=!1;return S(b),cT(e.provider,e.workspaceId).then(te=>{ae||S(te)}).catch(()=>{}),()=>{ae=!0}},[e.provider,e.workspaceId,b]),PS(U,H,!N,e.sessionId),ES(U,E,!N,e.sessionId),i.jsxs("main",{ref:U,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!N,"data-preview-mode":N?void 0:T.displayMode,"data-preview-dragging":N?void 0:T.isDragging,style:N?void 0:T.pageStyle,children:[N?i.jsx(Ik,{session:_}):null,N?null:i.jsx(pa,{containerRef:E,className:"mobile-conversation-page-header",currentWorkspace:G.find(ae=>ae.id===e.workspaceId)??G[0]??null,workspaces:G,heading:q.fullTitle,triggerAriaLabel:T.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{T.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:q.fullTitle,children:q.displayTitle})}),N?null:i.jsx(MS,{visible:T.isVisible,widthPx:T.previewWidthPx,isDragging:T.isDragging,gestureHandlers:T.railGestureHandlers,activeSessionId:e.sessionId,favoriteItems:M,items:F,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),onActivate:ae=>{bs("preview"),t(Gn(ae.workspace.id,ae.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...N?{}:T.mainGestureHandlers,children:i.jsxs("div",{ref:D,className:"mobile-conversation-main",children:[i.jsx(dx,{connectionState:"closed",onReconnect:()=>{}}),i.jsx(jk,{sessionId:e.sessionId,messages:g,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}}),i.jsx(mx,{capabilities:C,draftStorageId:e.sessionId,panelRef:N?void 0:ee,portalContainer:N?null:ne,contextUsage:null,isSubmitting:p,isRunning:!1,onSend:async(ae,te)=>{const ye=oF();x(J=>[...J,mS(e.sessionId,ae,ye,(te==null?void 0:te.attachmentMeta)??[],(te==null?void 0:te.attachments)??[])]),y(!0);try{const J=cn.getState().defaultPermissionMode,K=await hT({workspaceId:e.workspaceId,provider:e.provider,content:ae,clientRequestId:ye,model:(te==null?void 0:te.model)??null,reasoningLevel:(te==null?void 0:te.reasoningLevel)??null,permissionMode:J==="default"?null:J,attachments:(te==null?void 0:te.attachments)??[]});K.session&&d(K.session),l(K.sessionId,e.workspaceId),bs("preview"),t(Gn(e.workspaceId,K.sessionId),{replace:!0,state:K.message?{bootstrap:{sessionId:K.sessionId,messages:[K.message]}}:null}),o()}catch(J){throw x(K=>nf(K,ye)),J}finally{y(!1)}}})]})})]})}function Y_(e,t,n){var c,l;if(!iF(e))return null;const s=t??((c=n.get("workspaceId"))==null?void 0:c.trim())??null,o=((l=n.get("provider"))==null?void 0:l.trim())??null;return!s||!ST(o)?null:{sessionId:e,workspaceId:s,provider:o}}function X_(e){const t=new Date().toISOString();return{sessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,providerSessionId:`draft://${e.sessionId}`,rawStoreRef:`draft://${e.sessionId}`,parentSessionId:null,isSubagent:!1,subagentLabel:null,isArchived:!1,title:CT(e.provider),messageCount:0,lastMessageAt:null,createdAt:t,updatedAt:t,syncStatus:"idle",syncCursor:null,lastSyncAt:null,lastErrorCode:null,lastErrorDetail:null,resumedAt:null,runningState:"idle",activitySource:"none",lastEventAt:null,completedAt:null,lastSeenAt:null,activityState:"idle"}}function NS(e,t,n){if(!t)return[];const s=e.find(c=>c.workspace.id===t);return s?Fk(Gf([s]).filter(c=>!c.session.isArchived&&!n.has(c.session.sessionId))).flatMap(c=>[{entry:c.entry,depth:0},...c.children.map(l=>({entry:l,depth:1}))]):[]}function TS(e){return e.map(t=>({entry:t,depth:0}))}function PS(e,t,n,s){w.useEffect(()=>{const o=e.current;if(!n||!o){o&&o.style.removeProperty("--mobile-conversation-composer-height");return}if(!t){o.style.removeProperty("--mobile-conversation-composer-height");return}const c=o,l=t;function d(){!e.current||!l.isConnected||c.style.setProperty("--mobile-conversation-composer-height",`${l.offsetHeight}px`)}d();const m=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return m==null||m.observe(l),window.addEventListener("resize",d),()=>{m==null||m.disconnect(),window.removeEventListener("resize",d),o.style.removeProperty("--mobile-conversation-composer-height")}},[t,n,s,e])}function ES(e,t,n,s){w.useEffect(()=>{const o=e.current,c=t.current;if(!n||!o){o&&o.style.removeProperty("--mobile-conversation-page-header-height");return}if(!c){o.style.removeProperty("--mobile-conversation-page-header-height");return}const l=o,d=c;function m(){!e.current||!d.isConnected||l.style.setProperty("--mobile-conversation-page-header-height",`${d.offsetHeight}px`)}m();const p=typeof ResizeObserver<"u"?new ResizeObserver(m):null;return p==null||p.observe(d),window.addEventListener("resize",m),()=>{p==null||p.disconnect(),window.removeEventListener("resize",m),o.style.removeProperty("--mobile-conversation-page-header-height")}},[n,t,s,e])}function RS(e){const t=Or(),[n,s]=w.useState(()=>e?mh():"immersive"),[o,c]=w.useState(()=>yw()),[l,d]=w.useState(()=>e&&mh()==="preview"?"default":"closed"),m=w.useRef(l),p=w.useRef(null);w.useEffect(()=>{m.current=l},[l]),w.useEffect(()=>{if(!e){p.current=null,m.current="closed",d("closed"),s("immersive");return}const D=mh();s(D),d(D==="preview"?"default":"closed")},[e]),w.useEffect(()=>{e&&bs(n)},[e,n]),w.useEffect(()=>{if(typeof window>"u")return;function D(){c(yw())}return D(),window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[]);function y(D){m.current=D,d(D)}function g(D="default"){y(D),s("preview")}function x(){y("closed"),s("immersive")}function b(){y("expanded"),s("preview")}function C(){if(m.current!=="closed"){t.trigger("gesture"),x();return}t.trigger("gesture"),g()}function S(D,U){if(!e||U.touches.length!==1){p.current=null;return}if(J_(U.target)){p.current=null;return}const E=U.touches[0];if(!E){p.current=null;return}if(D==="main"){if(m.current!=="closed"||E.clientX>q_){p.current=null;return}}else if(m.current==="closed"){p.current=null;return}p.current={source:D,startX:E.clientX,startY:E.clientY,lastX:E.clientX,lastY:E.clientY,horizontalLocked:!1}}function N(D){const U=p.current,E=D.touches[0];if(!e||!U||!E)return;const H=E.clientX-U.startX,ee=E.clientY-U.startY;if(U.lastX=E.clientX,U.lastY=E.clientY,!U.horizontalLocked){if(Math.abs(H)<gw&&Math.abs(ee)<gw)return;if(Math.abs(H)<=Math.abs(ee)){p.current=null;return}if(U.source==="main"&&H<=0){p.current=null;return}U.horizontalLocked=!0}}function T(D){var ee;const U=p.current;if(p.current=null,!(U!=null&&U.horizontalLocked))return;const E=(ee=D==null?void 0:D.changedTouches)==null?void 0:ee[0];E&&(U.lastX=E.clientX,U.lastY=E.clientY);const H=U.lastX-U.startX;if(U.source==="main"){H>=H_&&(t.trigger("gesture"),g("default"));return}if(H<=-52){t.trigger("gesture"),x();return}H>=$_&&m.current==="default"&&(t.trigger("gesture"),b())}const _=l==="expanded"?ph:l==="default"?pw:0,R=Math.round(o*_*100)/100,G=_===0?0:_/ph,q={"--mobile-conversation-preview-default-width":`${Math.round(o*pw*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(o*ph*100)/100}px`,"--mobile-conversation-preview-width":`${R}px`,"--mobile-conversation-preview-progress":G.toFixed(4)};return{closePreview:x,displayMode:l==="closed"?"immersive":"preview",isDragging:!1,isVisible:l!=="closed",mainGestureHandlers:{onTouchStart:D=>S("main",D),onTouchMove:N,onTouchEnd:T,onTouchCancel:T},pageStyle:q,previewWidthPx:R,railGestureHandlers:{onTouchStart:D=>S("rail",D),onTouchMove:N,onTouchEnd:T,onTouchCancel:T},togglePreview:C}}function MS({visible:e,widthPx:t,isDragging:n,gestureHandlers:s,activeSessionId:o,favoriteItems:c,items:l,workspaceSectionLabel:d,archiveCurrentActionLabel:m,archiveFolderActionLabel:p,onArchiveActiveSession:y,onOpenArchiveFolder:g,onActivate:x}){return e?i.jsxs("aside",{className:"mobile-conversation-preview-rail surface-card","data-dragging":n,style:{width:`${t}px`,maxWidth:`${t}px`},...s,children:[i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-list-favorites",children:[i.jsx("div",{className:"mobile-conversation-preview-group-heading",children:h("shell.favoriteSectionTitle")}),c.length>0?i.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static",children:c.map(b=>i.jsxs("button",{type:"button",className:"mobile-conversation-preview-item","data-active":b.entry.session.sessionId===o,onClick:()=>x(b.entry),children:[i.jsx("span",{className:vw(b.entry.session.activityState??null,b.entry.session.sessionId===o),"aria-hidden":"true"}),i.jsxs("span",{className:"mobile-conversation-preview-item-copy",children:[i.jsx("span",{className:"mobile-conversation-preview-item-title",children:b.entry.session.title||h("common.unknown")}),i.jsx("span",{className:"mobile-conversation-preview-item-meta",children:af(b.entry.session.provider,b.entry.session.lastMessageAt??b.entry.session.updatedAt,b.entry.workspace.name)})]})]},`favorite:${b.entry.workspace.id}:${b.entry.session.sessionId}`))}):null]}),i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-workspace",children:[i.jsx("div",{className:"mobile-conversation-preview-group-heading",children:d}),i.jsx("div",{className:"mobile-conversation-preview-list","data-preview-gesture":"ignore",children:l.length===0?i.jsx("p",{className:"mobile-conversation-preview-empty",children:h("shell.emptyWorkspaceSessions")}):l.map(b=>i.jsxs("button",{type:"button",className:"mobile-conversation-preview-item","data-active":b.entry.session.sessionId===o,"data-depth":b.depth,onClick:()=>x(b.entry),children:[i.jsx("span",{className:vw(b.entry.session.activityState??null,b.entry.session.sessionId===o),"aria-hidden":"true"}),i.jsxs("span",{className:"mobile-conversation-preview-item-copy",children:[i.jsx("span",{className:"mobile-conversation-preview-item-title",children:b.entry.session.title||h("common.unknown")}),i.jsx("span",{className:"mobile-conversation-preview-item-meta",children:af(b.entry.session.provider,b.entry.session.lastMessageAt??b.entry.session.updatedAt)})]})]},`${b.entry.workspace.id}:${b.entry.session.sessionId}`))})]}),m&&y||p&&g?i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-archive",children:[m&&y?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button",onClick:()=>{y()},children:m}):null,p&&g?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button",onClick:g,children:p}):null]}):null]}):null}function yw(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function J_(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function vw(e,t){return e==="running"?"mobile-conversation-preview-indicator is-running":t?"mobile-conversation-preview-indicator is-active":"mobile-conversation-preview-indicator is-idle"}function af(e,t,n){return[n??null,Z_(e),eF(t)].filter(Boolean).join(" · ")}function Z_(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function eF(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function tF({open:e,busy:t,onClose:n,onConfirm:s}){return w.useEffect(()=>{if(!e)return;function o(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[t,n,e]),!e||typeof document>"u"?null:Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:t,onClick:n}),i.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":h("shell.archiveConfirmTitle"),children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("shell.archiveConfirmTitle")}),i.jsx("p",{children:h("shell.archiveConfirmDescription")})]})}),i.jsx("div",{className:"workbench-modal-body",children:i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{s()},children:h("shell.archiveAction")})]})})]})]}),document.body)}function nF({open:e,workspaceName:t,sessions:n,restoringSessionId:s,onClose:o,onRestore:c}){return w.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&!s&&o()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[o,e,s]),!e||typeof document>"u"?null:Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:!!s,onClick:o}),i.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":h("shell.archiveModalTitle"),children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("shell.archiveModalTitle")}),i.jsx("p",{children:t?`${t} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription")})]})}),i.jsx("div",{className:"workbench-modal-body",children:n.length>0?i.jsx("div",{className:"workbench-archive-list",children:n.map(l=>{const d=$i(l.title,h("common.unknown"));return i.jsxs("article",{className:"workbench-archive-item",children:[i.jsxs("div",{className:"workbench-archive-item-main",children:[i.jsx("strong",{title:d.fullTitle,children:d.displayTitle}),i.jsx("p",{children:af(l.provider,l.lastMessageAt??l.updatedAt)})]}),i.jsx("button",{type:"button",className:"secondary-button",disabled:s===l.sessionId,onClick:()=>{c(l.sessionId)},children:h("shell.unarchiveAction")})]},l.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})})]})]}),document.body)}function rF(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function iF(e){return e.startsWith("draft-")}function sF(e,t){if(!t||typeof t!="object")return[];const n=t.bootstrap;if(!n||typeof n!="object")return[];const s=n.sessionId,o=n.messages;return s!==e||!Array.isArray(o)?[]:o.filter(aF)}function aF(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.messageId=="string"&&typeof t.provider=="string"&&typeof t.providerSessionId=="string"&&typeof t.role=="string"&&typeof t.content=="string"&&typeof t.timestamp=="string"&&typeof t.sequence=="number"&&typeof t.rawRef=="string"}function oF(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function cm({open:e,workspaces:t,initialWorkspaceId:n,onClose:s,onSelect:o}){const[c,l]=w.useState(""),[d,m]=w.useState(!1),p=Or();if(w.useEffect(()=>{e&&(l(lF(t,n)),m(!1))},[n,e,t]),!e||typeof document>"u")return null;const y=t.find(g=>g.id===c)??t[0]??null;return Mn.createPortal(i.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:s,children:i.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":h("shell.createSessionModalTitle"),onClick:g=>g.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[i.jsx("div",{className:"mobile-workspace-home-sheet-header",children:i.jsx("strong",{children:h("shell.createSessionModalTitle")})}),i.jsxs("div",{className:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",children:[i.jsx("p",{className:"mobile-create-session-description",children:h("shell.createSessionModalDescription")}),i.jsxs("div",{className:"mobile-feature-field",children:[i.jsx("span",{children:h("shell.createSessionWorkspaceLabel")}),i.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${h("shell.createSessionWorkspaceLabel")} ${(y==null?void 0:y.name)??""}`.trim(),"aria-expanded":d?"true":"false",disabled:t.length===0,onClick:()=>{p.trigger("selection"),m(g=>!g)},children:[i.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[i.jsx("strong",{children:(y==null?void 0:y.name)??h("common.unknown")}),i.jsx("span",{children:(y==null?void 0:y.path)??h("common.unknown")})]}),i.jsx(cF,{expanded:d})]}),d?i.jsx("div",{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:t.map(g=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row",onClick:()=>{g.id!==c&&p.trigger("selection"),l(g.id),m(!1)},children:[i.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[i.jsx("strong",{children:g.name}),i.jsx("span",{children:g.path})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:g.id===c?i.jsx(dF,{}):i.jsx(uF,{})})]},g.id))}):null]}),i.jsxs("div",{className:"mobile-create-session-provider-block",children:[i.jsxs("div",{className:"mobile-create-session-provider-header",children:[i.jsx("span",{className:"mobile-create-session-provider-label",children:h("shell.createSessionProviderLabel")}),i.jsx("span",{className:"mobile-create-session-provider-hint",children:h("shell.providerOptionHint")})]}),i.jsx(Yk,{disabled:!c,onSelect:g=>{c&&o(c,g)}})]})]})]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:s,children:h("common.cancel")})]})}),document.body)}function lF(e,t){var n;return t&&e.some(s=>s.id===t)?t:((n=e[0])==null?void 0:n.id)??""}function cF({expanded:e}){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":e?"true":"false",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function uF(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function dF(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const hF=420;function ww({entry:e,isFavorite:t,isActive:n=!1,depth:s=0,variant:o="default",hasSubsessions:c=!1,showActions:l=!0,onActivate:d,onToggleSubsessions:m,onToggleFavorite:p,onArchive:y,onUnarchive:g,onRename:x}){const[b,C]=w.useState(!1),S=w.useRef(null),N=w.useRef(!1),T=Or(),{session:_,workspace:R}=e,G=_.title??_.sessionId,q=_.provider==="codex"?h("conversation.providerCodex"):_.provider==="opencode"?h("conversation.providerOpenCode"):h("conversation.providerClaude"),F=[q,mF(_.lastMessageAt??_.updatedAt??null)].filter(Boolean).join(" · ");w.useEffect(()=>()=>{M()},[]);function M(){S.current!==null&&(window.clearTimeout(S.current),S.current=null)}function D(ae){!c||ae.pointerType==="mouse"||(M(),S.current=window.setTimeout(()=>{N.current=!0,T.trigger("gesture"),m==null||m()},hF))}function U(){M()}function E(){if(N.current){N.current=!1;return}T.trigger("selection"),d(_.sessionId)}const H=async()=>{const ae=window.prompt(h("shell.renameModalDescription"),G);ae&&(await x(_.sessionId,ae.trim()),C(!1))},ee=async()=>{if(_.isArchived){await g(_.sessionId),C(!1);return}await y(_.sessionId),C(!1)},ne=()=>{p(_.sessionId),C(!1)};return i.jsxs("article",{className:"session-list-item","data-depth":s,"data-active":n,"data-has-subsessions":c,"data-variant":o,children:[i.jsxs("button",{type:"button",className:"session-list-link",onClick:E,onPointerDown:D,onPointerUp:U,onPointerCancel:U,onPointerLeave:U,children:[i.jsx("span",{className:fF({activityState:_.activityState??null,isActive:n,hasSubsessions:c}),"aria-hidden":"true"}),i.jsxs("div",{className:"session-list-copy",children:[i.jsx("div",{className:"session-list-title",children:G||h("shell.searchEntry")}),i.jsx("div",{className:"session-list-meta",children:o==="mobile"?i.jsx("span",{children:F}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:R.name}),i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{children:q})]})})]})]}),l?i.jsxs("div",{className:"session-list-actions",children:[i.jsx("button",{type:"button",className:"ghost-button","aria-expanded":b,onClick:()=>{T.trigger("selection"),C(ae=>!ae)},children:h("shell.sessionMoreAction")}),b?i.jsxs("div",{className:"session-action-menu surface-card",role:"menu","aria-label":h("shell.sessionMoreAction"),children:[i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:ne,children:h(t?"shell.unfavoriteAction":"shell.favoriteAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void ee(),children:_.isArchived?h("shell.unarchiveAction"):h("shell.archiveAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void H(),children:h("shell.renameAction")})]}):null]}):null]})}function fF(e){return e.hasSubsessions?e.activityState==="running"||e.isActive?"session-list-indicator is-subagent-running":"session-list-indicator is-subagent":e.activityState==="running"?"session-list-indicator is-running":"session-list-indicator is-idle"}function mF(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function pF(){const e=An(),{navigationGroups:t,favoriteSessionIds:n,currentWorkspaceId:s,currentSessionId:o,navigationLoading:c,selectWorkspace:l,toggleFavoriteSession:d,archiveSession:m,unarchiveSession:p,renameSession:y,startDraftSession:g}=cr(),x=t.find(U=>U.workspace.id===s)??t[0]??null,b=w.useMemo(()=>new Set(n),[n]),C=w.useMemo(()=>x?Gf([x]).filter(U=>!U.session.isArchived):[],[x]),S=w.useMemo(()=>Fk(C),[C]),N=(x==null?void 0:x.workspace.id)??"",T=!!N,[_,R]=w.useState([]),[G,q]=w.useState(!1);w.useEffect(()=>{if(!o)return;const U=S.filter(E=>E.children.some(H=>H.session.sessionId===o)).map(E=>E.entry.session.sessionId);U.length!==0&&R(E=>{const H=new Set(E);let ee=!1;for(const ne of U)H.has(ne)||(H.add(ne),ee=!0);return ee?Array.from(H):E})},[o,S]);function F(U){R(E=>E.includes(U)?E.filter(H=>H!==U):[...E,U])}function M(U,E){bs("immersive"),e(Gn(U,E))}function D(U,E){q(!1),bs("immersive"),g(U,E)}return i.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(pa,{currentWorkspace:(x==null?void 0:x.workspace)??null,workspaces:t.map(U=>U.workspace),onSelectWorkspace:U=>{l(U),e(_o(U))},content:i.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:c||!T,onClick:()=>q(!0),children:h("shell.createSession")})}),i.jsx("div",{className:"mobile-page-top-body",children:i.jsxs("section",{className:"session-section session-section-sheet",children:[i.jsxs("header",{className:"session-section-heading",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.mobileConversationCurrentWorkspaceSection")})}),i.jsx("span",{className:"session-section-count",children:S.length})]}),S.length===0?i.jsx("p",{className:"session-section-empty",children:h(c?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):i.jsx("div",{className:"session-current-workspace-list",children:S.map(U=>{const E=U.entry.session.sessionId,H=_.includes(E);return i.jsxs("div",{className:"session-list-tree-node",children:[i.jsx(ww,{entry:U.entry,isFavorite:b.has(E),isActive:o===E,variant:"mobile",hasSubsessions:U.children.length>0,onActivate:ee=>M(U.entry.workspace.id,ee),onToggleSubsessions:()=>F(E),onToggleFavorite:ee=>{d(ee)},onArchive:ee=>m(ee),onUnarchive:ee=>p(ee),onRename:(ee,ne)=>y(ee,ne)}),H&&U.children.length>0?i.jsx("div",{className:"session-list-children",children:U.children.map(ee=>i.jsx(ww,{entry:ee,isFavorite:b.has(ee.session.sessionId),isActive:o===ee.session.sessionId,depth:1,variant:"mobile",onActivate:ne=>M(ee.workspace.id,ne),onToggleFavorite:ne=>{d(ne)},onArchive:ne=>m(ne),onUnarchive:ne=>p(ne),onRename:(ne,ae)=>y(ne,ae)},`${ee.workspace.id}:${ee.session.sessionId}`))}):null]},`${U.entry.workspace.id}:${E}`)})})]})}),i.jsx(cm,{open:G,workspaces:t.map(U=>U.workspace),initialWorkspaceId:s??N,onClose:()=>q(!1),onSelect:D})]})}function gF(){const{currentWorkspaceId:e}=cr();return e?i.jsx(Ao,{to:ha(e,"files"),replace:!0}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.filesEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}function yF(){const{currentWorkspaceId:e}=cr();return e?i.jsx(Ao,{to:ha(e,"git"),replace:!0}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.gitEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}function JB(){return et.request("/api/terminals/shells")}function ZB(e){return et.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function vF(e){return et.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function eU(e){return et.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function tU(e){return et.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function nU(e){return et.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function rU(e,t={}){const n=new URLSearchParams;typeof t.beforeSeq=="number"&&n.set("beforeSeq",String(t.beforeSeq)),typeof t.limit=="number"&&n.set("limit",String(t.limit));const s=n.toString();return et.request(`/api/terminals/${encodeURIComponent(e)}/history${s?`?${s}`:""}`)}function wF(e){return et.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function bF(e,t){return et.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function xF(e){return et.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function bw(e,t){return et.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function kF(){return[{value:"",label:h("terminal.runtimeAutoOption"),description:h("terminal.runtimeAutoDescription")},{value:"tmux",label:"tmux",description:h("terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:h("terminal.runtimeEmbeddedDescription")}]}function xw(e){return e||h("terminal.runtimeAutoOption")}function iU(e){return e?e==="embedded-pty"?"pty":e:h("terminal.runtimeAutoShortLabel")}function SF(e){return e instanceof qn?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function CF({open:e,busy:t=!1,onClose:n,onConfirmFallback:s}){return w.useEffect(()=>{if(!e)return;function o(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[t,n,e]),!e||typeof document>"u"?null:Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:()=>{t||n()}}),i.jsxs("section",{className:"workbench-modal-card surface-card terminal-runtime-fallback-modal",role:"dialog","aria-modal":"true","aria-label":h("terminal.runtimeMissingDialogTitle"),children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("terminal.runtimeMissingDialogTitle")}),i.jsx("p",{children:h("terminal.runtimeMissingDialogDescription")})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:()=>{t||n()},children:"x"})]}),i.jsxs("div",{className:"workbench-modal-body terminal-runtime-fallback-body",children:[i.jsxs("section",{className:"terminal-runtime-fallback-section",children:[i.jsx("span",{className:"badge","data-tone":"error",children:"tmux"}),i.jsx("p",{className:"status-text",children:h("terminal.runtimeMissingInstallDescription")}),i.jsxs("ul",{className:"terminal-runtime-fallback-list",children:[i.jsx("li",{children:h("terminal.runtimeMissingInstallMacArm")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallMacIntel")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallDebian")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallFedora")})]})]}),i.jsxs("section",{className:"terminal-runtime-fallback-section",children:[i.jsx("span",{className:"badge",children:"embedded-pty"}),i.jsx("p",{className:"status-text",children:h("terminal.runtimeMissingFallbackDescription")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:h("terminal.runtimeMissingKeepAction")}),i.jsx("button",{type:"button",className:"primary-button",disabled:t,onClick:s,children:h(t?"terminal.runtimeMissingFallbackPending":"terminal.runtimeMissingFallbackAction")})]})]})]})]}),document.body)}const rc={mode:"command",name:"",cwd:"",target:"",args:"",port:""},kw=60*1e3;function jF(e){return e?new Date(e).toLocaleString():h("common.unknown")}function NF(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function TF(e){var t,n,s;return((t=e.find(o=>o.id==="cmd"&&o.available))==null?void 0:t.id)??((n=e.find(o=>o.available))==null?void 0:n.id)??((s=e[0])==null?void 0:s.id)??""}function PF(e){const t=e.name.trim();if(t)return t;const n=e.target.trim(),s=e.args.trim();return n?s?`${n} ${s}`:n:e.mode==="script"?h("terminalManager.defaultScriptName"):h("terminalManager.defaultCommandName")}function EF(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function RF(e){return{mode:AS(e),name:e.name,cwd:e.cwd,target:e.command,args:e.args.join(" "),port:e.port===null?"":String(e.port)}}function AS(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function MF(e){const t=e.trim();if(!t)return null;const n=Number(t);return Number.isInteger(n)?n:Number.NaN}function Sw(e,t){return e.get(t)??null}function AF(e,t){return e.port===null?{tone:"untracked",title:h("terminalManager.portUnset"),summary:h("terminalManager.portUnsetDescription"),badgeLabel:h("terminalManager.portUnset")}:t!=null&&t.occupied?{tone:"running",title:h("terminalManager.portOccupied"),summary:t.processName||h("terminalManager.processCommandFallback"),badgeLabel:t.processId?`PID ${t.processId}`:h("terminalManager.statusRunning"),badgeTone:"success"}:{tone:"idle",title:h("terminalManager.portAvailable"),summary:h("terminalManager.portAvailableDescription"),badgeLabel:h("terminalManager.statusStopped")}}function LF({open:e,title:t,description:n,onClose:s,children:o,className:c}){return w.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[s,e]),!e||typeof document>"u"?null:Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:s}),i.jsxs("section",{className:["workbench-modal-card","surface-card","terminal-manager-modal-card",c].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:n})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:"x"})]}),i.jsx("div",{className:"workbench-modal-body",children:o})]})]}),document.body)}function IF({open:e,busy:t,title:n,description:s,confirmLabel:o,onClose:c,onConfirm:l,className:d}){return w.useEffect(()=>{if(!e)return;function m(p){p.key==="Escape"&&!t&&c()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[t,c,e]),!e||typeof document>"u"?null:Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:t,onClick:c}),i.jsxs("section",{className:["workbench-modal-card","surface-card",d].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":n,children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:n}),i.jsx("p",{children:s})]})}),i.jsx("div",{className:"workbench-modal-body",children:i.jsxs("div",{className:"workbench-modal-actions terminal-manager-confirm-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:c,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{l()},children:t?h("terminalManager.templateRemoving"):o})]})})]})]}),document.body)}function Cw({label:e,value:t,options:n,open:s,onToggle:o,onChange:c}){const l=n.find(d=>d.value===t)??n[0]??null;return i.jsxs("div",{className:"field-group terminal-manager-mobile-picker",children:[i.jsx("span",{children:e}),i.jsxs("button",{type:"button",className:"terminal-manager-mobile-picker-trigger","aria-label":`${e} ${(l==null?void 0:l.label)??""}`.trim(),"aria-expanded":s?"true":"false",onClick:o,children:[i.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[i.jsx("strong",{children:(l==null?void 0:l.label)??h("common.unknown")}),l!=null&&l.description?i.jsx("span",{children:l.description}):null]}),i.jsx(DF,{expanded:s})]}),s?i.jsx("div",{className:"terminal-manager-mobile-picker-list",role:"listbox","aria-label":e,children:n.map(d=>{const m=d.value===t;return i.jsxs("button",{type:"button",role:"option",className:"terminal-manager-mobile-picker-option","aria-selected":m,disabled:d.disabled,onClick:()=>{c(d.value)},children:[i.jsxs("span",{className:"terminal-manager-mobile-picker-option-copy",children:[i.jsx("strong",{children:d.label}),d.description?i.jsx("span",{children:d.description}):null]}),i.jsx("span",{className:"terminal-manager-mobile-picker-option-indicator","aria-hidden":"true",children:m?i.jsx(FF,{}):i.jsx(_F,{})})]},d.value||"__empty__")})}):null]})}function DF({expanded:e}){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"terminal-manager-mobile-picker-chevron","data-expanded":e?"true":"false",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"})})}function _F(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function FF(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function LS({className:e,currentWorkspaceId:t,navigationGroups:n}){var dt,At,at,be;const{subscribeTerminalManagerSnapshot:s,requestTerminalManagerRefresh:o,addTerminalManagerSnapshotListener:c}=cr(),l=(t==null?void 0:t.trim())||null,[d,m]=w.useState([]),[p,y]=w.useState([]),[g,x]=w.useState([]),[b,C]=w.useState([]),[S,N]=w.useState(""),[T,_]=w.useState(""),[R,G]=w.useState(rc),[q,F]=w.useState(null),[M,D]=w.useState(null),[U,E]=w.useState([]),[H,ee]=w.useState(!1),[ne,ae]=w.useState(!1),[te,ye]=w.useState(null),[J,K]=w.useState(null),[ue,A]=w.useState(null),[z,le]=w.useState(null),[P,ve]=w.useState(null),[je,Se]=w.useState(!1),[De,Re]=w.useState(null),{showToast:We}=Qn(),ct=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,Tt=q!==null,qe=q==="edit"?p.find(W=>W.id===M)??null:null,ft=q==="edit";w.useEffect(()=>{jt("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:n.length})},[t,n.length]);const Ue=w.useMemo(()=>b.find(W=>W.id===S)??null,[S,b]),Ht=w.useMemo(()=>kF(),[]),vt=w.useMemo(()=>new Map(g.map(W=>[W.templateId,W])),[g]),Ge=w.useMemo(()=>g.filter(W=>W.occupied).length,[g]),yt=w.useMemo(()=>p.filter(W=>W.port!==null).length,[p]),Rt=(Ue==null?void 0:Ue.available)===!1&&b.length>0;w.useEffect(()=>{N(W=>b.length?W&&b.some(Pe=>Pe.id===W)?W:TF(b):"")},[b]),w.useEffect(()=>{!Tt||!l||b.length>0||gt(l)},[l,b.length,Tt]),w.useEffect(()=>{Tt||Re(null)},[Tt]),w.useEffect(()=>{q==="edit"&&M&&!qe&&(F(null),D(null),G(rc),_(""),Re(null))},[qe,M,q]),w.useEffect(()=>{!z||ue===z.templateId||p.some(W=>W.id===z.templateId)||le(null)},[z,ue,p]),w.useEffect(()=>{if(!l){m([]),y([]),x([]),ee(!1);return}const W=Cn(gh(l),kw);jt("terminal_manager.snapshot",{workspaceId:l,cached:!!W,cachedTemplateCount:(W==null?void 0:W.templates.length)??0,cachedStatusCount:(W==null?void 0:W.templateStatuses.length)??0}),W?(m(W.terminals),y(W.templates),x(W.templateStatuses),C(W.shellOptions??[]),ee(!1)):(m([]),y([]),x([]),C([]),ee(!0))},[l]),w.useEffect(()=>{if(l)return c(W=>{W.workspaceId===l&&(jt("terminal_manager.snapshot_received",{workspaceId:W.workspaceId,terminalCount:W.terminals.length,templateCount:W.templates.length,statusCount:W.templateStatuses.length}),zt(W),ee(!1))})},[l,c]),w.useEffect(()=>{if(!l)return;const W=Cn(gh(l),kw)!==null;if(s(l),W){const Pe=window.setTimeout(()=>{gt(l)},1500);return()=>{window.clearTimeout(Pe)}}gt(l)},[l,o,s]),w.useEffect(()=>{l&&xr(gh(l),{terminals:d,templates:p,templateStatuses:g,shellOptions:b})},[l,b,g,p,d]);function zt(W){m(W.terminals),y(W.templates),x(W.templateStatuses),C(W.shellOptions??[])}function gt(W){jt("terminal_manager.refresh_requested",{workspaceId:W}),o(W)}function Mt(){F(null),D(null),G(rc),_(""),Re(null)}function Vt(){D(null),G(rc),_(""),F("create")}function bt(W){D(W.id),G(RF(W)),_(W.runtimeType??""),F("edit")}async function It(W){if(l){K(W);try{await vF(W),gt(l),We({title:h("terminalManager.stopProcessSuccess"),tone:"success"})}catch(Pe){We({title:Pe instanceof Error?Pe.message:h("terminalManager.stopProcessFailed"),tone:"error"})}finally{K(null)}}}async function de(){if(!l||!R.target.trim())return;const W=MF(R.port);if(Number.isNaN(W)){We({title:h("terminalManager.invalidPort"),tone:"error"});return}ae(!0);try{const Pe={workspaceId:l,name:PF(R),cwd:R.cwd.trim()||void 0,command:R.target.trim(),args:NF(R.args),port:W,runtimeType:T||null};if(ft&&M){const nt=await bF(M,Pe);y(ot=>ot.map(Pt=>Pt.id===nt.id?nt:Pt))}else await wF(Pe);Mt(),gt(l),We({title:h(ft?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch(Pe){We({title:Pe instanceof Error?Pe.message:h(ft?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{ae(!1)}}async function xe(W,Pe){if(l){A(W.id);try{await xF(W.id),y(nt=>nt.filter(ot=>ot.id!==W.id)),x(nt=>nt.filter(ot=>ot.templateId!==W.id)),E(nt=>nt.filter(ot=>ot!==W.id)),le(nt=>(nt==null?void 0:nt.templateId)===W.id?null:nt),M===W.id&&Mt(),gt(l),We({title:h("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(nt){We({title:nt instanceof Error?nt.message:h("terminalManager.templateDeleteFailed"),tone:"error"})}finally{A(null)}}}async function _e(W){if(!l)return;const Pe=Ue!=null&&Ue.available?Ue.shell:void 0;ye(W);try{await bw(W,{shell:Pe}),gt(l),We({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(nt){if(SF(nt)){ve({templateId:W,shell:Pe});return}We({title:nt instanceof Error?nt.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{ye(null)}}async function Ve(){if(!(!l||!P)){Se(!0);try{await bw(P.templateId,{shell:P.shell,runtimeType:"embedded-pty"}),ve(null),gt(l),We({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(W){We({title:W instanceof Error?W.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{Se(!1)}}}function Qe(W){E(Pe=>Pe.includes(W)?Pe.filter(nt=>nt!==W):[...Pe,W])}return n.length?l?i.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[i.jsx(CF,{open:P!==null,busy:je,onClose:()=>{je||ve(null)},onConfirmFallback:()=>{Ve()}}),i.jsxs("div",{className:"terminal-manager-header terminal-manager-desktop-header",children:[i.jsxs("div",{className:"terminal-manager-panel-heading",children:[i.jsx("span",{className:"terminal-manager-panel-eyebrow",children:h("terminalManager.quickLaunchTitle")}),i.jsxs("div",{children:[i.jsx("h2",{children:h("terminalManager.templateSectionTitle")}),i.jsx("p",{className:"status-text",children:h("terminalManager.desktopPanelDescription")})]})]}),i.jsxs("div",{className:"terminal-manager-overview",children:[i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.runningCountLabel")}),i.jsx("strong",{children:Ge})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.portWatchCountLabel")}),i.jsx("strong",{children:yt})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.terminalCountLabel")}),i.jsx("strong",{children:d.length})]})]}),i.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[i.jsx("button",{className:"ghost-button",type:"button",disabled:!l||H,onClick:()=>{l&>(l)},children:h("terminalManager.refresh")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!l,onClick:()=>{Vt()},children:h("terminalManager.openCreateModalAction")})]})]}),i.jsxs("section",{className:"terminal-manager-section",children:[i.jsxs("div",{className:"terminal-manager-section-header",children:[i.jsxs("div",{children:[i.jsx("h3",{children:h("terminalManager.templateSectionTitle")}),i.jsx("p",{className:"status-text",children:h("terminalManager.templateSectionDescription")})]}),i.jsx("span",{className:"workbench-section-counter",children:p.length})]}),H&&!p.length?i.jsx("p",{className:"status-text",children:h("common.loading")}):null,p.length?i.jsx("div",{className:"terminal-manager-list",children:p.map(W=>{const Pe=Sw(vt,W.id),nt=AF(W,Pe),ot=U.includes(W.id),Pt=h(ot?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction");return i.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":nt.tone,"data-expanded":ot?"true":"false",children:[i.jsxs("div",{className:"terminal-manager-card-header",children:[i.jsxs("div",{className:"terminal-manager-card-title",children:[i.jsx("span",{className:"terminal-manager-card-indicator","aria-hidden":"true"}),i.jsx("strong",{children:W.name})]}),i.jsxs("div",{className:"terminal-manager-card-tools",children:[i.jsx("span",{className:"badge terminal-runtime-badge",children:xw(W.runtimeType)}),i.jsx("span",{className:"badge",children:AS(W)==="script"?h("terminalManager.scriptMode"):h("terminalManager.commandMode")}),i.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":Pt,"aria-expanded":ot,onClick:()=>{Qe(W.id)},children:"i"})]})]}),i.jsxs("div",{className:"terminal-manager-status-panel",children:[i.jsxs("div",{className:"terminal-manager-status-copy",children:[i.jsx("p",{className:"terminal-manager-status-title",children:nt.title}),i.jsx("p",{className:"status-text",children:nt.summary})]}),i.jsxs("div",{className:"terminal-manager-status-badges",children:[i.jsx("span",{className:"terminal-manager-stat-pill",children:W.port===null?h("terminalManager.portUnset"):`${h("terminalManager.portLabel")} ${W.port}`}),i.jsx("span",{className:"badge","data-tone":nt.badgeTone,children:nt.badgeLabel})]})]}),i.jsxs("div",{className:"terminal-manager-actions",children:[Pe!=null&&Pe.occupied?i.jsx("button",{className:"secondary-button",type:"button",disabled:J===W.id,onClick:()=>{It(W.id)},children:J===W.id?h("terminalManager.stoppingProcess"):h("terminalManager.stopProcessAction")}):null,i.jsx("button",{className:"secondary-button",type:"button",disabled:te===W.id||Rt,onClick:()=>{_e(W.id)},children:te===W.id?h("terminalManager.runningTemplate"):h("terminalManager.runTemplateAction")})]}),ot?i.jsxs("section",{className:"terminal-manager-details","aria-label":h("terminalManager.detailsSectionTitle"),children:[i.jsxs("div",{className:"terminal-manager-detail-grid",children:[i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.commandPreviewLabel")}),i.jsx("strong",{children:EF(W)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.cwdLabel")}),i.jsx("strong",{children:W.cwd})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("strong",{children:xw(W.runtimeType)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.updatedAt")}),i.jsx("strong",{children:jF(W.updatedAt)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.portLabel")}),i.jsx("strong",{children:W.port===null?h("terminalManager.portUnset"):W.port})]}),Pe!=null&&Pe.processId?i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.processIdLabel")}),i.jsx("strong",{children:Pe.processId})]}):null,Pe!=null&&Pe.processCommandLine?i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.processCommandLabel")}),i.jsx("strong",{children:Pe.processCommandLine})]}):null]}),i.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:ne||ue===W.id,onClick:()=>{bt(W)},children:h("terminalManager.editAction")}),i.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:ue===W.id,onClick:()=>{le({templateId:W.id,name:W.name,occupied:!!(Pe!=null&&Pe.occupied)})},children:ue===W.id?h("terminalManager.templateRemoving"):h("terminalManager.removeAction")})]})]}):null]},W.id)})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyTemplateBody")})})]}),i.jsx(LF,{open:Tt,title:h(ft?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:h(ft?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:ct?"terminal-manager-mobile-modal":void 0,onClose:Mt,children:i.jsxs("section",{className:"terminal-manager-modal-form",children:[ct?i.jsxs(i.Fragment,{children:[i.jsx(Cw,{label:h("terminalManager.shellField"),value:S,open:De==="shell",options:b.map(W=>({value:W.id,label:W.label,description:W.available?null:W.unavailableReason??h("terminalManager.shellUnavailable"),disabled:!W.available})),onToggle:()=>{Re(W=>W==="shell"?null:"shell")},onChange:W=>{N(W),Re(null)}}),(Ue==null?void 0:Ue.available)===!1&&Ue.unavailableReason?i.jsx("p",{className:"status-text",children:Ue.unavailableReason}):null,i.jsx(Cw,{label:h("terminal.runtimeField"),value:T,open:De==="runtime",options:Ht.map(W=>({value:W.value,label:W.label,description:W.description})),onToggle:()=>{Re(W=>W==="runtime"?null:"runtime")},onChange:W=>{_(W),Re(null)}}),i.jsx("p",{className:"status-text",children:((dt=Ht.find(W=>W.value===T))==null?void 0:dt.description)??((At=Ht[0])==null?void 0:At.description)})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.shellField")}),i.jsx("select",{value:S,onChange:W=>{N(W.target.value)},children:b.map(W=>i.jsx("option",{value:W.id,disabled:!W.available,children:W.available?W.label:`${W.label} - ${h("terminalManager.shellUnavailable")}`},W.id))}),(Ue==null?void 0:Ue.available)===!1&&Ue.unavailableReason?i.jsx("p",{className:"status-text",children:Ue.unavailableReason}):null]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("select",{value:T,onChange:W=>{_(W.target.value)},children:Ht.map(W=>i.jsx("option",{value:W.value,children:W.label},W.value||"auto"))}),i.jsx("p",{className:"status-text",children:((at=Ht.find(W=>W.value===T))==null?void 0:at.description)??((be=Ht[0])==null?void 0:be.description)})]})]}),i.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":h("terminalManager.modeField"),children:[i.jsx("button",{type:"button",className:R.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{G(W=>({...W,mode:"command"}))},children:h("terminalManager.commandMode")}),i.jsx("button",{type:"button",className:R.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{G(W=>({...W,mode:"script"}))},children:h("terminalManager.scriptMode")})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.templateNameField")}),i.jsx("input",{value:R.name,placeholder:h("terminalManager.templateNamePlaceholder"),onChange:W=>{G(Pe=>({...Pe,name:W.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.cwdField")}),i.jsx("input",{value:R.cwd,placeholder:h("terminalManager.cwdPlaceholder"),onChange:W=>{G(Pe=>({...Pe,cwd:W.target.value}))}})]})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:R.mode==="script"?h("terminalManager.scriptPathField"):h("terminalManager.commandField")}),i.jsx("input",{value:R.target,placeholder:R.mode==="script"?h("terminalManager.scriptPathPlaceholder"):h("terminalManager.commandPlaceholder"),onChange:W=>{G(Pe=>({...Pe,target:W.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.argsField")}),i.jsx("input",{value:R.args,placeholder:h("terminalManager.argsPlaceholder"),onChange:W=>{G(Pe=>({...Pe,args:W.target.value}))}})]})]}),i.jsx("div",{className:"terminal-manager-grid",children:i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.portField")}),i.jsx("input",{value:R.port,placeholder:h("terminalManager.portPlaceholder"),onChange:W=>{G(Pe=>({...Pe,port:W.target.value}))}})]})}),i.jsxs("div",{className:"terminal-manager-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:Mt,children:h("common.close")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!l||ne||!R.target.trim(),onClick:()=>{de()},children:h(ne?ft?"terminalManager.templateUpdating":"terminalManager.templateSaving":ft?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),i.jsx(IF,{open:z!==null,busy:z!==null&&ue===z.templateId,title:h("terminalManager.removeConfirmTitle"),description:z?h(z.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:z.name}):"",confirmLabel:h("terminalManager.removeConfirmAction"),className:ct?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{ue||le(null)},onConfirm:()=>{if(!z)return;const W=p.find(Pe=>Pe.id===z.templateId);if(!W){le(null);return}Sw(vt,W.id),xe(W)}})]}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.noCurrentWorkspaceBody")})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyWorkspaceBody")})})}function gh(e){return`terminal-manager.snapshot.${e}`}const OF=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:LS},Symbol.toStringTag,{value:"Module"}));function BF(){const{currentWorkspaceId:e,navigationGroups:t}=cr();return e?i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:i.jsx(LS,{className:"mobile-panel-scroll-root mobile-tool-native-panel mobile-tool-process-panel",currentWorkspaceId:e,navigationGroups:t})}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.terminalManagerEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}const UF=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),zF=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),WF=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),HF=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),$F=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),qF=new Set(["trace","debug","info","warn","warning","error","fatal"]);function VF({workspaceId:e,filePath:t,open:n,onClose:s,onSaved:o}){const[c,l]=w.useState(null),[d,m]=w.useState(""),[p,y]=w.useState(!1),[g,x]=w.useState(!1),[b,C]=w.useState("preview"),{showToast:S}=Qn(),N=w.useMemo(()=>_S(t),[t]),T=N==="markdown",_=!!(c!=null&&c.supported&&c.kind==="text");if(w.useEffect(()=>{if(!n){l(null),m(""),y(!1),x(!1),C("preview");return}if(!e||!t)return;const D=e,U=t;let E=!1;async function H(){y(!0);try{const ee=await Mv(D,U);E||(l(ee),m(ee.content??""),C((cO(U),"preview")))}catch(ee){E||(S({title:jw(ee,h("conversation.filePanelOpenFailed")),tone:"error"}),s())}finally{E||y(!1)}}return H(),()=>{E=!0}},[t,s,n,S,e]),w.useEffect(()=>{if(!n)return;function D(U){U.key==="Escape"&&s()}return window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}},[s,n]),!n||!t||typeof document>"u")return null;const R=t,G=e;async function q(){if(!(!G||!(c!=null&&c.version)||!_)){x(!0);try{await s2(G,R,d,c.version);const D=await Mv(G,R);l(D),m(D.content??""),await o(R),S({title:h("conversation.filePanelSaveSuccess"),tone:"success"}),C("preview")}catch(D){S({title:jw(D,h("conversation.filePanelSaveFailed")),tone:"error"})}finally{x(!1)}}}const F=(c==null?void 0:c.content)??"",M=_&&d!==F;return Mn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:s}),i.jsxs("section",{className:"workbench-modal-card surface-card file-viewer-modal",role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:h("conversation.fileViewerHint").replace("{language}",of(N))})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:i.jsx(uO,{})})]}),i.jsxs("div",{className:"file-viewer-toolbar",children:[i.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":h("conversation.fileViewerModeLabel"),children:[i.jsx("button",{type:"button",className:"file-viewer-tab","data-active":b==="preview",role:"tab","aria-selected":b==="preview",onClick:()=>C("preview"),children:h(T?"conversation.fileViewerPreview":"conversation.fileViewerCode")}),i.jsx("button",{type:"button",className:"file-viewer-tab","data-active":b==="edit",role:"tab","aria-selected":b==="edit",onClick:()=>C("edit"),disabled:!_,children:h("conversation.fileViewerEdit")})]}),i.jsxs("div",{className:"file-viewer-actions",children:[i.jsx("span",{className:"file-viewer-language",children:of(N)}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>void q(),disabled:!M||g,children:h(g?"conversation.filePanelSaving":"conversation.filePanelSave")})]})]}),i.jsx("div",{className:"workbench-modal-body file-viewer-body",children:p?i.jsx("p",{className:"status-text",children:h("common.loading")}):(c==null?void 0:c.supported)===!1?i.jsx("p",{className:"status-text",children:c.reason??h("conversation.filePanelUnsupported")}):b==="edit"?i.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:d,onChange:D=>m(D.target.value),spellCheck:!1}):T?i.jsx(GF,{content:d}):i.jsx(IS,{content:d,language:N})})]})]}),document.body)}function GF({content:e}){return i.jsx("div",{className:"markdown-content file-viewer-markdown",children:i.jsx(Bf,{remarkPlugins:[Hf],components:{code(t){const n=typeof t.className=="string"?t.className:"",s=/language-([\w-]+)/.exec(n);return s?i.jsx(IS,{content:String(t.children).replace(/\n$/,""),language:dm(s[1]??"plain")}):i.jsx("code",{className:n||void 0,children:t.children})}},children:e})})}function IS({content:e,language:t}){const n=e.split(/\r?\n/);return i.jsxs("div",{className:"file-viewer-code-block",children:[i.jsx("div",{className:"file-viewer-code-header",children:of(t)}),i.jsx("div",{className:"file-viewer-code-body",children:n.map((s,o)=>{const c=KF(s,t);return i.jsxs("div",{className:"file-viewer-code-line",children:[i.jsx("span",{className:"file-viewer-code-gutter",children:o+1}),i.jsx("code",{className:"file-viewer-code-content",children:c.length?c.map((l,d)=>i.jsx("span",{className:`code-token ${l.kind}`,children:l.text},`${o}-${d}-${l.text}`)):i.jsx("span",{className:"code-token plain",children:" "})})]},`${o}-${s}`)})})]})}function KF(e,t){const n=dm(t);return n==="json"?QF(e):n==="yaml"?ZF(e):n==="toml"?eO(e):n==="ini"?DS(e):n==="env"?tO(e):n==="properties"?nO(e):n==="conf"?rO(e):n==="editorconfig"?iO(e):n==="dockerfile"?sO(e):n==="gitignore"?aO(e):n==="log"?oO(e):n==="python"?yo(e,zF,"#"):n==="shell"?yo(e,WF,"#"):n==="sql"?JF(e):n==="html"||n==="xml"?YF(e):n==="css"?XF(e):n==="markdown"?[{text:e,kind:"plain"}]:yo(e,UF,"//")}function yo(e,t,n){const s=[];let o=0;for(;o<e.length;){const c=e.slice(o);if(c.startsWith(n)){s.push({text:c,kind:"comment"});break}const l=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(c);if(l){s.push({text:l[0],kind:"string"}),o+=l[0].length;continue}const d=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(c);if(d){s.push({text:d[0],kind:"number"}),o+=d[0].length;continue}const m=/^[A-Za-z_][\w$-]*/.exec(c);if(m){const y=m[0],g=y.toLowerCase();y==="true"||y==="false"||g==="true"||g==="false"?s.push({text:y,kind:"boolean"}):y==="null"||y==="None"||g==="none"?s.push({text:y,kind:"null"}):t.has(y)||t.has(g)?s.push({text:y,kind:"keyword"}):s.push({text:y,kind:"plain"}),o+=y.length;continue}const p=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(c);if(p){s.push({text:p[0],kind:"operator"}),o+=p[0].length;continue}s.push({text:c[0]??"",kind:"plain"}),o+=1}return s}function QF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),o=/^"(?:[^"\\]|\\.)*"/.exec(s);if(o){const m=e.slice(n+o[0].length).trimStart()[0];t.push({text:o[0],kind:m===":"?"attr":"string"}),n+=o[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(s);if(c){t.push({text:c[0],kind:"number"}),n+=c[0].length;continue}const l=/^(?:true|false|null)\b/.exec(s);if(l){const m=l[0]==="null"?"null":"boolean";t.push({text:l[0],kind:m}),n+=l[0].length;continue}const d=/^(?::|,|\{|\}|\[|\])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function YF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("<!--")){t.push({text:s,kind:"comment"});break}const o=/^(<\/?[\w:-]+)/.exec(s);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const c=/^([\w:-]+)(=)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:'[^']*'|"[^"]*")/.exec(s);if(l){t.push({text:l[0],kind:"string"}),n+=l[0].length;continue}const d=/^(?:\/?>)/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function XF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("/*")){t.push({text:s,kind:"comment"});break}const o=/^(?:'[^']*'|"[^"]*")/.exec(s);if(o){t.push({text:o[0],kind:"string"}),n+=o[0].length;continue}const c=/^([A-Za-z-]+)(\s*:)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(s);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const d=/^(?:@media|@supports|@import|@keyframes)\b/.exec(s);if(d){t.push({text:d[0],kind:"keyword"}),n+=d[0].length;continue}const m=/^(?:[{}:;(),.>])/.exec(s);if(m){t.push({text:m[0],kind:"operator"}),n+=m[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function JF(e){return yo(e,HF,"--")}function ZF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const o=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(s);if(o){t.push({text:o[1]??"",kind:"attr"}),t.push({text:o[2]??"",kind:"operator"}),n+=o[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(s);if(c){t.push({text:c[0],kind:"string"}),n+=c[0].length;continue}const l=/^(?:-?\d+(?:\.\d+)?)/.exec(s);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const d=/^(?:true|false|yes|no|null|~)\b/i.exec(s);if(d){const p=d[0].toLowerCase(),y=p==="null"||p==="~"?"null":"boolean";t.push({text:d[0],kind:y}),n+=d[0].length;continue}const m=/^(?:[-?:,[\]{}|>])/.exec(s);if(m){t.push({text:m[0],kind:"operator"}),n+=m[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function eO(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const o=/^(\[\[?[^\]]+\]?\])/.exec(s);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const c=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=Gc(s,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(l){t.push(...l.tokens),n+=l.length;continue}const d=/^(?:[,[\]{}])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function DS(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),o=s.trimStart();if(o.startsWith(";")||o.startsWith("#")){t.push({text:s,kind:"comment"});break}const c=/^(\[[^\]]+\])/.exec(s);if(c){t.push({text:c[0],kind:"tag"}),n+=c[0].length;continue}const l=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(s);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),n+=l[0].length;continue}const d=Gc(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(d){t.push(...d.tokens),n+=d.length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function tO(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const n=/^(\s*)(export)(\s+)/.exec(e),s=n?n[0].length:0,o=[];n&&(o.push({text:n[1]??"",kind:"plain"}),o.push({text:n[2]??"",kind:"keyword"}),o.push({text:n[3]??"",kind:"plain"}));const c=e.slice(s),l=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(c);if(!l)return DS(e);o.push({text:l[1]??"",kind:"attr"}),o.push({text:l[2]??"",kind:"operator"});const d=c.slice(l[0].length),m=Gc(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return m?(o.push(...m.tokens),o):(o.push({text:d,kind:"plain"}),o)}function nO(e){return um(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function rO(e){return um(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function iO(e){return um(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function sO(e){return yo(e,$F,"#")}function aO(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const n=e.length-t.length,s=e.slice(0,n),o=t.slice(1);return[{text:s,kind:"plain"},{text:"!",kind:"operator"},{text:o,kind:"string"}]}return[{text:e,kind:"string"}]}function oO(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const o=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(s);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const c=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(s);if(c){t.push({text:s.slice(0,c[0].length),kind:"keyword"}),n+=c[0].length;continue}const l=/^[A-Za-z_][\w-]*/.exec(s);if(l){const m=l[0];qF.has(m.toLowerCase())?t.push({text:m,kind:"keyword"}):t.push({text:m,kind:"plain"}),n+=m.length;continue}const d=/^(?:\d+(?:\.\d+)?)/.exec(s);if(d){t.push({text:d[0],kind:"number"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function um(e,t){const n=e.trimStart();if(t.commentPrefixes.some(m=>n.startsWith(m)))return[{text:e,kind:"comment"}];if(t.allowSection){const m=/^(\[[^\]]+\])/.exec(e);if(m)return[{text:m[0],kind:"tag"}]}const s=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!s)return[{text:e,kind:"plain"}];const o=(s[2]??"").trim();if(!t.delimiters.includes(o))return[{text:e,kind:"plain"}];const c=[{text:s[1]??"",kind:"attr"},{text:s[2]??"",kind:"operator"}],l=e.slice(s[0].length),d=lO(l);return d.length&&c.push(...d),c}function lO(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),o=Gc(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(o){t.push(...o.tokens),n+=o.length;continue}if(s.startsWith("#")||s.startsWith(";")){t.push({text:s,kind:"comment"});break}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function Gc(e,t){const n=/^(?:'[^']*'|"[^"]*")/.exec(e);if(n)return{tokens:[{text:n[0],kind:"string"}],length:n[0].length};const s=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(s)return{tokens:[{text:s[0],kind:"number"}],length:s[0].length};const o=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!o)return null;const c=o[0],l=c.toLowerCase();return t.trueValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.falseValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.nullValues.includes(l)?{tokens:[{text:c,kind:"null"}],length:c.length}:{tokens:[{text:c,kind:"plain"}],length:c.length}}function _S(e){var s,o;if(!e)return"plain";const t=((s=e.split(/[\\/]/).pop())==null?void 0:s.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((o=e.split(".").pop())==null?void 0:o.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function dm(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function of(e){switch(dm(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return h("conversation.fileViewerPlainText")}}function cO(e){return _S(e)==="markdown"}function jw(e,t){return e instanceof qn?e.message:t}function uO(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function xs(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function ks(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}function FS(e){return et.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function OS(e,t){return et.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function dO(e,t){return et.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function hO(e,t){return et.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function fO(e,t){return et.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function mO(e,t){return et.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function pO(e){return et.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function Nw(e,t=5,n=null){const s=new URLSearchParams({workspaceId:e,limit:String(t)});return n&&s.set("cursor",n),et.request(`/api/git/history?${s.toString()}`)}function gO(e){return et.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function yO(e,t,n){return et.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:n})})}function Tw(e,t){return et.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t})})}async function yh(e,t){const[n,s]=await Promise.all([FS(t),rT(e)]);return vO(n.changes,s.items)}function vO(e,t){const n=new Set(t.map(s=>gc(s.path)));return e.filter(s=>n.has(gc(s.path))||s.oldPath!==null&&n.has(gc(s.oldPath)))}function wO(e){const t=Pw("","");for(const n of e){const s=gc(n.path),o=s.split("/").filter(Boolean);let c=t;o.forEach((l,d)=>{const m=o.slice(0,d+1).join("/");if(d===o.length-1){c.children.set(`file:${m}`,{kind:"file",name:l,path:s,change:n});return}const p=`directory:${m}`,y=c.children.get(p);if(y&&y.kind==="directory"){c=y;return}const g=Pw(l,m);c.children.set(p,g),c=g})}return zS(US([...t.children.values()]))}function BS(e,t){const n=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return hm(e)?`${n} ${t}`:n}function hm(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function vh(e){return e.split("/").filter(Boolean).pop()??e}function gc(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function Pw(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function US(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:US([...t.children.values()])}:t)}function zS(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=zS(t.children);let s=t.name,o=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const d=c[0];s=`${s}/${d.name}`,o=d.path,c=d.children}return{kind:"directory",name:s,path:o,children:c}})}const bO=450,xO=60*1e3,Ew=20,Rw=16;function kO({sessionId:e,workspaceId:t,selectedPath:n,refreshVersion:s,onCountChange:o,onSelectFile:c,onOpenFile:l}){const[d,m]=w.useState("tree"),[p,y]=w.useState([]),[g,x]=w.useState(!0),[b,C]=w.useState(!1),[S,N]=w.useState([]),T=w.useRef(null),{showToast:_}=Qn();w.useEffect(()=>{const H=Cn(ic(t,e),xO);m("tree"),y(H??[]),x(H===null),C(!1),N([]),T.current=null,o==null||o((H==null?void 0:H.length)??0)},[e,t]),w.useEffect(()=>{let H=!1;async function ee(){x(!0);try{const ne=await yh(e,t);H||(y(ne),o==null||o(ne.length),xr(ic(t,e),ne))}catch(ne){H||(o==null||o(0),_({title:wh(ne,h("conversation.filePanelSessionLoadFailed")),tone:"error"}))}finally{H||x(!1)}}return ee(),()=>{H=!0}},[o,s,e,_,t]);const R=p.filter(H=>!H.staged),G=wO(p),q=new Set(S);async function F(){x(!0);try{const H=await yh(e,t);y(H),o==null||o(H.length),xr(ic(t,e),H)}catch(H){_({title:wh(H,h("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{x(!1)}}async function M(){if(R.length!==0){C(!0);try{await OS(t,R.map(ee=>ee.path));const H=await yh(e,t);y(H),o==null||o(H.length),xr(ic(t,e),H),_({title:h("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(H){_({title:wh(H,h("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function D(H){N(ee=>ee.includes(H)?ee.filter(ne=>ne!==H):[...ee,H])}function U(H){const ee=Date.now(),ne=T.current;return T.current={filePath:H,timestamp:ee},(ne==null?void 0:ne.filePath)===H&&ee-ne.timestamp<=bO}async function E(H,ee){if(ee&&U(H)){await l(H),T.current=null;return}ee||(T.current=null),await c(H)}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"file-panel-session-toolbar",children:[i.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":h("conversation.filePanelSessionViewLabel"),children:[i.jsx("button",{className:d==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":d==="tree",onClick:()=>m("tree"),children:h("conversation.filePanelSessionTreeView")}),i.jsx("button",{className:d==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":d==="list",onClick:()=>m("list"),children:h("conversation.filePanelSessionListView")})]}),i.jsxs("div",{className:"file-panel-session-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void F(),disabled:g||b,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void M(),disabled:b||R.length===0,children:h("conversation.filePanelSessionStageAll")})]})]}),i.jsxs("div",{className:"file-panel-session-summary",children:[i.jsx("span",{children:`${h("conversation.filePanelSessionSummary")} ${p.length}`}),i.jsx("span",{children:`${h("conversation.filePanelSessionUnstagedSummary")} ${R.length}`})]}),i.jsx("div",{className:"file-tree",children:g?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionLoading")}):p.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionEmpty")}):d==="tree"?WS({nodes:G,depth:0,collapsedPathSet:q,selectedPath:n,onToggleTreePath:D,onFileClick:E}):SO({items:p,selectedPath:n,onFileClick:E})})]})}function WS({nodes:e,depth:t,collapsedPathSet:n,selectedPath:s,onToggleTreePath:o,onFileClick:c}){return e.map(l=>{if(l.kind==="directory"){const d=!n.has(l.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":d,style:{paddingInlineStart:`${Ew+t*Rw}px`},onClick:()=>o(l.path),children:[i.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:d?"v":">"}),i.jsx("span",{className:"file-tree-label",children:l.name})]}),d?i.jsx("div",{className:"file-tree-children",children:WS({nodes:l.children,depth:t+1,collapsedPathSet:n,selectedPath:s,onToggleTreePath:o,onFileClick:c})}):null]},`session-directory:${l.path}`)}return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":s===l.change.path,"data-kind":"file",style:{paddingInlineStart:`${Ew+t*Rw}px`},onClick:()=>void c(l.change.path,!hm(l.change)),children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(l.name),"aria-hidden":"true",children:xs(l.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:l.name}),i.jsx("span",{className:"file-tree-path",children:BS(l.change,h("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":l.change.status,children:l.change.status}),i.jsx("span",{className:"file-session-badge subtle",children:l.change.staged?h("git.stagedLabel"):h("git.workingTreeLabel")})]})]})},`session-file:${l.path}`)})}function SO({items:e,selectedPath:t,onFileClick:n}){return e.map(s=>i.jsx("div",{className:"file-session-list-item",children:i.jsxs("button",{className:"file-session-list-button",type:"button","data-active":t===s.path,onClick:()=>void n(s.path,!hm(s)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(vh(s.path)),"aria-hidden":"true",children:xs(vh(s.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:vh(s.path)}),i.jsx("span",{className:"file-tree-path",children:BS(s,h("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":s.status,children:s.status}),i.jsx("span",{className:"file-session-badge subtle",children:s.staged?h("git.stagedLabel"):h("git.workingTreeLabel")})]})]})},`session-list:${s.path}`))}function ic(e,t){return`file-panel.session-changes.${e}.${t}`}function wh(e,t){return e instanceof qn?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const en="",CO=450,jO=300*1e3,NO=60*1e3,TO=1600,PO=20,EO=16;function HS({className:e,sessionId:t,workspaceId:n,hideHeading:s=!1}){var Ie;const{navigationGroups:o,subscribeFileTree:c,requestFileTreeRefresh:l,addFileTreeSnapshotListener:d}=cr(),[m,p]=w.useState({}),[y,g]=w.useState([]),[x,b]=w.useState([]),[C,S]=w.useState(en),[N,T]=w.useState(null),[_,R]=w.useState(!1),[G,q]=w.useState(!1),[F,M]=w.useState(!1),[D,U]=w.useState(!1),[E,H]=w.useState(""),[ee,ne]=w.useState(null),[ae,te]=w.useState(!1),[ye,J]=w.useState(null),[K,ue]=w.useState("workspace"),[A,z]=w.useState(0),[le,P]=w.useState(0),[ve,je]=w.useState(!1),[Se,De]=w.useState(!1),Re=w.useRef({}),We=w.useRef([]),ct=w.useRef(en),Tt=w.useRef(!1),qe=w.useRef(null),ft=w.useRef(null),Ue=w.useRef(null),Ht=w.useRef(null),vt=w.useRef(new Map),{showToast:Ge}=Qn(),yt=Kn(),Rt=!!(t!=null&&t.trim()),zt=s&&yt.isMobile;w.useEffect(()=>{jt("file_panel.props",{sessionId:t,workspaceId:n})},[t,n]),w.useEffect(()=>{ct.current=C},[C]);function gt(O){p(me=>{const ie=typeof O=="function"?O(me):O;return Re.current=ie,ie})}function Mt(O){g(me=>{const ie=typeof O=="function"?O(me):O;return We.current=ie,ie})}w.useEffect(()=>{var Oe,He;if(Pe(),!n){Pe(),Tt.current=!1,Re.current={},We.current=[],ct.current=en,gt({}),Mt([]),b([]),S(en),U(!1),H(""),ne(null),te(!1),R(!1);return}Tt.current=!0;const O=Cn(Lw(n),jO);jt("file_panel.workspace_snapshot",{workspaceId:n,cached:!!O,cachedRootItems:((He=(Oe=O==null?void 0:O.treeCache)==null?void 0:Oe[en])==null?void 0:He.length)??0,cachedDirectoryCount:Object.keys((O==null?void 0:O.treeCache)??{}).length});const me=UO((O==null?void 0:O.activeDirectoryPath)??en,(O==null?void 0:O.treeCache)??{}),ie=Aw((O==null?void 0:O.expandedDirectories)??[],me),Be=sc((O==null?void 0:O.treeCache)??{},me,ie);Re.current=Be,We.current=ie,ct.current=me,gt(Be),Mt(ie),b([]),S(me),R(!1),q(!1),U(!1),H(""),ne(null),te(!1),queueMicrotask(()=>{Tt.current=!1})},[n]),w.useEffect(()=>{if(n)return d(O=>{O.workspaceId===n&&(gt(me=>({...me,[O.path]:O.items})),O.path===en&&R(!1),b(me=>me.filter(ie=>ie!==O.path)),be(O.path,O.items))})},[d,n]),w.useEffect(()=>()=>{Pe()},[]),w.useEffect(()=>{n&&c(n,bh(We.current,ct.current))},[C,y,c,n]),w.useEffect(()=>{T(null),J(null),z(0),je(!1),De(!1),qe.current=null},[t]),w.useEffect(()=>{!Rt&&K==="session"&&ue("workspace")},[K,Rt]),w.useEffect(()=>{if(!ve&&!Se)return;function O(ie){var He,ut;if(!(ie.target instanceof Node))return;const Be=((He=ft.current)==null?void 0:He.contains(ie.target))??!1,Oe=((ut=Ue.current)==null?void 0:ut.contains(ie.target))??!1;!Be&&!Oe&&(je(!1),De(!1))}function me(ie){ie.key==="Escape"&&(je(!1),De(!1))}return document.addEventListener("pointerdown",O),document.addEventListener("keydown",me),()=>{document.removeEventListener("pointerdown",O),document.removeEventListener("keydown",me)}},[ve,Se]),w.useEffect(()=>{if(!n)return;const O=Aw(y,C),me=sc(m,C,O);xr(Lw(n),{treeCache:me,expandedDirectories:O,activeDirectoryPath:C})},[C,y,m,n]),w.useEffect(()=>{if(Tt.current)return;const O=sc(m,C,y);WO(m,O)||gt(O)},[C,y,m]),w.useEffect(()=>{var Oe;let O=!1;const me=(n==null?void 0:n.trim())??null;async function ie(He){var un,In;if(!me)return;const ut=(He==null?void 0:He.silent)!==!0&&(((un=Re.current[en])==null?void 0:un.length)??0)===0;ut&&R(!0),jt("file_panel.load_root_tree.start",{sessionId:t,workspaceId:me,silent:(He==null?void 0:He.silent)===!0,cachedRootItems:((In=Re.current[en])==null?void 0:In.length)??0});try{const on=await At(en,{force:!0});O||(jt("file_panel.load_root_tree.end",{sessionId:t,workspaceId:me,itemCount:on.length}),gt(kt=>({...sc(kt,ct.current,We.current),[en]:on})))}catch(on){O||Ge({title:ds(on,h("conversation.filePanelLoadFailed")),tone:"error"})}finally{!O&&ut&&R(!1)}}if((((Oe=Re.current[en])==null?void 0:Oe.length)??0)>0){const He=window.setTimeout(()=>{me&&(c(me,bh(We.current,ct.current)),ie({silent:!0}))},1500);return()=>{O=!0,window.clearTimeout(He)}}return ie(),()=>{O=!0}},[t,Ge,n]),w.useEffect(()=>{if(!n||!t){P(0);return}const O=Cn(HO(n,t),NO);jt("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:n,cached:O!==null,cachedCount:O}),P(O??0)},[t,A,n]);const Vt=m[en]??[],bt=D&&ee!==null,It=((Ie=o.find(O=>O.workspace.id===n))==null?void 0:Ie.workspace)??null,de=AO(N,C),xe=!!(It!=null&&It.path&&de!==null),_e=!!N,Ve=!!((N?lo(N):C)&&y.length);async function Qe(O,me=!1){if(!n)return[];if(!me){const ie=Re.current[O];if(ie)return ie}O===en?R(!0):b(ie=>yc(ie,O));try{const ie=await At(O,{force:me});return gt(Be=>({...Be,[O]:ie})),ie}catch(ie){throw Ge({title:ds(ie,h("conversation.filePanelLoadFailed")),tone:"error"}),ie}finally{O===en?R(!1):b(ie=>ie.filter(Be=>Be!==O))}}async function dt(){if(!n)return;const O=zO(Re.current,C,We.current);jt("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:n,targetDirectories:O});const ie=(await Promise.all(O.map(async Be=>{const Oe=await At(Be,{force:!0});return[Be,Oe]}))).reduce((Be,[Oe,He])=>(Be[Oe]=He,Be),{});jt("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:n,targetDirectories:O,directoryCount:Object.keys(ie).length}),gt(ie)}async function At(O,me){if(!n)return[];if(!(me!=null&&me.force)){const Be=Re.current[O];if(Be)return Be}const ie=bh(yc(We.current,O),O||ct.current);return c(n,ie),l(n,[O]),at(O)}function at(O,me=TO){const ie=Re.current[O];return ie?Promise.resolve(ie):new Promise((Be,Oe)=>{const He=window.setTimeout(()=>{W(O,He),Oe(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${O}`))},me),ut=vt.current.get(O)??[];vt.current.set(O,[...ut,{resolve:Be,reject:Oe,timerId:He}])})}function be(O,me){const ie=vt.current.get(O)??[];ie.length!==0&&(vt.current.delete(O),ie.forEach(Be=>{window.clearTimeout(Be.timerId),Be.resolve(me)}))}function W(O,me){const Be=(vt.current.get(O)??[]).filter(Oe=>Oe.timerId!==me);if(Be.length===0){vt.current.delete(O);return}vt.current.set(O,Be)}function Pe(){for(const[O,me]of vt.current.entries())me.forEach(ie=>{window.clearTimeout(ie.timerId),ie.reject(new Error(`FILE_TREE_ABORTED:${O}`))});vt.current.clear()}async function nt(O,me=!1){const ie=No(O,me);if(!ie.length){S(en);return}Mt(Be=>GS(Be,ie)),S(ie[ie.length-1]??en);for(const Be of ie)try{await Qe(Be)}catch{return}}async function ot(O){T(O),S(lo(O)),await nt(O)}async function Pt(O){await ot(O),J(O),qe.current=null}function Ot(O){const me=Date.now(),ie=qe.current;return qe.current={filePath:O,timestamp:me},(ie==null?void 0:ie.filePath)===O&&me-ie.timestamp<=CO}function St(){qe.current=null}async function Jt(O){if(Ot(O)){await Pt(O);return}await ot(O)}function Gt(){U(!1),H(""),ne(null),St()}async function nn(O){if(O.kind==="directory"){Gt(),await vn(O.path);return}if(Ot(O.path)){Gt(),await Pt(O.path);return}await ot(O.path)}async function vn(O){if(T(null),S(O),!We.current.includes(O))try{await Qe(O),Mt(me=>yc(me,O))}catch{}}async function Pn(O){if(T(null),S(O),We.current.includes(O)){mn(O);return}await vn(O)}function mn(O){Mt(me=>me.filter(ie=>ie!==O&&!ie.startsWith(`${O}/`))),S(lo(O)),T(null)}async function an(){if(n)try{if(await dt(),N&&await nt(N),bt&&E.trim()){const O=await Xh(n,E.trim());ne(O.items)}}catch(O){Ge({title:ds(O,h("conversation.filePanelLoadFailed")),tone:"error"})}}async function Ln(O){if(O==null||O.preventDefault(),!n||!E.trim()){ne(null);return}te(!0);try{const me=await Xh(n,E.trim());ne(me.items)}catch(me){Ge({title:ds(me,h("conversation.filePanelSearchFailed")),tone:"error"})}finally{te(!1)}}function re(){if(D){U(!1),H(""),ne(null);return}U(!0)}function I(O){De(!1),O()}function $(){var O;(O=Ht.current)==null||O.click()}async function L(O){var He;const me=((He=O.target.files)==null?void 0:He[0])??null;if(O.target.value="",!me||!n)return;const ie=MO(me.name);if(!ie){Ge({title:h("conversation.filePanelUploadFailed"),tone:"error"});return}const Be=Mw(C,N),Oe=RO(Be,ie);M(!0);try{const ut=await DO(me);await o2({workspaceId:n,path:Oe,contentBase64:ut}),await dt(),await ot(Oe),Ge({title:h("conversation.filePanelUploadSuccess",{name:ie}),tone:"success"})}catch(ut){Ge({title:ds(ut,h("conversation.filePanelUploadFailed")),tone:"error"})}finally{M(!1)}}async function X(){if(!(!n||!N)){M(!0);try{const O=await l2(n,N),me=_O(O.contentBase64);FO(O.fileName,new Blob([me],{type:"application/octet-stream"})),Ge({title:h("conversation.filePanelDownloadSuccess",{name:O.fileName}),tone:"success"})}catch(O){Ge({title:ds(O,h("conversation.filePanelDownloadFailed")),tone:"error"})}finally{M(!1)}}}function ce(){const O=N?lo(N):C;!O||!We.current.includes(O)||mn(O)}async function ke(O){if(!n)return;const me=Mw(C,N),ie=me?`${me}/`:"",Be=window.prompt(h(O==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),ie);if(!(Be!=null&&Be.trim()))return;const Oe=Be.trim();q(!0);try{await a2({workspaceId:n,opType:O,dstPath:Oe,content:O==="create_file"?"":void 0}),await dt(),O==="create_directory"?(await nt(Oe,!0),T(null)):await ot(Oe)}catch(He){Ge({title:ds(He,h("conversation.filePanelMutateFailed")),tone:"error"})}finally{q(!1)}}async function Fe(O){const me=(It==null?void 0:It.path)??"";if(de===null||!me){je(!1);return}try{const ie=IO(me),Be=O==="absolute"?LO(me,de,ie):$S(de,ie);await OO(Be,yt),Ge({title:h(O==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(ie){Ge({title:ie instanceof Error?ie.message:h("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{je(!1)}}function Ne(O,me){return i.jsx(i.Fragment,{children:O.map(ie=>{const Be=ie.kind==="directory",Oe=Be&&y.includes(ie.path),He=Be&&x.includes(ie.path),ut=m[ie.path]??[],un=N===ie.path||N===null&&Be&&C===ie.path;return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":un,"data-kind":ie.kind,"aria-expanded":Be?Oe:void 0,style:{paddingInlineStart:`${PO+me*EO}px`},onClick:()=>{if(Be){St(),Pn(ie.path);return}Jt(ie.path)},children:[i.jsx("span",{className:`file-tree-chevron${Be?"":" is-hidden"}`,"aria-hidden":"true",children:Oe?"v":">"}),Be?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(ie.name),"aria-hidden":"true",children:xs(ie.name)}),i.jsx("span",{className:"file-tree-label",children:ie.name}),He?i.jsx("span",{className:"file-tree-meta",children:h("common.loading")}):null]}),Be&&Oe?i.jsx("div",{className:"file-tree-children",children:He&&!ut.length?i.jsx("p",{className:"file-tree-empty",children:h("common.loading")}):ut.length?Ne(ut,me+1):i.jsx("p",{className:"file-tree-empty",children:h("conversation.filePanelEmptyDirectory")})}):null]},`${ie.kind}-${ie.path}`)})})}function Me(O){return i.jsx(i.Fragment,{children:O.map(me=>{const ie=me.kind==="directory",Be=N===me.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":Be,"data-kind":me.kind,onClick:()=>{nn(me)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),ie?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(me.name),"aria-hidden":"true",children:xs(me.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:me.name}),i.jsx("span",{className:"file-tree-path",children:me.path})]})]})},`search-${me.kind}-${me.path}`)})})}return i.jsx("section",{className:["conversation-panel","surface-card","file-panel",e].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:n?i.jsxs(i.Fragment,{children:[i.jsx(VF,{workspaceId:n,filePath:ye,open:ye!==null,onClose:()=>J(null),onSaved:async O=>{await dt(),await ot(O),z(me=>me+1)}}),s?null:i.jsx("div",{className:"file-panel-heading-row",children:i.jsx("h2",{className:"file-panel-heading",children:h("conversation.filePanelTitle")})}),i.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":h("conversation.filePanelTitle"),children:[i.jsx("button",{className:K==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":K==="workspace",onClick:()=>ue("workspace"),children:h("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:K==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":K==="session",onClick:()=>{Rt&&ue("session")},disabled:!Rt,children:[h("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${h("conversation.filePanelSessionTab")} ${le}`,children:le})]})]}),K==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:Ht,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:O=>void L(O)}),zt?i.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":h("conversation.filePanelTitle"),children:i.jsxs("div",{className:"file-mobile-action-shell",ref:Ue,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":h("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":Se,"data-active":Se,onClick:()=>{je(!1),De(O=>!O)},children:[i.jsx("span",{children:h("conversation.filePanelActionsMenu")}),i.jsx(XO,{})]}),Se?i.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":h("conversation.filePanelActionsMenu"),children:[i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{De(!1),re()},children:h(D?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>I(an),disabled:_||G||ae,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{De(!1),ce()},disabled:!Ve,children:h("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{De(!1),$()},disabled:G||F,children:h("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>I(X),disabled:!_e||F,children:h("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>I(()=>ke("create_file")),disabled:G||F,children:h("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>I(()=>ke("create_directory")),disabled:G||F,children:h("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>I(()=>Fe("absolute")),disabled:!xe,children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>I(()=>Fe("relative")),disabled:!xe,children:h("conversation.filePanelCopyRelativePath")})]}):null]})}):i.jsxs("div",{className:"file-panel-toolbar","aria-label":h("conversation.filePanelTitle"),children:[i.jsxs("div",{className:"file-toolbar-menu-shell",ref:ft,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCopyPath"),"aria-label":h("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":ve,"data-active":ve,onClick:()=>{De(!1),je(O=>!O)},disabled:!xe,children:i.jsx(VO,{})}),ve?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Fe("absolute"),children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Fe("relative"),children:h("conversation.filePanelCopyRelativePath")})]}):null]}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCollapseCurrent"),"aria-label":h("conversation.filePanelCollapseCurrent"),onClick:ce,disabled:!Ve,children:i.jsx($O,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelRefresh"),"aria-label":h("conversation.filePanelRefresh"),onClick:()=>void an(),disabled:_||G||ae,children:i.jsx(qO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),"data-active":D,onClick:re,disabled:_,children:i.jsx(Iw,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelUpload"),"aria-label":h("conversation.filePanelUpload"),onClick:$,disabled:G||F,children:i.jsx(KO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelDownload"),"aria-label":h("conversation.filePanelDownload"),onClick:()=>void X(),disabled:!_e||F,children:i.jsx(QO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewFile"),"aria-label":h("conversation.filePanelNewFile"),onClick:()=>void ke("create_file"),disabled:G||F,children:i.jsx(GO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewDirectory"),"aria-label":h("conversation.filePanelNewDirectory"),onClick:()=>void ke("create_directory"),disabled:G||F,children:i.jsx(YO,{})})]}),D?i.jsxs("form",{className:"file-toolbar-search",onSubmit:O=>void Ln(O),children:[i.jsx("input",{value:E,onChange:O=>H(O.target.value),placeholder:h("conversation.filePanelSearchPlaceholder")}),zt?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":h("conversation.filePanelSearchButton"),disabled:ae,children:h("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),disabled:ae,children:i.jsx(Iw,{})})]}):null,i.jsx("div",{className:"file-tree","data-search-mode":bt,children:_&&Vt.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("common.loading")}):bt?ee!=null&&ee.length?Me(ee):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSearchEmpty")}):Vt.length?Ne(Vt,0):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelEmptyDirectory")})})]}):Rt&&t?i.jsx(kO,{sessionId:t,workspaceId:n,selectedPath:N,refreshVersion:A,onCountChange:P,onSelectFile:ot,onOpenFile:Pt}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:h("conversation.filePanelSessionNoSession")})})]}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:h("conversation.filePanelNoWorkspace")})})})}function lo(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):en}function No(e,t=!1){const n=e.split("/").filter(Boolean),s=t?n.length:n.length-1,o=[];for(let c=0;c<s;c+=1)o.push(n.slice(0,c+1).join("/"));return o}function Mw(e,t){return e||(t?lo(t):en)}function RO(e,t){return e?`${e}/${t}`:t}function MO(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function AO(e,t){return e||t||null}function $S(e,t="posix"){return e?qS(e,t):"."}function LO(e,t,n){const s=qS(e,n),o=$S(t,n).replace(/^\.[/\\]?/,"");if(!o)return s;const c=VS(n),l=o.replace(/^[/\\]+/,"");return l?s.endsWith("/")||s.endsWith("\\")?`${s}${l}`:`${s}${c}${l}`:s}function IO(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function qS(e,t){return e&&(VS(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function VS(e){return e==="windows"?"\\":"/"}async function DO(e){const t=await e.arrayBuffer(),n=new Uint8Array(t),s=32768;let o="";for(let c=0;c<n.length;c+=s){const l=n.subarray(c,c+s);o+=String.fromCharCode(...l)}return btoa(o)}function _O(e){const t=atob(e),n=new Uint8Array(t.length);for(let s=0;s<t.length;s+=1)n[s]=t.charCodeAt(s);return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}function FO(e,t){if(typeof document>"u")throw new Error(h("conversation.filePanelDownloadFailed"));const n=window.URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=e,document.body.append(s),s.click(),s.remove(),window.URL.revokeObjectURL(n)}async function OO(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!BO(e))throw new Error(h("conversation.filePanelCopyPathFailed"))}}function BO(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}function UO(e,t){return e&&No(e,!0).every(o=>o in t)?e:en}function Aw(e,t){if(!t)return[];const n=No(t,!0);return e.filter(s=>n.includes(s))}function sc(e,t,n){const s=fm(t,n);return Object.entries(e).reduce((o,[c,l])=>(s.has(c)&&(o[c]=l),o),{})}function zO(e,t,n){const o=[...fm(t,n)].filter(c=>c===en||c in e);return o.length?o:[en]}function fm(e,t){const n=new Set([en]),s=GS(t,No(e,!0));for(const o of s){n.add(o);for(const c of No(o,!0))n.add(c)}return n}function WO(e,t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length?!1:n.every(o=>e[o]===t[o])}function yc(e,t){return e.includes(t)?e:[...e,t]}function GS(e,t){return t.reduce((n,s)=>yc(n,s),e)}function Lw(e){return`file-panel.workspace-tree.${e}`}function HO(e,t){return`file-panel.session-change-count.${e}.${t}`}function bh(e,t){return[...fm(t,e)]}function ds(e,t){return e instanceof qn?e.message:t}function $O(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function qO(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function Iw(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function VO(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function GO(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function KO(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function QO(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function YO(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function XO(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}const JO=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:HS},Symbol.toStringTag,{value:"Module"})),xh=56,Dw=28,kh=72,ac=8,_w=960,Fw=60*1e3,Ow=20,Bw=9,Uw=9;function KS({className:e,workspaceId:t}){const{subscribeGitSnapshot:n,requestGitRefresh:s,addGitSnapshotListener:o}=cr(),[c,l]=w.useState(null),[d,m]=w.useState([]),[p,y]=w.useState(0),[g,x]=w.useState(null),[b,C]=w.useState(!1),[S,N]=w.useState(null),[T,_]=w.useState(null),[R,G]=w.useState(""),[q,F]=w.useState(!1),[M,D]=w.useState(!1),[U,E]=w.useState([]),[H,ee]=w.useState(!0),[ne,ae]=w.useState(!1),[te,ye]=w.useState(()=>typeof window<"u"?window.innerWidth<=_w:!1),[J,K]=w.useState([]),[ue,A]=w.useState(null),[z,le]=w.useState("unstaged"),[P,ve]=w.useState(null),[je,Se]=w.useState(null),[De,Re]=w.useState(xh),[We,ct]=w.useState(!1),Tt=w.useRef(null),qe=w.useRef(null),ft=w.useRef(null),{showToast:Ue}=Qn();w.useEffect(()=>{jt("git_sidebar.props",{workspaceId:t})},[t]),w.useEffect(()=>{E([]),ee(!0),y(0),x(null),C(!1),_(null),G(""),ae(!1),K([]),A(null),le("unstaged"),ve(null),Se(null),ct(!1),Re(xh)},[t]),w.useEffect(()=>{function re(){ye(window.innerWidth<=_w)}return re(),window.addEventListener("resize",re),()=>{window.removeEventListener("resize",re)}},[]),w.useEffect(()=>{if(!We)return;const re=document.body.style.cursor,I=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function $(X){dt(X.clientY)}function L(){ct(!1)}return window.addEventListener("pointermove",$),window.addEventListener("pointerup",L),()=>{document.body.style.cursor=re,document.body.style.userSelect=I,window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",L)}},[We]),w.useEffect(()=>{var $,L;if(!(t!=null&&t.trim())){l(null),m([]),y(0),x(null),N(null),F(!1);return}const re=t.trim(),I=Cn(Ch(re),Fw);if(jt("git_sidebar.snapshot",{workspaceId:re,cached:!!I,cachedHistoryCount:(($=I==null?void 0:I.history)==null?void 0:$.length)??0,cachedChangedCount:((L=I==null?void 0:I.status)==null?void 0:L.changes.length)??0}),I){vt(I),F(!1);return}l(null),m([]),y(0),x(null),N(null),F(!0)},[t]),w.useEffect(()=>{if(t!=null&&t.trim())return o(re=>{var I,$,L;re.workspaceId===t.trim()&&(jt("git_sidebar.snapshot_received",{workspaceId:re.workspaceId,changedCount:((I=re.status)==null?void 0:I.changes.length)??0,historyCount:re.history.length,branchCount:((($=re.branches)==null?void 0:$.local.length)??0)+(((L=re.branches)==null?void 0:L.remote.length)??0)}),vt(re),F(!1))})},[o,t]),w.useEffect(()=>{if(!(t!=null&&t.trim()))return;const re=t.trim(),I=Cn(Ch(re),Fw)!==null;n(re),!I&&Ge()},[s,n,t]),w.useEffect(()=>{t&&xr(Ch(t),{status:c,history:d,historyTotalCount:p,historyNextCursor:g,branches:S})},[S,d,g,p,c,t]),w.useEffect(()=>{if(!c||!T)return;c.changes.find(I=>I.path===T)||_(null)},[T,c]),w.useEffect(()=>{nB(ft.current)},[R]),w.useEffect(()=>{te||(K([]),A(null),ve(null),Se(null))},[te]),w.useEffect(()=>{if(!c){K([]);return}const re=new Set(c.changes.map(I=>I.path));K(I=>I.filter($=>re.has($)))},[c]);function Ht(){const re=qe.current;if(!re)return;re.querySelectorAll(".git-tree-shell").forEach($=>{$.scrollTop=0})}function vt(re){l(re.status),m(Array.isArray(re.history)?re.history:[]),y(typeof re.historyTotalCount=="number"?re.historyTotalCount:0),x(typeof re.historyNextCursor=="string"?re.historyNextCursor:null),N(re.branches??null)}function Ge(re){t!=null&&t.trim()&&(F(!0),jt("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),s(t.trim()))}async function yt(re){if(!(t!=null&&t.trim()))return;const I=t.trim();F(!0);try{const[$,L,X]=await Promise.all([FS(I),Nw(I,Ow,null),gO(I)]);vt({status:$,history:L.items,historyTotalCount:L.totalCount,historyNextCursor:L.nextCursor,branches:X}),s(I),re!=null&&re.resetTreeScroll&&requestAnimationFrame(()=>{Ht()})}catch($){Ue({title:ti($,h("git.panelLoadFailed")),tone:"error"})}finally{F(!1)}}async function Rt(){if(!(!t||!g||b)){C(!0);try{const re=await Nw(t,Ow,g);m(I=>{const $=new Set(I.map(X=>X.commitHash)),L=re.items.filter(X=>!$.has(X.commitHash));return[...I,...L]}),y(re.totalCount),x(re.nextCursor)}catch(re){Ue({title:ti(re,h("git.panelLoadFailed")),tone:"error"})}finally{C(!1)}}}function zt(re){if(!H||b||!g)return;const I=re.currentTarget;I.scrollHeight-I.scrollTop-I.clientHeight<=40&&Rt()}async function gt(){if(t){D(!0);try{const re=await fO(t,"ai");G(re.validation.normalizedDraft.subject||re.draft.subject)}catch(re){Ue({title:ti(re,h("git.draftFailed")),tone:"error"})}finally{D(!1)}}}async function Mt(re,I){if(t&&re.length){D(!0);try{const $=I?await dO(t,re):await OS(t,re);l($),_(re[re.length-1]??null),K(L=>L.filter(X=>!re.includes(X))),A(null),Ge()}catch($){F(!1),Ue({title:ti($,h("git.stageFailed")),tone:"error"})}finally{D(!1)}}}async function Vt(re){if(t&&re.length){D(!0);try{const I=await hO(t,re);l(I),re.includes(T??"")&&_(null),K($=>$.filter(L=>!re.includes(L))),A(null),Ge()}catch(I){F(!1),Ue({title:ti(I,h("git.discardFailed")),tone:"error"})}finally{D(!1)}}}async function bt(){if(!(!t||!R.trim())){D(!0);try{await mO(t,tB(R)),Ue({title:h("git.commitSuccess"),tone:"success"}),G(""),_(null),Ge()}catch(re){Ue({title:ti(re,h("git.commitFailed")),tone:"error"})}finally{D(!1)}}}async function It(){if(t){D(!0);try{const re=await Tw(t,"push");Ue({title:re.summary,tone:"success"}),Ge()}catch(re){Ue({title:ti(re,h("git.remoteFailed")),tone:"error"})}finally{D(!1)}}}async function de(re){if(t){D(!0);try{const I=await Tw(t,re);Ue({title:I.summary,tone:"success"}),ae(!1),Ge()}catch(I){Ue({title:ti(I,h("git.remoteFailed")),tone:"error"})}finally{D(!1)}}}async function xe(){if(t){D(!0);try{const re=await pO(t);G(re.commitSubject??""),Ue({title:re.summary||h("git.undoLastCommitSuccess"),tone:"success"}),ae(!1),Ge()}catch(re){Ue({title:ti(re,h("git.undoLastCommitFailed")),tone:"error"})}finally{D(!1)}}}async function _e(re){if(t){D(!0);try{const I=await yO(t,re,!1);N(I),ae(!1),Ge()}catch(I){Ue({title:ti(I,h("git.branchFailed")),tone:"error"})}finally{D(!1)}}}function Ve(re){E(I=>I.includes(re)?I.filter($=>$!==re):[...I,re])}function Qe(re){_(re),A(null),K(I=>I.includes(re)?I.filter($=>$!==re):[...I,re])}function dt(re){const I=Tt.current;if(!I||!Number.isFinite(re))return;const $=I.getBoundingClientRect(),L=$.height-ac;if(!Number.isFinite($.top)||!Number.isFinite($.height)||L<=0)return;const X=(re-$.top-ac/2)/L*100;if(!Number.isFinite(X))return;const ce=Math.max(Dw,Math.min(kh,Math.round(X)));Re(ce)}function At(re){re.preventDefault(),dt(re.clientY),ct(!0)}const at=(c==null?void 0:c.changes)??[],be=at.filter(re=>lf(re,"staged")),W=at.filter(re=>lf(re,"unstaged")),Pe=qw(be,"staged"),nt=qw(W,"unstaged"),ot=new Set(U),Pt=new Set(J),Ot=Vw(J,at,"staged"),St=Vw(J,at,"unstaged"),Jt=at.length===0&&((c==null?void 0:c.snapshot.ahead)??0)>0,Gt=be.length>0&&R.trim().length>0,nn=(S==null?void 0:S.currentBranch)??(c==null?void 0:c.snapshot.branch)??h("common.unknown"),vn=Number.isFinite(De)?De:xh,Pn=H?`minmax(120px, ${vn}fr) ${ac}px minmax(140px, ${100-vn}fr)`:`minmax(120px, 1fr) ${ac}px auto`;w.useEffect(()=>{ue==="staged"&&Ot.length===0&&A(null),ue==="unstaged"&&St.length===0&&A(null)},[ue,Ot.length,St.length]),w.useEffect(()=>{if(!te)return;const re=W.length>0?"unstaged":be.length>0?"staged":"history";le(I=>I==="unstaged"&&W.length>0||I==="staged"&&be.length>0?I:re)},[te,be.length,W.length]),w.useEffect(()=>{P&&(d.some(re=>re.commitHash===P)||ve(null))},[d,P]),w.useEffect(()=>{te&&z!=="history"&&ne&&ae(!1)},[te,ne,z]);async function mn(re,I){var $;try{if(typeof navigator>"u"||!(($=navigator.clipboard)!=null&&$.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(re),Ue({title:I,tone:"success"})}catch{Ue({title:h("common.copyContentFailed"),tone:"error"})}}async function an(re,I){typeof window<"u"&&!window.confirm(h("git.discardConfirm",{path:I}))||await Vt(re)}function Ln(){return i.jsxs("div",{className:"git-operations-menu",children:[i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.currentBranch")}),i.jsx("strong",{className:"git-menu-branch",children:nn})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.branchTitle")}),i.jsx("div",{className:"git-menu-branch-list",children:S==null?void 0:S.local.map(re=>i.jsx("button",{className:"git-menu-item",type:"button",disabled:M||re.current,onClick:()=>void _e(re.name),children:i.jsx("span",{children:re.current?`${h("git.switchBranch")} ${re.name}`:`${h("git.switchBranchTo")} ${re.name}`})},re.name))})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:M,onClick:()=>void de("fetch"),children:i.jsx("span",{children:h("git.fetch")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:M,onClick:()=>void de("pull"),children:i.jsx("span",{children:h("git.pull")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:M,onClick:()=>void de("push"),children:i.jsx("span",{children:h("git.push")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:M,onClick:()=>void xe(),children:i.jsx("span",{children:h("git.undoLastCommit")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:M||q,onClick:()=>void yt({resetTreeScroll:!0}),children:i.jsx("span",{children:h("git.refresh")})})]})]})}return i.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",e].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[i.jsxs("section",{className:"git-card git-scaffold-section",children:[i.jsxs("div",{className:"git-editor-row",children:[i.jsx("textarea",{ref:ft,rows:1,value:R,onChange:re=>G(ZS(re.target.value)),onKeyDown:re=>{re.key==="Enter"&&re.preventDefault()},placeholder:h("git.commitSubjectPlaceholder")}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.generateDraft"),title:h("git.generateDraft"),onClick:()=>void gt(),disabled:M||q,children:i.jsx(iB,{})})]}),i.jsxs("div",{className:"git-primary-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void yt({resetTreeScroll:!0}),disabled:M||q||!t,children:h("git.refreshNow")}),i.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Jt){It();return}bt()},disabled:M||!Jt&&!Gt,children:h(Jt?"git.pushNow":"git.commitNow")})]})]}),te?i.jsxs("div",{className:"git-mobile-sections",children:[i.jsx(Sh,{title:h("git.stagedChangesTitle"),count:be.length,expanded:z==="staged",onToggle:()=>le("staged"),children:i.jsx(Ww,{title:h("git.stagedChangesTitle"),nodes:Pe,collapsedTreePathSet:ot,onToggleTreePath:Ve,onToggleMobileSelection:Qe,selectedMobilePathSet:Pt,selectedTargets:Ot,actioning:M,variant:"staged",swipeRowState:je,onSwipeRowChange:Se,onStageToggle:Mt,onDiscardWithConfirm:an,onClearSelectedTargets:()=>K(re=>re.filter(I=>!Ot.includes(I)))})}),i.jsx(Sh,{title:h("git.changesTitle"),count:W.length,expanded:z==="unstaged",onToggle:()=>le("unstaged"),children:i.jsx(Ww,{title:h("git.changesTitle"),nodes:nt,collapsedTreePathSet:ot,onToggleTreePath:Ve,onToggleMobileSelection:Qe,selectedMobilePathSet:Pt,selectedTargets:St,actioning:M,variant:"unstaged",swipeRowState:je,onSwipeRowChange:Se,onStageToggle:Mt,onDiscardWithConfirm:an,onClearSelectedTargets:()=>K(re=>re.filter(I=>!St.includes(I)))})}),i.jsxs(Sh,{title:h("git.recentVersionsTitle"),count:p,expanded:z==="history",onToggle:()=>le("history"),trailingContent:i.jsx("span",{className:"badge",children:nn}),headerAction:i.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),"aria-expanded":ne,onClick:()=>{le("history"),ae(re=>!re)},disabled:M,children:i.jsx(Ac,{})}),children:[ne?i.jsx("div",{className:"git-mobile-operations-shell",children:Ln()}):null,i.jsx(ZO,{history:d,historyLoadingMore:b,hasMore:!!g,actioning:M,openCommitHash:P,onToggleMenu:re=>ve(I=>I===re?null:re),onCopyCommitHash:re=>void mn(re,h("git.copyCommitHashSuccess")),onCopyCommitSubject:re=>void mn(re,h("git.copyCommitSubjectSuccess")),onUndoLastCommit:()=>void xe(),onLoadMore:()=>void Rt()})]})]}):i.jsxs("div",{ref:Tt,className:"git-content-split",style:{gridTemplateRows:Pn},children:[i.jsx("section",{className:"git-card git-tree-panel",children:i.jsxs("div",{ref:qe,className:"git-tree-panel-body",children:[be.length>0?i.jsx(zw,{title:h("git.stagedChangesTitle"),count:be.length,nodes:Pe,selectedPath:T,collapsedTreePathSet:ot,onToggleTreePath:Ve,onSelectFile:_,onToggleMobileSelection:Qe,onStageToggle:Mt,onDiscard:Vt,actioning:M,variant:"staged",isMobileViewport:te,selectedMobilePathSet:Pt,selectedTargets:Ot,mobileActionMenuOpen:ue==="staged",onToggleMobileActionMenu:()=>A(re=>re==="staged"?null:"staged"),onClearSelectedTargets:()=>K(re=>re.filter(I=>!Ot.includes(I)))}):null,i.jsx(zw,{title:h("git.changesTitle"),count:W.length,nodes:nt,selectedPath:T,collapsedTreePathSet:ot,onToggleTreePath:Ve,onSelectFile:_,onToggleMobileSelection:Qe,onStageToggle:Mt,onDiscard:Vt,actioning:M,variant:"unstaged",isMobileViewport:te,selectedMobilePathSet:Pt,selectedTargets:St,mobileActionMenuOpen:ue==="unstaged",onToggleMobileActionMenu:()=>A(re=>re==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>K(re=>re.filter(I=>!St.includes(I)))})]})}),i.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":h("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Dw,"aria-valuemax":kh,"aria-valuenow":H?vn:kh,"data-dragging":We,onPointerDown:At,children:i.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),i.jsxs("section",{className:"git-card git-history-section",children:[i.jsxs("div",{className:"git-history-topbar",children:[i.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":H,"aria-label":h(H?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>ee(re=>!re),children:[i.jsxs("span",{className:"git-section-toggle-main",children:[i.jsx(Kc,{expanded:H}),i.jsx("span",{children:h("git.recentVersionsTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:p})]}),i.jsxs("div",{className:"git-history-actions",children:[i.jsx("span",{className:"badge",children:nn}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:()=>ae(re=>!re),disabled:M,children:i.jsx(Ac,{})}),ne?Ln():null]})]}),H?i.jsx("div",{className:"git-history-list",onScroll:zt,children:d.length?i.jsxs(i.Fragment,{children:[d.map(re=>i.jsxs("article",{className:"git-history-entry","data-kind":re.commitKind,children:[i.jsx("span",{className:"git-history-marker","data-kind":re.commitKind,"aria-hidden":"true"}),i.jsxs("div",{className:"git-history-body",children:[i.jsxs("div",{className:"git-history-title-row",children:[i.jsx("strong",{title:re.subject,children:re.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":re.commitKind,children:eC(re.commitKind)})]}),re.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:re.refs.map(I=>i.jsx("span",{className:"git-history-ref-pill","data-kind":I.kind,"data-remote-index":String(tC(I.remoteName)),children:I.name},`${re.commitHash}:${I.kind}:${I.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:re.commitHash.slice(0,8)}),i.jsx("span",{children:re.authorName}),i.jsx("time",{dateTime:re.authoredAt,children:nC(re.authoredAt)})]})]})]},re.commitHash)),b?i.jsxs("p",{className:"git-history-loading",children:[h("git.refreshNow"),"..."]}):null]}):i.jsx("p",{className:"status-text",children:h("git.noHistory")})}):null]})]})]})}function zw({title:e,count:t,nodes:n,selectedPath:s,collapsedTreePathSet:o,onToggleTreePath:c,onSelectFile:l,onToggleMobileSelection:d,onStageToggle:m,onDiscard:p,actioning:y,variant:g,isMobileViewport:x,selectedMobilePathSet:b,selectedTargets:C,mobileActionMenuOpen:S,onToggleMobileActionMenu:N,onClearSelectedTargets:T}){const _=mm(n),R=h(g==="staged"?"git.unstageAll":"git.stageAll");return i.jsxs("section",{className:"git-tree-group","data-variant":g,children:[i.jsxs("div",{className:"git-section-header git-tree-group-header",children:[i.jsx("h3",{children:e}),i.jsxs("div",{className:"git-tree-group-actions",children:[i.jsx("span",{className:"workbench-section-counter",children:t}),!x&&_.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":R,title:R,onClick:()=>void m(_,g==="staged"),disabled:y,children:i.jsx(cf,{staged:g==="staged"})}),g==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":h("git.discardAll"),title:h("git.discardAll"),onClick:()=>void p(_),disabled:y,children:i.jsx(uf,{})}):null]}):null,x&&C.length>0?i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:N,disabled:y,children:i.jsx(Ac,{})}):null]}),x&&S?i.jsxs("div",{className:"git-selection-menu",children:[i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.selectedFiles")}),i.jsx("strong",{className:"git-menu-branch",children:C.length})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:y,onClick:()=>void m(C,g==="staged"),children:i.jsx("span",{children:h(g==="staged"?"git.unstage":"git.stage")})}),g==="unstaged"?i.jsx("button",{className:"git-menu-item",type:"button",disabled:y,onClick:()=>void p(C),children:i.jsx("span",{children:h("git.discard")})}):null,i.jsx("button",{className:"git-menu-item",type:"button",disabled:y,onClick:T,children:i.jsx("span",{children:h("git.clearSelection")})})]})]}):null]}),i.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":e,children:n.length?YS({nodes:n,depth:0,collapsedTreePathSet:o,selectedPath:s,onToggleTreePath:c,onSelectFile:l,onToggleMobileSelection:d,onStageToggle:m,onDiscard:p,actioning:y,variant:g,isMobileViewport:x,selectedMobilePathSet:b}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function Sh({title:e,count:t,expanded:n,onToggle:s,trailingContent:o,headerAction:c,children:l}){return i.jsxs("section",{className:"git-mobile-section","data-expanded":n,children:[i.jsxs("div",{className:"git-mobile-section-header",children:[i.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":n,onClick:s,children:[i.jsxs("span",{className:"git-mobile-section-toggle-main",children:[i.jsx(Kc,{expanded:n}),i.jsx("h3",{children:e})]}),i.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[o,i.jsx("span",{className:"workbench-section-counter",children:t})]})]}),c?i.jsx("div",{className:"git-mobile-section-header-action",children:c}):null]}),n?i.jsx("div",{className:"git-mobile-section-body",children:l}):null]})}function Ww({title:e,nodes:t,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,selectedTargets:l,actioning:d,variant:m,swipeRowState:p,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:x,onClearSelectedTargets:b}){return i.jsxs("div",{className:"git-mobile-record-shell",children:[l.length>0?i.jsxs("div",{className:"git-mobile-selection-toolbar",children:[i.jsxs("span",{className:"git-mobile-selection-count",children:[h("git.selectedFiles")," ",l.length]}),i.jsxs("div",{className:"git-mobile-selection-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>void g(l,m==="staged"),children:h(m==="staged"?"git.unstage":"git.stage")}),m==="unstaged"?i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:d,onClick:()=>void x(l,`${l.length}`),children:h("git.discard")}):null,i.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:b,children:h("git.clearSelection")})]})]}):null,i.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?QS({nodes:t,depth:0,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,actioning:d,variant:m,swipeRowState:p,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:x}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function QS({nodes:e,depth:t,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,actioning:l,variant:d,swipeRowState:m,onSwipeRowChange:p,onStageToggle:y,onDiscardWithConfirm:g}){return e.map(x=>{if(x.kind==="directory"){const S=!n.has(x.path),N=mm(x.children),T=`directory:${x.path}`;return i.jsxs("div",{className:"git-mobile-record-branch",children:[i.jsx(Hw,{rowKey:T,openState:(m==null?void 0:m.path)===T?m.direction:null,onOpenStateChange:_=>p(_?{path:T,direction:_}:null),leadingAction:N.length>0?{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y(N,d==="staged")}:null,trailingAction:d==="unstaged"&&N.length>0?{label:h("git.discard"),tone:"danger",onPress:()=>void g(N,x.path)}:null,children:i.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${Bw+t*Uw}px`},onClick:()=>s(x.path),children:[i.jsxs("span",{className:"git-mobile-record-leading",children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":S,children:i.jsx(Kc,{expanded:S})}),i.jsx("span",{className:"git-mobile-record-title",children:x.name})]}),i.jsx("span",{className:"git-mobile-record-meta",children:N.length})]})}),S?i.jsx("div",{className:"git-mobile-record-children",role:"group",children:QS({nodes:x.children,depth:t+1,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,actioning:l,variant:d,swipeRowState:m,onSwipeRowChange:p,onStageToggle:y,onDiscardWithConfirm:g})}):null]},T)}const b=`file:${x.path}`,C=c.has(x.path);return i.jsx(Hw,{rowKey:b,openState:(m==null?void 0:m.path)===b?m.direction:null,onOpenStateChange:S=>p(S?{path:b,direction:S}:null),leadingAction:{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y([x.change.path],d==="staged")},trailingAction:d==="unstaged"?{label:h("git.discard"),tone:"danger",onPress:()=>void g([x.change.path],x.path)}:null,children:i.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":C,style:{paddingInlineStart:`${Bw+t*Uw}px`},children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${x.name}`,onChange:()=>o(x.change.path)}),i.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>o(x.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(x.name),"aria-hidden":"true",children:xs(x.name)}),i.jsxs("span",{className:"git-mobile-record-copy",children:[i.jsx("span",{className:"git-mobile-record-title",children:x.name}),i.jsx("span",{className:"git-mobile-record-path",children:x.path})]}),i.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})]})]})},b)})}function Hw({rowKey:e,openState:t,onOpenStateChange:n,leadingAction:s,trailingAction:o,children:c}){const l=Or(),d=w.useRef(null),[m,p]=w.useState(0);w.useEffect(()=>{t||p(0)},[t,e]);const y=m!==0?m:t==="leading"?78:t==="trailing"?-78:0;function g(S){var N,T;S.button===0&&(d.current={pointerId:S.pointerId,startX:S.clientX},(T=(N=S.currentTarget).setPointerCapture)==null||T.call(N,S.pointerId))}function x(S){const N=d.current;if(!N||N.pointerId!==S.pointerId)return;const T=s?88:0,R=Math.max(-(o?88:0),Math.min(T,S.clientX-N.startX));p(R)}function b(S){var T,_;const N=d.current;if(!(!N||N.pointerId!==S.pointerId)){if((_=(T=S.currentTarget).releasePointerCapture)==null||_.call(T,S.pointerId),d.current=null,m>=44&&s){l.trigger("gesture"),n("leading"),p(0);return}if(m<=-44&&o){l.trigger("gesture"),n("trailing"),p(0);return}n(null),p(0)}}function C(S){var T,_;const N=d.current;!N||N.pointerId!==S.pointerId||((_=(T=S.currentTarget).releasePointerCapture)==null||_.call(T,S.pointerId),d.current=null,p(0))}return i.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":t??"closed","data-dragging":m!==0,children:[s?i.jsx("button",{type:"button",className:"git-mobile-swipe-action leading","data-tone":s.tone,onClick:()=>{l.trigger("action"),n(null),s.onPress()},children:s.label}):null,o?i.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":o.tone,onClick:()=>{l.trigger(o.tone==="danger"?"warning":"action"),n(null),o.onPress()},children:o.label}):null,i.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${y}px)`},onPointerDown:g,onPointerMove:x,onPointerUp:b,onPointerCancel:C,children:c})]})}function ZO({history:e,historyLoadingMore:t,hasMore:n,actioning:s,openCommitHash:o,onToggleMenu:c,onCopyCommitHash:l,onCopyCommitSubject:d,onUndoLastCommit:m,onLoadMore:p}){return e.length?i.jsxs("div",{className:"git-mobile-history-list",children:[e.map((y,g)=>{const x=o===y.commitHash,b=g===0&&y.commitKind==="local";return i.jsxs("article",{className:"git-mobile-history-entry","data-kind":y.commitKind,children:[i.jsxs("div",{className:"git-mobile-history-entry-main",children:[i.jsx("span",{className:"git-history-marker","data-kind":y.commitKind,"aria-hidden":"true"}),i.jsxs("div",{className:"git-mobile-history-copy",children:[i.jsxs("div",{className:"git-history-title-row",children:[i.jsx("strong",{title:y.subject,children:y.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":y.commitKind,children:eC(y.commitKind)})]}),y.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:y.refs.map(C=>i.jsx("span",{className:"git-history-ref-pill","data-kind":C.kind,"data-remote-index":String(tC(C.remoteName)),children:C.name},`${y.commitHash}:${C.kind}:${C.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:y.commitHash.slice(0,8)}),i.jsx("span",{children:y.authorName}),i.jsx("time",{dateTime:y.authoredAt,children:nC(y.authoredAt)})]})]}),i.jsx("button",{type:"button",className:"git-icon-button","aria-label":h("git.historyItemMenu"),onClick:()=>c(y.commitHash),children:i.jsx(Ac,{})})]}),x?i.jsxs("div",{className:"git-mobile-history-menu",children:[i.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>l(y.commitHash),children:i.jsx("span",{children:h("git.copyCommitHash")})}),i.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(y.subject),children:i.jsx("span",{children:h("git.copyCommitSubject")})}),b?i.jsx("button",{type:"button",className:"git-menu-item",disabled:s,onClick:m,children:i.jsx("span",{children:h("git.undoLastCommit")})}):null]}):null]},y.commitHash)}),n?i.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:p,children:t?`${h("git.refreshNow")}...`:h("common.loadMore")}):null]}):i.jsx("p",{className:"git-tree-status",children:h("git.noHistory")})}function YS({nodes:e,depth:t,collapsedTreePathSet:n,selectedPath:s,onToggleTreePath:o,onSelectFile:c,onToggleMobileSelection:l,onStageToggle:d,onDiscard:m,actioning:p,variant:y,isMobileViewport:g,selectedMobilePathSet:x}){return e.map(b=>{if(b.kind==="directory"){const N=!n.has(b.path),T=mm(b.children),_=`${h(y==="staged"?"git.unstage":"git.stage")} ${b.path}`,R=`${h("git.discard")} ${b.path}`;return i.jsxs("div",{className:"git-tree-node",children:[i.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":N,children:[i.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+t*8}px`},onClick:()=>o(b.path),children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":N,children:i.jsx(Kc,{expanded:N})}),i.jsx("span",{className:"git-tree-label git-tree-label-directory",children:b.name})]}),!g&&T.length>0?i.jsxs("div",{className:"git-row-actions",children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":_,title:_,onClick:()=>void d(T,y==="staged"),disabled:p,children:i.jsx(cf,{staged:y==="staged"})}),y==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":R,title:R,onClick:()=>void m(T),disabled:p,children:i.jsx(uf,{})}):null]}):null]}),N?i.jsx("div",{className:"git-tree-children",role:"group",children:YS({nodes:b.children,depth:t+1,collapsedTreePathSet:n,selectedPath:s,onToggleTreePath:o,onSelectFile:c,onToggleMobileSelection:l,onStageToggle:d,onDiscard:m,actioning:p,variant:y,isMobileViewport:g,selectedMobilePathSet:x})}):null]},`directory:${b.path}`)}const C=x.has(b.path),S=g?C:s===b.path;return g?i.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":S,"data-mobile":"true",children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${b.name}`,onChange:()=>l(b.change.path)}),i.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":S,"data-mobile":"true",style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>l(b.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(b.name),"aria-hidden":"true",children:xs(b.name)}),i.jsx("span",{className:"git-tree-label-wrap",children:i.jsx("span",{className:"git-tree-label",children:b.name})}),i.jsx("span",{className:"git-tree-file-meta",children:i.jsx("span",{className:"git-status-badge","data-status":b.status,children:b.status})})]})]},`file:${b.path}`):i.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":S,children:[i.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":S,style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>c(b.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(b.name),"aria-hidden":"true",children:xs(b.name)}),i.jsx("span",{className:"git-tree-label-wrap",children:i.jsx("span",{className:"git-tree-label",children:b.name})}),i.jsx("span",{className:"git-tree-file-meta",children:i.jsx("span",{className:"git-status-badge","data-status":b.status,children:b.status})})]}),i.jsxs("div",{className:"git-row-actions",children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":b.variant==="staged"?h("git.unstage"):h("git.stage"),title:b.variant==="staged"?h("git.unstage"):h("git.stage"),onClick:()=>void d([b.change.path],b.variant==="staged"),disabled:p,children:i.jsx(cf,{staged:b.variant==="staged"})}),y==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":h("git.discard"),title:h("git.discard"),onClick:()=>void m([b.change.path]),disabled:p,children:i.jsx(uf,{})}):null]})]},`file:${b.path}`)})}function $w(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function qw(e,t){const n=$w("","");for(const s of e){const o=s.path.replace(/\\/g,"/"),c=o.split("/").filter(Boolean);let l=n;c.forEach((d,m)=>{const p=c.slice(0,m+1).join("/");if(m===c.length-1){l.children.set(`file:${p}`,{kind:"file",name:d,path:o,change:s,status:eB(s,t),variant:t});return}const y=`directory:${p}`,g=l.children.get(y);if(g&&g.kind==="directory"){l=g;return}const x=$w(d,p);l.children.set(y,x),l=x})}return JS(XS([...n.children.values()]))}function XS(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:XS([...t.children.values()])}:t)}function JS(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=JS(t.children);let s=t.name,o=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const d=c[0];s=`${s}/${d.name}`,o=d.path,c=d.children}return{kind:"directory",name:s,path:o,children:c}})}function Vw(e,t,n){const s=new Set(e);return t.filter(o=>lf(o,n)&&s.has(o.path)).map(o=>o.path)}function mm(e){const t=[],n=new Set;function s(o){if(o.kind==="file"){n.has(o.path)||(n.add(o.path),t.push(o.path));return}o.children.forEach(s)}return e.forEach(s),t}function lf(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function eB(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function tB(e){return{subject:ZS(e).trim(),body:null,footer:null,source:"manual"}}function ZS(e){return e.replace(/[\r\n]+/g," ")}function nB(e){if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,34),120);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>120?"auto":"hidden"}function eC(e){switch(e){case"local":return h("git.historyKindLocal");case"remote":return h("git.historyKindRemote");default:return h("git.historyKindShared")}}function tC(e){if(!e)return 0;let t=0;for(const n of e)t=t*33+n.charCodeAt(0)>>>0;return t%6}function ti(e,t){return e instanceof qn?rB(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function Ch(e){return`git-sidebar.snapshot.${e}`}function rB(e){switch(e.errorCode){case"UNAUTHORIZED":return h("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return h("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return h("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return h("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return h("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return h("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return h("git.errors.invalidTarget");case"NOT_STAGED":return h("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return h("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return h("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return h("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return h("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return h("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return h("git.errors.pushFailed");case"GIT_PULL_FAILED":return h("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return h("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return h("git.errors.commandTimeout");case"GIT_DISCARD_FAILED":return h("git.discardFailed");case"GIT_UNDO_FAILED":return h("git.undoLastCommitFailed");default:return null}}function Kc({expanded:e}){return i.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})}function cf({staged:e}){return e?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"M5 12h14"})}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}function uf(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[i.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function iB(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function Ac(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function nC(e){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return e}}const sB=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:KS},Symbol.toStringTag,{value:"Module"})),rC="mobile.tools.last-primary-tool",vc=["files","git"],aB=56,oB=1.2;function Gw(e,t){return e==="git"?"git":e==="files"?"files":t}function lB(e,t,n){if(!t)return e;const s=n.x-t.x,o=n.y-t.y;if(Math.abs(s)<aB||Math.abs(s)<Math.abs(o)*oB)return e;const c=vc.indexOf(e),l=s<0?Math.min(vc.length-1,c+1):Math.max(0,c-1);return vc[l]??e}function cB(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(rC)==="git"?"git":"files"}catch{return"files"}}function uB(){var R,G;const e=Yr(),t=An(),n=Or(),{navigationGroups:s,currentWorkspaceId:o,currentSessionId:c,selectWorkspace:l}=cr(),d=((R=s.find(q=>q.workspace.id===o))==null?void 0:R.workspace)??((G=s[0])==null?void 0:G.workspace)??null,m=new URLSearchParams(e.search).get("tab"),p=w.useRef(cB()),y=Gw(m,p.current),[g,x]=w.useState(()=>{const q=Gw(m,p.current);return{files:q==="files",git:q==="git"}}),b=w.useRef(null),C=w.useMemo(()=>[{key:"files",title:h("shell.filesEntry"),render:()=>i.jsx(HS,{sessionId:c,workspaceId:o,hideHeading:!0})},{key:"git",title:h("shell.gitEntry"),render:()=>i.jsx(KS,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:o})}],[c,o]),S=vc.indexOf(y);w.useEffect(()=>{x(q=>({...q,[y]:!0}))},[y]),w.useEffect(()=>{if(p.current=y,!(typeof window>"u"))try{window.localStorage.setItem(rC,y)}catch{}},[y]),w.useEffect(()=>{if(m===y)return;const q=new URLSearchParams(e.search);q.set("tab",y),t({pathname:e.pathname,search:`?${q.toString()}`},{replace:!0})},[y,e.pathname,e.search,t,m]);function N(q,F="selection"){if(q===y)return;n.trigger(F);const M=new URLSearchParams(e.search);M.set("tab",q),t({pathname:e.pathname,search:`?${M.toString()}`},{replace:!0})}function T(q){if(q.changedTouches.length!==1){b.current=null;return}const F=q.changedTouches[0];b.current={x:F.clientX,y:F.clientY}}function _(q){const F=b.current;if(b.current=null,q.changedTouches.length!==1)return;const M=q.changedTouches[0],D=lB(y,F,{x:M.clientX,y:M.clientY});D!==y&&N(D)}return i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tools-workspace-page",children:d?i.jsxs(i.Fragment,{children:[i.jsx(pa,{currentWorkspace:d,workspaces:s.map(q=>q.workspace),onSelectWorkspace:q=>{l(q),t(ha(q,y))},trailing:i.jsx("button",{type:"button",className:"secondary-button mobile-tools-more-button","aria-label":h("shell.toolsMoreAction"),title:h("shell.toolsMoreAction"),onClick:()=>{n.trigger("action"),t($c(d.id))},children:i.jsx(dB,{})}),content:i.jsx("div",{className:"mobile-tools-switcher","aria-label":h("shell.mobileToolsEntry"),children:i.jsx("div",{className:"mobile-tools-segmented-control",role:"tablist","aria-label":h("shell.mobileToolsEntry"),children:C.map(q=>{const F=q.key===y;return i.jsx("button",{type:"button",role:"tab",className:"mobile-tools-segmented-button","data-active":F,"aria-selected":F,"aria-controls":`mobile-tool-panel-${q.key}`,onClick:()=>N(q.key,"selection"),children:q.title},q.key)})})})}),i.jsx("section",{className:"mobile-tools-stage","data-active-tool":y,"data-testid":"mobile-tools-stage",onTouchStart:T,onTouchEnd:_,onTouchCancel:()=>{b.current=null},children:i.jsx("div",{className:"mobile-tools-stage-viewport",children:i.jsx("div",{className:"mobile-tools-stage-track",style:{transform:`translateX(-${S*100}%)`},children:C.map(q=>i.jsx("article",{id:`mobile-tool-panel-${q.key}`,role:"tabpanel","aria-label":q.title,"aria-hidden":q.key!==y,className:"mobile-tools-stage-panel",children:i.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[q.key]?q.render():null})},q.key))})})})]}):i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})})})}function dB(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function hB(e){return e.isArchived!==!0&&e.isSubagent!==!0}function iC(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function fB(e){return e.activityState==="idle"&&iC(e)===!1}function Kw(e){return e==="creating"||e==="running"}function Lc(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function mB(e,t){return Lc(t).localeCompare(Lc(e))}function Qw(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"shell.providerClaudeCode")}function Yw(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}const oc=60*1e3;function pB(){const e=An(),{navigationGroups:t,currentWorkspaceId:n,refreshNavigation:s,selectWorkspace:o,startDraftSession:c,subscribeGitSnapshot:l,requestGitRefresh:d,addGitSnapshotListener:m,subscribeTerminalManagerSnapshot:p,requestTerminalManagerRefresh:y,addTerminalManagerSnapshotListener:g}=cr(),[x,b]=w.useState(null),[C,S]=w.useState(!1),[N,T]=w.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),_=t.find(P=>P.workspace.id===n)??t[0]??null,R=(_==null?void 0:_.workspace)??null,G=[...(_==null?void 0:_.sessions)??[]].filter(hB).sort(mB),q=G.filter(iC),F=G.filter(fB),M=G.filter(P=>P.activityState==="completed_unread"),D=G.filter(P=>P.isFavorite===!0),U=q.slice(0,6),E=D.slice(0,6);w.useEffect(()=>{const P=(R==null?void 0:R.id)??null;if(!P){T({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const ve=Cn(jh(P),oc);T(je=>{var Se,De;return{...je,gitLoading:ve===null,branch:((Se=ve==null?void 0:ve.status)==null?void 0:Se.snapshot.branch)??null,changedFileCount:((De=ve==null?void 0:ve.status)==null?void 0:De.changes.length)??null}})},[R==null?void 0:R.id]),w.useEffect(()=>{const P=(R==null?void 0:R.id)??null;if(P)return m(ve=>{ve.workspaceId===P&&(xr(jh(P),ve),T(je=>{var Se,De,Re;return{...je,gitLoading:!1,branch:((Se=ve.status)==null?void 0:Se.snapshot.branch)??((De=ve.branches)==null?void 0:De.currentBranch)??null,changedFileCount:((Re=ve.status)==null?void 0:Re.changes.length)??null}}))})},[m,R==null?void 0:R.id]),w.useEffect(()=>{const P=(R==null?void 0:R.id)??null;if(!P){T(je=>({...je,gitLoading:!1,branch:null,changedFileCount:null}));return}const ve=Cn(Nh(P),oc);T(je=>({...je,terminalLoading:ve===null,activeTerminalCount:ve?ve.terminals.filter(Se=>Kw(Se.status)).length:null,quickLaunchRunning:ve?ve.templateStatuses.some(Se=>Se.occupied):null}))},[R==null?void 0:R.id]),w.useEffect(()=>{const P=(R==null?void 0:R.id)??null;if(!P){T(ve=>({...ve,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return g(ve=>{ve.workspaceId===P&&(xr(Nh(P),{terminals:ve.terminals,templates:ve.templates,templateStatuses:ve.templateStatuses}),T(je=>({...je,terminalLoading:!1,activeTerminalCount:ve.terminals.filter(Se=>Kw(Se.status)).length,quickLaunchRunning:ve.templateStatuses.some(Se=>Se.occupied)})))})},[g,R==null?void 0:R.id]),w.useEffect(()=>{const P=(R==null?void 0:R.id)??null;if(!P)return;const ve=Cn(jh(P),oc)!==null;l(P),!ve&&d(P)},[R==null?void 0:R.id,d,l]),w.useEffect(()=>{const P=(R==null?void 0:R.id)??null;if(!P)return;const ve=Cn(Nh(P),oc)!==null;p(P),!ve&&y(P)},[R==null?void 0:R.id,y,p]);async function H(P){await s(),o(P.id),b(null),e(ii(P.id))}async function ee(P){await s(),o(P.id),b(null),e(ii(P.id))}function ne(){R&&(o(R.id),e(ha(R.id,"git")))}function ae(){R&&(o(R.id),e(ia(R.id)))}function te(){R&&(o(R.id),e($c(R.id)))}function ye(){R&&e(_o(R.id))}function J(){R&&S(!0)}function K(P,ve){S(!1),c(P,ve)}function ue(){R&&(o(R.id),e(ii(R.id)))}function A(P){o(P)}const z=[{label:h("shell.workspaceHomeMetricActive"),value:q.length,onClick:G.length>0?ye:void 0},{label:h("shell.workspaceHomeMetricUnread"),value:M.length,onClick:G.length>0?ye:void 0},{label:h("shell.workspaceHomeMetricTerminal"),value:N.terminalLoading?"…":N.activeTerminalCount??"—",onClick:R?ae:void 0},{label:h("shell.workspaceHomeMetricChanges"),value:N.gitLoading?"…":N.changedFileCount??"—",onClick:R?ne:void 0}],le=[{label:h("shell.workspaceHomeQuickLaunchStatusLabel"),value:N.quickLaunchRunning===null?"…":N.quickLaunchRunning?h("shell.workspaceHomeQuickLaunchRunning"):h("shell.workspaceHomeQuickLaunchStopped"),onClick:R?te:void 0},{label:h("shell.workspaceHomeWaitingInputLabel"),value:F.length,onClick:G.length>0?ye:void 0}];return i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[R?i.jsxs(i.Fragment,{children:[i.jsx(pa,{currentWorkspace:R,workspaces:t.map(P=>P.workspace),onSelectWorkspace:A,sheetContent:P=>i.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{P(),b("import")},children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.importWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{P(),b("clone")},children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.cloneWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]})]})}),i.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":h("shell.workspaceHomeStatusSectionTitle"),children:i.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:z.map(P=>P.onClick?i.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric",onClick:P.onClick,children:[i.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:P.value}),i.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:P.label})]},P.label):i.jsxs("div",{className:"mobile-workspace-home-toolbar-metric",role:"listitem",children:[i.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:P.value}),i.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:P.label})]},P.label))})})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:ue,children:h("shell.workspaceDetailTitle")}),i.jsx("button",{type:"button",className:"primary-button",onClick:J,children:h("shell.createSession")})]})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-group",children:le.map(P=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:P.onClick,children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:P.label}),i.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[i.jsx("strong",{children:P.value}),i.jsx(Di,{})]})]},P.label))})}),i.jsxs("section",{className:"mobile-workspace-home-section",children:[i.jsxs("div",{className:"mobile-workspace-home-section-header",children:[i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.workspaceHomeActiveSessionsSectionTitle")}),R?i.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:ye,children:h("shell.workspaceHomeViewAllAction")}):null]}),i.jsx("div",{className:"mobile-workspace-home-group",children:U.length===0?i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:J,children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:h("shell.createSession")}),i.jsx("span",{className:"mobile-workspace-home-session-meta",children:R.name})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]}):U.map(P=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Gn(R.id,P.sessionId)),children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:P.title||h("common.unknown")}),i.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Qw(P.provider)," · ",Yw(Lc(P))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]},P.sessionId))})]}),E.length>0?i.jsxs("section",{className:"mobile-workspace-home-section",children:[i.jsx("div",{className:"mobile-workspace-home-section-header",children:i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.favoriteSectionTitle")})}),i.jsx("div",{className:"mobile-workspace-home-group",children:E.map(P=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Gn(R.id,P.sessionId)),children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:P.title||h("common.unknown")}),i.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Qw(P.provider)," · ",Yw(Lc(P))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]},P.sessionId))})]}):null]})]}):i.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:i.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.workspaceHomeSwitcherTitle")}),i.jsxs("div",{className:"mobile-workspace-home-group",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("import"),children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.importWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("clone"),children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.cloneWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]})]})]})}),i.jsx(Jk,{open:x==="import",onClose:()=>b(null),onImported:H}),i.jsx(Xk,{open:x==="clone",onClose:()=>b(null),onCloned:ee}),i.jsx(cm,{open:C,workspaces:t.map(P=>P.workspace),initialWorkspaceId:(R==null?void 0:R.id)??n??null,onClose:()=>S(!1),onSelect:K})]})}function jh(e){return`git-sidebar.snapshot.${e}`}function Nh(e){return`terminal-manager.snapshot.${e}`}function Di(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Xw(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function gB(e){return e.isArchived!==!0&&e.isSubagent!==!0}function yB(e){return e.isArchived===!0&&e.isSubagent!==!0}function Jw(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt??""}function Zw(e,t){return Jw(t).localeCompare(Jw(e))}const Th=60*1e3,Ph=10;function vB(){var ye;const{workspaceId:e=""}=xf(),t=An(),{showToast:n}=Qn(),{navigationGroups:s,currentWorkspaceId:o,favoriteSessionIds:c,workspaceManagementStateById:l,selectWorkspace:d,subscribeGitSnapshot:m,requestGitRefresh:p,subscribeWorkspaceManagementSnapshot:y,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:x,archiveSession:b,unarchiveSession:C,startDraftSession:S}=cr(),[N,T]=w.useState(!1),[_,R]=w.useState(!1),[G,q]=w.useState(Ph),F=s.find(J=>J.workspace.id===e)??null,M=(F==null?void 0:F.workspace)??null,D=w.useMemo(()=>[...(F==null?void 0:F.sessions)??[]].filter(gB).sort(Zw),[F]),U=w.useMemo(()=>[...(F==null?void 0:F.sessions)??[]].filter(yB).sort(Zw),[F]);w.useEffect(()=>{e&&d(e)},[d,e]),w.useEffect(()=>{if(!e)return;m(e),y(e);const J=Cn(xB(e),Th)!==null,K=Cn(eb(e),Th)!==null;J||p(e),K||g(e)},[p,g,m,y,e]),w.useEffect(()=>{q(Ph)},[e]);const E=w.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const J=Cn(eb(e),Th),K=l[e]??null,ue=(K==null?void 0:K.detail)??(M?kB(M,J):J??null);return{loading:(K==null?void 0:K.loading)??!1,error:(K==null?void 0:K.error)??null,hasMeaningfulSummary:SB(ue),summary:ue}},[M,e,l]),H=w.useMemo(()=>E.summary?Kk(E.summary.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],[E.summary]),ee=w.useMemo(()=>H.length>0?Qk(H):void 0,[H]),ne=w.useMemo(()=>U.slice(0,G),[U,G]);async function ae(){if(!(!M||!(typeof window>"u"||window.confirm(h("shell.manageWorkspaceRemoveConfirmTarget",{name:M.name}))))){T(!0);try{await ox(M.id),n({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(K){n({title:K instanceof Error?K.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{T(!1)}}}function te(J,K){R(!1),S(J,K)}return M?i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[i.jsx(pa,{currentWorkspace:M,workspaces:s.map(J=>J.workspace),heading:h("shell.workspaceDetailTitle"),triggerLabel:M.name,onSelectWorkspace:J=>{d(J),t(ii(J))},content:i.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[i.jsx("button",{type:"button",className:"primary-button",onClick:()=>R(!0),children:h("shell.createSession")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(Dk(M.id))},children:h("shell.filesEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(ia(M.id))},children:h("shell.terminalsEntry")})]})}),i.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[i.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.workspaceDetailSummaryTitle")})}),o!==M.id?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(M.id),children:h("shell.switchWorkspace")}):null]}),E.loading&&E.summary===null?i.jsx("p",{children:h("common.loading")}):null,E.error?i.jsx("p",{className:"status-text","data-tone":"error",children:E.error}):null,E.summary?i.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[i.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[i.jsx("span",{children:h("shell.manageWorkspacePathLabel")}),i.jsx("strong",{title:E.summary.path,children:E.summary.path})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("strong",{title:E.summary.git.currentBranch??h("common.unknown"),children:E.summary.git.currentBranch??h("common.unknown")})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceGitCommitCount")}),i.jsx("strong",{children:E.hasMeaningfulSummary?E.summary.git.commitCount??0:"—"})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceCodeCompositionFiles")}),i.jsx("strong",{children:E.hasMeaningfulSummary?E.summary.codeComposition.scannedFileCount:"—"})]})]}):null,i.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(_k(M.id))},children:h("shell.gitEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t($c(M.id))},children:h("shell.terminalManagerEntry")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:N,onClick:()=>{ae()},children:h(N?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),i.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.manageWorkspaceCodeCompositionLabel")})}),E.summary?i.jsx("span",{className:"mobile-feature-counter",children:E.summary.codeComposition.scannedFileCount}):null]}),E.loading&&E.summary===null?i.jsx("p",{children:h("common.loading")}):null,E.summary?H.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:ee,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:E.summary.codeComposition.scannedFileCount}),i.jsx("span",{className:"workbench-manage-type-chart-caption",children:h("shell.manageWorkspaceCodeCompositionFiles")})]}),i.jsx("div",{className:"workbench-manage-type-list",children:H.map(J=>i.jsxs("div",{className:"workbench-manage-type-item",children:[i.jsxs("span",{className:"workbench-manage-type-meta",children:[i.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:J.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:J.type})]}),i.jsxs("span",{children:[J.count," · ",Gk(J)]})]},J.key))})]}):i.jsx("p",{children:E.summary.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}):null,(ye=E.summary)!=null&&ye.codeComposition.truncated?i.jsx("p",{className:"mobile-workspace-composition-note",children:h("shell.manageWorkspaceCodeTruncated",{count:E.summary.codeComposition.scannedFileCount})}):null]}),i.jsxs("section",{className:"mobile-feature-section",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.recentSessionsSectionTitle")})}),i.jsx("span",{className:"mobile-feature-counter",children:D.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:D.length===0?i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyWorkspaceSessions")})}):D.map(J=>{const K=$i(J.title,h("common.unknown")),ue=c.includes(J.sessionId);return i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Gn(M.id,J.sessionId)),children:[i.jsx("span",{className:"mobile-session-row-title",title:K.fullTitle,children:K.displayTitle}),i.jsx("span",{className:"mobile-session-row-provider",children:Xw(J.provider)})]}),i.jsxs("div",{className:"mobile-session-row-actions",children:[i.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:J.messageCount}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h(ue?"shell.unfavoriteAction":"shell.favoriteAction"),title:h(ue?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{x(J.sessionId)},children:i.jsx(wB,{active:ue})}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h("shell.archiveAction"),title:h("shell.archiveAction"),onClick:()=>{b(J.sessionId)},children:i.jsx(bB,{})})]})]},J.sessionId)})})]}),U.length>0?i.jsxs("section",{className:"mobile-feature-section",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.archiveModalTitle")})}),i.jsx("span",{className:"mobile-feature-counter",children:U.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:ne.map(J=>i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[i.jsx("span",{className:"mobile-session-row-title",title:J.title,children:J.title}),i.jsx("span",{className:"mobile-session-row-provider",children:Xw(J.provider)})]}),i.jsx("div",{className:"mobile-session-row-actions",children:i.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{C(J.sessionId)},children:h("shell.unarchiveAction")})})]},J.sessionId))}),ne.length<U.length?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{q(J=>J+Ph)},children:h("shell.archiveExpandMore")}):null]}):null]}),i.jsx(cm,{open:_,workspaces:s.map(J=>J.workspace),initialWorkspaceId:o??M.id,onClose:()=>R(!1),onSelect:te})]}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.workspaceDetailMissingTitle")}),i.jsx("p",{children:h("shell.workspaceDetailMissingBody")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t("/workspaces"),children:h("shell.mobileWorkspacesEntry")})]})})}function wB({active:e}){return i.jsx("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:i.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function bB(){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M4 7.5h16"}),i.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),i.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),i.jsx("path",{d:"M10 11.5h4"})]})}function eb(e){return`workspace-management.summary.${e}`}function xB(e){return`git-sidebar.snapshot.${e}`}function kB(e,t){const n=(t==null?void 0:t.git.repoRoot)??e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:(t==null?void 0:t.git.isRepository)??!!n,repoRoot:n,currentBranch:(t==null?void 0:t.git.currentBranch)??null,commitCount:(t==null?void 0:t.git.commitCount)??null,remotes:(t==null?void 0:t.git.remotes)??[],error:(t==null?void 0:t.git.error)??null},codeComposition:(t==null?void 0:t.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function SB(e){return e?e.git.isRepository||e.git.repoRoot!==null||e.git.currentBranch!==null||e.git.commitCount!==null||e.git.remotes.length>0||e.codeComposition.scannedFileCount>0||e.codeComposition.items.length>0||e.codeComposition.error!==null:!1}function CB({isDesktop:e,isWeb:t,viewportClass:n}){return e||t&&n==="expanded"?"desktop":"mobile"}function jB(){const e=Kn(),t=CB(e);return i.jsx(o_,{shellMode:t})}const NB=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function TB(){return i.jsx("main",{className:"workbench-page conversation-page-shell",children:i.jsx("section",{className:"workbench-center-placeholder",children:i.jsxs("div",{className:"workbench-empty-guide surface-card",children:[i.jsx("p",{className:"workbench-empty-eyebrow",children:h("workbench.emptyEyebrow")}),i.jsx("div",{className:"workbench-empty-main",children:i.jsxs("div",{className:"workbench-empty-copy",children:[i.jsx("h1",{children:h("workbench.emptyTitle")}),i.jsx("p",{className:"workbench-empty-body",children:h("workbench.emptyBody")})]})}),i.jsx("ol",{className:"workbench-empty-steps",children:NB.map((e,t)=>i.jsxs("li",{className:"workbench-empty-step",children:[i.jsx("span",{className:"workbench-empty-step-index",children:t+1}),i.jsxs("div",{className:"workbench-empty-step-copy",children:[i.jsx("h2",{children:h(e.titleKey)}),i.jsx("p",{children:h(e.bodyKey)})]})]},e.titleKey))}),i.jsx("p",{className:"workbench-empty-tip",children:h("workbench.emptyTip")})]})})})}function PB(){const{shellMode:e}=cr();return e==="mobile"?i.jsx(Ao,{to:"/workspaces",replace:!0}):i.jsx(TB,{})}async function EB(){const e=si(),t=cn.getState(),n=await e.bridge.checkForUpdate(t.releaseChannel);if(!n.ok||!n.value)throw new Error(n.detail??"更新检查失败。");return n.value}async function RB(e){return si().bridge.installUpdate(e)}async function MB(){return si().bridge.rollbackToPreviousVersion()}function sC(){const e=si(),t=e.isDesktop,[n,s]=w.useState(!1),[o,c]=w.useState(!1),[l,d]=w.useState(!1),[m,p]=w.useState(null),[y,g]=w.useState(null),[x,b]=w.useState(null),[C,S]=w.useState(!1);async function N(){var F,M;s(!0),p(null);try{const D=await EB();b(D.manifest),g(D.currentVersion),S(D.hasUpdate),p(AB(D.manifest,D.hasUpdate)),D.hasUpdate&&await e.bridge.showNotification(h("settings.releaseUpdateReady"),((F=D.manifest)==null?void 0:F.tagName)??((M=D.manifest)==null?void 0:M.version)??"-")}catch(D){p(D instanceof Error?D.message:h("settings.releaseCheckFailed"))}finally{s(!1)}}async function T(){if(!(!(x!=null&&x.packageUrl)||!x.signature)){c(!0),p(null);try{const F=await RB(x);if(!F.ok){p(F.detail??h("settings.releaseInstallFailed"));return}p(h("settings.releaseInstallStarted")),await e.bridge.showNotification(h("settings.releaseInstallStarted"),x.version)}catch(F){p(F instanceof Error?F.message:h("settings.releaseInstallFailed"))}finally{c(!1)}}}async function _(){c(!0),p(null);try{const F=await MB();p(F.ok?h("settings.releaseRollbackStarted"):F.detail??h("settings.releaseRollbackFailed")),F.ok&&await e.bridge.showNotification(h("settings.releaseRollbackStarted"),y??h("settings.releaseUnknownVersion"))}catch(F){p(F instanceof Error?F.message:h("settings.releaseRollbackFailed"))}finally{c(!1)}}async function R(){if(x!=null&&x.htmlUrl){d(!0);try{const F=await e.bridge.openExternal(x.htmlUrl);F.ok||p(F.detail??h("settings.releasePageOpenFailed"))}catch(F){p(F instanceof Error?F.message:h("settings.releasePageOpenFailed"))}finally{d(!1)}}}const G=!!(t&&(x!=null&&x.packageUrl)&&x.signature&&C),q=m??(t?null:h("settings.clientUpdateUnsupported"));return i.jsxs("div",{className:"settings-release-card",children:[i.jsxs("div",{className:"settings-release-meta",children:[i.jsxs("span",{children:[h("settings.releaseCurrentVersion"),": ",y??h("settings.releaseUnknownVersion")]}),i.jsxs("span",{children:[h("settings.releaseTargetVersion"),": ",(x==null?void 0:x.version)??"-"]}),i.jsxs("span",{children:[h("settings.releaseTargetTag"),": ",(x==null?void 0:x.tagName)??"-"]}),i.jsxs("span",{children:[h("settings.releasePublishedAt"),": ",LB(x==null?void 0:x.publishedAt)]})]}),x?i.jsxs("div",{className:"settings-release-notes",children:[i.jsx("strong",{children:h("settings.releaseNotes")}),x.title&&x.title!==x.tagName?i.jsx("p",{className:"settings-release-title",children:x.title}):null,x.notes?i.jsx("div",{className:"settings-release-markdown",children:i.jsx(Bf,{remarkPlugins:[Hf],children:x.notes})}):i.jsx("p",{children:h("settings.releaseNotesEmpty")})]}):null,q?i.jsx("p",{className:"settings-release-status",children:q}):null,i.jsxs("div",{className:"settings-release-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:!t||n||o,onClick:N,children:h(n?"common.loading":"settings.releaseCheckNow")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!G||o,onClick:T,children:h(o?"common.loading":"settings.releaseInstallNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(x!=null&&x.htmlUrl)||n||o||l,onClick:R,children:h(l?"common.loading":"settings.releaseOpenPage")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!t||o,onClick:_,children:h("settings.releaseRollback")})]})]})}function AB(e,t){return t?e!=null&&e.packageUrl?e.signature?h("settings.releaseUpdateReady"):h("settings.releaseSignatureMissing"):h("settings.releaseInstallerMissing"):h("settings.releaseUpToDate")}function LB(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function IB(){const e=cn.getState();return et.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function aC(){const e=si(),[t,n]=w.useState(!1),[s,o]=w.useState(!1),[c,l]=w.useState(null),[d,m]=w.useState(null);async function p(){n(!0),l(null);try{const g=await IB();m(g),l(DB(g)),g.hasUpdate&&await e.bridge.showNotification(h("settings.serverUpdateReady"),`${h("settings.serverTargetVersion")}: ${g.latestVersion??"-"}`)}catch(g){l(g instanceof Error?g.message:h("settings.serverCheckFailed"))}finally{n(!1)}}async function y(){if(d!=null&&d.packagePageUrl){o(!0);try{const g=await e.bridge.openExternal(d.packagePageUrl);g.ok||l(g.detail??h("settings.serverOpenPageFailed"))}catch(g){l(g instanceof Error?g.message:h("settings.serverOpenPageFailed"))}finally{o(!1)}}}return i.jsxs("div",{className:"settings-release-card",children:[i.jsxs("div",{className:"settings-release-meta",children:[i.jsxs("span",{children:[h("settings.serverCurrentVersion"),": ",(d==null?void 0:d.currentVersion)??"-"]}),i.jsxs("span",{children:[h("settings.serverTargetVersion"),": ",(d==null?void 0:d.latestVersion)??h("settings.serverLatestUnknown")]}),i.jsxs("span",{children:[h("settings.serverPackageName"),": ",(d==null?void 0:d.packageName)??"-"]})]}),d?i.jsxs("div",{className:"settings-release-notes",children:[i.jsx("strong",{children:h("settings.serverUpdateCommand")}),i.jsx("p",{className:"settings-release-command",children:d.updateCommand})]}):null,c?i.jsx("p",{className:"settings-release-status",children:c}):null,i.jsxs("div",{className:"settings-release-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:t,onClick:p,children:h(t?"common.loading":"settings.serverCheckNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(d!=null&&d.packagePageUrl)||t||s,onClick:y,children:h(s?"common.loading":"settings.serverOpenPage")})]})]})}function DB(e){return e.latestVersion?e.hasUpdate?h("settings.serverUpdateReady"):h("settings.serverUpToDate"):h("settings.serverLatestUnknown")}function tb({title:e,description:t,actions:n,content:s,className:o}){return i.jsx(CS,{className:o,children:i.jsxs("section",{className:"mobile-workspace-home-header mobile-page-header",children:[i.jsx("h1",{className:"mobile-workspace-switcher-heading",children:e}),i.jsxs("div",{className:"mobile-workspace-home-toolbar-top mobile-page-header-main",children:[i.jsx("div",{className:"mobile-page-header-copy",children:i.jsx("div",{className:"mobile-workspace-home-switcher mobile-page-header-static-title",children:i.jsx("span",{className:"mobile-workspace-home-switcher-label",children:e})})}),n?i.jsx("div",{className:"mobile-workspace-home-toolbar-actions mobile-page-header-actions",children:n}):null]}),t?i.jsx("p",{className:"mobile-workspace-home-path mobile-page-header-description",children:t}):null,s?i.jsx("div",{className:"mobile-page-header-content",children:s}):null]})})}function _B(e){return e==="appearance"||e==="server-connection"||e==="security-privacy"||e==="software-update"}function nb(e){return h(e==="en-US"?"locale.enUS":"locale.zhCN")}function rb(e){return h(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function ib(e){switch(e){case"acceptEdits":return h("settings.permissionModeAcceptEdits");case"bypassPermissions":return h("settings.permissionModeBypassPermissions");default:return h("settings.permissionModeDefault")}}function FB(){const e=An(),{theme:t,setTheme:n}=Vb(),s=Ic(R=>R),o=Kn(),c=ff(s.platform),l=c,[d,m]=w.useState(s.hostBaseUrl);w.useEffect(()=>{m(s.hostBaseUrl)},[s.hostBaseUrl]);function p(){Sn.clear(),e("/login",{replace:!0})}function y(R){try{return pi(R)}catch{return null}}const g=y(d),x=g!==null&&g!==s.hostBaseUrl;function b(R){R.preventDefault(),g&&cn.update({hostBaseUrl:g})}const C=[{value:"default",label:h("settings.permissionModeDefault")},{value:"acceptEdits",label:h("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:h("settings.permissionModeBypassPermissions")}];function S(R){cn.update({releaseChannel:R==="beta"?"beta":"stable"})}function N(R){cn.update({autoReconnect:R})}function T(R){cn.update({autoCheckUpdate:R})}function _(R){cn.update({defaultPermissionMode:R==="acceptEdits"||R==="bypassPermissions"?R:"default"})}return{platform:o,theme:t,setTheme:n,runtimeConfig:s,showServerSettings:l,canConfigureServerAddress:c,hostBaseUrlDraft:d,setHostBaseUrlDraft:m,canSaveHostBaseUrl:x,permissionModeOptions:C,handleHostBaseUrlSubmit:b,handleLogout:p,updateReleaseChannel:S,updateAutoReconnect:N,updateAutoCheckUpdate:T,updateDefaultPermissionMode:_}}function sb(){const e=FB(),t=Qb();return e.platform.isMobile?i.jsx(BB,{model:e,appVersion:t}):i.jsx(OB,{model:e,appVersion:t})}function OB({model:e,appVersion:t}){const{theme:n,setTheme:s,runtimeConfig:o,showServerSettings:c,hostBaseUrlDraft:l,setHostBaseUrlDraft:d,canSaveHostBaseUrl:m,permissionModeOptions:p,platform:y,handleHostBaseUrlSubmit:g,handleLogout:x,updateReleaseChannel:b,updateAutoReconnect:C,updateAutoCheckUpdate:S,updateDefaultPermissionMode:N}=e;return i.jsx("div",{className:"settings-page",children:i.jsxs("div",{className:"settings-container",children:[i.jsx("h1",{className:"settings-title",children:h("settings.title")}),i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.appearance")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.language")}),i.jsx("span",{className:"settings-row-description",children:h("settings.languageDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsx(kf,{})})]}),i.jsxs("div",{className:"settings-row settings-row-theme",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.theme")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx("div",{className:"theme-selector",children:_c.map(T=>i.jsxs("button",{type:"button",className:`theme-card ${n===T.id?"active":""}`,"aria-pressed":n===T.id,onClick:()=>s(T.id),children:[i.jsx("span",{className:"theme-preview",style:{background:T.color}}),i.jsx("span",{className:"theme-label",children:Hb(T)}),n===T.id?i.jsx("span",{className:"theme-check",children:"✓"}):null]},T.id))})})]})]})]}),c?i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.serverConnection")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.serverAddress")}),i.jsx("span",{className:"settings-row-description",children:h("settings.serverDescription")})]}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsxs("form",{className:"settings-inline-form",onSubmit:g,children:[i.jsx("input",{"aria-label":h("settings.serverAddress"),className:"settings-text-input",value:l,onChange:T=>d(T.target.value)}),i.jsx("button",{className:"settings-button",disabled:!m,type:"submit",children:h("common.save")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.autoReconnect")}),i.jsx("span",{className:"settings-row-description",children:h("settings.autoReconnectDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox",checked:o.autoReconnect,onChange:T=>C(T.target.checked)}),i.jsx("span",{children:o.autoReconnect?h("settings.enabled"):h("settings.disabled")})]})})]})]})]}):null,i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.securityPrivacy")}),i.jsx("div",{className:"settings-card",children:i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.defaultPermissionMode")}),i.jsx("span",{className:"settings-row-description",children:h("settings.defaultPermissionModeDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsx("select",{"aria-label":h("settings.defaultPermissionMode"),className:"settings-select",value:o.defaultPermissionMode,onChange:T=>N(T.target.value),children:p.map(T=>i.jsx("option",{value:T.value,children:T.label},T.value))})})]})})]}),i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.softwareUpdate")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.releaseChannel")}),i.jsx("span",{className:"settings-row-description",children:h("settings.releaseChannelDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("select",{"aria-label":h("settings.releaseChannel"),className:"settings-select",value:o.releaseChannel,onChange:T=>b(T.target.value),children:[i.jsx("option",{value:"stable",children:h("settings.releaseStable")}),i.jsx("option",{value:"beta",children:h("settings.releaseBeta")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.serverUpdate")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx(aC,{})})]}),y.isWeb?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.autoCheckUpdate")})}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox",checked:o.autoCheckUpdate,onChange:T=>S(T.target.checked)}),i.jsx("span",{children:o.autoCheckUpdate?h("settings.enabled"):h("settings.disabled")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.clientUpdate")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx(sC,{})})]})]})]})]}),i.jsxs("div",{className:"settings-footer settings-footer-with-logout",children:[i.jsxs("span",{className:"settings-version",children:["CodingNS v",t]}),i.jsx("button",{className:"settings-button settings-button-danger settings-button-sticky",onClick:x,type:"button",children:h("common.logout")})]})]})})}function BB({model:e,appVersion:t}){const n=An(),{section:s}=xf(),o=_B(s)?s:null,c=e.showServerSettings?[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:nb(e.runtimeConfig.language),icon:i.jsx(ob,{})},{id:"server-connection",title:h("settings.serverConnection"),description:h("settings.serverConnectionSectionSummary"),value:e.runtimeConfig.hostBaseUrl,icon:i.jsx($B,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:ib(e.runtimeConfig.defaultPermissionMode),icon:i.jsx(cb,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:rb(e.runtimeConfig.releaseChannel),icon:i.jsx(lb,{})}]:[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:nb(e.runtimeConfig.language),icon:i.jsx(ob,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:ib(e.runtimeConfig.defaultPermissionMode),icon:i.jsx(cb,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:rb(e.runtimeConfig.releaseChannel),icon:i.jsx(lb,{})}];return(o?c.find(d=>d.id===o)??null:null)?i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(tb,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[o==="appearance"?i.jsx(UB,{model:e}):null,o==="server-connection"&&e.showServerSettings?i.jsx(zB,{model:e}):null,o==="security-privacy"?i.jsx(WB,{model:e}):null,o==="software-update"?i.jsx(HB,{model:e}):null]}),i.jsx(ab,{onLogout:e.handleLogout})]}):i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(tb,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[i.jsx("section",{className:"settings-mobile-group-section",children:i.jsx("div",{className:"settings-mobile-card",children:c.map(d=>i.jsxs("button",{type:"button",className:"settings-mobile-nav-row",onClick:()=>n(`/settings/${d.id}`),children:[i.jsx("span",{className:"settings-mobile-nav-icon",children:d.icon}),i.jsxs("span",{className:"settings-mobile-nav-copy",children:[i.jsx("span",{className:"settings-mobile-nav-title",children:d.title}),i.jsx("span",{className:"settings-mobile-nav-description",children:d.description})]}),i.jsxs("span",{className:"settings-mobile-nav-trailing",children:[d.value?i.jsx("span",{className:"settings-mobile-nav-value",children:d.value}):null,i.jsx(qB,{})]})]},d.id))})}),i.jsx("div",{className:"settings-footer settings-footer-mobile",children:i.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),i.jsx(ab,{onLogout:e.handleLogout})]})}function UB({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.language")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.languageDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsx("div",{className:"settings-mobile-row-copy",children:i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.language")})}),i.jsx(kf,{variant:"compact",className:"settings-mobile-language-switcher"})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.theme")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.themeDescription")}),i.jsx("div",{className:"settings-mobile-card",children:_c.map(t=>{const n=e.theme===t.id;return i.jsxs("button",{type:"button",className:`settings-mobile-choice-row${n?" active":""}`,"aria-pressed":n,onClick:()=>e.setTheme(t.id),children:[i.jsxs("span",{className:"settings-mobile-choice-leading",children:[i.jsx("span",{className:"settings-mobile-choice-dot",style:{background:t.color},"aria-hidden":"true"}),i.jsx("span",{className:"settings-mobile-choice-label",children:Hb(t)})]}),i.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:n?i.jsx(VB,{}):null})]},t.id)})})]})]})}function zB({model:e}){return i.jsxs(i.Fragment,{children:[e.canConfigureServerAddress?i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverAddress")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.serverDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("form",{className:"settings-mobile-form-stack",onSubmit:e.handleHostBaseUrlSubmit,children:[i.jsx("input",{"aria-label":h("settings.serverAddress"),className:"settings-text-input settings-mobile-input",value:e.hostBaseUrlDraft,onChange:t=>e.setHostBaseUrlDraft(t.target.value)}),i.jsx("button",{className:"settings-mobile-primary-button",disabled:!e.canSaveHostBaseUrl,type:"submit",children:h("common.save")})]})})]}):null,i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverConnection")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.autoReconnect")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.autoReconnectDescription")})]}),i.jsx(oC,{checked:e.runtimeConfig.autoReconnect,label:h("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function WB({model:e}){return i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.securityPrivacy")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.securityPrivacySectionSummary")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.defaultPermissionMode")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.defaultPermissionModeDescription")})]}),i.jsx("select",{"aria-label":h("settings.defaultPermissionMode"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.defaultPermissionMode,onChange:t=>e.updateDefaultPermissionMode(t.target.value),children:e.permissionModeOptions.map(t=>i.jsx("option",{value:t.value,children:t.label},t.value))})]})})]})}function HB({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.softwareUpdate")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.softwareUpdateSectionSummary")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.releaseChannel")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.releaseChannelDescription")})]}),i.jsxs("select",{"aria-label":h("settings.releaseChannel"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.releaseChannel,onChange:t=>e.updateReleaseChannel(t.target.value),children:[i.jsx("option",{value:"stable",children:h("settings.releaseStable")}),i.jsx("option",{value:"beta",children:h("settings.releaseBeta")})]})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverUpdate")}),i.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:i.jsx(aC,{})})]}),e.platform.isWeb?null:i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.clientUpdate")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsx("div",{className:"settings-mobile-row-copy",children:i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.autoCheckUpdate")})}),i.jsx(oC,{checked:e.runtimeConfig.autoCheckUpdate,label:h("settings.autoCheckUpdate"),onChange:e.updateAutoCheckUpdate})]})}),i.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:i.jsx(sC,{})})]})]})}function ab({onLogout:e}){return i.jsx("div",{className:"settings-mobile-sticky-footer",children:i.jsx("button",{type:"button",className:"settings-mobile-danger-button settings-mobile-danger-button-sticky",onClick:e,children:h("common.logout")})})}function oC({checked:e,label:t,onChange:n}){return i.jsxs("label",{className:"settings-mobile-switch","aria-label":t,children:[i.jsx("input",{type:"checkbox",checked:e,onChange:s=>n(s.target.checked)}),i.jsx("span",{className:"settings-mobile-switch-track","aria-hidden":"true",children:i.jsx("span",{className:"settings-mobile-switch-thumb"})})]})}function ob(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M10 3.5a6.5 6.5 0 1 0 6.5 6.5c0-.8-.6-1.4-1.4-1.4h-1.6A1.5 1.5 0 0 1 12 7.1V5.5c0-1.1-.9-2-2-2Z"}),i.jsx("circle",{cx:"6.6",cy:"9.2",r:".8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"8.8",cy:"6.8",r:".8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12.1",cy:"6.6",r:".8",fill:"currentColor",stroke:"none"})]})}function $B(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M4 7.5 10 4l6 3.5v5L10 16l-6-3.5v-5Z"}),i.jsx("path",{d:"M10 9.5V16"}),i.jsx("path",{d:"M4 7.5 10 11l6-3.5"})]})}function lb(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"4",width:"13",height:"9.5",rx:"2.2"}),i.jsx("path",{d:"M7 16h6"}),i.jsx("path",{d:"M10 13.5V16"}),i.jsx("path",{d:"m8 8 2 2 3-3"})]})}function cb(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M10 3.2 15 5v4.4c0 3-1.9 5.8-5 7.4-3.1-1.6-5-4.4-5-7.4V5l5-1.8Z"}),i.jsx("path",{d:"m8.3 9.8 1.2 1.2 2.4-2.5"})]})}function qB(){return i.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:i.jsx("path",{d:"m4 2 4 4-4 4"})})}function VB(){return i.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"m3.5 8.2 2.6 2.6 6-6"})})}function GB(){const e=ix(n=>n.session),t=Yr();if(!e){const n=`${t.pathname}${t.search}`;return i.jsx(Ao,{to:`/login?returnTo=${encodeURIComponent(n)}`,replace:!0})}return i.jsx(Ih,{})}function ub(){const{shellMode:e}=cr();return i.jsx(Ao,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const KB=[{path:"/bootstrap",element:i.jsx(HN,{})},{path:"/login",element:i.jsx(QN,{})},{path:"/",element:i.jsx(GB,{}),children:[{element:i.jsx(jB,{}),children:[{index:!0,element:i.jsx(ub,{})},{path:"landing",element:i.jsx(PB,{})},{path:"workspaces",element:i.jsx(pB,{})},{path:"workspaces/:workspaceId",element:i.jsx(vB,{})},{path:"workspaces/:workspaceId/sessions",element:i.jsx(pF,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:i.jsx(V_,{})},{path:"workspaces/:workspaceId/tools",element:i.jsx(uB,{})},{path:"workspaces/:workspaceId/tools/files",element:i.jsx(gF,{})},{path:"workspaces/:workspaceId/tools/git",element:i.jsx(yF,{})},{path:"workspaces/:workspaceId/tools/processes",element:i.jsx(BF,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await Oc(()=>import("./TerminalPage-CVG1cGAJ.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"settings",element:i.jsx(sb,{})},{path:"settings/:section",element:i.jsx(sb,{})},{path:"*",element:i.jsx(ub,{})}]}]}];function QB(){return Uj(KB)}function YB(){const e=Ic(n=>n.language),t=w.useMemo(()=>QB(),[]);return i.jsx(tN,{children:i.jsx(bN,{children:i.jsx(lN,{language:e,children:i.jsx(pN,{children:i.jsx(wN,{children:i.jsx(Qj,{router:t})})})})})})}b1().finally(()=>{Q0.createRoot(document.getElementById("root")).render(i.jsx(YB,{}))});export{$k as C,pa as M,CF as T,Sn as a,Or as b,qf as c,An as d,xf as e,cr as f,nx as g,Qn as h,ZB as i,Cn as j,i as k,kF as l,iU as m,xw as n,nU as o,tU as p,rU as q,w as r,Vf as s,h as t,Kn as u,Mn as v,xr as w,eU as x,SF as y,JB as z};
|