hob-bot 1.2.0 → 1.3.0
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/web/assets/DesktopView-lixZfbYr.js +5 -0
- package/dist/web/assets/index-BZhge0qe.js +267 -0
- package/dist/web/assets/index-DIo1ArRa.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/server/src/desktop-tools.ts +45 -10
- package/server/src/http.ts +32 -2
- package/server/src/jobs.ts +18 -49
- package/server/src/now.ts +1 -1
- package/server/src/overview.ts +1 -1
- package/server/src/pages.ts +3 -2
- package/server/src/prompt.ts +68 -5
- package/server/src/router-activity.ts +7 -0
- package/server/src/router-tools.ts +20 -11
- package/server/src/router.ts +91 -40
- package/server/src/store.ts +20 -0
- package/server/src/worker-tools.ts +3 -10
- package/shared/skills.ts +3 -1
- package/shared/types.ts +2 -0
- package/dist/web/assets/DesktopView-CEBJFAIN.js +0 -5
- package/dist/web/assets/index-Di5lyTHO.css +0 -1
- package/dist/web/assets/index-y09i1RGd.js +0 -267
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/math-weKGDUmL.js","assets/math-C-EwFotM.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();var lf={exports:{}},Bi={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and 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 ix;function S1(){if(ix)return Bi;ix=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(o,c,f){var h=null;if(f!==void 0&&(h=""+f),c.key!==void 0&&(h=""+c.key),"key"in c){f={};for(var m in c)m!=="key"&&(f[m]=c[m])}else f=c;return c=f.ref,{$$typeof:n,type:o,key:h,ref:c!==void 0?c:null,props:f}}return Bi.Fragment=a,Bi.jsx=r,Bi.jsxs=r,Bi}var rx;function T1(){return rx||(rx=1,lf.exports=S1()),lf.exports}var l=T1(),af={exports:{}},qi={},rf={exports:{}},of={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* scheduler.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and 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 ox;function C1(){return ox||(ox=1,(function(n){function a(le,ve){var pe=le.length;le.push(ve);e:for(;0<pe;){var Oe=pe-1>>>1,Ae=le[Oe];if(0<c(Ae,ve))le[Oe]=ve,le[pe]=Ae,pe=Oe;else break e}}function r(le){return le.length===0?null:le[0]}function o(le){if(le.length===0)return null;var ve=le[0],pe=le.pop();if(pe!==ve){le[0]=pe;e:for(var Oe=0,Ae=le.length,bt=Ae>>>1;Oe<bt;){var Ot=2*(Oe+1)-1,Et=le[Ot],R=Ot+1,F=le[R];if(0>c(Et,pe))R<Ae&&0>c(F,Et)?(le[Oe]=F,le[R]=pe,Oe=R):(le[Oe]=Et,le[Ot]=pe,Oe=Ot);else if(R<Ae&&0>c(F,pe))le[Oe]=F,le[R]=pe,Oe=R;else break e}}return ve}function c(le,ve){var pe=le.sortIndex-ve.sortIndex;return pe!==0?pe:le.id-ve.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,b=null,j=3,E=!1,S=!1,T=!1,z=!1,A=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function V(le){for(var ve=r(g);ve!==null;){if(ve.callback===null)o(g);else if(ve.startTime<=le)o(g),ve.sortIndex=ve.expirationTime,a(p,ve);else break;ve=r(g)}}function N(le){if(T=!1,V(le),!S)if(r(p)!==null)S=!0,k||(k=!0,ke());else{var ve=r(g);ve!==null&&_e(N,ve.startTime-le)}}var k=!1,C=-1,M=5,L=-1;function J(){return z?!0:!(n.unstable_now()-L<M)}function te(){if(z=!1,k){var le=n.unstable_now();L=le;var ve=!0;try{e:{S=!1,T&&(T=!1,$(C),C=-1),E=!0;var pe=j;try{t:{for(V(le),b=r(p);b!==null&&!(b.expirationTime>le&&J());){var Oe=b.callback;if(typeof Oe=="function"){b.callback=null,j=b.priorityLevel;var Ae=Oe(b.expirationTime<=le);if(le=n.unstable_now(),typeof Ae=="function"){b.callback=Ae,V(le),ve=!0;break t}b===r(p)&&o(p),V(le)}else o(p);b=r(p)}if(b!==null)ve=!0;else{var bt=r(g);bt!==null&&_e(N,bt.startTime-le),ve=!1}}break e}finally{b=null,j=pe,E=!1}ve=void 0}}finally{ve?ke():k=!1}}}var ke;if(typeof D=="function")ke=function(){D(te)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,Ne=me.port2;me.port1.onmessage=te,ke=function(){Ne.postMessage(null)}}else ke=function(){A(te,0)};function _e(le,ve){C=A(function(){le(n.unstable_now())},ve)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(le){le.callback=null},n.unstable_forceFrameRate=function(le){0>le||125<le?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<le?Math.floor(1e3/le):5},n.unstable_getCurrentPriorityLevel=function(){return j},n.unstable_next=function(le){switch(j){case 1:case 2:case 3:var ve=3;break;default:ve=j}var pe=j;j=ve;try{return le()}finally{j=pe}},n.unstable_requestPaint=function(){z=!0},n.unstable_runWithPriority=function(le,ve){switch(le){case 1:case 2:case 3:case 4:case 5:break;default:le=3}var pe=j;j=le;try{return ve()}finally{j=pe}},n.unstable_scheduleCallback=function(le,ve,pe){var Oe=n.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?Oe+pe:Oe):pe=Oe,le){case 1:var Ae=-1;break;case 2:Ae=250;break;case 5:Ae=1073741823;break;case 4:Ae=1e4;break;default:Ae=5e3}return Ae=pe+Ae,le={id:v++,callback:ve,priorityLevel:le,startTime:pe,expirationTime:Ae,sortIndex:-1},pe>Oe?(le.sortIndex=pe,a(g,le),r(p)===null&&le===r(g)&&(T?($(C),C=-1):T=!0,_e(N,pe-Oe))):(le.sortIndex=Ae,a(p,le),S||E||(S=!0,k||(k=!0,ke()))),le},n.unstable_shouldYield=J,n.unstable_wrapCallback=function(le){var ve=j;return function(){var pe=j;j=ve;try{return le.apply(this,arguments)}finally{j=pe}}}})(of)),of}var cx;function E1(){return cx||(cx=1,rf.exports=C1()),rf.exports}var cf={exports:{}},Se={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* react.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and 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 ux;function A1(){if(ux)return Se;ux=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),j=Symbol.for("react.view_transition"),E=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=E&&R[E]||R["@@iterator"],typeof R=="function"?R:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,A={};function $(R,F,ee){this.props=R,this.context=F,this.refs=A,this.updater=ee||T}$.prototype.isReactComponent={},$.prototype.setState=function(R,F){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,F,"setState")},$.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function D(){}D.prototype=$.prototype;function V(R,F,ee){this.props=R,this.context=F,this.refs=A,this.updater=ee||T}var N=V.prototype=new D;N.constructor=V,z(N,$.prototype),N.isPureReactComponent=!0;var k=Array.isArray;function C(){}var M={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function J(R,F,ee){var oe=ee.ref;return{$$typeof:n,type:R,key:F,ref:oe!==void 0?oe:null,props:ee}}function te(R,F){return J(R.type,F,R.props)}function ke(R){return typeof R=="object"&&R!==null&&R.$$typeof===n}function me(R){var F={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ee){return F[ee]})}var Ne=/\/+/g;function _e(R,F){return typeof R=="object"&&R!==null&&R.key!=null?me(""+R.key):F.toString(36)}function le(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(C,C):(R.status="pending",R.then(function(F){R.status==="pending"&&(R.status="fulfilled",R.value=F)},function(F){R.status==="pending"&&(R.status="rejected",R.reason=F)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function ve(R,F,ee,oe,K){var ie=typeof R;(ie==="undefined"||ie==="boolean")&&(R=null);var ae=!1;if(R===null)ae=!0;else switch(ie){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(R.$$typeof){case n:case a:ae=!0;break;case v:return ae=R._init,ve(ae(R._payload),F,ee,oe,K)}}if(ae)return K=K(R),ae=oe===""?"."+_e(R,0):oe,k(K)?(ee="",ae!=null&&(ee=ae.replace(Ne,"$&/")+"/"),ve(K,F,ee,"",function(st){return st})):K!=null&&(ke(K)&&(K=te(K,ee+(K.key==null||R&&R.key===K.key?"":(""+K.key).replace(Ne,"$&/")+"/")+ae)),F.push(K)),1;ae=0;var ce=oe===""?".":oe+":";if(k(R))for(var xe=0;xe<R.length;xe++)oe=R[xe],ie=ce+_e(oe,xe),ae+=ve(oe,F,ee,ie,K);else if(xe=S(R),typeof xe=="function")for(R=xe.call(R),xe=0;!(oe=R.next()).done;)oe=oe.value,ie=ce+_e(oe,xe++),ae+=ve(oe,F,ee,ie,K);else if(ie==="object"){if(typeof R.then=="function")return ve(le(R),F,ee,oe,K);throw F=String(R),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return ae}function pe(R,F,ee){if(R==null)return R;var oe=[],K=0;return ve(R,oe,"","",function(ie){return F.call(ee,ie,K++)}),oe}function Oe(R){if(R._status===-1){var F=R._result,ee=F();ee.then(function(oe){(R._status===0||R._status===-1)&&(R._status=1,R._result=oe,ee.status===void 0&&(ee.status="fulfilled",ee.value=oe))},function(oe){(R._status===0||R._status===-1)&&(R._status=2,R._result=oe,ee.status===void 0&&(ee.status="rejected",ee.reason=oe))}),R._status===-1&&(R._status=0,R._result=ee)}if(R._status===1)return R._result.default;throw R._result}var Ae=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)};function bt(R){var F=M.T,ee={};ee.types=F!==null?F.types:null,M.T=ee;try{var oe=R(),K=M.S;K!==null&&K(ee,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(C,Ae)}catch(ie){Ae(ie)}finally{F!==null&&ee.types!==null&&(F.types=ee.types),M.T=F}}function Ot(R){var F=M.T;if(F!==null){var ee=F.types;ee===null?F.types=[R]:ee.indexOf(R)===-1&&ee.push(R)}else bt(Ot.bind(null,R))}var Et={map:pe,forEach:function(R,F,ee){pe(R,function(){F.apply(this,arguments)},ee)},count:function(R){var F=0;return pe(R,function(){F++}),F},toArray:function(R){return pe(R,function(F){return F})||[]},only:function(R){if(!ke(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Se.Activity=b,Se.Children=Et,Se.Component=$,Se.Fragment=r,Se.Profiler=c,Se.PureComponent=V,Se.StrictMode=o,Se.Suspense=p,Se.ViewTransition=j,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,Se.__COMPILER_RUNTIME={__proto__:null,c:function(R){return M.H.useMemoCache(R)}},Se.addTransitionType=Ot,Se.cache=function(R){return function(){return R.apply(null,arguments)}},Se.cacheSignal=function(){return null},Se.cloneElement=function(R,F,ee){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var oe=z({},R.props),K=R.key;if(F!=null)for(ie in F.key!==void 0&&(K=""+F.key),F)!L.call(F,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&F.ref===void 0||(oe[ie]=F[ie]);var ie=arguments.length-2;if(ie===1)oe.children=ee;else if(1<ie){for(var ae=Array(ie),ce=0;ce<ie;ce++)ae[ce]=arguments[ce+2];oe.children=ae}return J(R.type,K,oe)},Se.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:f,_context:R},R},Se.createElement=function(R,F,ee){var oe,K={},ie=null;if(F!=null)for(oe in F.key!==void 0&&(ie=""+F.key),F)L.call(F,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(K[oe]=F[oe]);var ae=arguments.length-2;if(ae===1)K.children=ee;else if(1<ae){for(var ce=Array(ae),xe=0;xe<ae;xe++)ce[xe]=arguments[xe+2];K.children=ce}if(R&&R.defaultProps)for(oe in ae=R.defaultProps,ae)K[oe]===void 0&&(K[oe]=ae[oe]);return J(R,ie,K)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(R){return{$$typeof:m,render:R}},Se.isValidElement=ke,Se.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:Oe}},Se.memo=function(R,F){return{$$typeof:g,type:R,compare:F===void 0?null:F}},Se.startTransition=bt,Se.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},Se.use=function(R){return M.H.use(R)},Se.useActionState=function(R,F,ee){return M.H.useActionState(R,F,ee)},Se.useCallback=function(R,F){return M.H.useCallback(R,F)},Se.useContext=function(R){return M.H.useContext(R)},Se.useDebugValue=function(){},Se.useDeferredValue=function(R,F){return M.H.useDeferredValue(R,F)},Se.useEffect=function(R,F){return M.H.useEffect(R,F)},Se.useEffectEvent=function(R){return M.H.useEffectEvent(R)},Se.useId=function(){return M.H.useId()},Se.useImperativeHandle=function(R,F,ee){return M.H.useImperativeHandle(R,F,ee)},Se.useInsertionEffect=function(R,F){return M.H.useInsertionEffect(R,F)},Se.useLayoutEffect=function(R,F){return M.H.useLayoutEffect(R,F)},Se.useMemo=function(R,F){return M.H.useMemo(R,F)},Se.useOptimistic=function(R,F){return M.H.useOptimistic(R,F)},Se.useReducer=function(R,F,ee){return M.H.useReducer(R,F,ee)},Se.useRef=function(R){return M.H.useRef(R)},Se.useState=function(R){return M.H.useState(R)},Se.useSyncExternalStore=function(R,F,ee){return M.H.useSyncExternalStore(R,F,ee)},Se.useTransition=function(){return M.H.useTransition()},Se.version="19.3.1",Se}var dx;function Wf(){return dx||(dx=1,cf.exports=A1()),cf.exports}var uf={exports:{}},Tt={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and 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 fx;function M1(){if(fx)return Tt;fx=1;var n=Wf();function a(v){var b="https://react.dev/errors/"+v;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var j=2;j<arguments.length;j++)b+="&args[]="+encodeURIComponent(arguments[j])}return"Minified React error #"+v+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var o={d:{f:r,r:function(){throw Error(a(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal"),f=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function m(v,b,j){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:E==null?null:E===h?h:""+E,children:v,containerInfo:b,implementation:j}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,b){if(v==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Tt.browser=function(v){return{$$typeof:f,_reason:v}},Tt.createPortal=function(v,b){var j=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(a(299));return m(v,b,null,j)},Tt.flushSync=function(v){var b=p.T,j=o.p;try{if(p.T=null,o.p=2,v)return v()}finally{p.T=b,o.p=j,o.d.f()}},Tt.preconnect=function(v,b){typeof v=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,o.d.C(v,b))},Tt.prefetchDNS=function(v){typeof v=="string"&&o.d.D(v)},Tt.preinit=function(v,b){if(typeof v=="string"&&b&&typeof b.as=="string"){var j=b.as,E=g(j,b.crossOrigin),S=typeof b.integrity=="string"?b.integrity:void 0,T=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;j==="style"?o.d.S(v,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:E,integrity:S,fetchPriority:T}):j==="script"&&o.d.X(v,{crossOrigin:E,integrity:S,fetchPriority:T,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},Tt.preinitModule=function(v,b){if(typeof v=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var j=g(b.as,b.crossOrigin);o.d.M(v,{crossOrigin:j,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&o.d.M(v)},Tt.preload=function(v,b){if(typeof v=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var j=b.as,E=g(j,b.crossOrigin);o.d.L(v,j,{crossOrigin:E,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},Tt.preloadModule=function(v,b){if(typeof v=="string")if(b){var j=g(b.as,b.crossOrigin);o.d.m(v,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:j,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else o.d.m(v)},Tt.requestFormReset=function(v){o.d.r(v)},Tt.unstable_batchedUpdates=function(v,b){return v(b)},Tt.useFormState=function(v,b,j){return p.H.useFormState(v,b,j)},Tt.useFormStatus=function(){return p.H.useHostTransitionStatus()},Tt.version="19.3.1",Tt}var hx;function Ib(){if(hx)return uf.exports;hx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),uf.exports=M1(),uf.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var mx;function z1(){if(mx)return qi;mx=1;var n=E1(),a=Wf(),r=Ib();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){for(var t=e,s=t;s&&!s.alternate;)t=s,(t.flags&4098)!==0&&(e=t.return),s=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(f(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var s=e,i=t;;){var u=s.return;if(u===null)break;var d=u.alternate;if(d===null){if(i=u.return,i!==null){s=i;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===s)return p(u),e;if(d===i)return p(u),t;d=d.sibling}throw Error(o(188))}if(s.return!==i.return)s=u,i=d;else{for(var x=!1,w=u.child;w;){if(w===s){x=!0,s=u,i=d;break}if(w===i){x=!0,i=u,s=d;break}w=w.sibling}if(!x){for(w=d.child;w;){if(w===s){x=!0,s=d,i=u;break}if(w===i){x=!0,i=d,s=u;break}w=w.sibling}if(!x)throw Error(o(189))}}if(s.alternate!==i)throw Error(o(190))}if(s.tag!==3)throw Error(o(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}function b(e,t,s,i,u,d){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&s(e,i,u,d)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&b(e.child,t,s,i,u,d))return!0;e=e.sibling}return!1}function j(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function E(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function S(e){var t=[null,null],s=j(e);return s===null||T(t,e,s.child,{foundSelf:!1}),t}function T(e,t,s,i){for(;s!==null;){if(s===t)i.foundSelf=!0;else if(s.tag===5||s.tag===27||s.tag===6){if(i.foundSelf)return e[1]=s,!0;e[0]=s}else if((s.tag!==22||s.memoizedState===null)&&T(e,t,s.child,i))return!0;s=s.sibling}return!1}function z(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var A=null,$=null;function D(e,t,s){return e===s?!0:e===t?(A=e,!0):!1}function V(e,t,s){return e===s?($=e,!1):e===t?($!==null&&(A=e),!0):!1}function N(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function k(e,t,s){for(var i=0,u=e;u;u=s(u))i++;u=0;for(var d=t;d;d=s(d))u++;for(;0<i-u;)e=s(e),i--;for(;0<u-i;)t=s(t),u--;for(;i--;){if(e===t||t!==null&&e===t.alternate)return e;e=s(e),t=s(t)}return null}var C=Object.assign,M=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),J=Symbol.for("react.portal"),te=Symbol.for("react.fragment"),ke=Symbol.for("react.strict_mode"),me=Symbol.for("react.profiler"),Ne=Symbol.for("react.consumer"),_e=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),pe=Symbol.for("react.suspense_list"),Oe=Symbol.for("react.memo"),Ae=Symbol.for("react.lazy"),bt=Symbol.for("react.activity"),Ot=Symbol.for("react.legacy_hidden"),Et=Symbol.for("react.memo_cache_sentinel"),R=Symbol.for("react.view_transition"),F=Symbol.for("react.recoverable"),ee=Symbol.iterator;function oe(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var K=Symbol.for("react.client.reference");function ie(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case te:return"Fragment";case me:return"Profiler";case ke:return"StrictMode";case ve:return"Suspense";case pe:return"SuspenseList";case bt:return"Activity";case R:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case J:return"Portal";case _e:return e.displayName||"Context";case Ne:return(e._context.displayName||"Context")+".Consumer";case le:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Oe:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Ae:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,ce=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,st={pending:!1,data:null,method:null,action:null},Cn=[],Hn=-1;function un(e){return{current:e}}function ot(e){0>Hn||(e.current=Cn[Hn],Cn[Hn]=null,Hn--)}function Ge(e,t){Hn++,Cn[Hn]=e.current,e.current=t}var Zt=un(null),_t=un(null),En=un(null),Ws=un(null);function vr(e,t){switch(Ge(En,t),Ge(_t,e),Ge(Zt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?pv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=pv(t),e=gv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ot(Zt),Ge(Zt,e)}function Hl(){ot(Zt),ot(_t),ot(En)}function Nc(e){var t=e.memoizedState;t!==null&&(Ta._currentValue=t.memoizedState,Ge(Ws,e)),t=Zt.current;var s=gv(t,e.type);t!==s&&(Ge(_t,e),Ge(Zt,s))}function xr(e){_t.current===e&&(ot(Zt),ot(_t)),Ws.current===e&&(ot(Ws),Ta._currentValue=st)}var Sc,$h;function js(e){if(Sc===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Sc=t&&t[1]||"",$h=-1<s.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Sc+e+$h}var Tc=!1;function Cc(e,t){if(!e||Tc)return"";Tc=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(re){var U=re}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(re){U=re}Q=!1;try{var I=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Q=!0,new e}finally{Q&&(I!==void 0?Object.defineProperty(e.prototype,"props",I):delete e.prototype.props)}}}else{try{throw Error()}catch(re){U=re}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(re){if(re&&U&&typeof re.stack=="string")return[re.stack,U.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=i.DetermineComponentFrameRoot(),x=d[0],w=d[1];if(x&&w){var O=x.split(`
|
|
45
|
+
`),B=w.split(`
|
|
46
|
+
`);for(u=i=0;i<O.length&&!O[i].includes("DetermineComponentFrameRoot");)i++;for(;u<B.length&&!B[u].includes("DetermineComponentFrameRoot");)u++;if(i===O.length||u===B.length)for(i=O.length-1,u=B.length-1;1<=i&&0<=u&&O[i]!==B[u];)u--;for(;1<=i&&0<=u;i--,u--)if(O[i]!==B[u]){if(i!==1||u!==1)do if(i--,u--,0>u||O[i]!==B[u]){var G=`
|
|
47
|
+
`+O[i].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=i&&0<=u);break}}}finally{Tc=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?js(s):""}function Ay(e,t){switch(e.tag){case 26:case 27:case 5:return js(e.type);case 16:return js("Lazy");case 13:return e.child!==t&&t!==null?js("Suspense Fallback"):js("Suspense");case 19:return js("SuspenseList");case 0:case 15:return Cc(e.type,!1);case 11:return Cc(e.type.render,!1);case 1:return Cc(e.type,!0);case 31:return js("Activity");case 30:return js("ViewTransition");default:return""}}function Uh(e){try{var t="",s=null;do t+=Ay(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
|
|
48
|
+
Error generating stack: `+i.message+`
|
|
49
|
+
`+i.stack}}var Ec=Object.prototype.hasOwnProperty,Ac=n.unstable_scheduleCallback,Mc=n.unstable_cancelCallback,My=n.unstable_shouldYield,zy=n.unstable_requestPaint,Qt=n.unstable_now,Oy=n.unstable_getCurrentPriorityLevel,Lh=n.unstable_ImmediatePriority,Hh=n.unstable_UserBlockingPriority,br=n.unstable_NormalPriority,_y=n.unstable_LowPriority,Bh=n.unstable_IdlePriority,Ry=n.log,Dy=n.unstable_setDisableYieldValue,Xa=null,Jt=null;function ws(e){if(typeof Ry=="function"&&Dy(e),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Xa,e)}catch{}}var Pt=Math.clz32?Math.clz32:Ly,$y=Math.log,Uy=Math.LN2;function Ly(e){return e>>>=0,e===0?32:31-($y(e)/Uy|0)|0}var yr=256,kr=262144,jr=4194304;function el(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function wr(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var u=0,d=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var w=i&134217727;return w!==0?(i=w&~d,i!==0?u=el(i):(x&=w,x!==0?u=el(x):s||(s=w&~e,s!==0&&(u=el(s))))):(w=i&~d,w!==0?u=el(w):x!==0?u=el(x):s||(s=i&~e,s!==0&&(u=el(s)))),u===0?0:t!==0&&t!==u&&(t&d)===0&&(d=u&-u,s=t&-t,d>=s||d===32&&(s&4194048)!==0)?t:u}function Za(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qh(e,t){(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var i=31-Pt(s),u=1<<i;t|=e[i],s&=~u}return t}function Hy(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ih(){var e=jr;return jr<<=1,(jr&62914560)===0&&(jr=4194304),e}function zc(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Qa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function By(e,t,s,i,u,d){var x=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var w=e.entanglements,O=e.expirationTimes,B=e.hiddenUpdates;for(s=x&~s;0<s;){var G=31-Pt(s),Q=1<<G;w[G]=0,O[G]=-1;var U=B[G];if(U!==null)for(B[G]=null,G=0;G<U.length;G++){var I=U[G];I!==null&&(I.lane&=-536870913)}s&=~Q}i!==0&&Yh(e,i,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(x&~t))}function Yh(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Pt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function Gh(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-Pt(s),u=1<<i;u&t|e[i]&t&&(e[i]|=t),s&=~u}}function Kh(e,t){var s=t&-t;return s=(s&42)!==0?1:Oc(s),(s&(e.suspendedLanes|t))!==0?0:s}function Oc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function _c(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Vh(){var e=xe.p;return e!==0?e:(e=window.event,e===void 0?32:Wv(e.type))}function Xh(e,t){var s=xe.p;try{return xe.p=e,t()}finally{xe.p=s}}var ns=Math.random().toString(36).slice(2),yt="__reactFiber$"+ns,Bt="__reactProps$"+ns,Bl="__reactContainer$"+ns,Zh="__reactEvents$"+ns,qy="__reactListeners$"+ns,Iy="__reactHandles$"+ns,Qh="__reactResources$"+ns,Ja="__reactMarker$"+ns,Nr="__reactLoad$"+ns;function Sr(e){delete e[yt],delete e[Bt],delete e[qy],delete e[Iy]}function tl(e){var t;if(t=e[yt])return t;for(var s=e.parentNode;s;){if(t=s[Bl]||s[yt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=_v(e);e!==null;){if(s=e[yt])return s;e=_v(e)}return t}e=s,s=e.parentNode}return null}function ql(e){if(e=e[yt]||e[Bl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Il(e){var t=e[Qh];return t||(t=e[Qh]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[Ja]=!0}function Jh(e){e[Nr]=void 0}var Ph=new Set,Fh={};function nl(e,t){Yl(e,t),Yl(e+"Capture",t)}function Yl(e,t){for(Fh[e]=t,e=0;e<t.length;e++)Ph.add(t[e])}var Yy=RegExp("^[: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]*$"),Wh={},em={};function Gy(e){return Ec.call(em,e)?!0:Ec.call(Wh,e)?!1:Yy.test(e)?em[e]=!0:(Wh[e]=!0,!1)}var qe=!1;function tm(){var e=qe;return qe=!1,e}function Tr(e,t,s){if(Gy(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,s)}}function Cr(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,s)}}function ss(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,i)}}function Ft(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ky(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,d=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(x){s=""+x,d.call(this,x)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(x){s=""+x},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rc(e){if(!e._valueTracker){var t=nm(e)?"checked":"value";e._valueTracker=Ky(e,t,""+e[t])}}function sm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=nm(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}var Vy=/[\n"\\]/g;function dn(e){return e.replace(Vy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Dc(e,t,s,i,u,d,x,w){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ft(t)):e.value!==""+Ft(t)&&(e.value=""+Ft(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?x==="number"&&e.value==t?$c(e,Ft(e.value)):$c(e,Ft(t)):s!=null?$c(e,Ft(s)):i!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Ft(w):e.removeAttribute("name")}function lm(e,t,s,i,u,d,x,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||s!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Rc(e);return}s=s!=null?""+Ft(s):"",t=t!=null?""+Ft(t):s,w||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=w?e.checked:!!i,e.defaultChecked=!!i,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Rc(e)}function $c(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Gl(e,t,s,i){if(e=e.options,t){t={};for(var u=0;u<s.length;u++)t["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=t.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Ft(s),t=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function am(e,t,s){if(t!=null&&(t=""+Ft(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Ft(s):""}function im(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(o(92));if(ae(i)){if(1<i.length)throw Error(o(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Ft(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),Rc(e)}function Kl(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Xy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function rm(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||Xy.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function om(e,t,s){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="",qe=!0);for(var u in t)i=t[u],t.hasOwnProperty(u)&&s[u]!==i&&(rm(e,u,i),qe=!0)}else for(var d in t)t.hasOwnProperty(d)&&rm(e,d,t[d])}function Uc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Qy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Er(e){return Qy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bn(){}var Lc=null;function Hc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vl=null,Xl=null;function cm(e){var t=ql(e);if(t&&(e=t.stateNode)){var s=e[Bt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Dc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+dn(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var u=i[Bt]||null;if(!u)throw Error(o(90));Dc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&sm(i)}break e;case"textarea":am(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Gl(e,!!s.multiple,t,!1)}}}var Bc=!1;function um(e,t,s){if(Bc)return e(t,s);Bc=!0;try{var i=e(t);return i}finally{if(Bc=!1,(Vl!==null||Xl!==null)&&(Ao(),Vl&&(t=Vl,e=Xl,Xl=Vl=null,cm(t),e)))for(t=0;t<e.length;t++)cm(e[t])}}function Fa(e,t){var s=e.stateNode;if(s===null)return null;var i=s[Bt]||null;if(i===null)return null;s=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(o(231,t,typeof s));return s}var ls=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qc=!1;if(ls)try{var Wa={};Object.defineProperty(Wa,"passive",{get:function(){qc=!0}}),window.addEventListener("test",Wa,Wa),window.removeEventListener("test",Wa,Wa)}catch{qc=!1}var Ns=null,Ic=null,Ar=null;function dm(){if(Ar)return Ar;var e,t=Ic,s=t.length,i,u="value"in Ns?Ns.value:Ns.textContent,d=u.length;for(e=0;e<s&&t[e]===u[e];e++);var x=s-e;for(i=1;i<=x&&t[s-i]===u[d-i];i++);return Ar=u.slice(e,1<i?1-i:void 0)}function Mr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function zr(){return!0}function fm(){return!1}function Rt(e){function t(s,i,u,d,x){this._reactName=s,this._targetInst=u,this.type=i,this.nativeEvent=d,this.target=x,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(s=e[w],this[w]=s?s(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?zr:fm,this.isPropagationStopped=fm,this}return C(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=zr)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=zr)},persist:function(){},isPersistent:zr}),t}var Ss={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Or=Rt(Ss),ei=C({},Ss,{view:0,detail:0}),Jy=Rt(ei),Yc,Gc,ti,_r=C({},ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ti&&(ti&&e.type==="mousemove"?(Yc=e.screenX-ti.screenX,Gc=e.screenY-ti.screenY):Gc=Yc=0,ti=e),Yc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),hm=Rt(_r),Py=C({},_r,{dataTransfer:0}),Fy=Rt(Py),Wy=C({},ei,{relatedTarget:0}),Kc=Rt(Wy),ek=C({},Ss,{animationName:0,elapsedTime:0,pseudoElement:0}),tk=Rt(ek),nk=C({},Ss,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sk=Rt(nk),lk=C({},Ss,{data:0}),mm=Rt(lk),ak={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ik={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"},rk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ok(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rk[e])?!!t[e]:!1}function Vc(){return ok}var ck=C({},ei,{key:function(e){if(e.key){var t=ak[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Mr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ik[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vc,charCode:function(e){return e.type==="keypress"?Mr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Mr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),uk=Rt(ck),dk=C({},_r,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pm=Rt(dk),fk=C({},Ss,{submitter:0}),hk=Rt(fk),mk=C({},ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vc}),pk=Rt(mk),gk=C({},Ss,{propertyName:0,elapsedTime:0,pseudoElement:0}),vk=Rt(gk),xk=C({},_r,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),bk=Rt(xk),yk=C({},Ss,{newState:0,oldState:0,source:0}),kk=Rt(yk),jk=[9,13,27,32],Xc=ls&&"CompositionEvent"in window,ni=null;ls&&"documentMode"in document&&(ni=document.documentMode);var wk=ls&&"TextEvent"in window&&!ni,gm=ls&&(!Xc||ni&&8<ni&&11>=ni),vm=" ",xm=!1;function bm(e,t){switch(e){case"keyup":return jk.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ym(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zl=!1;function Nk(e,t){switch(e){case"compositionend":return ym(t);case"keypress":return t.which!==32?null:(xm=!0,vm);case"textInput":return e=t.data,e===vm&&xm?null:e;default:return null}}function Sk(e,t){if(Zl)return e==="compositionend"||!Xc&&bm(e,t)?(e=dm(),Ar=Ic=Ns=null,Zl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return gm&&t.locale!=="ko"?null:t.data;default:return null}}var Tk={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 km(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Tk[e.type]:t==="textarea"}function jm(e,t,s,i){Vl?Xl?Xl.push(i):Xl=[i]:Vl=i,t=Do(t,"onChange"),0<t.length&&(s=new Or("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var si=null,li=null;function Ck(e){cv(e,0)}function Rr(e){var t=Pa(e);if(sm(t))return e}function wm(e,t){if(e==="change")return t}var Nm=!1;if(ls){var Zc;if(ls){var Qc="oninput"in document;if(!Qc){var Sm=document.createElement("div");Sm.setAttribute("oninput","return;"),Qc=typeof Sm.oninput=="function"}Zc=Qc}else Zc=!1;Nm=Zc&&(!document.documentMode||9<document.documentMode)}function Tm(){si&&(si.detachEvent("onpropertychange",Cm),li=si=null)}function Cm(e){if(e.propertyName==="value"&&Rr(li)){var t=[];jm(t,li,e,Hc(e)),um(Ck,t)}}function Ek(e,t,s){e==="focusin"?(Tm(),si=t,li=s,si.attachEvent("onpropertychange",Cm)):e==="focusout"&&Tm()}function Ak(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rr(li)}function Mk(e,t){if(e==="click")return Rr(t)}function zk(e,t){if(e==="input"||e==="change")return Rr(t)}function Ok(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wt=typeof Object.is=="function"?Object.is:Ok;function ai(e,t){if(Wt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var u=s[i];if(!Ec.call(t,u)||!Wt(e[u],t[u]))return!1}return!0}function Jc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Em(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,t){var s=Em(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Em(s)}}function Mm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jc(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Jc(e.document)}return t}function Pc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var _k=ls&&"documentMode"in document&&11>=document.documentMode,Ql=null,Fc=null,ii=null,Wc=!1;function Om(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Wc||Ql==null||Ql!==Jc(i)||(i=Ql,"selectionStart"in i&&Pc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ii&&ai(ii,i)||(ii=i,i=Do(Fc,"onSelect"),0<i.length&&(t=new Or("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=Ql)))}function sl(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Jl={animationend:sl("Animation","AnimationEnd"),animationiteration:sl("Animation","AnimationIteration"),animationstart:sl("Animation","AnimationStart"),transitionrun:sl("Transition","TransitionRun"),transitionstart:sl("Transition","TransitionStart"),transitioncancel:sl("Transition","TransitionCancel"),transitionend:sl("Transition","TransitionEnd")},eu={},_m={};ls&&(_m=document.createElement("div").style,"AnimationEvent"in window||(delete Jl.animationend.animation,delete Jl.animationiteration.animation,delete Jl.animationstart.animation),"TransitionEvent"in window||delete Jl.transitionend.transition);function ll(e){if(eu[e])return eu[e];if(!Jl[e])return e;var t=Jl[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in _m)return eu[e]=t[s];return e}var Rm=ll("animationend"),Dm=ll("animationiteration"),$m=ll("animationstart"),Rk=ll("transitionrun"),Dk=ll("transitionstart"),$k=ll("transitioncancel"),Um=ll("transitionend"),Lm=new Map,tu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");tu.push("scrollEnd");function An(e,t){Lm.set(e,t),nl(t,[e])}var Uk=0;function as(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=_n.identifierPrefix;var s=Uk++;return e="_"+e+"t_"+s.toString(32)+"_",t.autoName=e}function Hm(e){if(e==null||typeof e=="string")return e;var t=null,s=ga;if(s!==null)for(var i=0;i<s.length;i++){var u=e[s[i]];if(u!=null){if(u==="none")return"none";t=t==null?u:t+(" "+u)}}return t??e.default}function is(e,t){return e=Hm(e),t=Hm(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Dr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},fn=[],Pl=0,nu=0;function $r(){for(var e=Pl,t=nu=Pl=0;t<e;){var s=fn[t];fn[t++]=null;var i=fn[t];fn[t++]=null;var u=fn[t];fn[t++]=null;var d=fn[t];if(fn[t++]=null,i!==null&&u!==null){var x=i.pending;x===null?u.next=u:(u.next=x.next,x.next=u),i.pending=u}d!==0&&Bm(s,u,d)}}function Ur(e,t,s,i){fn[Pl++]=e,fn[Pl++]=t,fn[Pl++]=s,fn[Pl++]=i,nu|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function su(e,t,s,i){return Ur(e,t,s,i),Lr(e)}function al(e,t){return Ur(e,null,null,t),Lr(e)}function Bm(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var u=!1,d=e.return;d!==null;)d.childLanes|=s,i=d.alternate,i!==null&&(i.childLanes|=s),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&t!==null&&(u=31-Pt(s),e=d.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=s|536870912),d):null}function Lr(e){if(50<Ei)throw Ei=0,Eo=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Fl={};function Lk(e,t,s,i){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qt(e,t,s,i){return new Lk(e,t,s,i)}function lu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rs(e,t){var s=e.alternate;return s===null?(s=qt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&1206910976,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function qm(e,t){e.flags&=1206910978;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Hr(e,t,s,i,u,d){var x=0;if(i=e,typeof i=="function")lu(i)&&(x=1);else if(typeof i=="string")x=f1(e,s,Zt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(i){case bt:return e=qt(31,s,t,u),e.elementType=bt,e.lanes=d,e;case te:return il(s.children,u,d,t);case ke:x=8,u|=24;break;case me:return e=qt(12,s,t,u|2),e.elementType=me,e.lanes=d,e;case ve:return e=qt(13,s,t,u),e.elementType=ve,e.lanes=d,e;case pe:return e=qt(19,s,t,u),e.elementType=pe,e.lanes=d,e;case Ot:case R:return e=u|32,e=qt(30,s,t,e),e.elementType=R,e.lanes=d,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case _e:x=10;break e;case Ne:x=9;break e;case le:x=11;break e;case Oe:x=14;break e;case Ae:x=16,i=null;break e}x=29,s=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=qt(x,s,t,u),t.elementType=e,t.type=i,t.lanes=d,t}function il(e,t,s,i){return e=qt(7,e,i,t),e.lanes=s,e}function au(e,t,s){return e=qt(6,e,null,t),e.lanes=s,e}function Im(e){var t=qt(18,null,null,0);return t.stateNode=e,t}function iu(e,t,s){return t=qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ym=new WeakMap;function hn(e,t){if(typeof e=="object"&&e!==null){var s=Ym.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Uh(t)},Ym.set(e,t),t)}return{value:e,source:t,stack:Uh(t)}}var Wl=[],ea=0,Br=null,ri=0,mn=[],pn=0,Ts=null,qn=1,In="";function os(e,t){Wl[ea++]=ri,Wl[ea++]=Br,Br=e,ri=t}function Gm(e,t,s){mn[pn++]=qn,mn[pn++]=In,mn[pn++]=Ts,Ts=e;var i=qn;e=In;var u=32-Pt(i)-1;i&=~(1<<u),s+=1;var d=32-Pt(t)+u;if(30<d){var x=u-u%5;d=(i&(1<<x)-1).toString(32),i>>=x,u-=x,qn=1<<32-Pt(t)+u|s<<u|i,In=d+e}else qn=1<<d|s<<u|i,In=e}function qr(e){e.return!==null&&(os(e,1),Gm(e,1,0))}function ru(e){for(;e===Br;)Br=Wl[--ea],Wl[ea]=null,ri=Wl[--ea],Wl[ea]=null;for(;e===Ts;)Ts=mn[--pn],mn[pn]=null,In=mn[--pn],mn[pn]=null,qn=mn[--pn],mn[pn]=null}function Km(e,t){mn[pn++]=qn,mn[pn++]=In,mn[pn++]=Ts,qn=t.id,In=t.overflow,Ts=e}var gt=null,We=null,Me=!1,Cs=null,gn=!1,ou=Error(o(519));function Es(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw oi(hn(t,e)),ou}function Vm(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[yt]=e,t[Bt]=i,s){case"dialog":De("cancel",t),De("close",t);break;case"iframe":case"object":case"embed":De("load",t);break;case"video":case"audio":for(s=0;s<Mi.length;s++)De(Mi[s],t);break;case"source":De("error",t);break;case"img":case"image":case"link":De("error",t),De("load",t);break;case"details":De("toggle",t);break;case"input":De("invalid",t),lm(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":De("invalid",t);break;case"textarea":De("invalid",t),im(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||hv(t.textContent,s)?(i.popover!=null&&(De("beforetoggle",t),De("toggle",t)),i.onScroll!=null&&De("scroll",t),i.onScrollEnd!=null&&De("scrollend",t),i.onClick!=null&&(t.onclick=Bn),t=!0):t=!1,t||Es(e,!0)}function Ir(e){for(gt=e.return;gt;)switch(gt.tag){case 5:case 31:case 13:gn=!1;return;case 27:case 3:gn=!0;return;default:gt=gt.return}}function ta(e){if(e!==gt)return!1;if(!Me)return Ir(e),Me=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Ld(e.type,e.memoizedProps)),s=!s),s&&We&&Es(e),Ir(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));We=Ov(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));We=Ov(e)}else t===27?(t=We,Gs(e.type)?(e=Xd,Xd=null,We=e):We=t):We=gt?xn(e.stateNode.nextSibling):null;return!0}function rl(){We=gt=null,Me=!1}function cu(){var e=Cs;return e!==null&&(Gt===null?Gt=e:Gt.push.apply(Gt,e),Cs=null),e}function oi(e){Cs===null?Cs=[e]:Cs.push(e)}var uu=un(null),ol=null,cs=null;function As(e,t,s){Ge(uu,t._currentValue),t._currentValue=s}function us(e){e._currentValue=uu.current,ot(uu)}function Yr(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function du(e,t,s,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var x=u.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=u;for(var O=0;O<t.length;O++)if(w.context===t[O]){d.lanes|=s,w=d.alternate,w!==null&&(w.lanes|=s),Yr(d.return,s,e),i||(x=null);break e}d=w.next}}else if(u.tag===18){if(x=u.return,x===null)throw Error(o(341));x.lanes|=s,d=x.alternate,d!==null&&(d.lanes|=s),Yr(x,s,e),x=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=s,x=u.alternate,x!==null&&(x.lanes|=s),Yr(u.return,s,e),x=u.child,x=x!==null?x.sibling:null):x=u.child;if(x!==null)x.return=u;else for(x=u;x!==null;){if(x===e){x=null;break}if(u=x.sibling,u!==null){u.return=x.return,x=u;break}x=x.return}u=x}}function cl(e,t,s,i){e=null;for(var u=t,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var x=u.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var w=u.type;Wt(u.pendingProps.value,x.value)||(e!==null?e.push(w):e=[w])}}else if(u===Ws.current){if(x=u.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ta):e=[Ta])}u=u.return}return e!==null&&du(t,e,s,i),t.flags|=262144,e!==null}function Gr(e){for(e=e.firstContext;e!==null;){if(!Wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ul(e){ol=e,cs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return Xm(ol,e)}function Kr(e,t){return ol===null&&ul(e),Xm(e,t)}function Xm(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},cs===null){if(e===null)throw Error(o(308));cs=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else cs=cs.next=t;return s}var Hk=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},Bk=n.unstable_scheduleCallback,qk=n.unstable_NormalPriority,ct={$$typeof:_e,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fu(){return{controller:new Hk,data:new Map,refCount:0}}function ci(e){e.refCount--,e.refCount===0&&Bk(qk,function(){e.controller.abort()})}function Zm(e,t){if((e.pendingLanes&4194048)!==0){var s=e.transitionTypes;for(s===null&&(s=e.transitionTypes=[]),e=0;e<t.length;e++){var i=t[e];s.indexOf(i)===-1&&s.push(i)}}}var ui=null;function Ik(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var di=null,hu=0,dl=0,na=null;function Yk(e,t){if(di===null){var s=di=[];hu=0,dl=Ad(),na={status:"pending",value:void 0,then:function(i){s.push(i)}}}return hu++,t.then(Qm,Qm),t}function Qm(){if(--hu===0&&(ui=null,di!==null)){na!==null&&(na.status="fulfilled");var e=di;di=null,dl=0,na=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Gk(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<s.length;u++)(0,s[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),i}var Jm=ce.S;ce.S=function(e,t){if(Ig=Qt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Yk(e,t),ui!==null)for(var s=ya;s!==null;)Zm(s,ui),s=s.next;if(s=e.types,s!==null){for(var i=ya;i!==null;)Zm(i,s),i=i.next;if(dl!==0){i=ui,i===null&&(i=ui=[]);for(var u=0;u<s.length;u++){var d=s[u];i.indexOf(d)===-1&&i.push(d)}}}Jm!==null&&Jm(e,t)};var fl=un(null);function mu(){var e=fl.current;return e!==null?e:Je.pooledCache}function Vr(e,t){t===null?Ge(fl,fl.current):Ge(fl,t.pool)}function Pm(){var e=mu();return e===null?null:{parent:ct._currentValue,pool:e}}var sa=Error(o(460)),pu=Error(o(474)),Xr=Error(o(542)),Zr={then:function(){}};function Fm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Wm(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Bn,Bn),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tp(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(Bn,Bn);else{if(e=Je,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tp(e),e}throw ml=t,sa}}function hl(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(ml=s,sa):s}}var ml=null;function ep(){if(ml===null)throw Error(o(459));var e=ml;return ml=null,e}function tp(e){if(e===sa||e===Xr)throw Error(o(483))}var la=null,fi=0;function Qr(e){var t=fi;return fi+=1,la===null&&(la=[]),Wm(la,e,t)}function Ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Jr(e,t){throw t.$$typeof===M?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function np(e){function t(H,_){if(e){var q=H.deletions;q===null?(H.deletions=[_],H.flags|=16):q.push(_)}}function s(H,_){if(!e)return null;for(;_!==null;)t(H,_),_=_.sibling;return null}function i(H){for(var _=new Map;H!==null;)H.key===null?_.set(H.index,H):_.set(H.key,H),H=H.sibling;return _}function u(H,_){return H=rs(H,_),H.index=0,H.sibling=null,H}function d(H,_,q){return H.index=q,e?(q=H.alternate,q!==null?(q=q.index,q<_?(H.flags|=2,_):q):(H.flags|=134217730,_)):(H.flags|=1048576,_)}function x(H){return e&&H.alternate===null&&(H.flags|=134217730),H}function w(H,_,q,Z){return _===null||_.tag!==6?(_=au(q,H.mode,Z),_.return=H,_):(_=u(_,q),_.return=H,_)}function O(H,_,q,Z){var fe=q.type;return fe===te?(H=G(H,_,q.props.children,Z,q.key),Ms(H,q),H):_!==null&&(_.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Ae&&hl(fe)===_.type)?(_=u(_,q.props),Ms(_,q),_.return=H,_):(_=Hr(q.type,q.key,q.props,null,H.mode,Z),Ms(_,q),_.return=H,_)}function B(H,_,q,Z){return _===null||_.tag!==4||_.stateNode.containerInfo!==q.containerInfo||_.stateNode.implementation!==q.implementation?(_=iu(q,H.mode,Z),_.return=H,_):(_=u(_,q.children||[]),_.return=H,_)}function G(H,_,q,Z,fe){return _===null||_.tag!==7?(_=il(q,H.mode,Z,fe),_.return=H,_):(_=u(_,q),_.return=H,_)}function Q(H,_,q){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=au(""+_,H.mode,q),_.return=H,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case L:return q=Hr(_.type,_.key,_.props,null,H.mode,q),Ms(q,_),q.return=H,q;case J:return _=iu(_,H.mode,q),_.return=H,_;case Ae:return _=hl(_),Q(H,_,q)}if(ae(_)||oe(_))return _=il(_,H.mode,q,null),_.return=H,_;if(typeof _.then=="function")return Q(H,Qr(_),q);if(_.$$typeof===_e)return Q(H,Kr(H,_),q);Jr(H,_)}return null}function U(H,_,q,Z){var fe=_!==null?_.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return fe!==null?null:w(H,_,""+q,Z);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case L:return q.key===fe?O(H,_,q,Z):null;case J:return q.key===fe?B(H,_,q,Z):null;case Ae:return q=hl(q),U(H,_,q,Z)}if(ae(q)||oe(q))return fe!==null?null:G(H,_,q,Z,null);if(typeof q.then=="function")return U(H,_,Qr(q),Z);if(q.$$typeof===_e)return U(H,_,Kr(H,q),Z);Jr(H,q)}return null}function I(H,_,q,Z,fe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return H=H.get(q)||null,w(_,H,""+Z,fe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case L:return H=H.get(Z.key===null?q:Z.key)||null,O(_,H,Z,fe);case J:return H=H.get(Z.key===null?q:Z.key)||null,B(_,H,Z,fe);case Ae:return Z=hl(Z),I(H,_,q,Z,fe)}if(ae(Z)||oe(Z))return H=H.get(q)||null,G(_,H,Z,fe,null);if(typeof Z.then=="function")return I(H,_,q,Qr(Z),fe);if(Z.$$typeof===_e)return I(H,_,q,Kr(_,Z),fe);Jr(_,Z)}return null}function re(H,_,q,Z){for(var fe=null,Ue=null,ye=_,we=_=0,ft=null;ye!==null&&we<q.length;we++){ye.index>we?(ft=ye,ye=null):ft=ye.sibling;var Be=U(H,ye,q[we],Z);if(Be===null){ye===null&&(ye=ft);break}e&&ye&&Be.alternate===null&&t(H,ye),_=d(Be,_,we),Ue===null?fe=Be:Ue.sibling=Be,Ue=Be,ye=ft}if(we===q.length)return s(H,ye),Me&&os(H,we),fe;if(ye===null){for(;we<q.length;we++)ye=Q(H,q[we],Z),ye!==null&&(_=d(ye,_,we),Ue===null?fe=ye:Ue.sibling=ye,Ue=ye);return Me&&os(H,we),fe}for(ye=i(ye);we<q.length;we++)ft=I(ye,H,we,q[we],Z),ft!==null&&(e&&(Be=ft.alternate,Be!==null&&ye.delete(Be.key===null?we:Be.key)),_=d(ft,_,we),Ue===null?fe=ft:Ue.sibling=ft,Ue=ft);return e&&ye.forEach(function(Qs){return t(H,Qs)}),Me&&os(H,we),fe}function ge(H,_,q,Z){if(q==null)throw Error(o(151));for(var fe=null,Ue=null,ye=_,we=_=0,ft=null,Be=q.next();ye!==null&&!Be.done;we++,Be=q.next()){ye.index>we?(ft=ye,ye=null):ft=ye.sibling;var Qs=U(H,ye,Be.value,Z);if(Qs===null){ye===null&&(ye=ft);break}e&&ye&&Qs.alternate===null&&t(H,ye),_=d(Qs,_,we),Ue===null?fe=Qs:Ue.sibling=Qs,Ue=Qs,ye=ft}if(Be.done)return s(H,ye),Me&&os(H,we),fe;if(ye===null){for(;!Be.done;we++,Be=q.next())Be=Q(H,Be.value,Z),Be!==null&&(_=d(Be,_,we),Ue===null?fe=Be:Ue.sibling=Be,Ue=Be);return Me&&os(H,we),fe}for(ye=i(ye);!Be.done;we++,Be=q.next())Be=I(ye,H,we,Be.value,Z),Be!==null&&(e&&(ft=Be.alternate,ft!==null&&ye.delete(ft.key===null?we:ft.key)),_=d(Be,_,we),Ue===null?fe=Be:Ue.sibling=Be,Ue=Be);return e&&ye.forEach(function(N1){return t(H,N1)}),Me&&os(H,we),fe}function Ee(H,_,q,Z){if(typeof q=="object"&&q!==null&&q.type===te&&q.key===null&&q.props.ref===void 0&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case L:e:{for(var fe=q.key;_!==null;){if(_.key===fe){if(fe=q.type,fe===te){if(_.tag===7){s(H,_.sibling),Z=u(_,q.props.children),Ms(Z,q),Z.return=H,H=Z;break e}}else if(_.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Ae&&hl(fe)===_.type){s(H,_.sibling),Z=u(_,q.props),Ms(Z,q),Z.return=H,H=Z;break e}s(H,_);break}else t(H,_);_=_.sibling}q.type===te?(Z=il(q.props.children,H.mode,Z,q.key),Ms(Z,q),Z.return=H,H=Z):(Z=Hr(q.type,q.key,q.props,null,H.mode,Z),Ms(Z,q),Z.return=H,H=Z)}return x(H);case J:e:{for(fe=q.key;_!==null;){if(_.key===fe)if(_.tag===4&&_.stateNode.containerInfo===q.containerInfo&&_.stateNode.implementation===q.implementation){s(H,_.sibling),Z=u(_,q.children||[]),Z.return=H,H=Z;break e}else{s(H,_);break}else t(H,_);_=_.sibling}Z=iu(q,H.mode,Z),Z.return=H,H=Z}return x(H);case Ae:return q=hl(q),Ee(H,_,q,Z)}if(ae(q))return re(H,_,q,Z);if(oe(q)){if(fe=oe(q),typeof fe!="function")throw Error(o(150));return q=fe.call(q),ge(H,_,q,Z)}if(typeof q.then=="function")return Ee(H,_,Qr(q),Z);if(q.$$typeof===_e)return Ee(H,_,Kr(H,q),Z);Jr(H,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,_!==null&&_.tag===6?(s(H,_.sibling),Z=u(_,q),Z.return=H,H=Z):(s(H,_),Z=au(q,H.mode,Z),Z.return=H,H=Z),x(H)):s(H,_)}return function(H,_,q,Z){try{fi=0;var fe=Ee(H,_,q,Z);return la=null,fe}catch(ye){if(ye===sa||ye===Xr)throw ye;var Ue=qt(29,ye,null,H.mode);return Ue.lanes=Z,Ue.return=H,Ue}finally{}}}var pl=np(!0),sp=np(!1),zs=!1;function gu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Os(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function _s(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Ie&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=Lr(e),Bm(e,null,s),t}return Ur(e,i,t,s),Lr(e)}function hi(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Gh(e,s)}}function xu(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var u=null,d=null;if(s=s.firstBaseUpdate,s!==null){do{var x={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};d===null?u=d=x:d=d.next=x,s=s.next}while(s!==null);d===null?u=d=t:d=d.next=t}else u=d=t;s={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var bu=!1;function mi(){if(bu){var e=na;if(e!==null)throw e}}function pi(e,t,s,i){bu=!1;var u=e.updateQueue;zs=!1;var d=u.firstBaseUpdate,x=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var O=w,B=O.next;O.next=null,x===null?d=B:x.next=B,x=O;var G=e.alternate;G!==null&&(G=G.updateQueue,w=G.lastBaseUpdate,w!==x&&(w===null?G.firstBaseUpdate=B:w.next=B,G.lastBaseUpdate=O))}if(d!==null){var Q=u.baseState;x=0,G=B=O=null,w=d;do{var U=w.lane&-536870913,I=U!==w.lane;if(I?($e&U)===U:(i&U)===U){U!==0&&U===dl&&(bu=!0),G!==null&&(G=G.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var re=e,ge=w;U=t;var Ee=s;switch(ge.tag){case 1:if(re=ge.payload,typeof re=="function"){Q=re.call(Ee,Q,U);break e}Q=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ge.payload,U=typeof re=="function"?re.call(Ee,Q,U):re,U==null)break e;Q=C({},Q,U);break e;case 2:zs=!0}}U=w.callback,U!==null&&(e.flags|=64,I&&(e.flags|=8192),I=u.callbacks,I===null?u.callbacks=[U]:I.push(U))}else I={lane:U,tag:w.tag,payload:w.payload,callback:w.callback,next:null},G===null?(B=G=I,O=Q):G=G.next=I,x|=U;if(w=w.next,w===null){if(w=u.shared.pending,w===null)break;I=w,w=I.next,I.next=null,u.lastBaseUpdate=I,u.shared.pending=null}}while(!0);G===null&&(O=Q),u.baseState=O,u.firstBaseUpdate=B,u.lastBaseUpdate=G,d===null&&(u.shared.lanes=0),Bs|=x,e.lanes=x,e.memoizedState=Q}}function lp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function ap(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)lp(s[e],t)}var Rs=un(null),Pr=un(0);function ip(e,t){e=ps,Ge(Pr,e),Ge(Rs,t),ps=e|t.baseLanes}function yu(){Ge(Pr,ps),Ge(Rs,Rs.current)}function ku(){ps=Pr.current,ot(Rs),ot(Pr)}var jt=un(null),At=null;function Ds(e){var t=e.alternate;Ge(wt,wt.current&1),Ge(jt,e),At===null&&(t===null||Rs.current!==null||t.memoizedState!==null)&&(At=e)}function ju(e){Ge(wt,wt.current),Ge(jt,e),At===null&&(At=e)}function rp(e){e.tag===22?(Ge(wt,wt.current),Ge(jt,e),At===null&&(At=e)):$s()}function $s(){Ge(wt,wt.current),Ge(jt,jt.current)}function en(e){ot(jt),At===e&&(At=null),ot(wt)}var wt=un(0);function gi(e,t){Ge(jt,jt.current),Ge(wt,t)}function wu(e){ot(wt),ot(jt),At===e&&(At=null)}function Fr(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Kd(s)||Vd(s)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ds=0,Ce=null,Qe=null,ut=null,Wr=!1,aa=!1,gl=!1,eo=0,vi=0,ia=null,Kk=0;function lt(){throw Error(o(321))}function Nu(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Wt(e[s],t[s]))return!1;return!0}function Su(e,t,s,i,u,d){return ds=d,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ce.H=e===null||e.memoizedState===null?Gp:Kp,gl=!1,d=s(i,u),gl=!1,aa&&(d=cp(t,s,i,u)),op(e),d}function op(e){ce.H=ro;var t=Qe!==null&&Qe.next!==null;if(ds=0,ut=Qe=Ce=null,Wr=!1,vi=0,ia=null,t)throw Error(o(300));e===null||dt||(e=e.dependencies,e!==null&&Gr(e)&&(dt=!0))}function cp(e,t,s,i){Ce=e;var u=0;do{if(aa&&(ia=null),vi=0,aa=!1,25<=u)throw Error(o(301));if(u+=1,ut=Qe=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}ce.H=Wk,d=t(s,i)}while(aa);return d}function Vk(){var e=ce.H,t=e.useState()[0];return t=typeof t.then=="function"?xi(t):t,e=e.useState()[0],(Qe!==null?Qe.memoizedState:null)!==e&&(Ce.flags|=1024),t}function Tu(){var e=eo!==0;return eo=0,e}function Cu(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Eu(e){if(Wr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Wr=!1}ds=0,ut=Qe=Ce=null,aa=!1,vi=eo=0,ia=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?Ce.memoizedState=ut=e:ut=ut.next=e,ut}function it(){if(Qe===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=Qe.next;var t=ut===null?Ce.memoizedState:ut.next;if(t!==null)ut=t,Qe=e;else{if(e===null)throw Ce.alternate===null?Error(o(467)):Error(o(310));Qe=e,e={memoizedState:Qe.memoizedState,baseState:Qe.baseState,baseQueue:Qe.baseQueue,queue:Qe.queue,next:null},ut===null?Ce.memoizedState=ut=e:ut=ut.next=e}return ut}function to(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xi(e){var t=vi;return vi+=1,ia===null&&(ia=[]),e=Wm(ia,e,t),t=Ce,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,ce.H=t===null||t.memoizedState===null?Gp:Kp),e}function no(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return xi(e);if(e.$$typeof===F)return;if(e.$$typeof===_e)return kt(e)}throw Error(o(438,String(e)))}function Au(e){var t=null,s=Ce.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=Ce.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=to(),Ce.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=Et;return t.index++,s}function fs(e,t){return typeof t=="function"?t(e):t}function so(e){var t=it();return Mu(t,Qe,e)}function Mu(e,t,s){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=s;var u=e.baseQueue,d=i.pending;if(d!==null){if(u!==null){var x=u.next;u.next=d.next,d.next=x}t.baseQueue=u=d,i.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var w=x=null,O=null,B=t,G=!1;do{var Q=B.lane&-536870913;if(Q!==B.lane?($e&Q)===Q:(ds&Q)===Q){var U=B.revertLane;if(U===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),Q===dl&&(G=!0);else if((ds&U)===U){B=B.next,U===dl&&(G=!0);continue}else Q={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(w=O=Q,x=d):O=O.next=Q,Ce.lanes|=U,Bs|=U;Q=B.action,gl&&s(d,Q),d=B.hasEagerState?B.eagerState:s(d,Q)}else U={lane:Q,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(w=O=U,x=d):O=O.next=U,Ce.lanes|=Q,Bs|=Q;B=B.next}while(B!==null&&B!==t);if(O===null?x=d:O.next=w,!Wt(d,e.memoizedState)&&(dt=!0,G&&(s=na,s!==null)))throw s;e.memoizedState=d,e.baseState=x,e.baseQueue=O,i.lastRenderedState=d}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function zu(e){var t=it(),s=t.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=e;var i=s.dispatch,u=s.pending,d=t.memoizedState;if(u!==null){s.pending=null;var x=u=u.next;do d=e(d,x.action),x=x.next;while(x!==u);Wt(d,t.memoizedState)||(dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),s.lastRenderedState=d}return[d,i]}function up(e,t,s){var i=Ce,u=it(),d=Me;if(d){if(s===void 0)throw Error(o(407));s=s()}else s=t();var x=!Wt((Qe||u).memoizedState,s);if(x&&(u.memoizedState=s,dt=!0),u=u.queue,Ru(hp.bind(null,i,u,e),[e]),e=u.getSnapshot!==t||x||ut!==null&&(ut.memoizedState.tag&1)!==0,ra(e?9:8,{destroy:void 0},fp.bind(null,i,u,s,t),null),e){if(i.flags|=2048,Je===null)throw Error(o(349));d||(ds&127)!==0||dp(i,t,s)}return s}function dp(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ce.updateQueue,t===null?(t=to(),Ce.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function fp(e,t,s,i){t.value=s,t.getSnapshot=i,mp(t)&&pp(e)}function hp(e,t,s){return s(function(){mp(t)&&pp(e)})}function mp(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Wt(e,s)}catch{return!0}}function pp(e){var t=al(e,2);t!==null&&Kt(t,e,2)}function Ou(e){var t=Dt();if(typeof e=="function"){var s=e;if(e=s(),gl){ws(!0);try{s()}finally{ws(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:e},t}function gp(e,t,s,i){return e.baseState=s,Mu(e,Qe,typeof i=="function"?i:fs)}function Xk(e,t,s,i,u){if(io(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){d.listeners.push(x)}};ce.T!==null?s(!0):d.isTransition=!1,i(d),s=t.pending,s===null?(d.next=t.pending=d,vp(t,d)):(d.next=s.next,t.pending=s.next=d)}}function vp(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var d=ce.T,x={};x.types=d!==null?d.types:null,ce.T=x;try{var w=s(u,i),O=ce.S;O!==null&&O(x,w),xp(e,t,w)}catch(B){_u(e,t,B)}finally{d!==null&&x.types!==null&&(d.types=x.types),ce.T=d}}else try{d=s(u,i),xp(e,t,d)}catch(B){_u(e,t,B)}}function xp(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){bp(e,t,i)},function(i){return _u(e,t,i)}):bp(e,t,s)}function bp(e,t,s){t.status="fulfilled",t.value=s,yp(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,vp(e,s)))}function _u(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,yp(t),t=t.next;while(t!==i)}e.action=null}function yp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function kp(e,t){return t}function jp(e,t){if(Me){var s=Je.formState;if(s!==null){e:{var i=Ce;if(Me){if(We){t:{for(var u=We,d=gn;u.nodeType!==8;){if(!d){u=null;break t}if(u=xn(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){We=xn(u.nextSibling),i=u.data==="F!";break e}}Es(i)}i=!1}i&&(t=s[0])}}return s=Dt(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kp,lastRenderedState:t},s.queue=i,s=qp.bind(null,Ce,i),i.dispatch=s,i=Ou(!1),d=Hu.bind(null,Ce,!1,i.queue),i=Dt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=Xk.bind(null,Ce,u,d,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function wp(e){var t=it();return Np(t,Qe,e)}function Np(e,t,s){if(t=Mu(e,t,kp)[0],e=so(fs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=xi(t)}catch(x){throw x===sa?Xr:x}else i=t;t=it();var u=t.queue,d=u.dispatch;return s!==t.memoizedState&&(Ce.flags|=2048,ra(9,{destroy:void 0},Zk.bind(null,u,s),null)),[i,d,e]}function Zk(e,t){e.action=t}function Sp(e){var t=it(),s=Qe;if(s!==null)return Np(t,s,e);it(),t=t.memoizedState,s=it();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function ra(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=Ce.updateQueue,t===null&&(t=to(),Ce.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function Tp(){return it().memoizedState}function lo(e,t,s,i){var u=Dt();Ce.flags|=e,u.memoizedState=ra(1|t,{destroy:void 0},s,i===void 0?null:i)}function ao(e,t,s,i){var u=it();i=i===void 0?null:i;var d=u.memoizedState.inst;Qe!==null&&i!==null&&Nu(i,Qe.memoizedState.deps)?u.memoizedState=ra(t,d,s,i):(Ce.flags|=e,u.memoizedState=ra(1|t,d,s,i))}function Cp(e,t){lo(8390656,8,e,t)}function Ru(e,t){ao(2048,8,e,t)}function Qk(e){Ce.flags|=4;var t=Ce.updateQueue;if(t===null)t=to(),Ce.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Ep(e){var t=it().memoizedState;return Qk({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ap(e,t){return ao(4,2,e,t)}function Mp(e,t){return ao(4,4,e,t)}function zp(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Op(e,t,s){s=s!=null?s.concat([e]):null,ao(4,4,zp.bind(null,t,e),s)}function Du(){}function _p(e,t){var s=it();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Nu(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function Rp(e,t){var s=it();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Nu(t,i[1]))return i[0];if(i=e(),gl){ws(!0);try{e()}finally{ws(!1)}}return s.memoizedState=[i,t],i}function $u(e,t,s){return s===void 0||(ds&1073741824)!==0&&($e&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=Gg(),Ce.lanes|=e,Bs|=e,s)}function Dp(e,t,s,i){return Wt(s,t)?s:Rs.current!==null?(e=$u(e,s,i),Wt(e,t)||(dt=!0),e):(ds&106)===0||(ds&1073741824)!==0&&($e&261930)===0?(dt=!0,e.memoizedState=s):(e=Gg(),Ce.lanes|=e,Bs|=e,t)}function $p(e,t,s,i,u){var d=xe.p;xe.p=d!==0&&8>d?d:8;var x=ce.T,w={};w.types=x!==null?x.types:null,ce.T=w,Hu(e,!1,t,s);try{var O=u(),B=ce.S;if(B!==null&&B(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var G=Gk(O,i);bi(e,t,G,ln(e))}else bi(e,t,i,ln(e))}catch(Q){bi(e,t,{then:function(){},status:"rejected",reason:Q},ln())}finally{xe.p=d,x!==null&&w.types!==null&&(x.types=w.types),ce.T=x}}function Jk(){}function Uu(e,t,s,i){if(e.tag!==5)throw Error(o(476));var u=Up(e).queue;$p(e,u,t,st,s===null?Jk:function(){return Lp(e),s(i)})}function Up(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:st,baseState:st,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:st},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fs,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Lp(e){var t=Up(e);t.next===null&&(t=e.alternate.memoizedState),bi(e,t.next.queue,{},ln())}function Lu(){return kt(Ta)}function Hp(){return it().memoizedState}function Bp(){return it().memoizedState}function Pk(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=ln();e=Os(s);var i=_s(t,e,s);i!==null&&(Kt(i,t,s),hi(i,t,s)),t={cache:fu()},e.payload=t;return}t=t.return}}function Fk(e,t,s){var i=ln();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},io(e)?Ip(t,s):(s=su(e,t,s,i),s!==null&&(Kt(s,e,i),Yp(s,t,i)))}function qp(e,t,s){var i=ln();bi(e,t,s,i)}function bi(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(io(e))Ip(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var x=t.lastRenderedState,w=d(x,s);if(u.hasEagerState=!0,u.eagerState=w,Wt(w,x))return Ur(e,t,u,0),Je===null&&$r(),!1}catch{}finally{}if(s=su(e,t,u,i),s!==null)return Kt(s,e,i),Yp(s,t,i),!0}return!1}function Hu(e,t,s,i){if(i={lane:2,revertLane:Ad(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},io(e)){if(t)throw Error(o(479))}else t=su(e,s,i,2),t!==null&&Kt(t,e,2)}function io(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function Ip(e,t){aa=Wr=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Yp(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Gh(e,s)}}var ro={readContext:kt,use:no,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt,useEffectEvent:lt},Gp={readContext:kt,use:no,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:Cp,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,lo(4194308,4,zp.bind(null,t,e),s)},useLayoutEffect:function(e,t){return lo(4194308,4,e,t)},useInsertionEffect:function(e,t){lo(4,2,e,t)},useMemo:function(e,t){var s=Dt();t=t===void 0?null:t;var i=e();if(gl){ws(!0);try{e()}finally{ws(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=Dt();if(s!==void 0){var u=s(t);if(gl){ws(!0);try{s(t)}finally{ws(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=Fk.bind(null,Ce,e),[i.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ou(e);var t=e.queue,s=qp.bind(null,Ce,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:Du,useDeferredValue:function(e,t){var s=Dt();return $u(s,e,t)},useTransition:function(){var e=Ou(!1);return e=$p.bind(null,Ce,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=Ce,u=Dt();if(Me){if(s===void 0)throw Error(o(407));s=s()}else{if(s=t(),Je===null)throw Error(o(349));($e&127)!==0||dp(i,t,s)}u.memoizedState=s;var d={value:s,getSnapshot:t};return u.queue=d,Cp(hp.bind(null,i,d,e),[e]),i.flags|=2048,ra(9,{destroy:void 0},fp.bind(null,i,d,s,t),null),s},useId:function(){var e=Dt(),t=Je.identifierPrefix;if(Me){var s=In,i=qn;s=(i&~(1<<32-Pt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=eo++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=Kk++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Lu,useFormState:jp,useActionState:jp,useOptimistic:function(e){var t=Dt();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=Hu.bind(null,Ce,!0,s),s.dispatch=t,[e,t]},useMemoCache:Au,useCacheRefresh:function(){return Dt().memoizedState=Pk.bind(null,Ce)},useEffectEvent:function(e){var t=Dt(),s={impl:e};return t.memoizedState=s,function(){if((Ie&2)!==0)throw Error(o(440));return s.impl.apply(void 0,arguments)}}},Kp={readContext:kt,use:no,useCallback:_p,useContext:kt,useEffect:Ru,useImperativeHandle:Op,useInsertionEffect:Ap,useLayoutEffect:Mp,useMemo:Rp,useReducer:so,useRef:Tp,useState:function(){return so(fs)},useDebugValue:Du,useDeferredValue:function(e,t){var s=it();return Dp(s,Qe.memoizedState,e,t)},useTransition:function(){var e=so(fs)[0],t=it().memoizedState;return[typeof e=="boolean"?e:xi(e),t]},useSyncExternalStore:up,useId:Hp,useHostTransitionStatus:Lu,useFormState:wp,useActionState:wp,useOptimistic:function(e,t){var s=it();return gp(s,Qe,e,t)},useMemoCache:Au,useCacheRefresh:Bp,useEffectEvent:Ep},Wk={readContext:kt,use:no,useCallback:_p,useContext:kt,useEffect:Ru,useImperativeHandle:Op,useInsertionEffect:Ap,useLayoutEffect:Mp,useMemo:Rp,useReducer:zu,useRef:Tp,useState:function(){return zu(fs)},useDebugValue:Du,useDeferredValue:function(e,t){var s=it();return Qe===null?$u(s,e,t):Dp(s,Qe.memoizedState,e,t)},useTransition:function(){var e=zu(fs)[0],t=it().memoizedState;return[typeof e=="boolean"?e:xi(e),t]},useSyncExternalStore:up,useId:Hp,useHostTransitionStatus:Lu,useFormState:Sp,useActionState:Sp,useOptimistic:function(e,t){var s=it();return Qe!==null?gp(s,Qe,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Au,useCacheRefresh:Bp,useEffectEvent:Ep};function Bu(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:C({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var qu={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=ln(),u=Os(i);u.payload=t,s!=null&&(u.callback=s),t=_s(e,u,i),t!==null&&(Kt(t,e,i),hi(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=ln(),u=Os(i);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=_s(e,u,i),t!==null&&(Kt(t,e,i),hi(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=ln(),i=Os(s);i.tag=2,t!=null&&(i.callback=t),t=_s(e,i,s),t!==null&&(Kt(t,e,s),hi(t,e,s))}};function Vp(e,t,s,i,u,d,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,d,x):t.prototype&&t.prototype.isPureReactComponent?!ai(s,i)||!ai(u,d):!0}function Xp(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&qu.enqueueReplaceState(t,t.state,null)}function vl(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=C({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function Zp(e){Dr(e)}function Qp(e){console.error(e)}function Jp(e){Dr(e)}function oo(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Pp(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Iu(e,t,s){return s=Os(s),s.tag=3,s.payload={element:null},s.callback=function(){oo(e,t)},s}function Fp(e){return e=Os(e),e.tag=3,e}function Wp(e,t,s,i){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var d=i.value;e.payload=function(){return u(d)},e.callback=function(){Pp(t,s,i)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Pp(t,s,i),typeof u!="function"&&(qs===null?qs=new Set([this]):qs.add(this));var w=i.stack;this.componentDidCatch(i.value,{componentStack:w!==null?w:""})})}function ej(e,t,s,i,u){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&cl(t,s,u,!0),s=jt.current,s!==null){switch(s.tag){case 31:case 13:case 19:return At===null?Mo():s.alternate===null&&at===0&&(at=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===Zr?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),Td(e,i,u)),!1;case 22:return s.flags|=65536,i===Zr?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),Td(e,i,u)),!1}throw Error(o(435,s.tag))}return Td(e,i,u),Mo(),!1}if(Me)return t=jt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==ou&&(e=Error(o(422),{cause:i}),oi(hn(e,s)))):(i!==ou&&(t=Error(o(423),{cause:i}),oi(hn(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=hn(i,s),u=Iu(e.stateNode,i,u),xu(e,u),at!==4&&(at=2)),!1;var d=Error(o(520),{cause:i});if(d=hn(d,s),Ci===null?Ci=[d]:Ci.push(d),at!==4&&(at=2),t===null)return!0;i=hn(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=Iu(s.stateNode,i,e),xu(s,e),!1;case 1:if(t=s.type,d=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(qs===null||!qs.has(d))))return s.flags|=65536,u&=-u,s.lanes|=u,u=Fp(u),Wp(u,e,s,i),xu(s,u),!1;break;case 22:if(s.memoizedState!==null)return s.flags|=65536,!1}s=s.return}while(s!==null);return!1}var Yu=Error(o(461)),dt=!1;function ht(e,t,s,i){t.child=e===null?sp(t,null,s,i):pl(t,e.child,s,i)}function eg(e,t,s,i,u){s=s.render;var d=t.ref;if("ref"in i){var x={};for(var w in i)w!=="ref"&&(x[w]=i[w])}else x=i;return ul(t),i=Su(e,t,s,x,d,u),w=Tu(),e!==null&&!dt?(Cu(e,t,u),hs(e,t,u)):(Me&&w&&qr(t),t.flags|=1,ht(e,t,i,u),t.child)}function tg(e,t,s,i,u){if(e===null){var d=s.type;return typeof d=="function"&&!lu(d)&&d.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=d,ng(e,t,d,i,u)):(e=Hr(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Pu(e,u)){var x=d.memoizedProps;if(s=s.compare,s=s!==null?s:ai,s(x,i)&&e.ref===t.ref)return hs(e,t,u)}return t.flags|=1,e=rs(d,i),e.ref=t.ref,e.return=t,t.child=e}function ng(e,t,s,i,u){if(e!==null){var d=e.memoizedProps;if(ai(d,i)&&e.ref===t.ref)if(dt=!1,t.pendingProps=i=d,Pu(e,u))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,hs(e,t,u)}return Gu(e,t,s,i,u)}function sg(e,t,s,i){var u=i.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|s:s,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~d}else i=0,t.child=null;return lg(e,t,d,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Vr(t,d!==null?d.cachePool:null),d!==null?ip(t,d):yu(),rp(t);else return i=t.lanes=536870912,lg(e,t,d!==null?d.baseLanes|s:s,s,i)}else d!==null?(Vr(t,d.cachePool),ip(t,d),$s(),t.memoizedState=null):(e!==null&&Vr(t,null),yu(),$s());return ht(e,t,u,s),t.child}function yi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function lg(e,t,s,i,u){var d=mu();return d=d===null?null:{parent:ct._currentValue,pool:d},t.memoizedState={baseLanes:s,cachePool:d},e!==null&&Vr(t,null),yu(),rp(t),e!==null&&cl(e,t,i,!0),t.childLanes=u,null}function co(e,t){return t=uo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ag(e,t,s){return pl(t,e.child,null,s),e=co(t,t.pendingProps),e.flags|=2,en(t),t.memoizedState=null,e}function tj(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(i.mode==="hidden")return e=co(t,i),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},yi(null,e);if(ju(t),(e=We)?(e=zv(e,gn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:qn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},s=Im(e),s.return=t,t.child=s,gt=t,We=null)):e=null,e===null)throw Es(t);return t.lanes=536870912,null}return co(t,i)}var d=e.memoizedState;if(d!==null){var x=d.dehydrated;if(ju(t),u)if(t.flags&256)t.flags&=-257,t=ag(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(dt||cl(e,t,s,!1),u=(s&e.childLanes)!==0,dt||u){if(Rs.current===null){if(i=Je,i!==null&&(x=Kh(i,s),x!==0&&x!==d.retryLane))throw d.retryLane=x,al(e,x),Kt(i,e,x),Yu;Mo()}t=ag(e,t,s)}else e=d.treeContext,We=xn(x.nextSibling),gt=t,Me=!0,Cs=null,gn=!1,e!==null&&Km(t,e),t=co(t,i),t.flags|=134221824;return t}return e=rs(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function oa(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(o(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function Gu(e,t,s,i,u){return ul(t),s=Su(e,t,s,i,void 0,u),i=Tu(),e!==null&&!dt?(Cu(e,t,u),hs(e,t,u)):(Me&&i&&qr(t),t.flags|=1,ht(e,t,s,u),t.child)}function ig(e,t,s,i,u,d){return ul(t),t.updateQueue=null,s=cp(t,i,s,u),op(e),i=Tu(),e!==null&&!dt?(Cu(e,t,d),hs(e,t,d)):(Me&&i&&qr(t),t.flags|=1,ht(e,t,s,d),t.child)}function rg(e,t,s,i,u){if(ul(t),t.stateNode===null){var d=Fl,x=s.contextType;typeof x=="object"&&x!==null&&(d=kt(x)),d=new s(i,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=qu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=i,d.state=t.memoizedState,d.refs={},gu(t),x=s.contextType,d.context=typeof x=="object"&&x!==null?kt(x):Fl,d.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Bu(t,s,x,i),d.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(x=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),x!==d.state&&qu.enqueueReplaceState(d,d.state,null),pi(t,i,d,u),mi(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){d=t.stateNode;var w=t.memoizedProps,O=vl(s,w);d.props=O;var B=d.context,G=s.contextType;x=Fl,typeof G=="object"&&G!==null&&(x=kt(G));var Q=s.getDerivedStateFromProps;G=typeof Q=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,G||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||B!==x)&&Xp(t,d,i,x),zs=!1;var U=t.memoizedState;d.state=U,pi(t,i,d,u),mi(),B=t.memoizedState,w||U!==B||zs?(typeof Q=="function"&&(Bu(t,s,Q,i),B=t.memoizedState),(O=zs||Vp(t,s,O,i,U,B,x))?(G||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=B),d.props=i,d.state=B,d.context=x,i=O):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{d=t.stateNode,vu(e,t),x=t.memoizedProps,G=vl(s,x),d.props=G,Q=t.pendingProps,U=d.context,B=s.contextType,O=Fl,typeof B=="object"&&B!==null&&(O=kt(B)),w=s.getDerivedStateFromProps,(B=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(x!==Q||U!==O)&&Xp(t,d,i,O),zs=!1,U=t.memoizedState,d.state=U,pi(t,i,d,u),mi();var I=t.memoizedState;x!==Q||U!==I||zs||e!==null&&e.dependencies!==null&&Gr(e.dependencies)?(typeof w=="function"&&(Bu(t,s,w,i),I=t.memoizedState),(G=zs||Vp(t,s,G,i,U,I,O)||e!==null&&e.dependencies!==null&&Gr(e.dependencies))?(B||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(i,I,O),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(i,I,O)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=I),d.props=i,d.state=I,d.context=O,i=G):(typeof d.componentDidUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),i=!1)}return d=i,oa(e,t),i=(t.flags&128)!==0,d||i?(d=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&i?(t.child=pl(t,e.child,null,u),t.child=pl(t,null,s,u)):ht(e,t,s,u),t.memoizedState=d.state,e=t.child):e=hs(e,t,u),e}function og(e,t,s,i){return rl(),t.flags|=256,ht(e,t,s,i),t.child}var Ku={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vu(e){return{baseLanes:e,cachePool:Pm()}}function Xu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=sn),e}function cg(e,t,s){var i=t.pendingProps,u=!1,d=(t.flags&128)!==0,x;if((x=d)||(x=e!==null&&e.memoizedState===null?!1:(wt.current&2)!==0),x&&(u=!0,t.flags&=-129),x=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(u?Ds(t):$s(),(e=We)?(e=zv(e,gn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ts!==null?{id:qn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},s=Im(e),s.return=t,t.child=s,gt=t,We=null)):e=null,e===null)throw Es(t);return Vd(e)?t.lanes=32:t.lanes=536870912,null}return d=i.children,i=i.fallback,u?($s(),u=t.mode,d=uo({mode:"hidden",children:d},u),i=il(i,u,s,null),d.return=t,i.return=t,d.sibling=i,t.child=d,i=t.child,i.memoizedState=Vu(s),i.childLanes=Xu(e,x,s),t.memoizedState=Ku,yi(null,i)):(Ds(t),Zu(t,d))}var w=e.memoizedState;if(w!==null){var O=w.dehydrated;if(O!==null)return nj(e,t,d,x,i,O,w,s)}return u?($s(),u=i.fallback,d=t.mode,w=e.child,O=w.sibling,i=rs(w,{mode:"hidden",children:i.children}),i.subtreeFlags=w.subtreeFlags&1206910976,O!==null?u=rs(O,u):(u=il(u,d,s,null),u.flags|=2),u.return=t,i.return=t,i.sibling=u,t.child=i,yi(null,i),i=t.child,u=e.child.memoizedState,u===null?u=Vu(s):(d=u.cachePool,d!==null?(w=ct._currentValue,d=d.parent!==w?{parent:w,pool:w}:d):d=Pm(),u={baseLanes:u.baseLanes|s,cachePool:d}),i.memoizedState=u,i.childLanes=Xu(e,x,s),t.memoizedState=Ku,yi(e.child,i)):(Ds(t),s=e.child,e=s.sibling,s=rs(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(x=t.deletions,x===null?(t.deletions=[e],t.flags|=16):x.push(e)),t.child=s,t.memoizedState=null,s)}function Zu(e,t){return t=uo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function uo(e,t){return e=qt(22,e,null,t),e.lanes=0,e}function fo(e,t,s){return pl(t,e.child,null,s),e=Zu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function nj(e,t,s,i,u,d,x,w){if(s)return t.flags&256?(Ds(t),t.flags&=-257,fo(e,t,w)):t.memoizedState!==null?($s(),t.child=e.child,t.flags|=128,null):($s(),d=u.fallback,x=t.mode,u=uo({mode:"visible",children:u.children},x),d=il(d,x,w,null),d.flags|=2,u.return=t,d.return=t,u.sibling=d,t.child=u,pl(t,e.child,null,w),u=t.child,u.memoizedState=Vu(w),u.childLanes=Xu(e,i,w),t.memoizedState=Ku,yi(null,u));if(Ds(t),Vd(d)){if(i=d.nextSibling&&d.nextSibling.dataset,i)var O=i.dgst;return i=O,i!==""&&(u=Error(o(419)),u.stack="",u.digest=i,oi({value:u,source:null,stack:null})),fo(e,t,w)}if(dt||cl(e,t,w,!1),i=(w&e.childLanes)!==0,dt||i){if(Rs.current!==null)return fo(e,t,w);if(i=Je,i!==null&&(u=Kh(i,w),u!==0&&u!==x.retryLane))throw x.retryLane=u,al(e,u),Kt(i,e,u),Yu;return Kd(d)||Mo(),fo(e,t,w)}return Kd(d)?(t.flags|=192,t.child=e.child,null):(e=x.treeContext,We=xn(d.nextSibling),gt=t,Me=!0,Cs=null,gn=!1,e!==null&&Km(t,e),t=Zu(t,u.children),t.flags|=134221824,t)}function ug(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Yr(e.return,t,s)}function dg(e){for(var t=null;e!==null;){var s=e.alternate;s!==null&&Fr(s)===null&&(t=e),e=e.sibling}return t}function ho(e,t,s,i,u,d){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:u,treeForkCount:d}:(x.isBackwards=t,x.rendering=null,x.renderingStartTime=0,x.last=i,x.tail=s,x.tailMode=u,x.treeForkCount=d)}function Qu(e){var t=e.child;for(e.child=null;t!==null;){var s=t.sibling;t.sibling=e.child,e.child=t,t=s}}function Ju(e,t,s){var i=t.pendingProps,u=i.revealOrder,d=i.tail;i=i.children;var x=wt.current;if(t.flags&128)return gi(t,x),null;var w=(x&2)!==0;if(w?(x=x&1|2,t.flags|=128):x&=1,gi(t,x),u==="backwards"&&e!==null?(Qu(e),ht(e,t,i,s),Qu(e)):ht(e,t,i,s),i=Me?ri:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ug(e,s,t);else if(e.tag===19)ug(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"backwards":s=dg(t.child),s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null,Qu(t)),ho(t,!0,u,null,d,i);break;case"unstable_legacy-backwards":for(s=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Fr(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}ho(t,!0,s,null,d,i);break;case"together":ho(t,!1,null,null,void 0,i);break;case"independent":t.memoizedState=null;break;default:s=dg(t.child),s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),ho(t,!1,u,s,d,i)}return t.child}function fg(e,t,s){var i=t.pendingProps;return As(t,t.type,i.value),ht(e,t,i.children,s),t.child}function hs(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),Bs|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(cl(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,s=rs(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=rs(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Pu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Gr(e)))}function sj(e,t,s){switch(t.tag){case 3:vr(t,t.stateNode.containerInfo),As(t,ct,e.memoizedState.cache),rl();break;case 27:case 5:Nc(t);break;case 4:vr(t,t.stateNode.containerInfo);break;case 10:As(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ju(t),null;break;case 13:var i=t.memoizedState;if(i!==null){if(i.dehydrated!==null)return Ds(t),t.flags|=128,null;i=cl(e,t,s,!1);var u=t.child.childLanes;return i||(s&u)!==0?cg(e,t,s):(Ds(t),e=hs(e,t,s),e!==null?e.sibling:null)}Ds(t);break;case 19:if(t.flags&128)return Ju(e,t,s);if(u=(e.flags&128)!==0,i=(s&t.childLanes)!==0,i||(cl(e,t,s,!1),i=(s&t.childLanes)!==0),u){if(i)return Ju(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),gi(t,wt.current),i)break;return null;case 22:return t.lanes=0,sg(e,t,s,t.pendingProps);case 24:As(t,ct,e.memoizedState.cache)}return hs(e,t,s)}function hg(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!Pu(e,s)&&(t.flags&128)===0)return dt=!1,sj(e,t,s);dt=(e.flags&131072)!==0}else dt=!1,Me&&(t.flags&1048576)!==0&&Gm(t,ri,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=hl(t.elementType),t.type=e,typeof e=="function")lu(e)?(i=vl(e,i),t.tag=1,t=rg(null,t,e,i,s)):(t.tag=0,t=Gu(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===le){t.tag=11,t=eg(null,t,e,i,s);break e}else if(u===Oe){t.tag=14,t=tg(null,t,e,i,s);break e}else if(u===_e){t.tag=10,t.type=e,t=fg(null,t,s);break e}}throw t=ie(e)||e,Error(o(306,t,""))}}return t;case 0:return Gu(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=vl(i,t.pendingProps),rg(e,t,i,u,s);case 3:e:{if(vr(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var d=t.memoizedState;u=d.element,vu(e,t),pi(t,i,null,s);var x=t.memoizedState;if(i=x.cache,As(t,ct,i),i!==d.cache&&du(t,[ct],s,!0),mi(),i=x.element,d.isDehydrated)if(d={element:i,isDehydrated:!1,cache:x.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=og(e,t,i,s);break e}else if(i!==u){u=hn(Error(o(424)),t),oi(u),t=og(e,t,i,s);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(We=xn(e.firstChild),gt=t,Me=!0,Cs=null,gn=!0,s=sp(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|134221824,s=s.sibling}else{if(rl(),i===u){t=hs(e,t,s);break e}ht(e,t,i,s)}t=t.child}return t;case 26:return oa(e,t),e===null?(s=Lv(t.type,null,t.pendingProps,null))?t.memoizedState=s:Me||(t.stateNode=vv(t.type,t.pendingProps,En.current,t)):t.memoizedState=Lv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Nc(t),e===null&&Me&&(i=t.stateNode=Rv(t.type,t.pendingProps,En.current),gt=t,gn=!0,u=We,Gs(t.type)?(Xd=u,We=xn(i.firstChild)):We=u),ht(e,t,t.pendingProps.children,s),oa(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((u=i=We)&&(i=Pj(i,t.type,t.pendingProps,gn),i!==null?(t.stateNode=i,gt=t,We=xn(i.firstChild),gn=!1,u=!0):u=!1),u||Es(t)),Nc(t),u=t.type,d=t.pendingProps,x=e!==null?e.memoizedProps:null,i=d.children,Ld(u,d)?i=null:x!==null&&Ld(u,x)&&(t.flags|=32),t.memoizedState!==null&&(u=Su(e,t,Vk,null,null,s),Ta._currentValue=u),oa(e,t),ht(e,t,i,s),t.child;case 6:return e===null&&Me&&((e=s=We)&&(s=Fj(s,t.pendingProps,gn),s!==null?(t.stateNode=s,gt=t,We=null,e=!0):e=!1),e||Es(t)),null;case 13:return cg(e,t,s);case 4:return vr(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=pl(t,null,i,s):ht(e,t,i,s),t.child;case 11:return eg(e,t,t.type,t.pendingProps,s);case 7:return i=t.pendingProps,oa(e,t),ht(e,t,i,s),t.child;case 8:return ht(e,t,t.pendingProps.children,s),t.child;case 12:return ht(e,t,t.pendingProps.children,s),t.child;case 10:return fg(e,t,s);case 9:return u=t.type._context,i=t.pendingProps.children,ul(t),u=kt(u),i=i(u),t.flags|=1,ht(e,t,i,s),t.child;case 14:return tg(e,t,t.type,t.pendingProps,s);case 15:return ng(e,t,t.type,t.pendingProps,s);case 19:return Ju(e,t,s);case 31:return tj(e,t,s);case 22:return sg(e,t,s,t.pendingProps);case 24:return ul(t),i=kt(ct),e===null?(u=mu(),u===null&&(u=Je,d=fu(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=s),u=d),t.memoizedState={parent:i,cache:u},gu(t),As(t,ct,u)):((e.lanes&s)!==0&&(vu(e,t),pi(t,null,null,s),mi()),u=e.memoizedState,d=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),As(t,ct,i)):(i=d.cache,As(t,ct,i),i!==u.cache&&du(t,[ct],s,!0))),ht(e,t,t.pendingProps.children,s),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),i=t.pendingProps,i.name!=null&&i.name!=="auto"?t.flags|=e===null?18882560:18874368:Me&&qr(t),e!==null&&e.memoizedProps.name!==i.name?t.flags|=4194816:oa(e,t),ht(e,t,i.children,s),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ms(e){e.flags|=4}function Fu(e,t,s,i,u){var d;if((d=(e.mode&32)!==0)&&(d=s===null?Iv(t,i):Iv(t,i)&&(i.src!==s.src||i.srcSet!==s.srcSet)),d){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Zg())e.flags|=8192;else throw ml=Zr,pu}else e.flags&=-16777217}function mg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yv(t))if(Zg())e.flags|=8192;else throw ml=Zr,pu}function mo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ih():536870912,e.lanes|=t,ha|=t)}function ki(e,t){if(!Me)switch(e.tailMode){case"visible":break;case"collapsed":for(var s=e.tail,i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null;break;default:for(t=e.tail,s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null}}function et(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags&1206910976,i|=u.flags&1206910976,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function lj(e,t,s){var i=t.pendingProps;switch(ru(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return et(t),null;case 1:return et(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),us(ct),Hl(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ta(t)?ms(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,cu())),et(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(ms(t),d!==null?(et(t),mg(t,d)):(et(t),Fu(t,u,null,i,s))):d?d!==e.memoizedState?(ms(t),et(t),mg(t,d)):(et(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ms(t),et(t),Fu(t,u,e,i,s)),null;case 27:if(xr(t),s=En.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ms(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return et(t),t.subtreeFlags&=-33554433,null}e=Zt.current,ta(t)?Vm(t):(e=Rv(u,i,s),t.stateNode=e,ms(t))}return et(t),t.subtreeFlags&=-33554433,null;case 5:if(xr(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ms(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return et(t),t.subtreeFlags&=-33554433,null}if(d=Zt.current,ta(t))Vm(t);else{var x=Oi(En.current);switch(d){case 1:d=x.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=x.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=x.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=x.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof i.is=="string"?x.createElement("select",{is:i.is}):x.createElement("select"),i.multiple?d.multiple=!0:i.size&&(d.size=i.size);break;default:d=typeof i.is=="string"?x.createElement(u,{is:i.is}):x.createElement(u)}}d[yt]=t,d[Bt]=i;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)d.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=d;e:switch(St(d,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ms(t)}}return et(t),t.subtreeFlags&=-33554433,Fu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ms(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=En.current,ta(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,u=gt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[yt]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||hv(e.nodeValue,s)),e||Es(t,!0)}else e=Oi(e).createTextNode(i),e[yt]=t,t.stateNode=e}return et(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=ta(t),s!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[yt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),e=!1}else s=cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(en(t),t):(en(t),null);if((t.flags&128)!==0)throw Error(o(558))}return et(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ta(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[yt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;et(t),u=!1}else u=cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(en(t),t):(en(t),null)}return en(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==u&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),mo(t,t.updateQueue),et(t),null);case 4:return Hl(),e===null&&_d(t.stateNode.containerInfo),t.flags|=67108864,et(t),null;case 10:return us(t.type),et(t),null;case 19:if(wu(t),i=t.memoizedState,i===null)return et(t),null;if(u=(t.flags&128)!==0,d=i.rendering,d===null)if(u)ki(i,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Fr(e),d!==null){for(t.flags|=128,ki(i,!1),e=d.updateQueue,t.updateQueue=e,mo(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)qm(s,e),s=s.sibling;return gi(t,wt.current&1|2),Me&&os(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Qt()>To&&(t.flags|=128,u=!0,ki(i,!1),t.lanes=4194304)}else{if(!u)if(e=Fr(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,mo(t,e),ki(i,!0),i.tail===null&&i.tailMode!=="collapsed"&&i.tailMode!=="visible"&&!d.alternate&&!Me)return et(t),null}else 2*Qt()-i.renderingStartTime>To&&s!==536870912&&(t.flags|=128,u=!0,ki(i,!1),t.lanes=4194304);i.isBackwards?(d.sibling=t.child,t.child=d):(e=i.last,e!==null?e.sibling=d:t.child=d,i.last=d)}if(i.tail!==null){e=i.tail;e:{for(s=e;s!==null;){if(s.alternate!==null){s=!1;break e}s=s.sibling}s=!0}return i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Qt(),e.sibling=null,d=wt.current,d=u?d&1|2:d&1,i.tailMode==="visible"||i.tailMode==="collapsed"||!s||Me?gi(t,d):(s=d,Ge(jt,t),Ge(wt,s),At===null&&(At=t)),Me&&os(t,i.treeForkCount),e}return et(t),null;case 22:case 23:return en(t),ku(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),s=t.updateQueue,s!==null&&mo(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&ot(fl),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),us(ct),et(t),null;case 25:return null;case 30:return t.flags|=33554432,et(t),null}throw Error(o(156,t.tag))}function aj(e,t){switch(ru(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return us(ct),Hl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xr(t),null;case 31:if(t.memoizedState!==null){if(en(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(en(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return wu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Hl(),null;case 10:return us(t.type),null;case 22:case 23:return en(t),ku(),e!==null&&ot(fl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return us(ct),null;case 25:return null;default:return null}}function pg(e,t){switch(ru(t),t.tag){case 3:us(ct),Hl();break;case 26:case 27:case 5:xr(t);break;case 4:Hl();break;case 31:t.memoizedState!==null&&en(t);break;case 13:en(t);break;case 19:wu(t);break;case 10:us(t.type);break;case 22:case 23:en(t),ku(),e!==null&&ot(fl);break;case 24:us(ct)}}function ji(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var u=i.next;s=u;do{if((s.tag&e)===e){i=void 0;var d=s.create,x=s.inst;i=d(),x.destroy=i}s=s.next}while(s!==u)}}catch(w){Ve(t,t.return,w)}}function Us(e,t,s){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var d=u.next;i=d;do{if((i.tag&e)===e){var x=i.inst,w=x.destroy;if(w!==void 0){x.destroy=void 0,u=t;var O=s,B=w;try{B()}catch(G){Ve(u,O,G)}}}i=i.next}while(i!==d)}}catch(G){Ve(t,t.return,G)}}function gg(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{ap(t,s)}catch(i){Ve(e,e.return,i)}}}function vg(e,t,s){s.props=vl(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Ve(e,t,i)}}function Yn(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:var u=e.stateNode,d=as(e.memoizedProps,u);(u.ref===null||u.ref.name!==d)&&(u.ref=Nv(d)),i=u.ref;break;case 7:if(e.stateNode===null){var x=new an(e);b(e.child,!1,Qj,x,void 0,void 0),e.stateNode=x}i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(w){Ve(e,t,w)}}function Nt(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(u){Ve(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Ve(e,t,u)}else s.current=null}function po(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var s=0;s<t.length;s++)Mv(e.stateNode,t[s])}function xg(e){for(var t=e.return;t!==null&&(ed(t)&&Mv(e.stateNode,t.stateNode),!Wu(t));)t=t.return}function wi(e){for(var t=e.return;t!==null&&(ed(t)&&Jj(e.stateNode,t.stateNode),!Wu(t));)t=t.return}function Wu(e){return e.tag===5||e.tag===3||e.tag===27}function ed(e){return e&&e.tag===7&&e.stateNode!==null}function td(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(u){Ve(e,e.return,u)}}function nd(e,t,s){try{var i=e.stateNode;zj(i,e.type,s,t),i[Bt]=t}catch(u){Ve(e,e.return,u)}}function bg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Gs(e.type)||e.tag===4}function sd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Gs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ld(e,t,s,i){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(u,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(u),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Bn)),po(e,i),qe=!0;else if(u!==4&&(u===27&&(po(e,i),i=null,Gs(e.type)&&(s=e.stateNode,t=null)),e=e.child,e!==null))for(ld(e,t,s,i),e=e.sibling;e!==null;)ld(e,t,s,i),e=e.sibling}function go(e,t,s,i){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?s.insertBefore(u,t):s.appendChild(u),po(e,i),qe=!0;else if(u!==4&&(u===27&&(po(e,i),i=null,Gs(e.type)&&(s=e.stateNode)),e=e.child,e!==null))for(go(e,t,s,i),e=e.sibling;e!==null;)go(e,t,s,i),e=e.sibling}function yg(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);St(t,i,s),t[yt]=e,t[Bt]=s}catch(d){Ve(e,e.return,d)}}var vo=!1,tn=null;function kg(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(vo=!0)}var Gn=null;function jg(){var e=Gn;return Gn=null,e}var It=0;function ca(e,t,s,i,u){return It=0,wg(e.child,t,s,i,u)}function wg(e,t,s,i,u){for(var d=!1;e!==null;){if(e.tag===5){var x=e.stateNode;if(i!==null){var w=qd(x);i.push(w),w.view&&(d=!0)}else d||qd(x).view&&(d=!0);vo=!0,jv(x,It===0?t:t+"_"+It,s),It++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||wg(e.child,t,s,i,u)&&(d=!0));e=e.sibling}return d}function Kn(e,t){for(;e!==null;)e.tag===5?wv(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Kn(e.child,t)),e=e.sibling}function xo(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(xo(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(o(544));var s=t.name;t=is(t.default,t.share),t!=="none"&&(ca(e,s,t,null,!1)||Kn(e.child,!1))}e=e.sibling}}function ad(e,t){if(e.tag===30){var s=e.stateNode,i=e.memoizedProps,u=as(i,s),d=is(i.default,s.paired?i.share:i.enter);d!=="none"?ca(e,u,d,null,!1)?(xo(e),s.paired||t||va(e,i.onEnter)):Kn(e.child,!1):xo(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)ad(e,t),e=e.sibling;else xo(e)}function id(e){if(tn!==null&&tn.size!==0){var t=tn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var s=e.memoizedProps,i=s.name;if(i!=null&&i!=="auto"){var u=t.get(i);if(u!==void 0){var d=is(s.default,s.share);if(d!=="none"&&(ca(e,i,d,null,!1)?(d=e.stateNode,u.paired=d,d.paired=u,va(e,s.onShare)):Kn(e.child,!1)),t.delete(i),t.size===0)break}}}id(e)}e=e.sibling}}}function rd(e){if(e.tag===30){var t=e.memoizedProps,s=as(t,e.stateNode),i=tn!==null?tn.get(s):void 0,u=is(t.default,i!==void 0?t.share:t.exit);u!=="none"&&(ca(e,s,u,null,!1)?i!==void 0?(u=e.stateNode,i.paired=u,u.paired=i,tn.delete(s),va(e,t.onShare)):va(e,t.onExit):Kn(e.child,!1)),tn!==null&&id(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)rd(e),e=e.sibling;else tn!==null&&id(e)}function Ng(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,s=as(t,e.stateNode);t=is(t.default,t.update),e.flags&=-5,t!=="none"&&ca(e,s,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Ng(e);e=e.sibling}}function od(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Kn(e.child,!1))}od(e)}e=e.sibling}}function bo(e){if(e.tag===30)e.stateNode.paired=null,Kn(e.child,!1),od(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)bo(e),e=e.sibling;else od(e)}function Sg(e){for(e=e.child;e!==null;)e.tag===30?Kn(e.child,!1):(e.subtreeFlags&33554432)!==0&&Sg(e),e=e.sibling}function cd(e,t,s,i,u,d,x){for(var w=!1;t!==null;){if(t.tag===5){var O=t.stateNode;if(d!==null&&It<d.length){var B=d[It],G=qd(O);(B.view||G.view)&&(w=!0);var Q;if(Q=(e.flags&4)===0)if(G.clip)Q=!0;else{Q=B.rect;var U=G.rect;Q=Q.y!==U.y||Q.x!==U.x||Q.height!==U.height||Q.width!==U.width}Q&&(e.flags|=4),G.abs?G=!B.abs:(B=B.rect,G=G.rect,G=B.height!==G.height||B.width!==G.width),G&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&jv(O,It===0?s:s+"_"+It,u),w&&(e.flags&4)!==0||(Gn===null&&(Gn=[]),Gn.push(O,It===0?i:i+"_"+It,t.memoizedProps)),It++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&x?e.flags|=t.flags&32:cd(e,t.child,s,i,u,d,x)&&(w=!0));t=t.sibling}return w}function Tg(e,t){for(e=e.child;e!==null;){if(e.tag===30){var s=e.memoizedProps,i=e.stateNode,u=as(s,i),d=is(s.default,s.update),x;x=e.memoizedState,e.memoizedState=null,i=e;var w=e.child;It=0,u=cd(i,w,u,u,d,x,!1),(e.flags&4)!==0&&u&&va(e,s.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Tg(e);e=e.sibling}}var vt=!1,Ye=!1,Vn=!1,ud=!1,Cg=typeof WeakSet=="function"?WeakSet:Set,xt=null,Xn=!1,Ni=!1,yo=!1,dd=!1;function ij(e,t,s){if(e=e.containerInfo,$d=Ca,e=zm(e),Pc(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var d=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{i.nodeType,x.nodeType}catch{i=null;break e}var w=0,O=-1,B=-1,G=0,Q=0,U=e,I=null;t:for(;;){for(var re;U!==i||d!==0&&U.nodeType!==3||(O=w+d),U!==x||u!==0&&U.nodeType!==3||(B=w+u),U.nodeType===3&&(w+=U.nodeValue.length),(re=U.firstChild)!==null;)I=U,U=re;for(;;){if(U===e)break t;if(I===i&&++G===d&&(O=w),I===x&&++Q===u&&(B=w),(re=U.nextSibling)!==null)break;U=I,I=U.parentNode}U=re}i=O===-1||B===-1?null:{start:O,end:B}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ud={focusedElem:e,selectionRange:i},Ca=!1,s=(s&335544064)===s,xt=t,t=s?9270:1024;xt!==null;){if(e=xt,s&&(i=e.deletions,i!==null))for(d=0;d<i.length;d++)s&&rd(i[d]);if(e.alternate===null&&(e.flags&2)!==0)s&&kg(e),ko(s);else{if(e.tag===22){if(i=e.alternate,e.memoizedState!==null){i!==null&&i.memoizedState===null&&s&&rd(i),ko(s);continue}else if(i!==null&&i.memoizedState!==null){s&&kg(e),ko(s);continue}}i=e.child,(e.subtreeFlags&t)!==0&&i!==null?(i.return=e,xt=i):(s&&Ng(e),ko(s))}}tn=null}function ko(e){for(;xt!==null;){var t=xt,s=e,i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&i!==null){s=void 0,u=i.memoizedProps,i=i.memoizedState;var d=t.stateNode;try{var x=vl(t.type,u);s=d.getSnapshotBeforeUpdate(x,i),d.__reactInternalSnapshotBeforeUpdate=s}catch(w){Ve(t,t.return,w)}}break;case 3:if((u&1024)!==0){if(i=t.stateNode.containerInfo,s=i.nodeType,s===9)Gd(i);else if(s===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Gd(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:s&&i!==null&&(s=as(i.memoizedProps,i.stateNode),u=t.memoizedProps,u=is(u.default,u.update),u!=="none"&&ca(i,s,u,i.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(o(163))}if(i=t.sibling,i!==null){i.return=t.return,xt=i;break}xt=t.return}}function Eg(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Zn(e,s),i&4&&ji(5,s);break;case 1:if(Zn(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(x){Ve(s,s.return,x)}else{var u=vl(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Ve(s,s.return,x)}}i&64&&gg(s),i&512&&Yn(s,s.return);break;case 3:if(Zn(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{ap(e,t)}catch(x){Ve(s,s.return,x)}}break;case 27:t===null&&i&4&&yg(s);case 26:case 5:Zn(e,s),t===null&&i&4&&td(s),i&512&&Yn(s,s.return);break;case 12:Zn(e,s);break;case 31:Zn(e,s),i&4&&Og(e,s);break;case 13:Zn(e,s),i&4&&_g(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=xj.bind(null,s),Wj(e,s))));break;case 22:if(i=s.memoizedState!==null||vt,!i){var d=t!==null&&t.memoizedState!==null||Ye;t=vt,u=Ye,vt=i,(Ye=d)&&!u?(i=2,(s.subtreeFlags&8772)!==0&&(i|=1),On(e,s,i)):Zn(e,s),vt=t,Ye=u}break;case 30:Zn(e,s),i&512&&Yn(s,s.return);break;case 7:i&512&&Yn(s,s.return);default:Zn(e,s)}}function fd(e,t){for(e=e.child;e!==null;)Ag(e,t),e=e.sibling}function Ag(e,t){switch(e.tag){case 5:case 26:try{var s=e.stateNode;if(t){var i=s.style;typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"}else{var u=e.stateNode,d=e.memoizedProps.style,x=d!=null&&d.hasOwnProperty("display")?d.display:null;u.style.display=x==null||typeof x=="boolean"?"":(""+x).trim()}}catch(O){Ve(e,e.return,O)}hd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,qe=!0}catch(O){Ve(e,e.return,O)}break;case 18:try{var w=e.stateNode;t?kv(w,!0):kv(e.stateNode,!1)}catch(O){Ve(e,e.return,O)}break;case 22:case 23:e.memoizedState===null&&fd(e,t);break;default:fd(e,t)}}function hd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var s=e,i=t;switch(s.tag){case 4:Ag(s,i);break e;case 22:s.memoizedState===null&&hd(s,i);break e;default:hd(s,i)}}e=e.sibling}}function Mg(e){var t=e.alternate;t!==null&&(e.alternate=null,Mg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Sr(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tt=null,Yt=!1;function Mn(e,t,s){for(s=s.child;s!==null;)zg(e,t,s),s=s.sibling}function zg(e,t,s){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(Xa,s)}catch{}switch(s.tag){case 26:Ye||Nt(s,t),Mn(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&!Ye&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Ye||Nt(s,t),wi(s);var i=tt,u=Yt;Gs(s.type)&&(tt=s.stateNode,Yt=!1),Mn(e,t,s),Dv(s.stateNode,s.type,s.memoizedProps),tt=i,Yt=u;break;case 5:Ye||Nt(s,t),wi(s);case 6:if(s.tag===6&&wi(s),i=tt,u=Yt,tt=null,Mn(e,t,s),tt=i,Yt=u,tt!==null)if(Yt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(s.stateNode),qe=!0}catch(d){Ve(s,t,d)}else try{tt.removeChild(s.stateNode),qe=!0}catch(d){Ve(s,t,d)}break;case 18:tt!==null&&(Yt?(e=tt,yv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Ea(e)):yv(tt,s.stateNode));break;case 4:i=tt,u=Yt,tt=s.stateNode.containerInfo,Yt=!0,Mn(e,t,s),tt=i,Yt=u;break;case 0:case 11:case 14:case 15:Us(2,s,t),Ye||Us(4,s,t),Mn(e,t,s);break;case 1:Ye||(Nt(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&vg(s,t,i)),Mn(e,t,s);break;case 21:Mn(e,t,s);break;case 22:Ye=(i=Ye)||s.memoizedState!==null,Mn(e,t,s),Ye=i;break;case 30:Nt(s,t),Mn(e,t,s);break;case 7:Ye||Nt(s,t),Mn(e,t,s);break;default:Mn(e,t,s)}}function Og(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ea(e)}catch(s){Ve(t,t.return,s)}}}function _g(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ea(e)}catch(s){Ve(t,t.return,s)}}function rj(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Cg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Cg),t;default:throw Error(o(435,e.tag))}}function jo(e,t){var s=rj(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=bj.bind(null,e,i);i.then(u,u)}})}function $t(e,t,s){var i=t.deletions;if(i!==null)for(var u=0;u<i.length;u++){var d=i[u],x=e,w=t,O=w;e:for(;O!==null;){switch(O.tag){case 27:if(Gs(O.type)){tt=O.stateNode,Yt=!1;break e}break;case 5:tt=O.stateNode,Yt=!1;break e;case 3:case 4:tt=O.stateNode.containerInfo,Yt=!0;break e}O=O.return}if(tt===null)throw Error(o(160));zg(x,w,d),tt=null,Yt=!1,x=d.alternate,x!==null&&(x.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Rg(t,e,s),t=t.sibling}var zn=null;function Rg(e,t,s){var i=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(u&4&&(i=e.updateQueue,i=i!==null?i.events:null,i!==null))for(var d=0;d<i.length;d++){var x=i[d];x.ref.impl=x.nextImpl}$t(t,e,s),Ut(e),u&4&&(Us(3,e,e.return),ji(3,e),Us(5,e,e.return));break;case 1:$t(t,e,s),Ut(e),u&512&&(Ye||i===null||Nt(i,i.return)),u&64&&vt&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?t:s.concat(t))));break;case 26:if(d=zn,$t(t,e,s),Ut(e),u&512&&(Ye||i===null||Nt(i,i.return)),u&4)if(u=i!==null?i.memoizedState:null,s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null)if(vt)e.stateNode=vv(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,s=e.memoizedProps,u=d.ownerDocument||d;t:switch(t){case"title":i=u.getElementsByTagName("title")[0],(!i||i[Ja]||i[yt]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=u.createElement(t),u.head.insertBefore(i,u.querySelector("head > title"))),St(i,t,s),i[yt]=e,pt(i),t=i;break e;case"link":if(d=qv("link","href",u).get(t+(s.href||""))){for(x=0;x<d.length;x++)if(i=d[x],i.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&i.getAttribute("rel")===(s.rel==null?null:s.rel)&&i.getAttribute("title")===(s.title==null?null:s.title)&&i.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){d.splice(x,1);break t}}i=u.createElement(t),St(i,t,s),u.head.appendChild(i);break;case"meta":if(d=qv("meta","content",u).get(t+(s.content||""))){for(x=0;x<d.length;x++)if(i=d[x],i.getAttribute("content")===(s.content==null?null:""+s.content)&&i.getAttribute("name")===(s.name==null?null:s.name)&&i.getAttribute("property")===(s.property==null?null:s.property)&&i.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&i.getAttribute("charset")===(s.charSet==null?null:s.charSet)){d.splice(x,1);break t}}i=u.createElement(t),St(i,t,s),u.head.appendChild(i);break;default:throw Error(o(468,t))}i[yt]=e,pt(i),t=i}e.stateNode=t}else vt||Pd(d,e.type,e.stateNode);else e.stateNode=Bv(d,s,e.memoizedProps);else u!==s?(u===null?(t=i.stateNode,t===null||Ye||t.parentNode.removeChild(t)):u.count--,s===null?vt||Pd(d,e.type,e.stateNode):Bv(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&nd(e,e.memoizedProps,i.memoizedProps);break;case 27:$t(t,e,s),Ut(e),u&512&&(Ye||i===null||Nt(i,i.return)),i!==null&&u&4&&nd(e,e.memoizedProps,i.memoizedProps);break;case 5:if(d=Vn,Vn=!1,$t(t,e,s),Vn=d,Ut(e),u&512&&(Ye||i===null||Nt(i,i.return)),e.flags&32){t=e.stateNode;try{Kl(t,""),qe=!0}catch(G){Ve(e,e.return,G)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,nd(e,t,i!==null?i.memoizedProps:t)),u&1024&&(ud=!0);break;case 6:if($t(t,e,s),Ut(e),u&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,s=e.stateNode;try{s.nodeValue=t,qe=!0}catch(G){Ve(e,e.return,G)}}break;case 3:if(qe=!1,Uo=null,d=zn,zn=_i(t.containerInfo),$t(t,e,s),zn=d,Ut(e),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Ea(t.containerInfo)}catch(G){Ve(e,e.return,G)}ud&&(ud=!1,Dg(e)),qe=!1;break;case 4:u=Vn,Vn=vt,i=tm(),d=zn,zn=_i(e.stateNode.containerInfo),$t(t,e,s),Ut(e),zn=d,qe&&Ni&&(yo=!0),qe=i,Vn=u;break;case 12:$t(t,e,s),Ut(e);break;case 31:$t(t,e,s),Ut(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jo(e,t)));break;case 13:$t(t,e,s),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(So=Qt()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jo(e,t)));break;case 22:d=e.memoizedState!==null,x=i!==null&&i.memoizedState!==null;var w=vt,O=Ye,B=Vn;vt=w||d,Vn=B||d,Ye=O||x,$t(t,e,s),Ye=O,Vn=B,vt=w,Ut(e),u&8192&&(t=e.stateNode,t._visibility=d?t._visibility&-2:t._visibility|1,!d||i===null||x||vt||Ye||(t=x||Ye,s=vt,i=Ye,vt=d||vt,Ye=t,Ls(e,2),vt=s,Ye=i),!d&&Vn||fd(e,d)),u&4&&(t=e.updateQueue,t!==null&&(s=t.retryQueue,s!==null&&(t.retryQueue=null,jo(e,s))));break;case 19:$t(t,e,s),Ut(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jo(e,t)));break;case 30:u&512&&(Ye||i===null||Nt(i,i.return)),u=tm(),d=Ni,x=(s&335544064)===s,w=e.memoizedProps,Ni=x&&is(w.default,w.update)!=="none",$t(t,e,s),Ut(e),x&&i!==null&&qe&&(e.flags|=4),Ni=d,qe=u;break;case 21:break;case 7:u&512&&(Ye||i===null||Nt(i,i.return)),i&&i.stateNode!==null&&(i.stateNode._fragmentFiber=e);default:$t(t,e,s),Ut(e)}}function Ut(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(bg(i)){s=i;break}i=i.return}i=null;for(var u=e.return;u!==null;){if(ed(u)){var d=u.stateNode;i===null?i=[d]:i.push(d)}if(Wu(u))break;u=u.return}var x=i;if(s==null)throw Error(o(160));switch(s.tag){case 27:var w=s.stateNode,O=sd(e);go(e,O,w,x);break;case 5:var B=s.stateNode;s.flags&32&&(Kl(B,""),s.flags&=-33);var G=sd(e);go(e,G,B,x);break;case 3:case 4:var Q=s.stateNode.containerInfo,U=sd(e);ld(e,U,Q,x);break;default:throw Error(o(161))}}catch(I){Ve(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Dg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Dg(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Ca=!0,t.reset(),Ca=!1),e=e.sibling}}function ua(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)$g(t,e),t=t.sibling;else Tg(t)}function $g(e,t){var s=e.alternate;if(s===null)ad(e,!1);else switch(e.tag){case 3:if(dd=Xn=!1,jg(),ua(t,e),!Xn&&!yo){if(e=Gn,e!==null)for(var i=0;i<e.length;i+=3){s=e[i];var u=e[i+1];wv(s,e[i+2]),s=s.ownerDocument.documentElement,s!==null&&s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),dd=!0}Gn=null;break;case 5:ua(t,e);break;case 4:i=Xn,Xn=!1,ua(t,e),Xn&&(yo=!0),Xn=i;break;case 22:e.memoizedState===null&&(s.memoizedState!==null?ad(e,!1):ua(t,e));break;case 30:i=Xn,u=jg(),Xn=!1,ua(t,e),Xn&&(e.flags|=4);var d=e.memoizedProps,x=e.stateNode;t=as(d,x),x=as(s.memoizedProps,x);var w=is(d.default,d.update);w==="none"?t=!1:(d=s.memoizedState,s.memoizedState=null,s=e.child,It=0,t=cd(e,s,t,x,w,d,!0),It!==(d===null?0:d.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(va(e,e.memoizedProps.onUpdate),Gn=u):u!==null&&(u.push.apply(u,Gn),Gn=u),Xn=(e.flags&32)!==0?!0:i;break;default:ua(t,e)}}function Zn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Eg(e,t.alternate,t),t=t.sibling}function Ls(e,t){for(e=e.child;e!==null;){var s=e,i=t;switch(s.tag){case 0:case 11:case 14:case 15:Us(4,s,s.return),Ls(s,i);break;case 1:Nt(s,s.return);var u=s.stateNode;typeof u.componentWillUnmount=="function"&&vg(s,s.return,u),Ls(s,i);break;case 27:(i&2)!==0&&Dv(s.stateNode,s.type,s.memoizedProps);case 5:Nt(s,s.return),s.tag!==5&&s.tag!==27||wi(s),Ls(s,i);break;case 6:wi(s);break;case 26:Nt(s,s.return),u=s.stateNode,s.memoizedState!==null||u===null||Ye||u.parentNode.removeChild(u),Ls(s,i);break;case 22:s.memoizedState===null&&Ls(s,i);break;case 30:Nt(s,s.return),Ls(s,i);break;case 7:Nt(s,s.return);default:Ls(s,i)}e=e.sibling}}function On(e,t,s){for(s=(t.subtreeFlags&8772)!==0?s:s&-2,t=t.child;t!==null;){var i=t.alternate,u=e,d=t,x=d.flags,w=(s&1)!==0;switch(d.tag){case 0:case 11:case 15:On(u,d,s),ji(4,d);break;case 1:if(On(u,d,s),i=d,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(G){Ve(i,i.return,G)}if(i=d,u=i.updateQueue,u!==null){var O=i.stateNode;try{var B=u.shared.hiddenCallbacks;if(B!==null)for(u.shared.hiddenCallbacks=null,u=0;u<B.length;u++)lp(B[u],O)}catch(G){Ve(i,i.return,G)}}w&&x&64&&gg(d),Yn(d,d.return);break;case 27:(s&2)!==0&&yg(d);case 5:d.tag!==5&&d.tag!==27||xg(d),On(u,d,s),w&&i===null&&x&4&&td(d),Yn(d,d.return);break;case 6:xg(d);break;case 26:O=d.stateNode,d.memoizedState!==null||O===null||vt||Pd(_i(O.ownerDocument),d.type,O),On(u,d,s),w&&i===null&&x&4&&td(d),Yn(d,d.return);break;case 12:On(u,d,s);break;case 31:On(u,d,s),w&&x&4&&Og(u,d);break;case 13:On(u,d,s),w&&x&4&&_g(u,d);break;case 22:d.memoizedState===null&&On(u,d,s),Yn(d,d.return);break;case 30:On(u,d,s),Yn(d,d.return);break;case 7:Yn(d,d.return);default:On(u,d,s)}t=t.sibling}}function md(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&ci(s))}function pd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ci(e))}function vn(e,t,s,i){var u=(s&335544064)===s;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)Ug(e,t,s,i),t=t.sibling;else u&&Sg(t)}function Ug(e,t,s,i){var u=(s&335544064)===s;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&bo(t);var d=t.flags;switch(t.tag){case 0:case 11:case 15:vn(e,t,s,i),d&2048&&ji(9,t);break;case 1:vn(e,t,s,i);break;case 3:vn(e,t,s,i),u&&dd&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),d&2048&&(d=null,t.alternate!==null&&(d=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==d&&(t.refCount++,d!=null&&ci(d)));break;case 12:if(d&2048){vn(e,t,s,i),d=t.stateNode;try{var x=t.memoizedProps,w=x.id,O=x.onPostCommit;typeof O=="function"&&O(w,t.alternate===null?"mount":"update",d.passiveEffectDuration,-0)}catch(B){Ve(t,t.return,B)}}else vn(e,t,s,i);break;case 31:vn(e,t,s,i);break;case 13:vn(e,t,s,i);break;case 23:break;case 22:x=t.stateNode,w=t.alternate,t.memoizedState!==null?(u&&w!==null&&w.memoizedState===null&&bo(w),x._visibility&2?vn(e,t,s,i):Si(e,t)):(u&&w!==null&&w.memoizedState!==null&&bo(t),x._visibility&2?vn(e,t,s,i):(x._visibility|=2,da(e,t,s,i,(t.subtreeFlags&10256)!==0||!1))),d&2048&&md(w,t);break;case 24:vn(e,t,s,i),d&2048&&pd(t.alternate,t);break;case 30:u&&(d=t.alternate,d!==null&&(Kn(d.child,!0),Kn(t.child,!0))),vn(e,t,s,i);break;default:vn(e,t,s,i)}}function da(e,t,s,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,x=t,w=s,O=i,B=x.flags;switch(x.tag){case 0:case 11:case 15:da(d,x,w,O,u),ji(8,x);break;case 23:break;case 22:var G=x.stateNode;x.memoizedState!==null?G._visibility&2?da(d,x,w,O,u):Si(d,x):(G._visibility|=2,da(d,x,w,O,u)),u&&B&2048&&md(x.alternate,x);break;case 24:da(d,x,w,O,u),u&&B&2048&&pd(x.alternate,x);break;default:da(d,x,w,O,u)}t=t.sibling}}function Si(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,u=i.flags;switch(i.tag){case 22:Si(s,i),u&2048&&md(i.alternate,i);break;case 24:Si(s,i),u&2048&&pd(i.alternate,i);break;default:Si(s,i)}t=t.sibling}}var xl=8192;function bl(e,t,s){if(e.subtreeFlags&xl)for(e=e.child;e!==null;)Lg(e,t,s),e=e.sibling}function Lg(e,t,s){switch(e.tag){case 26:bl(e,t,s),e.flags&xl&&(e.memoizedState!==null?h1(s,zn,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&Kv(s,e)));break;case 5:bl(e,t,s),e.flags&xl&&(e=e.stateNode,(t&335544128)===t&&Kv(s,e));break;case 3:case 4:var i=zn;zn=_i(e.stateNode.containerInfo),bl(e,t,s),zn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=xl,xl=16777216,bl(e,t,s),xl=i):bl(e,t,s));break;case 30:if((e.flags&xl)!==0&&(i=e.memoizedProps.name,i!=null&&i!=="auto")){var u=e.stateNode;u.paired=null,tn===null&&(tn=new Map),tn.set(i,u)}bl(e,t,s);break;default:bl(e,t,s)}}function Hg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ti(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];xt=i,qg(i,e)}Hg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Bg(e),e=e.sibling}function Bg(e){switch(e.tag){case 0:case 11:case 15:Ti(e),e.flags&2048&&Us(9,e,e.return);break;case 3:Ti(e);break;case 12:Ti(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,wo(e)):Ti(e);break;default:Ti(e)}}function wo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];xt=i,qg(i,e)}Hg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Us(8,t,t.return),wo(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,wo(t));break;default:wo(t)}e=e.sibling}}function qg(e,t){for(;xt!==null;){var s=xt;switch(s.tag){case 0:case 11:case 15:Us(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ci(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,xt=i;else e:for(s=e;xt!==null;){i=xt;var u=i.sibling,d=i.return;if(Mg(i),i===s){xt=null;break e}if(u!==null){u.return=d,xt=u;break e}xt=d}}}var oj={getCacheForType:function(e){var t=kt(ct),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return kt(ct).controller.signal}},cj=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Je=null,Re=null,$e=0,Ke=0,nn=null,Hs=!1,fa=!1,gd=!1,ps=0,at=0,Bs=0,yl=0,No=0,sn=0,ha=0,Ci=null,Gt=null,vd=!1,So=0,Ig=0,To=1/0,Co=null,qs=null,nt=0,_n=null,kl=null,Qn=0,xd=0,bd=null,Yg=null,ma=null,pa=null,ga=null,Ei=0,Eo=null;function ln(){return(Ie&2)!==0&&$e!==0?$e&-$e:ce.T!==null?Ad():Vh()}function Gg(){if(sn===0)if(($e&536870912)===0||Me){var e=kr;kr<<=1,(kr&3932160)===0&&(kr=262144),sn=e}else sn=536870912;return e=jt.current,e!==null&&(e.flags|=32),sn}function va(e,t){if(t!=null){var s=e.stateNode,i=s.ref;i===null&&(i=s.ref=Nv(as(e.memoizedProps,s))),pa===null&&(pa=[]),pa.push(t.bind(null,i))}}function Kt(e,t,s){(e===Je&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(xa(e,0),Is(e,$e,sn,!1)),Qa(e,s),((Ie&2)===0||e!==Je)&&(e===Je&&((Ie&2)===0&&(yl|=s),at===4&&Is(e,$e,sn,!1)),Jn(e))}function Kg(e,t,s){if((Ie&6)!==0)throw Error(o(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Za(e,t),u=i?fj(e,t):kd(e,t,!0),d=i;do{if(u===0){fa&&!i&&Is(e,t,0,!1);break}else{if(s=e.current.alternate,d&&!uj(s)){u=kd(e,t,!1),d=!1;continue}if(u===2){if(d=t,e.errorRecoveryDisabledLanes&d)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){t=x;e:{var w=e;u=Ci;var O=w.current.memoizedState.isDehydrated;if(O&&(xa(w,x).flags|=256),x=kd(w,x,!1),x!==2&&x!==6){if(gd&&!O){w.errorRecoveryDisabledLanes|=d,yl|=d,u=4;break e}d=Gt,Gt=u,d!==null&&(Gt===null?Gt=d:Gt.push.apply(Gt,d))}u=x}if(d=!1,u!==2)continue}}if(u===1){xa(e,0),Is(e,t,0,!0);break}e:{switch(i=e,d=u,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Is(i,t,sn,!Hs);break e;case 2:Gt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=So+300-Qt(),10<u)){if(Is(i,t,sn,!Hs),wr(i,0,!0)!==0)break e;Qn=t,i.timeoutHandle=Bd(Vg.bind(null,i,s,Gt,Co,vd,t,sn,yl,ha,Hs,d,"Throttled",-0,0),u);break e}Vg(i,s,Gt,Co,vd,t,sn,yl,ha,Hs,d,null,-0,0)}}break}while(!0);Jn(e)}function Vg(e,t,s,i,u,d,x,w,O,B,G,Q,U,I){e.timeoutHandle=-1;var re=t.subtreeFlags,ge=(d&335544064)===d;if(Q=null,(ge||re&8192||(re&16785408)===16785408)&&(Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bn},tn=null,Lg(t,d,Q),ge&&(re=Q,ge=e.containerInfo,ge=(ge.nodeType===9?ge:ge.ownerDocument).__reactViewTransition,ge!=null&&(re.count++,re.waitingForViewTransition=!0,re=$i.bind(re),ge.finished.then(re,re))),re=(d&62914560)===d?So-Qt():(d&4194048)===d?Ig-Qt():0,re=m1(Q,re),re!==null)){Qn=d,e.cancelPendingCommit=re(ev.bind(null,e,t,d,s,i,u,x,w,O,B,G,Q,null,U,I)),Is(e,d,x,!B);return}ev(e,t,d,s,i,u,x,w,O,B,G,Q)}function uj(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var u=s[i],d=u.getSnapshot;u=u.value;try{if(!Wt(d(),u))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Is(e,t,s,i){t=qh(e,t),t&=~No,t&=~yl,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var d=31-Pt(u),x=1<<d;i[d]=-1,u&=~x}s!==0&&Yh(e,s,t)}function Ao(){return(Ie&6)===0?(Ai(0),!1):!0}function yd(){if(Re!==null){if(Ke===0)var e=Re.return;else e=Re,cs=ol=null,Eu(e),la=null,fi=0,e=Re;for(;e!==null;)pg(e.alternate,e),e=e.return;Re=null}}function xa(e,t){var s=e.timeoutHandle;return s!==-1&&(e.timeoutHandle=-1,Rj(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Qn=0,yd(),Je=e,Re=s=rs(e.current,null),$e=t,Ke=0,nn=null,Hs=!1,fa=Za(e,t),gd=!1,ha=sn=No=yl=Bs=at=0,Gt=Ci=null,vd=!1,ps=qh(e,t),$r(),s}function Xg(e,t){Ce=null,ce.H=ro,t===sa||t===Xr?(t=ep(),Ke=3):t===pu?(t=ep(),Ke=4):Ke=t===Yu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,nn=t,Re===null&&(at=1,oo(e,hn(t,e.current)))}function Zg(){var e=jt.current;return e===null?!0:($e&4194048)===$e?At===null:($e&62914560)===$e||($e&536870912)!==0?e===At:!1}function Qg(){var e=ce.H;return ce.H=ro,e===null?ro:e}function Jg(){var e=ce.A;return ce.A=oj,e}function Mo(){at=4,Hs||($e&4194048)!==$e&&jt.current!==null||(fa=!0),(Bs&134217727)===0&&(yl&134217727)===0||Je===null||Is(Je,$e,sn,!1)}function kd(e,t,s){var i=Ie;Ie|=2;var u=Qg(),d=Jg();(Je!==e||$e!==t)&&(Co=null,xa(e,t)),t=!1;var x=at;e:do try{if(Ke!==0&&Re!==null){var w=Re,O=nn;switch(Ke){case 8:yd(),x=6;break e;case 3:case 2:case 9:case 6:jt.current===null&&(t=!0);var B=Ke;if(Ke=0,nn=null,ba(e,w,O,B),s&&fa){x=0;break e}break;default:B=Ke,Ke=0,nn=null,ba(e,w,O,B)}}dj(),x=at;break}catch(G){Xg(e,G)}while(!0);return t&&e.shellSuspendCounter++,cs=ol=null,Ie=i,ce.H=u,ce.A=d,Re===null&&(Je=null,$e=0,$r()),x}function dj(){for(;Re!==null;)Pg(Re)}function fj(e,t){var s=Ie;Ie|=2;var i=Qg(),u=Jg();Je!==e||$e!==t?(Co=null,To=Qt()+500,xa(e,t)):fa=Za(e,t);e:do try{if(Ke!==0&&Re!==null){t=Re;var d=nn;t:switch(Ke){case 1:Ke=0,nn=null,ba(e,t,d,1);break;case 2:case 9:if(Fm(d)){Ke=0,nn=null,Fg(t);break}t=function(){Ke!==2&&Ke!==9||Je!==e||(Ke=7),Jn(e)},d.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:Fm(d)?(Ke=0,nn=null,Fg(t)):(Ke=0,nn=null,ba(e,t,d,7));break;case 5:var x=null;switch(Re.tag){case 26:x=Re.memoizedState;case 5:case 27:var w=Re;if(x?Yv(x):w.stateNode.complete){Ke=0,nn=null;var O=w.sibling;if(O!==null)Re=O;else{var B=w.return;B!==null?(Re=B,zo(B)):Re=null}break t}}Ke=0,nn=null,ba(e,t,d,5);break;case 6:Ke=0,nn=null,ba(e,t,d,6);break;case 8:yd(),at=6;break e;default:throw Error(o(462))}}hj();break}catch(G){Xg(e,G)}while(!0);return cs=ol=null,ce.H=i,ce.A=u,Ie=s,Re!==null?0:(Je=null,$e=0,$r(),at)}function hj(){for(;Re!==null&&!My();)Pg(Re)}function Pg(e){var t=hg(e.alternate,e,ps);e.memoizedProps=e.pendingProps,t===null?zo(e):Re=t}function Fg(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=ig(s,t,t.pendingProps,t.type,void 0,$e);break;case 11:t=ig(s,t,t.pendingProps,t.type.render,t.ref,$e);break;case 5:Eu(t);var i=t;i===gt&&(Me?(Ir(i),i.tag===5&&i.stateNode!=null&&(We=i.stateNode)):(Ir(i),Me=!0));default:pg(s,t),t=Re=qm(t,ps),t=hg(s,t,ps)}e.memoizedProps=e.pendingProps,t===null?zo(e):Re=t}function ba(e,t,s,i){cs=ol=null,Eu(t),la=null,fi=0;var u=t.return;try{if(ej(e,u,t,s,$e)){at=1,oo(e,hn(s,e.current)),Re=null;return}}catch(d){if(u!==null)throw Re=u,d;at=1,oo(e,hn(s,e.current)),Re=null;return}t.flags&32768?(Me||i===1?e=!0:fa||($e&536870912)!==0?e=!1:(Hs=e=!0,(i===2||i===9||i===3||i===6)&&(i=jt.current,i!==null&&i.tag===13&&(i.flags|=16384))),Wg(t,e)):zo(t)}function zo(e){var t=e;do{if((t.flags&32768)!==0){Wg(t,Hs);return}e=t.return;var s=lj(t.alternate,t,ps);if(s!==null){Re=s;return}if(t=t.sibling,t!==null){Re=t;return}Re=t=e}while(t!==null);at===0&&(at=5)}function Wg(e,t){do{var s=aj(e.alternate,e);if(s!==null){s.flags&=32767,Re=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Re=e;return}Re=e=s}while(e!==null);at=6,Re=null}function ev(e,t,s,i,u,d,x,w,O,B,G,Q){e.cancelPendingCommit=null;do Oo();while(nt!==0);if((Ie&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===Je&&(Re=Je=null,$e=0),kl=t,_n=e,Qn=s,bd=u,Yg=i,mj(e,t,s,x,w,O,Q)}}function mj(e,t,s,i,u,d,x){var w=t.lanes|t.childLanes;if(xd=w,w|=nu,By(e,s,w,i,u,d),pa=null,(s&335544064)===s?(ga=Ik(e),i=10262):(ga=null,i=10256),(t.subtreeFlags&i)!==0||(t.flags&i)!==0?(e.callbackNode=null,e.callbackPriority=0,yj(br,function(){return Sd(),null})):(e.callbackNode=null,e.callbackPriority=0),vo=!1,i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=ce.T,ce.T=null,u=xe.p,xe.p=2,d=Ie,Ie|=4;try{ij(e,t,s)}finally{Ie=d,xe.p=u,ce.T=i}}nt=1,vo?ma=Bj(x,e.containerInfo,ga,jd,wd,gj,Nd,Sd,pj):(jd(),wd(),Nd())}function pj(e){if(nt!==0){var t=_n.onRecoverableError;t(e,{componentStack:null})}}function gj(){nt===3&&(nt=0,$g(kl,_n),nt=4)}function jd(){if(nt===1){nt=0;var e=_n,t=kl,s=Qn,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=ce.T,ce.T=null;var u=xe.p;xe.p=2;var d=Ie;Ie|=4;try{Ni=yo=!1,Rg(t,e,s),s=Ud;var x=zm(e.containerInfo),w=s.focusedElem,O=s.selectionRange;if(x!==w&&w&&w.ownerDocument&&Mm(w.ownerDocument.documentElement,w)){if(O!==null&&Pc(w)){var B=O.start,G=O.end;if(G===void 0&&(G=B),"selectionStart"in w)w.selectionStart=B,w.selectionEnd=Math.min(G,w.value.length);else{var Q=w.ownerDocument||document,U=Q&&Q.defaultView||window;if(U.getSelection){var I=U.getSelection(),re=w.textContent.length,ge=Math.min(O.start,re),Ee=O.end===void 0?ge:Math.min(O.end,re);!I.extend&&ge>Ee&&(x=Ee,Ee=ge,ge=x);var H=Am(w,ge),_=Am(w,Ee);if(H&&_&&(I.rangeCount!==1||I.anchorNode!==H.node||I.anchorOffset!==H.offset||I.focusNode!==_.node||I.focusOffset!==_.offset)){var q=Q.createRange();q.setStart(H.node,H.offset),I.removeAllRanges(),ge>Ee?(I.addRange(q),I.extend(_.node,_.offset)):(q.setEnd(_.node,_.offset),I.addRange(q))}}}}for(Q=[],I=w;I=I.parentNode;)I.nodeType===1&&Q.push({element:I,left:I.scrollLeft,top:I.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<Q.length;w++){var Z=Q[w];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Ca=!!$d,Ud=$d=null}finally{Ie=d,xe.p=u,ce.T=i}}e.current=t,nt=2}}function wd(){if(nt===2){nt=0;var e=_n,t=kl,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=ce.T,ce.T=null;var i=xe.p;xe.p=2;var u=Ie;Ie|=4;try{Eg(e,t.alternate,t)}finally{Ie=u,xe.p=i,ce.T=s}}nt=3}}function Nd(){if(nt===4||nt===3){nt=0;var e=ma;ma=null,zy();var t=_n,s=kl,i=Qn,u=Yg,d=(i&335544064)===i?10262:10256;if((s.subtreeFlags&d)!==0||(s.flags&d)!==0?nt=5:(nt=0,kl=_n=null,tv(t,t.pendingLanes)),d=t.pendingLanes,d===0&&(qs=null),_c(i),s=s.stateNode,Jt&&typeof Jt.onCommitFiberRoot=="function")try{Jt.onCommitFiberRoot(Xa,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=ce.T,d=xe.p,xe.p=2,ce.T=null;try{for(var x=t.onRecoverableError,w=0;w<u.length;w++){var O=u[w];x(O.value,{componentStack:O.stack})}}finally{ce.T=s,xe.p=d}}if(u=pa,x=ga,ga=null,u!==null&&(pa=null,x===null&&(x=[]),e!==null))for(O=0;O<u.length;O++)s=(0,u[O])(x),s!==void 0&&e.finished.finally(s);(Qn&3)!==0&&Oo(),Jn(t),d=t.pendingLanes,(i&261930)!==0&&(d&42)!==0?t===Eo?Ei++:(Ei=0,Eo=t):(Ei=0,Eo=null),Ai(0)}}function tv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ci(t)))}function Oo(){return ma!==null&&(ma.skipTransition(),ma=null),jd(),wd(),Nd(),Sd()}function Sd(){if(nt!==5)return!1;var e=_n,t=xd;xd=0;var s=_c(Qn),i=ce.T,u=xe.p;try{xe.p=32>s?32:s,ce.T=null,s=bd,bd=null;var d=_n,x=Qn;if(nt=0,kl=_n=null,Qn=0,(Ie&6)!==0)throw Error(o(331));var w=Ie;if(Ie|=4,Bg(d.current),Ug(d,d.current,x,s),Ie=w,Ai(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Xa,d)}catch{}return!0}finally{xe.p=u,ce.T=i,tv(e,t)}}function nv(e,t,s){t=hn(s,t),t=Iu(e.stateNode,t,2),e=_s(e,t,2),e!==null&&(Qa(e,2),Jn(e))}function Ve(e,t,s){if(e.tag===3)nv(e,e,s);else for(;t!==null;){if(t.tag===3){nv(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(qs===null||!qs.has(i))){e=hn(s,e),s=Fp(2),i=_s(t,s,2),i!==null&&(Wp(s,i,t,e),Qa(i,2),Jn(i));break}}t=t.return}}function Td(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new cj;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(s)||(gd=!0,u.add(s),e=vj.bind(null,e,t,s),t.then(e,e))}function vj(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Je===e&&($e&s)===s&&((at===4||at===3&&($e&62914560)===$e&&300>Qt()-So)&&(Ie&2)===0?xa(e,0):No|=s,ha===$e&&(ha=0)),Jn(e)}function sv(e,t){t===0&&(t=Ih()),e=al(e,t),e!==null&&(Qa(e,t),Jn(e))}function xj(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),sv(e,s)}function bj(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),sv(e,s)}function yj(e,t){return Ac(e,t)}var ya=null,ka=null,Cd=!1,_o=!1,Ed=!1,Ys=0;function Jn(e){e!==ka&&e.next===null&&(ka===null?ya=ka=e:ka=ka.next=e),_o=!0,Cd||(Cd=!0,jj())}function Ai(e,t){if(!Ed&&_o){Ed=!0;do for(var s=!1,i=ya;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var d=0;else{var x=i.suspendedLanes,w=i.pingedLanes;d=(1<<31-Pt(42|e)+1)-1,d&=u&~(x&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(s=!0,rv(i,d))}else d=$e,d=wr(i,i===Je?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(d&3)===0||Za(i,d)||(s=!0,rv(i,d));i=i.next}while(s);Ed=!1}}function kj(){lv()}function lv(){_o=Cd=!1;var e=0;Ys!==0&&_j()&&(e=Ys);for(var t=Qt(),s=null,i=ya;i!==null;){var u=i.next,d=av(i,t);d===0?(i.next=null,s===null?ya=u:s.next=u,u===null&&(ka=s)):(s=i,(e!==0||(d&3)!==0)&&(_o=!0)),i=u}nt!==0&&nt!==5||Ai(e),Ys!==0&&(Ys=0)}function av(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var x=31-Pt(d),w=1<<x,O=u[x];O===-1?((w&s)===0||(w&i)!==0)&&(u[x]=Hy(w,t)):O<=t&&(e.expiredLanes|=w),d&=~w}if(t=Je,s=$e,s=wr(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Mc(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Za(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&Mc(i),_c(s)){case 2:case 8:s=Hh;break;case 32:s=br;break;case 268435456:s=Bh;break;default:s=br}return i=iv.bind(null,e),s=Ac(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&Mc(i),e.callbackPriority=2,e.callbackNode=null,2}function iv(e,t){if(nt!==0&&nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Oo()&&e.callbackNode!==s)return null;var i=$e;return i=wr(e,e===Je?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Kg(e,i,t),av(e,Qt()),e.callbackNode!=null&&e.callbackNode===s?iv.bind(null,e):null)}function rv(e,t){if(Oo())return null;Kg(e,t,!0)}function jj(){Dj(function(){(Ie&6)!==0?Ac(Lh,kj):lv()})}function Ad(){if(Ys===0){var e=dl;e===0&&(e=yr,yr<<=1,(yr&261888)===0&&(yr=256)),Ys=e}return Ys}function ov(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Er(e)}function wj(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var d=ov((u[Bt]||null).action),x=i.submitter;x&&(t=(t=x[Bt]||null)?ov(t.formAction):x.getAttribute("formAction"),t!==null&&(d=t,x=null));var w=new Or("action","action",null,i,u);e.push({event:w,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ys!==0){var O=new FormData(u,x);Uu(s,{pending:!0,data:O,method:u.method,action:d},null,O)}}else typeof d=="function"&&(w.preventDefault(),O=new FormData(u,x),Uu(s,{pending:!0,data:O,method:u.method,action:d},d,O))},currentTarget:u}]})}}for(var Md=0;Md<tu.length;Md++){var zd=tu[Md],Nj=zd.toLowerCase(),Sj=zd[0].toUpperCase()+zd.slice(1);An(Nj,"on"+Sj)}An(Rm,"onAnimationEnd"),An(Dm,"onAnimationIteration"),An($m,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(Rk,"onTransitionRun"),An(Dk,"onTransitionStart"),An($k,"onTransitionCancel"),An(Um,"onTransitionEnd"),Yl("onMouseEnter",["mouseout","mouseover"]),Yl("onMouseLeave",["mouseout","mouseover"]),Yl("onPointerEnter",["pointerout","pointerover"]),Yl("onPointerLeave",["pointerout","pointerover"]),nl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),nl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),nl("onBeforeInput",["compositionend","keypress","textInput","paste"]),nl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),nl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),nl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mi="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(" "),Tj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mi));function cv(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],u=i.event;i=i.listeners;e:{var d=void 0;if(t)for(var x=i.length-1;0<=x;x--){var w=i[x],O=w.instance,B=w.currentTarget;if(w=w.listener,O!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=B;try{d(u)}catch(G){Dr(G)}u.currentTarget=null,d=O}else for(x=0;x<i.length;x++){if(w=i[x],O=w.instance,B=w.currentTarget,w=w.listener,O!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=B;try{d(u)}catch(G){Dr(G)}u.currentTarget=null,d=O}}}}function De(e,t){var s=t[Zh];s===void 0&&(s=t[Zh]=new Set);var i=e+"__bubble";s.has(i)||(uv(t,e,2,!1),s.add(i))}function Od(e,t,s){var i=0;t&&(i|=4),uv(s,e,i,t)}var Ro="_reactListening"+Math.random().toString(36).slice(2);function _d(e){if(!e[Ro]){e[Ro]=!0,Ph.forEach(function(s){s!=="selectionchange"&&(Tj.has(s)||Od(s,!1,e),Od(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ro]||(t[Ro]=!0,Od("selectionchange",!1,t))}}function uv(e,t,s,i){switch(Wv(t)){case 2:var u=x1;break;case 8:u=b1;break;default:u=Wd}s=u.bind(null,t,s,e),u=void 0,!qc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,s,{capture:!0,passive:u}):e.addEventListener(t,s,!0):u!==void 0?e.addEventListener(t,s,{passive:u}):e.addEventListener(t,s,!1)}function Rd(e,t,s,i,u){var d=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var x=i.tag;if(x===3||x===4){var w=i.stateNode.containerInfo;if(w===u)break;if(x===4)for(x=i.return;x!==null;){var O=x.tag;if((O===3||O===4)&&x.stateNode.containerInfo===u)return;x=x.return}for(;w!==null;){if(x=tl(w),x===null)return;if(O=x.tag,O===5||O===6||O===26||O===27){i=d=x;continue e}w=w.parentNode}}i=i.return}um(function(){var B=d,G=Hc(s),Q=[];e:{var U=Lm.get(e);if(U!==void 0){var I=Or,re=e;switch(e){case"keypress":if(Mr(s)===0)break e;case"keydown":case"keyup":I=uk;break;case"focusin":re="focus",I=Kc;break;case"focusout":re="blur",I=Kc;break;case"beforeblur":case"afterblur":I=Kc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":I=hm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":I=Fy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":I=pk;break;case Rm:case Dm:case $m:I=tk;break;case Um:I=vk;break;case"scroll":case"scrollend":I=Jy;break;case"wheel":I=bk;break;case"copy":case"cut":case"paste":I=sk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":I=pm;break;case"submit":I=hk;break;case"toggle":case"beforetoggle":I=kk}var ge=(t&4)!==0,Ee=!ge&&(e==="scroll"||e==="scrollend"),H=ge?U!==null?U+"Capture":null:U;ge=[];for(var _=B,q;_!==null;){var Z=_;if(q=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||q===null||H===null||(Z=Fa(_,H),Z!=null&&ge.push(zi(_,Z,q))),Ee)break;_=_.return}0<ge.length&&(U=new I(U,re,null,s,G),Q.push({event:U,listeners:ge}))}}if((t&7)===0){e:{if(I=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",I&&s!==Lc&&(re=s.relatedTarget||s.fromElement)&&(tl(re)||re[Bl]))break e;(U||I)&&(re=G.window===G?G:(I=G.ownerDocument)?I.defaultView||I.parentWindow:window,U?(I=s.relatedTarget||s.toElement,U=B,I=I?tl(I):null,I!==null&&(Ee=f(I),ge=I.tag,I!==Ee||ge!==5&&ge!==27&&ge!==6)&&(I=null)):(U=null,I=B),U!==I&&(ge=hm,Z="onMouseLeave",H="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(ge=pm,Z="onPointerLeave",H="onPointerEnter",_="pointer"),Ee=U==null?re:Pa(U),q=I==null?re:Pa(I),re=new ge(Z,_+"leave",U,s,G),re.target=Ee,re.relatedTarget=q,Z=null,tl(G)===B&&(ge=new ge(H,_+"enter",I,s,G),ge.target=q,ge.relatedTarget=Ee,Z=ge),Ee=Z,ge=U&&I?k(U,I,Cj):null,U!==null&&dv(Q,re,U,ge,!1),I!==null&&Ee!==null&&dv(Q,Ee,I,ge,!0)))}e:{if(U=B?Pa(B):window,I=U.nodeName&&U.nodeName.toLowerCase(),I==="select"||I==="input"&&U.type==="file")var fe=wm;else if(km(U))if(Nm)fe=zk;else{fe=Ak;var Ue=Ek}else I=U.nodeName,!I||I.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?B&&Uc(B.elementType)&&(fe=wm):fe=Mk;if(fe&&(fe=fe(e,B))){jm(Q,fe,s,G);break e}Ue&&Ue(e,U,B)}switch(Ue=B?Pa(B):window,e){case"focusin":(km(Ue)||Ue.contentEditable==="true")&&(Ql=Ue,Fc=B,ii=null);break;case"focusout":ii=Fc=Ql=null;break;case"mousedown":Wc=!0;break;case"contextmenu":case"mouseup":case"dragend":Wc=!1,Om(Q,s,G);break;case"selectionchange":if(_k)break;case"keydown":case"keyup":Om(Q,s,G)}var ye;if(Xc)e:{switch(e){case"compositionstart":var we="onCompositionStart";break e;case"compositionend":we="onCompositionEnd";break e;case"compositionupdate":we="onCompositionUpdate";break e}we=void 0}else Zl?bm(e,s)&&(we="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(we="onCompositionStart");we&&(gm&&s.locale!=="ko"&&(Zl||we!=="onCompositionStart"?we==="onCompositionEnd"&&Zl&&(ye=dm()):(Ns=G,Ic="value"in Ns?Ns.value:Ns.textContent,Zl=!0)),Ue=Do(B,we),0<Ue.length&&(we=new mm(we,e,null,s,G),Q.push({event:we,listeners:Ue}),ye?we.data=ye:(ye=ym(s),ye!==null&&(we.data=ye)))),(ye=wk?Nk(e,s):Sk(e,s))&&(we=Do(B,"onBeforeInput"),0<we.length&&(Ue=new mm("onBeforeInput","beforeinput",null,s,G),Q.push({event:Ue,listeners:we}),Ue.data=ye)),wj(Q,e,B,s,G)}cv(Q,t)})}function zi(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Do(e,t){for(var s=t+"Capture",i=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=Fa(e,s),u!=null&&i.unshift(zi(e,u,d)),u=Fa(e,t),u!=null&&i.push(zi(e,u,d))),e.tag===3)return i;e=e.return}return[]}function Cj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function dv(e,t,s,i,u){for(var d=t._reactName,x=[];s!==null&&s!==i;){var w=s,O=w.alternate,B=w.stateNode;if(w=w.tag,O!==null&&O===i)break;w!==5&&w!==26&&w!==27||B===null||(O=B,u?(B=Fa(s,d),B!=null&&x.unshift(zi(s,B,O))):u||(B=Fa(s,d),B!=null&&x.push(zi(s,B,O)))),s=s.return}x.length!==0&&e.push({event:t,listeners:x})}var Ej=/\r\n?/g,Aj=/\u0000|\uFFFD/g;function fv(e){return(typeof e=="string"?e:""+e).replace(Ej,`
|
|
50
|
+
`).replace(Aj,"")}function hv(e,t){return t=fv(t),fv(e)===t}function Xe(e,t,s,i,u,d){switch(s){case"children":if(typeof i=="string")t==="body"||t==="textarea"&&i===""||Kl(e,i);else if(typeof i=="number"||typeof i=="bigint")t!=="body"&&Kl(e,""+i);else return;break;case"className":Cr(e,"class",i);break;case"tabIndex":Cr(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(e,s,i);break;case"style":om(e,i,d);return;case"data":if(t!=="object"){Cr(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=Er(i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(s==="formAction"?(t!=="input"&&Xe(e,t,"name",u.name,u,null),Xe(e,t,"formEncType",u.formEncType,u,null),Xe(e,t,"formMethod",u.formMethod,u,null),Xe(e,t,"formTarget",u.formTarget,u,null)):(Xe(e,t,"encType",u.encType,u,null),Xe(e,t,"method",u.method,u,null),Xe(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=Er(i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=Bn);return;case"onScroll":i!=null&&De("scroll",e);return;case"onScrollEnd":i!=null&&De("scrollend",e);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(o(60));d?.__html!==s&&(e.innerHTML=s)}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=Er(i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":De("beforetoggle",e),De("toggle",e),Tr(e,"popover",i);break;case"xlinkActuate":ss(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ss(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ss(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ss(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ss(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ss(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ss(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ss(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ss(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Tr(e,"is",i);break;case"innerText":case"textContent":return;default:if(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")s=Zy.get(s)||s,Tr(e,s,i);else return}qe=!0}function Dd(e,t,s,i,u,d){switch(s){case"style":om(e,i,d);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(o(60));d?.__html!==s&&(e.innerHTML=s)}}break;case"children":if(typeof i=="string")Kl(e,i);else if(typeof i=="number"||typeof i=="bigint")Kl(e,""+i);else return;break;case"onScroll":i!=null&&De("scroll",e);return;case"onScrollEnd":i!=null&&De("scrollend",e);return;case"onClick":i!=null&&(e.onclick=Bn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Fh.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),d=s.slice(2,u?s.length-7:void 0),t=e[Bt]||null,t=t!=null?t[s]:null,typeof t=="function"&&e.removeEventListener(d,t,u),typeof i=="function")){typeof t!="function"&&t!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(d,i,u);break e}qe=!0,s in e?e[s]=i:i===!0?e.setAttribute(s,""):Tr(e,s,i)}return}qe=!0}function St(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var i=!1,u=!1,d;for(d in s)if(s.hasOwnProperty(d)){var x=s[d];if(x!=null)switch(d){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Xe(e,t,d,x,s,null)}}u&&Xe(e,t,"srcSet",s.srcSet,s,null),i&&Xe(e,t,"src",s.src,s,null);return;case"input":De("invalid",e);var w=d=x=u=null,O=null,B=null;for(i in s)if(s.hasOwnProperty(i)){var G=s[i];if(G!=null)switch(i){case"name":u=G;break;case"type":x=G;break;case"checked":O=G;break;case"defaultChecked":B=G;break;case"value":d=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,t));break;default:Xe(e,t,i,G,s,null)}}lm(e,d,w,O,B,x,u,!1);return;case"select":De("invalid",e),i=x=d=null;for(u in s)if(s.hasOwnProperty(u)&&(w=s[u],w!=null))switch(u){case"value":d=w;break;case"defaultValue":x=w;break;case"multiple":i=w;default:Xe(e,t,u,w,s,null)}t=d,s=x,e.multiple=!!i,t!=null?Gl(e,!!i,t,!1):s!=null&&Gl(e,!!i,s,!0);return;case"textarea":De("invalid",e),d=u=i=null;for(x in s)if(s.hasOwnProperty(x)&&(w=s[x],w!=null))switch(x){case"value":i=w;break;case"defaultValue":u=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(o(91));break;default:Xe(e,t,x,w,s,null)}im(e,i,u,d);return;case"option":for(O in s)if(s.hasOwnProperty(O)&&(i=s[O],i!=null))switch(O){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Xe(e,t,O,i,s,null)}return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(i=0;i<Mi.length;i++)De(Mi[i],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in s)if(s.hasOwnProperty(B)&&(i=s[B],i!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Xe(e,t,B,i,s,null)}return;default:if(Uc(t)){for(G in s)s.hasOwnProperty(G)&&(i=s[G],i!==void 0&&Dd(e,t,G,i,s,void 0));return}}for(w in s)s.hasOwnProperty(w)&&(i=s[w],i!=null&&Xe(e,t,w,i,s,null))}var Mj={};function zj(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,x=null,w=null,O=null,B=null,G=null;for(I in s){var Q=s[I];if(s.hasOwnProperty(I)&&Q!=null)switch(I){case"checked":break;case"value":break;case"defaultValue":O=Q;default:i.hasOwnProperty(I)||Xe(e,t,I,null,i,Q)}}for(var U in i){var I=i[U];if(Q=s[U],i.hasOwnProperty(U)&&(I!=null||Q!=null))switch(U){case"type":I!==Q&&(qe=!0),d=I;break;case"name":I!==Q&&(qe=!0),u=I;break;case"checked":I!==Q&&(qe=!0),B=I;break;case"defaultChecked":I!==Q&&(qe=!0),G=I;break;case"value":I!==Q&&(qe=!0),x=I;break;case"defaultValue":I!==Q&&(qe=!0),w=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(o(137,t));break;default:I!==Q&&Xe(e,t,U,I,i,Q)}}Dc(e,x,w,O,B,G,d,u);return;case"select":I=x=w=U=null;for(d in s)if(O=s[d],s.hasOwnProperty(d)&&O!=null)switch(d){case"value":break;case"multiple":I=O;default:i.hasOwnProperty(d)||Xe(e,t,d,null,i,O)}for(u in i)if(d=i[u],O=s[u],i.hasOwnProperty(u)&&(d!=null||O!=null))switch(u){case"value":d!==O&&(qe=!0),U=d;break;case"defaultValue":d!==O&&(qe=!0),w=d;break;case"multiple":d!==O&&(qe=!0),x=d;default:d!==O&&Xe(e,t,u,d,i,O)}t=w,s=x,i=I,U!=null?Gl(e,!!s,U,!1):!!i!=!!s&&(t!=null?Gl(e,!!s,t,!0):Gl(e,!!s,s?[]:"",!1));return;case"textarea":I=U=null;for(w in s)if(u=s[w],s.hasOwnProperty(w)&&u!=null&&!i.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Xe(e,t,w,null,i,u)}for(x in i)if(u=i[x],d=s[x],i.hasOwnProperty(x)&&(u!=null||d!=null))switch(x){case"value":u!==d&&(qe=!0),U=u;break;case"defaultValue":u!==d&&(qe=!0),I=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==d&&Xe(e,t,x,u,i,d)}am(e,U,I);return;case"option":for(var re in s)if(U=s[re],s.hasOwnProperty(re)&&U!=null&&!i.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:Xe(e,t,re,null,i,U)}for(O in i)if(U=i[O],I=s[O],i.hasOwnProperty(O)&&U!==I&&(U!=null||I!=null))switch(O){case"selected":U!==I&&(qe=!0),e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Xe(e,t,O,U,i,I)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ge in s)U=s[ge],s.hasOwnProperty(ge)&&U!=null&&!i.hasOwnProperty(ge)&&Xe(e,t,ge,null,i,U);for(B in i)if(U=i[B],I=s[B],i.hasOwnProperty(B)&&U!==I&&(U!=null||I!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(o(137,t));break;default:Xe(e,t,B,U,i,I)}return;default:if(Uc(t)){for(var Ee in s)U=s[Ee],s.hasOwnProperty(Ee)&&U!==void 0&&!i.hasOwnProperty(Ee)&&Dd(e,t,Ee,void 0,i,U);for(G in i)U=i[G],I=s[G],!i.hasOwnProperty(G)||U===I||U===void 0&&I===void 0||Dd(e,t,G,U,i,I);return}}for(var H in s)U=s[H],s.hasOwnProperty(H)&&U!=null&&!i.hasOwnProperty(H)&&Xe(e,t,H,null,i,U);for(Q in i)U=i[Q],I=s[Q],!i.hasOwnProperty(Q)||U===I||U==null&&I==null||Xe(e,t,Q,U,i,I)}function mv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Oj(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var u=s[i],d=u.transferSize,x=u.initiatorType,w=u.duration;if(d&&w&&mv(x)){for(x=0,w=u.responseEnd,i+=1;i<s.length;i++){var O=s[i],B=O.startTime;if(B>w)break;var G=O.transferSize,Q=O.initiatorType;G&&mv(Q)&&(O=O.responseEnd,x+=G*(O<w?1:(w-B)/(O-B)))}if(--i,t+=8*(d+x)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $d=null,Ud=null;function Oi(e){return e.nodeType===9?e:e.ownerDocument}function pv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function gv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function vv(e,t,s,i){return s=Oi(s).createElement(e),s[yt]=i,s[Bt]=t,St(s,e,t),pt(s),s}function Ld(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Hd=null;function _j(){var e=window.event;return e&&e.type==="popstate"?e===Hd?!1:(Hd=e,!0):(Hd=null,!1)}var Bd=typeof setTimeout=="function"?setTimeout:void 0,Rj=typeof clearTimeout=="function"?clearTimeout:void 0,xv=typeof Promise=="function"?Promise:void 0,bv=typeof requestAnimationFrame=="function"?requestAnimationFrame:Bd,Dj=typeof queueMicrotask=="function"?queueMicrotask:typeof xv<"u"?function(e){return xv.resolve(null).then(e).catch($j)}:Bd;function $j(e){setTimeout(function(){throw e})}function Gs(e){return e==="head"}function yv(e,t){var s=t,i=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(u),Ea(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")Zd(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Zd(s);for(var d=s.firstChild;d;){var x=d.nextSibling,w=d.nodeName;d[Ja]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||s.removeChild(d),d=x}}else s==="body"&&Zd(e.ownerDocument.body);s=u}while(s);Ea(t)}function kv(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function jv(e,t,s){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,s!=null&&(e.style.viewTransitionClass=s),s=getComputedStyle(e),s.display==="inline"){if(t=e.getClientRects(),t.length===1)var i=1;else for(var u=i=0;u<t.length;u++){var d=t[u];0<d.width&&0<d.height&&i++}i===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+s.paddingTop,e.marginBottom="-"+s.paddingBottom)}}function wv(e,t){e=e.style,t=t.style;var s=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=s==null||typeof s=="boolean"?"":(""+s).trim(),s=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=s==null||typeof s=="boolean"?"":(""+s).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(s=t.display,e.display=s==null||typeof s=="boolean"?"":s,s=t.margin,s!=null?e.margin=s:(s=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=s==null||typeof s=="boolean"?"":s,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Uj(e,t,s){return s=s.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=s.innerHeight&&e.left<=s.innerWidth}}function qd(e){var t=e.getBoundingClientRect(),s=getComputedStyle(e);return Uj(t,s,e)}function Lj(e){return e.documentElement.clientHeight}function Hj(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Bj(e,t,s,i,u,d,x,w,O){var B=t.nodeType===9?t:t.ownerDocument;try{var G=B.startViewTransition({update:function(){var U=B.defaultView,I=U.navigation&&U.navigation.transition,re=B.fonts.status;i();var ge=[];if(re==="loaded"&&(Lj(B),B.fonts.status==="loading"&&ge.push(B.fonts.ready)),re=ge.length,e!==null)for(var Ee=e.suspenseyImages,H=0,_=0;_<Ee.length;_++){var q=Ee[_];if(!q.complete){var Z=q.getBoundingClientRect();if(0<Z.bottom&&0<Z.right&&Z.top<U.innerHeight&&Z.left<U.innerWidth){if(H+=Gv(q),H>Lo){ge.length=re;break}q=new Promise(Hj.bind(q)),ge.push(q)}}}if(0<ge.length)return U=Promise.race([Promise.all(ge),new Promise(function(fe){return setTimeout(fe,500)})]).then(u,u),(I?Promise.allSettled([I.finished,U]):U).then(d,d);if(u(),I)return I.finished.then(d,d);d()},types:s});B.__reactViewTransition=G;var Q=[];return G.ready.then(function(){for(var U=B.documentElement.getAnimations({subtree:!0}),I=0;I<U.length;I++){var re=U[I],ge=re.effect,Ee=ge.pseudoElement;if(Ee!=null&&Ee.startsWith("::view-transition")){Q.push(re),re=ge.getKeyframes();for(var H=Ee=void 0,_=!0,q=0;q<re.length;q++){var Z=re[q],fe=Z.width;if(Ee===void 0)Ee=fe;else if(Ee!==fe){_=!1;break}if(fe=Z.height,H===void 0)H=fe;else if(H!==fe){_=!1;break}delete Z.width,delete Z.height,Z.transform==="none"&&delete Z.transform}_&&Ee!==void 0&&H!==void 0&&(ge.setKeyframes(re),_=getComputedStyle(ge.target,ge.pseudoElement),_.width!==Ee||_.height!==H)&&(_=re[0],_.width=Ee,_.height=H,_=re[re.length-1],_.width=Ee,_.height=H,ge.setKeyframes(re))}}x()},function(U){B.__reactViewTransition===G&&(B.__reactViewTransition=null);try{if(typeof U=="object"&&U!==null)switch(U.name){case"InvalidStateError":(U.message==="View transition was skipped because document visibility state is hidden."||U.message==="Skipping view transition because document visibility state has become hidden."||U.message==="Skipping view transition because viewport size changed."||U.message==="Transition was aborted because of invalid state")&&(U=null)}U!==null&&O(U)}finally{i(),u(),x()}}),G.finished.finally(function(){for(var U=0;U<Q.length;U++)Q[U].cancel();B.__reactViewTransition===G&&(B.__reactViewTransition=null),w()}),G}catch{return i(),u(),x(),null}}function jl(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}jl.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:C({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},jl.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,s=e.getAnimations({subtree:!0}),i=[],u=0;u<s.length;u++){var d=s[u].effect;d!==null&&d.target===e&&d.pseudoElement===t&&i.push(s[u])}return i},jl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Nv(e){return{name:e,group:new jl("group",e),imagePair:new jl("image-pair",e),old:new jl("old",e),new:new jl("new",e)}}function an(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}an.prototype.addEventListener=function(e,t,s){var i=null,u=null;if(!(s!=null&&typeof s!="boolean"&&(i=s.signal||null,i!==null&&i.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var d=this._eventListeners;if(Tv(d,e,t,s)===-1){var x=this,w=t;s!=null&&typeof s!="boolean"&&s.once===!0&&(w=function(O){x.removeEventListener(e,t,s),typeof t=="function"?t.call(this,O):t.handleEvent(O)}),i!==null&&(u=x.removeEventListener.bind(x,e,t,s),i.addEventListener("abort",u,{once:!0}),u=i.removeEventListener.bind(i,"abort",u)),i=ja(s),d.push({type:e,listener:t,optionsOrUseCapture:s,attachedListener:w,cleanup:u}),b(this._fragmentFiber.child,!1,qj,e,w,i)}this._eventListeners=d}};function qj(e,t,s,i){return z(e).addEventListener(t,s,i),!1}an.prototype.removeEventListener=function(e,t,s){var i=this._eventListeners;if(i!==null&&(t=Tv(i,e,t,s),t!==-1)){var u=i[t];s=u.attachedListener;var d=u.cleanup;u=ja(u.optionsOrUseCapture),b(this._fragmentFiber.child,!1,Ij,e,s,u),i.splice(t,1),d!==null&&d()}};function Ij(e,t,s,i){return z(e).removeEventListener(t,s,i),!1}function ja(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Sv(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Tv(e,t,s,i){if(e.length===0)return-1;i=Sv(i);for(var u=0;u<e.length;u++){var d=e[u];if(d.type===t&&d.listener===s&&Sv(d.optionsOrUseCapture)===i)return u}return-1}an.prototype.dispatchEvent=function(e){var t=j(this._fragmentFiber);if(t===null)return!0;t=z(t);var s=this._eventListeners;if(s!==null&&0<s.length||!e.bubbles){var i=t.nodeType===9?t.createComment(""):document.createTextNode("");if(s)for(var u=0;u<s.length;u++){var d=s[u];i.addEventListener(d.type,d.attachedListener,ja(d.optionsOrUseCapture))}if(t.appendChild(i),e=i.dispatchEvent(e),s)for(u=0;u<s.length;u++)d=s[u],i.removeEventListener(d.type,d.attachedListener,ja(d.optionsOrUseCapture));return t.removeChild(i),e}return t.dispatchEvent(e)},an.prototype.focus=function(e){b(this._fragmentFiber.child,!0,Cv,e,void 0,void 0)};function Cv(e,t){return e.tag===6?!1:(e=z(e),e1(e,t))}an.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,Id,t,void 0,void 0);for(var s=t.length-1;0<=s&&!Cv(t[s],e);s--);};function Id(e,t){return t.push(e),!1}an.prototype.blur=function(){var e=j(this._fragmentFiber);e!==null&&(e=z(e),e=Oi(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Yj,e,void 0,void 0))};function Yj(e,t){return e.tag===6?!1:(e=z(e),e===t||e.contains(t)?(t.blur(),!0):!1)}an.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),b(this._fragmentFiber.child,!1,Gj,e,void 0,void 0)};function Gj(e,t){return e.tag===6||(e=z(e),t.observe(e)),!1}an.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),b(this._fragmentFiber.child,!1,Kj,e,void 0,void 0);for(var s=t=0;s<Rn.length;s++){var i=Rn[s];i.fragmentInstance===this&&i.observer===e?e.unobserve(i.instance):Rn[t++]=i}Rn.length=t}};function Kj(e,t){return e.tag===6||(e=z(e),t.unobserve(e)),!1}var Rn=[],Yd=!1;function Vj(e,t,s){Rn.push({fragmentInstance:e,observer:t,instance:s}),Yd||(Yd=!0,t1(function(){Yd=!1;var i=Rn;Rn=[];for(var u=0;u<i.length;u++){var d=i[u];d.observer.unobserve(d.instance)}}))}an.prototype.getClientRects=function(){var e=[];return b(this._fragmentFiber.child,!1,Xj,e,void 0,void 0),e};function Xj(e,t){if(e.tag===6){e=e.stateNode;var s=e.ownerDocument.createRange();s.selectNodeContents(e),t.push.apply(t,s.getClientRects())}else e=z(e),t.push.apply(t,e.getClientRects());return!1}an.prototype.getRootNode=function(e){var t=j(this._fragmentFiber);return t===null?this:z(t).getRootNode(e)},an.prototype.compareDocumentPosition=function(e){var t=j(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var s=[];b(this._fragmentFiber.child,!1,Id,s,void 0,void 0);var i=z(t);if(s.length===0){if(s=i,E(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(s=t)}t=this._fragmentFiber;var u=i=s.compareDocumentPosition(e);return s===e?u=Node.DOCUMENT_POSITION_CONTAINS:i&Node.DOCUMENT_POSITION_CONTAINED_BY&&(s=S(t)[1],s===null?u=Node.DOCUMENT_POSITION_PRECEDING:(e=z(s).compareDocumentPosition(e),u=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=z(s[0]),u=z(s[s.length-1]);var d=E(this._fragmentFiber)?t.parentElement:i;if(d==null)return Node.DOCUMENT_POSITION_DISCONNECTED;i=d.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,d=d.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var x=t.compareDocumentPosition(e),w=u.compareDocumentPosition(e),O=x&Node.DOCUMENT_POSITION_CONTAINED_BY||w&Node.DOCUMENT_POSITION_CONTAINED_BY;return w=i&&d&&x&Node.DOCUMENT_POSITION_FOLLOWING&&w&Node.DOCUMENT_POSITION_PRECEDING,t=i&&t===e||d&&u===e||O||w?Node.DOCUMENT_POSITION_CONTAINED_BY:!i&&t===e||!d&&u===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:x,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Zj(t,this._fragmentFiber,s[0],s[s.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Zj(e,t,s,i,u){var d=tl(u);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(s=!!d)e:{for(;d!==null;){if(d.tag===7&&(d===t||d.alternate===t)){s=!0;break e}d=d.return}s=!1}return s}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(d===null)return d=u.ownerDocument,u===d||u===d.documentElement||u===d.body;e:{for(d=t,t=j(t);d!==null;){if(!(d.tag!==5&&d.tag!==3&&d.tag!==27||d!==t&&d.alternate!==t)){d=!0;break e}d=d.return}d=!1}return d}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!d)&&!(t=d===s)&&(t=k(s,d,N),t===null?t=!1:(b(t,!0,D,d,s),d=A,A=null,t=d!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!d)&&!(t=d===i)&&(t=k(i,d,N),t===null?t=!1:(b(t,!0,V,d,i),d=A,$=A=null,t=d!==null)),t):!1}function Ev(e,t){var s=e.ownerDocument.createRange();s.selectNodeContents(e),e=s.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}an.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];b(this._fragmentFiber.child,!1,Id,t,void 0,void 0);var s=e!==!1;if(t.length===0){var i=S(this._fragmentFiber);if(i=s?i[1]||i[0]||j(this._fragmentFiber):i[0]||i[1],i===null)return;if(i.tag===6){e=z(i),Ev(e,s);return}if(i=z(i),i.nodeType!==9){if(i.nodeType===11){s="host"in i?i.host:null,s!==null&&s.scrollIntoView(e);return}i.scrollIntoView(e)}}for(i=s?t.length-1:0;i!==(s?-1:t.length);){var u=t[i];u.tag===6?(u=z(u),Ev(u,s)):z(u).scrollIntoView(e),i+=s?-1:1}};function Qj(e,t){return e=z(e),Av(e,t),!1}function Av(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Mv(e,t){var s=t._eventListeners;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i];e.addEventListener(u.type,u.attachedListener,ja(u.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(d){for(var x=0,w=0;w<Rn.length;w++){var O=Rn[w];(O.fragmentInstance!==t||O.observer!==d||O.instance!==e)&&(Rn[x++]=O)}Rn.length=x,d.observe(e)}),Av(e,t))}function Jj(e,t){var s=t._eventListeners;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i];e.removeEventListener(u.type,u.attachedListener,ja(u.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(d){typeof d.rootMargin=="string"?Vj(t,d,e):d.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Gd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Gd(s),Sr(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Pj(e,t,s,i){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ja])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=xn(e.nextSibling),e===null)break}return null}function Fj(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=xn(e.nextSibling),e===null))return null;return e}function zv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=xn(e.nextSibling),e===null))return null;return e}function Kd(e){return e.data==="$?"||e.data==="$~"}function Vd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Wj(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function xn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Xd=null;function Ov(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return xn(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function _v(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function e1(e,t){function s(){i=!0}if(e.ownerDocument.activeElement===e)return!0;var i=!1;try{e.ownerDocument.addEventListener("focus",s,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",s,!0)}return i}function t1(e){bv(function(){bv(function(t){return e(t)})})}function Rv(e,t,s){switch(t=Oi(s),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Dv(e,t,s){for(var i in s){var u=s[i];s.hasOwnProperty(i)&&u!=null&&Xe(e,t,i,null,Mj,u)}s.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Bn&&(e.onclick=null),Sr(e)}function Zd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Sr(e)}var bn=new Map,$v=new Set;function _i(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var gs=xe.d;xe.d={f:n1,r:s1,D:l1,C:a1,L:i1,m:r1,X:c1,S:o1,M:u1};function n1(){var e=gs.f(),t=Ao();return e||t}function s1(e){var t=ql(e);t!==null&&t.tag===5&&t.type==="form"?Lp(t):gs.r(e)}var wa=typeof document>"u"?null:document;function Uv(e,t,s){var i=wa;if(i&&typeof t=="string"&&t){var u=dn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),$v.has(u)||($v.add(u),e={rel:e,crossOrigin:s,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),St(t,"link",e),pt(t),i.head.appendChild(t)))}}function l1(e){gs.D(e),Uv("dns-prefetch",e,null)}function a1(e,t){gs.C(e,t),Uv("preconnect",e,t)}function i1(e,t,s){gs.L(e,t,s);var i=wa;if(i&&e&&t){var u='link[rel="preload"][as="'+dn(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+dn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+dn(s.imageSizes)+'"]')):u+='[href="'+dn(e)+'"]';var d=u;switch(t){case"style":d=Na(e);break;case"script":d=Sa(e)}if(!(bn.has(d)||(e=C({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),bn.set(d,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ri(d))||t==="script"&&i.querySelector(Di(d))))){var x=i.createElement("link");St(x,"link",e),t==="style"&&(x[Nr]=!0,x.onload=x.onerror=function(){Jh(x)}),pt(x),i.head.appendChild(x)}}}function r1(e,t){gs.m(e,t);var s=wa;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+dn(i)+'"][href="'+dn(e)+'"]',d=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Sa(e)}if(!bn.has(d)&&(e=C({rel:"modulepreload",href:e},t),bn.set(d,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Di(d)))return}i=s.createElement("link"),St(i,"link",e),pt(i),s.head.appendChild(i)}}}function o1(e,t,s){gs.S(e,t,s);var i=wa;if(i&&e){var u=Il(i).hoistableStyles,d=Na(e);t=t||"default";var x=u.get(d);if(!x){var w={loading:0,preload:null};if(x=i.querySelector(Ri(d)))w.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},s),(s=bn.get(d))&&Qd(e,s);var O=x=i.createElement("link");pt(O),St(O,"link",e),O._p=new Promise(function(B,G){O.onload=B,O.onerror=G}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,$o(x,t,i)}x={type:"stylesheet",instance:x,count:1,state:w},u.set(d,x)}}}function c1(e,t){gs.X(e,t);var s=wa;if(s&&e){var i=Il(s).hoistableScripts,u=Sa(e),d=i.get(u);d||(d=s.querySelector(Di(u)),d||(e=C({src:e,async:!0},t),(t=bn.get(u))&&Jd(e,t),d=s.createElement("script"),pt(d),St(d,"link",e),s.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(u,d))}}function u1(e,t){gs.M(e,t);var s=wa;if(s&&e){var i=Il(s).hoistableScripts,u=Sa(e),d=i.get(u);d||(d=s.querySelector(Di(u)),d||(e=C({src:e,async:!0,type:"module"},t),(t=bn.get(u))&&Jd(e,t),d=s.createElement("script"),pt(d),St(d,"link",e),s.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},i.set(u,d))}}function Lv(e,t,s,i){var u=(u=En.current)?_i(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(s=Na(s.href),t=Il(u).hoistableStyles,i=t.get(s),i||(i={type:"style",instance:null,count:0,state:null},t.set(s,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Na(s.href);var d=Il(u).hoistableStyles,x=d.get(e);if(x||(u=u.ownerDocument||u,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,x),(d=u.querySelector(Ri(e)))?d._p||(x.instance=d,x.state.loading=5):(d=bn.get(e),d||(d={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},bn.set(e,d)),d1(u,e,d,x.state))),t&&i===null)throw Error(o(528,""));return x}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(s=Sa(s),t=Il(u).hoistableScripts,i=t.get(s),i||(i={type:"script",instance:null,count:0,state:null},t.set(s,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Na(e){return'href="'+dn(e)+'"'}function Ri(e){return'link[rel="stylesheet"]['+e+"]"}function Hv(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function d1(e,t,s,i){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Nr]!==!0){i.loading=1;return}}else t=e.createElement("link"),t[Nr]=!0,t.onload=t.onerror=Jh.bind(null,t),St(t,"link",s),pt(t),e.head.appendChild(t);i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2})}function Sa(e){return'[src="'+dn(e)+'"]'}function Di(e){return"script[async]"+e}function Bv(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+dn(s.href)+'"]');if(i)return t.instance=i,pt(i),i;var u=C({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),pt(i),St(i,"style",u),$o(i,s.precedence,e),t.instance=i;case"stylesheet":u=Na(s.href);var d=e.querySelector(Ri(u));if(d)return t.state.loading|=4,t.instance=d,pt(d),d;i=Hv(s),(u=bn.get(u))&&Qd(i,u),d=(e.ownerDocument||e).createElement("link"),pt(d);var x=d;return x._p=new Promise(function(w,O){x.onload=w,x.onerror=O}),St(d,"link",i),t.state.loading|=4,$o(d,s.precedence,e),t.instance=d;case"script":return d=Sa(s.src),(u=e.querySelector(Di(d)))?(t.instance=u,pt(u),u):(i=s,(u=bn.get(d))&&(i=C({},s),Jd(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),pt(u),St(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,$o(i,s.precedence,e));return t.instance}function $o(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,d=u,x=0;x<i.length;x++){var w=i[x];if(w.dataset.precedence===t)d=w;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Qd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Jd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Uo=null;function qv(e,t,s){if(Uo===null){var i=new Map,u=Uo=new Map;u.set(s,i)}else u=Uo,i=u.get(s),i||(i=new Map,u.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var d=s[u];if(!(d[Ja]||d[yt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var x=d.getAttribute(t)||"";x=e+x;var w=i.get(x);w?w.push(d):i.set(x,[d])}}return i}function Pd(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function f1(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Iv(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function Yv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Gv(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Kv(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Gv(t),e.suspenseyImages.push(t)),e=p1.bind(e),t.decode().then(e,e))}function h1(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=Na(i.href),d=t.querySelector(Ri(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=$i.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=d,pt(d);return}d=t.ownerDocument||t,i=Hv(i),(u=bn.get(u))&&Qd(i,u),d=d.createElement("link"),pt(d);var x=d;x._p=new Promise(function(w,O){x.onload=w,x.onerror=O}),St(d,"link",i),s.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=$i.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Lo=0;function m1(e,t){return e.stylesheets&&e.count===0&&Bo(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&Bo(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Lo===0&&(Lo=62500*Oj());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bo(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Lo?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Vv(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Bo(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function $i(){this.count--,Vv(this)}function p1(){this.imgCount--,Vv(this)}var Ho=null;function Bo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ho=new Map,t.forEach(g1,e),Ho=null,$i.call(e))}function g1(e,t){if(!(t.state.loading&4)){var s=Ho.get(e);if(s)var i=s.get(null);else{s=new Map,Ho.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var x=u[d];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(s.set(x.dataset.precedence,x),i=x)}i&&s.set(null,i)}u=t.instance,x=u.getAttribute("data-precedence"),d=s.get(x)||i,d===i&&s.set(null,u),s.set(x,u),this.count++,i=$i.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Ta={$$typeof:_e,Provider:null,Consumer:null,_currentValue:st,_currentValue2:st,_threadCount:0};function v1(e,t,s,i,u,d,x,w,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.hiddenUpdates=zc(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.transitionTypes=null,this.incompleteTransitions=new Map}function Xv(e,t,s,i,u,d,x,w,O,B,G,Q){return e=new v1(e,t,s,x,O,B,G,Q,w),t=1,d===!0&&(t|=24),d=qt(3,null,null,t),e.current=d,d.stateNode=e,t=fu(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:i,isDehydrated:s,cache:t},gu(d),e}function Zv(e){return e?(e=Fl,e):Fl}function Qv(e,t,s,i,u,d){u=Zv(u),i.context===null?i.context=u:i.pendingContext=u,i=Os(t),i.payload={element:s},d=d===void 0?null:d,d!==null&&(i.callback=d),s=_s(e,i,t),s!==null&&(Kt(s,e,t),hi(s,e,t))}function Jv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Fd(e,t){Jv(e,t),(e=e.alternate)&&Jv(e,t)}function Pv(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&Kt(t,e,67108864),Fd(e,67108864)}}function Fv(e){if(e.tag===13||e.tag===31){var t=ln();t=Oc(t);var s=al(e,t);s!==null&&Kt(s,e,t),Fd(e,t)}}var Ca=!0;function x1(e,t,s,i){var u=ce.T;ce.T=null;var d=xe.p;try{xe.p=2,Wd(e,t,s,i)}finally{xe.p=d,ce.T=u}}function b1(e,t,s,i){var u=ce.T;ce.T=null;var d=xe.p;try{xe.p=8,Wd(e,t,s,i)}finally{xe.p=d,ce.T=u}}function Wd(e,t,s,i){if(Ca){var u=ef(i);if(u===null)Rd(e,t,i,qo,s),ex(e,i);else if(k1(u,e,t,s,i))i.stopPropagation();else if(ex(e,i),t&4&&-1<y1.indexOf(e)){for(;u!==null;){var d=ql(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var x=el(d.pendingLanes);if(x!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;x;){var O=1<<31-Pt(x);w.entanglements[1]|=O,x&=~O}Jn(d),(Ie&6)===0&&(To=Qt()+500,Ai(0))}}break;case 31:case 13:w=al(d,2),w!==null&&Kt(w,d,2),Ao(),Fd(d,2)}if(d=ef(i),d===null&&Rd(e,t,i,qo,s),d===u)break;u=d}u!==null&&i.stopPropagation()}else Rd(e,t,i,null,s)}}function ef(e){return e=Hc(e),tf(e)}var qo=null;function tf(e){if(qo=null,e=tl(e),e!==null){var t=f(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=m(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return qo=e,null}function Wv(e){switch(e){case"beforetoggle":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"seeked":case"submit":case"toggle":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"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Oy()){case Lh:return 2;case Hh:return 8;case br:case _y:return 32;case Bh:return 268435456;default:return 32}default:return 32}}var nf=!1,Ks=null,Vs=null,Xs=null,Ui=new Map,Li=new Map,Zs=[],y1="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".split(" ");function ex(e,t){switch(e){case"focusin":case"focusout":Ks=null;break;case"dragenter":case"dragleave":Vs=null;break;case"mouseover":case"mouseout":Xs=null;break;case"pointerover":case"pointerout":Ui.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Li.delete(t.pointerId)}}function Hi(e,t,s,i,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:d,targetContainers:[u]},t!==null&&(t=ql(t),t!==null&&Pv(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function k1(e,t,s,i,u){switch(t){case"focusin":return Ks=Hi(Ks,e,t,s,i,u),!0;case"dragenter":return Vs=Hi(Vs,e,t,s,i,u),!0;case"mouseover":return Xs=Hi(Xs,e,t,s,i,u),!0;case"pointerover":var d=u.pointerId;return Ui.set(d,Hi(Ui.get(d)||null,e,t,s,i,u)),!0;case"gotpointercapture":return d=u.pointerId,Li.set(d,Hi(Li.get(d)||null,e,t,s,i,u)),!0}return!1}function tx(e){var t=tl(e.target);if(t!==null){var s=f(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,Xh(e.priority,function(){Fv(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,Xh(e.priority,function(){Fv(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Io(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=ef(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);Lc=i,s.target.dispatchEvent(i),Lc=null}else return t=ql(s),t!==null&&Pv(t),e.blockedOn=s,!1;t.shift()}return!0}function nx(e,t,s){Io(e)&&s.delete(t)}function j1(){nf=!1,Ks!==null&&Io(Ks)&&(Ks=null),Vs!==null&&Io(Vs)&&(Vs=null),Xs!==null&&Io(Xs)&&(Xs=null),Ui.forEach(nx),Li.forEach(nx)}function Yo(e,t){e.blockedOn===t&&(e.blockedOn=null,nf||(nf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,j1)))}var Go=null;function sx(e){Go!==e&&(Go=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Go===e&&(Go=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(tf(i||s)===null)continue;break}var d=ql(s);d!==null&&(e.splice(t,3),t-=3,Uu(d,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function Ea(e){function t(O){return Yo(O,e)}Ks!==null&&Yo(Ks,e),Vs!==null&&Yo(Vs,e),Xs!==null&&Yo(Xs,e),Ui.forEach(t),Li.forEach(t);for(var s=0;s<Zs.length;s++){var i=Zs[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Zs.length&&(s=Zs[0],s.blockedOn===null);)tx(s),s.blockedOn===null&&Zs.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var u=s[i],d=s[i+1],x=u[Bt]||null;if(typeof d=="function")x||sx(s);else if(x){var w=null;if(d&&d.hasAttribute("formAction")){if(u=d,x=d[Bt]||null)w=x.formAction;else if(tf(u)!==null)continue}else w=x.action;typeof w=="function"?s[i+1]=w:(s.splice(i,3),i-=3),sx(s)}}}function lx(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(x){return u=x})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function sf(e){this._internalRoot=e}Ko.prototype.render=sf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var s=t.current,i=ln();Qv(s,i,e,t,null,null)},Ko.prototype.unmount=sf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qv(e.current,2,null,e,null,null),Ao(),t[Bl]=null}};function Ko(e){this._internalRoot=e}Ko.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vh();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Zs.length&&t!==0&&t<Zs[s].priority;s++);Zs.splice(s,0,e),s===0&&tx(e)}};var ax=a.version;if(ax!=="19.3.1")throw Error(o(527,ax,"19.3.1"));xe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var w1={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:ce,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vo.isDisabled&&Vo.supportsFiber)try{Xa=Vo.inject(w1),Jt=Vo}catch{}}return qi.createRoot=function(e,t){if(!c(e))throw Error(o(299));var s=!1,i="",u=Zp,d=Qp,x=Jp;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=Xv(e,1,!1,null,null,s,i,null,u,d,x,lx),e[Bl]=t.current,_d(e),new sf(t)},qi.hydrateRoot=function(e,t,s){if(!c(e))throw Error(o(299));var i=!1,u="",d=Zp,x=Qp,w=Jp,O=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError),s.formState!==void 0&&(O=s.formState)),t=Xv(e,1,!0,t,s??null,i,u,O,d,x,w,lx),t.context=Zv(null),s=t.current,i=ln(),i=Oc(i),u=Os(i),u.callback=null,_s(s,u,i),s=i,t.current.lanes=s,Qa(t,s),Jn(t),e[Bl]=t.current,_d(e),new Ko(t)},qi.version="19.3.1",qi}var px;function O1(){if(px)return af.exports;px=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),af.exports=z1(),af.exports}var _1=O1(),y=Wf();const R1=["general","rules","providers","models","memory","image","knowledge","search","skills","mcp","desktop","work","push","about"];function gx(n){try{return n?decodeURIComponent(n):null}catch{return null}}function D1(n,a){if(n==="job"||n==="routine")return a?{kind:n,id:a}:void 0;if(n==="file")return a?{kind:n,path:a,full:!1}:void 0;if(n==="routines"||n==="skills"||n==="knowledge"||n==="rules"||n==="assistant"||n==="jobs"||n==="newRoutine")return{kind:n}}function $1(n){return n.kind==="job"||n.kind==="routine"?`/${n.kind}/${encodeURIComponent(n.id)}`:n.kind==="file"?n.liveId||!n.path?"":`/file/${encodeURIComponent(n.path)}`:`/${n.kind}`}function U1(n){const[a,r,o,c]=n.replace(/^#\/?/,"").split("/"),f=gx(r);return a==="knowledge"?{sel:null,settings:!1,section:null,knowledge:!0}:a==="chat"&&f?{sel:f,settings:!1,section:null,panel:D1(o,gx(c))}:a==="settings"?{sel:null,settings:!0,section:R1.find(m=>m===f)??null}:{sel:null,settings:!1,section:null}}function L1(n,a){if(n.page==="knowledge")return"#/knowledge";if(n.page==="settings")return n.section?`#/settings/${n.section}`:"#/settings";if(!n.sel||a&&n.mobile!=="chat")return"";const r=n.panelStack?.at(-1);return`#/chat/${encodeURIComponent(n.sel)}${r?$1(r):""}`}const H1=["searxng","exa","tavily","brave","serper","jina","firecrawl","perplexity","youcom","ollama"];function Yb(){return H1.map(n=>({name:n,enabled:!1}))}class He extends Error{status;constructor(a,r){super(r),this.status=a}}async function se(n,a){let r;try{r=await fetch(n,{credentials:"same-origin",...a})}catch(c){throw new He(0,`无法连接 Hob:${c instanceof Error?c.message:String(c)}`)}if(!r.ok){let c=`${r.status} ${r.statusText}`;try{const f=await r.json();f?.error&&(c=f.error)}catch{}throw new He(r.status,c)}if(r.status===204)return;const o=await r.text();return o?JSON.parse(o):void 0}function Le(n,a="POST"){return{method:a,headers:{"content-type":"application/json"},body:JSON.stringify(n)}}const B1=["rules","assistant","assistant_removed","item","delta","job","delegation","job_step","activity","approval","draft","routine","routine_removed","profile","knowledge","skills"],q1={knowledge:(n={})=>{const a=new URLSearchParams;for(const[r,o]of Object.entries(n))o!==void 0&&o!==""&&a.set(r,String(o));return se(`/api/knowledge?${a}`)},knowledgeEntry:(n,a)=>se(`/api/knowledge/entries/${encodeURIComponent(n)}${a!==void 0?`?chunk=${a}`:""}`),reindexKnowledge:n=>se(`/api/knowledge/collections/${encodeURIComponent(n)}/reindex`,{method:"POST"}),embeddingKey:()=>se("/api/knowledge/embedding"),putEmbedding:(n,a,r)=>se("/api/knowledge/embedding",Le({revision:n,embedding:a,...r?{apiKey:r}:{}},"PUT")),embeddingTest:n=>se("/api/knowledge/embedding/test",Le(n)),createKnowledgeCollection:n=>se("/api/knowledge/collections",Le({name:n})).then(a=>a.collection),renameKnowledgeCollection:(n,a)=>se(`/api/knowledge/collections/${encodeURIComponent(n)}`,Le({name:a},"PATCH")).then(r=>r.collection),deleteKnowledgeCollection:n=>se(`/api/knowledge/collections/${encodeURIComponent(n)}`,{method:"DELETE"}),patchKnowledgeEntry:(n,a)=>se(`/api/knowledge/entries/${encodeURIComponent(n)}`,Le(a,"PATCH")).then(r=>r.entry),deleteKnowledgeEntry:n=>se(`/api/knowledge/entries/${encodeURIComponent(n)}`,{method:"DELETE"}),uploadKnowledge:(n,a)=>{const r=new FormData;for(const o of a)r.append("files",o);return se(`/api/knowledge/upload?collection=${encodeURIComponent(n)}`,{method:"POST",body:r})},me:()=>se("/api/me"),login:n=>se("/api/login",Le({password:n})),logout:()=>se("/api/logout",{method:"POST"}),bootstrap:()=>se("/api/bootstrap"),settings:()=>se("/api/settings"),rules:()=>se("/api/rules"),saveRules:n=>se("/api/rules",Le({rules:n},"PUT")),models:()=>se("/api/models"),putSettings:(n,a)=>se("/api/settings",Le({revision:n,patch:a},"PUT")),providers:()=>se("/api/providers"),claude:()=>se("/api/claude"),saveClaude:(n,a)=>se("/api/claude",Le({revision:n,claude:a},"PUT")),putProvider:(n,a)=>se(`/api/providers/${encodeURIComponent(n)}`,Le(a,"PUT")),putThinking:n=>se("/api/models/thinking",Le(n,"PUT")),deleteProvider:n=>se(`/api/providers/${encodeURIComponent(n)}`,{method:"DELETE"}),testProvider:n=>se("/api/providers/test",Le(n)),discoverProvider:n=>se("/api/providers/discover",Le(n)),providersImport:()=>se("/api/providers/import"),importProviders:n=>se("/api/providers/import",Le({ids:n})),assistantSkills:n=>se(`/api/assistants/${encodeURIComponent(n)}/skills`),patchAssistantSkill:(n,a,r)=>se(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:r})}),rollbackAssistantSkill:(n,a)=>se(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}/rollback`,{method:"POST"}),deleteAssistantSkill:(n,a)=>se(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),sedimentJob:n=>se(`/api/jobs/${encodeURIComponent(n)}/sediment`,{method:"POST"}),skills:()=>se("/api/skills"),skillsImport:n=>se(`/api/skills/import/${n}`),importSkills:(n,a,r)=>se(`/api/skills/import/${n}`,Le({ids:a,overwrite:r})),deleteSkill:n=>se(`/api/skills/${encodeURIComponent(n)}`,{method:"DELETE"}),desktop:()=>se("/api/desktop"),saveDesktop:n=>se("/api/desktop",Le(n,"PUT")),saveDesktopPublic:(n,a)=>se("/api/desktop/public",Le({revision:n,assistants:a},"PUT")),testDesktop:()=>se("/api/desktop/test",Le({})),mcp:()=>se("/api/mcp"),putMcp:(n,a)=>se(`/api/mcp/${encodeURIComponent(n)}`,Le(a,"PUT")),patchMcp:(n,a)=>se(`/api/mcp/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteMcp:n=>se(`/api/mcp/${encodeURIComponent(n)}`,{method:"DELETE"}),testMcp:(n,a)=>se(`/api/mcp/${encodeURIComponent(n)}/test`,Le({refresh:a})),mcpImports:()=>se("/api/mcp/import"),importMcp:n=>se("/api/mcp/import",Le({ids:n})),search:()=>se("/api/search"),putSearch:(n,a,r)=>se("/api/search",Le({revision:n,providers:a,keys:r},"PUT")),testSearch:(n,a,r)=>se("/api/search/test",Le({name:n,baseUrl:a,apiKey:r})),imageKey:()=>se("/api/image"),putImage:(n,a,r)=>se("/api/image",Le({revision:n,image:a,...r?{apiKey:r}:{}},"PUT")),imageTest:n=>se("/api/image/test",Le(n)),changePassword:(n,a)=>se("/api/password",Le({old:n,new:a})),about:()=>se("/api/about"),memory:()=>se("/api/memory"),putMemory:(n,a)=>se("/api/memory",Le({revision:n,provider:a},"PUT")),putLore:n=>se("/api/memory/lore",Le(n,"PUT")),loreTest:n=>se("/api/memory/lore-test",Le(n)),loreImport:()=>se("/api/memory/lore/import"),importLore:()=>se("/api/memory/lore/import",{method:"POST"}),items:(n,a)=>se(`/api/assistants/${encodeURIComponent(n)}/items?limit=60${a?`&before=${encodeURIComponent(a)}`:""}`),profile:n=>se(`/api/assistants/${encodeURIComponent(n)}/profile`),sendMessage:(n,a)=>se(`/api/assistants/${encodeURIComponent(n)}/messages`,Le(a)),stopAssistant:n=>se(`/api/assistants/${encodeURIComponent(n)}/stop`,{method:"POST"}),markRead:n=>se(`/api/assistants/${encodeURIComponent(n)}/read`,{method:"POST"}),patchAssistant:(n,a)=>se(`/api/assistants/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),archiveAssistant:n=>se(`/api/assistants/${encodeURIComponent(n)}/archive`,{method:"POST"}),deleteRule:(n,a)=>se(`/api/assistants/${encodeURIComponent(n)}/rules/${encodeURIComponent(a)}`,{method:"DELETE"}),retryDelegation:n=>se(`/api/delegations/${encodeURIComponent(n)}/retry`,{method:"POST"}),answerApproval:(n,a)=>se(`/api/approvals/${encodeURIComponent(n)}`,Le(a)),createDraft:n=>se(`/api/drafts/${encodeURIComponent(n)}/create`,{method:"POST"}),dismissDraft:n=>se(`/api/drafts/${encodeURIComponent(n)}/dismiss`,{method:"POST"}),createRoutine:n=>se("/api/routines",Le(n)),patchRoutine:(n,a)=>se(`/api/routines/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteRoutine:n=>se(`/api/routines/${encodeURIComponent(n)}`,{method:"DELETE"}),runRoutine:n=>se(`/api/routines/${encodeURIComponent(n)}/run`,{method:"POST"}),replyJob:(n,a)=>se(`/api/jobs/${encodeURIComponent(n)}/reply`,Le({text:a})),stopJob:n=>se(`/api/jobs/${encodeURIComponent(n)}/stop`,{method:"POST"}),transcript:n=>se(`/api/jobs/${encodeURIComponent(n)}/transcript`),jobs:(n={})=>{const a=new URLSearchParams;n.assistantId&&a.set("assistantId",n.assistantId),n.status&&a.set("status",n.status),n.before&&a.set("before",n.before),n.limit&&a.set("limit",String(n.limit));const r=a.toString();return se(`/api/jobs${r?`?${r}`:""}`)},upload:async n=>{const a=new FormData;a.append("file",n);const r=await se("/api/uploads",{method:"POST",body:a});if(!r.file?.path)throw new Error("上传响应缺少文件路径");return r.file.path},fileUrl:(n,a)=>`/api/files?path=${encodeURIComponent(n)}${a?.inline?"&inline=1":""}${a?.truncate?"&truncate=1":""}${a?.thumb?"&thumb=1":""}`,fileMeta:n=>se(`/api/files/meta?path=${encodeURIComponent(n)}`),jobFiles:(n,a)=>se(`/api/jobs/${encodeURIComponent(n)}/files${a?`?path=${encodeURIComponent(a)}`:""}`),push:()=>se("/api/push"),subscribePush:(n,a)=>se("/api/push/subscribe",Le({subscription:n,label:a})).then(r=>r.push),unsubscribePush:n=>se("/api/push/subscribe",{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})}),testPush:n=>se("/api/push/test",Le(n?{endpoint:n}:{})),visibility:(n,a)=>se("/api/visibility",Le({clientId:n,visible:a})),events:({onEvent:n,onReconnect:a,onDown:r},o)=>{const c=new EventSource(`/api/events${o?`?clientId=${encodeURIComponent(o)}`:""}`);let f=!1;const h=m=>{try{n(JSON.parse(m.data))}catch{}};c.onmessage=h;for(const m of B1)c.addEventListener(m,h);return c.onerror=()=>{f=!0,r(c.readyState===EventSource.CLOSED?"实时连接已断开":"实时连接中断,正在重连")},c.onopen=()=>{f&&(f=!1,a())},()=>c.close()}},I1=60;function Y1(n,a){return n.at===a.at?0:n.at<a.at?-1:1}function Gb(n,a,r=I1){const o=Array.isArray(a)?a:[a];if(!o.length)return n;const c=n.slice(),f=new Map;c.forEach((h,m)=>f.set(h.id,m));for(const h of o){const m=f.get(h.id);m===void 0?(f.set(h.id,c.length),c.push(h)):c[m]=h}return c.sort(Y1),c.length>r?c.slice(-r):c}function G1(n,a,r){const o=n.findIndex(h=>h.id===a);if(o<0)return n;const c=n[o];if(c.kind!=="assistant")return n;const f=n.slice();return f[o]={...c,text:c.text+r},f}function Kb(n){const a=n[n.length-1];return a?.kind==="assistant"&&!!a.streaming}function K1(n,a){return n.state==="writing"&&!a.seen&&!a.closed&&a.inChat&&n.assistantId===a.assistantId}function V1(n,a){return n.filter(r=>r.assistantId===a&&r.state==="writing")}const X1=900,Ra=new Map;function Vb(n){for(const a of n)Ra.has(a)||Ra.set(a,window.setTimeout(()=>Ra.delete(a),X1))}function Z1(n){return Ra.has(n)}function Q1(){for(const n of Ra.values())window.clearTimeout(n);Ra.clear()}function Xb(n){const a=n.querySelector(".hov.msg > .u, .hov.msg > .b")??n;a.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",block:"center"}),a.classList.remove("quote-flash"),a.offsetWidth,a.classList.add("quote-flash"),window.setTimeout(()=>a.classList.remove("quote-flash"),1100)}function wn(n,a=180){const[r,o]=y.useState(n);return y.useEffect(()=>{if(n){o(!0);return}const c=window.setTimeout(()=>o(!1),a);return()=>window.clearTimeout(c)},[n,a]),{mounted:r,leaving:r&&!n}}function J1(n,a,r="",o=200){const[c,f]=y.useState([]),[h,m]=y.useState([]),p=y.useRef(null),g=y.useRef(r),v=y.useRef([]),b=y.useRef([]);return y.useEffect(()=>{const E=n.map(a);if(p.current===null||g.current!==r){p.current=new Set(E),g.current=r,v.current=n;return}const S=E.filter(z=>!p.current.has(z)),T=v.current.filter(z=>!E.includes(a(z)));if(p.current=new Set(E),v.current=n,S.length&&(f(z=>[...z,...S]),b.current.push(window.setTimeout(()=>f(z=>z.filter(A=>!S.includes(A))),1e3))),T.length){const z=T.map(A=>({item:A,key:a(A),state:"leave"}));m(A=>[...A,...z]),b.current.push(window.setTimeout(()=>m(A=>A.filter($=>!z.some(D=>D.key===$.key))),o))}},[n,a,r,o]),y.useEffect(()=>{const E=b.current;return()=>{for(const S of E)window.clearTimeout(S)}},[]),[...n.map(E=>{const S=a(E);return{item:E,key:S,state:c.includes(S)?"enter":"still"}}),...h]}function yc(n){return`pending/${n.id}/${n.name}`}function P1(n){return{kind:"user",id:n.localId,at:n.at,text:n.text,...n.quote?{quote:n.quote}:{},...n.attachments.length?{files:n.attachments.map(a=>a.path??yc(a))}:{}}}function F1(n,a){if(a.kind!=="user"||n.status!=="sending"||a.text!==n.text)return!1;const r=n.attachments.map(c=>c.path),o=a.files??[];return r.length===o.length&&r.every((c,f)=>c===o[f])}const W1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"};function Ji(n){const a=n.lastIndexOf(".");return a===-1?!1:n.slice(a).toLowerCase()in W1}function Ii(n){return(n.split("/").pop()??n).replace(/^u-[a-z0-9]{6}-/,"")}function Zb(n){const a=/^#k\/(k-[\w-]+)(?:\/(\d+))?$/.exec(n.trim());return a?{entryId:a[1],...a[2]!==void 0?{chunk:Number(a[2])}:{}}:null}function Qb(n){return n==="image"||n==="svg"?"image":n==="csv"||n==="json"?"table":n==="html"?"page":n==="markdown"||n==="text"||n==="pdf"||n==="code"||n==="xml"?"document":"other"}const oc=["off","minimal","low","medium","high","xhigh","max"],sc={off:"关闭",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},ew=40;function tw(n,a){return a?/gpt/i.test(n)?oc.slice(0,6):[...oc]:["off"]}function nw(n,a){return a==="google-generative-ai"||a==="google-vertex"?"high":n}function sw(n,a,r,o){if(!a)return{levels:["off"],chars:{},map:{}};const c=tw(n,a),f=[],h={},m={};for(const p of oc){const g=r?.[p];if(!(g!==void 0?g!==null:c.includes(p))){m[p]=null;continue}f.push(p);const b=typeof g=="string"?g.trim():"";h[p]=b,b?m[p]=b:(p==="xhigh"||p==="max")&&(m[p]=nw(p,o))}return{levels:f,chars:h,map:m}}function lw(n){if(!n||typeof n!="object"||Array.isArray(n))return;const a=n,r={};let o=!1;for(const c of oc){if(!(c in a))continue;o=!0;const f=a[c];if(f===null){r[c]=null;continue}const h=typeof f=="string"?f.trim():"";r[c]=h.length<=ew?h:""}if(o)return r.off===null&&(r.off=""),r}const Jb={image:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-demo":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-think":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-tool":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"act-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"act-home":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},boot:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},bubbles:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"bubbles-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},s1:{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"list"},s2:{sel:"bird",panel:"routine:r-daily",collapsed:!1,dark:!1,mobile:"list"},s3:{sel:"page",panel:"assistant",collapsed:!1,dark:!1,mobile:"list"},s4:{sel:"hob",panel:"now",collapsed:!0,dark:!1,mobile:"list"},s6:{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"list"},mlist:{sel:null,panel:"now",collapsed:!1,dark:!1,mobile:"list"},mchat:{sel:"page",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-running":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-waiting":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-done":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"d-source":{sel:"server",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"d-mobile":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-hob":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-dark":{sel:"hob",panel:"now",collapsed:!1,dark:!0,mobile:"chat"},"h-source":{sel:"server",panel:"now",collapsed:!1,dark:!1,mobile:"chat"},"h-settings":{sel:"server",panel:"assistant",collapsed:!1,dark:!1,mobile:"chat"},"h-mobile":{sel:"hob",panel:"now",collapsed:!1,dark:!1,mobile:"chat"}},yn=(()=>{let n=0;return a=>`${a}${++n}`})();function W(n,a,r=0){const o=new Date;return o.setDate(o.getDate()-n),o.setHours(a,r,0,0),o.toISOString()}function ue(n){return new Date(Date.now()-n*6e4).toISOString()}function de(n){return JSON.parse(JSON.stringify(n))}function cc(){const n=new URLSearchParams(globalThis.location?.search??"").get("desktop");return n==="ready"||n==="deployed"||n==="failed"?n:"none"}const aw={version:"1.7.0",display:{width:1280,height:800},screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}]},iw={none:{revision:1,url:"",enabled:!1,deployed:!1,tokenConfigured:!1,publicAssistants:[]},ready:{revision:1,url:"http://127.0.0.1:30196",enabled:!0,deployed:!1,tokenConfigured:!0,publicAssistants:[]},deployed:{revision:1,url:"http://desktop:6080",enabled:!0,deployed:!0,tokenConfigured:!0,publicAssistants:[]},failed:{revision:1,url:"http://127.0.0.1:30196",enabled:!0,deployed:!1,tokenConfigured:!0,publicAssistants:[]}},rw=[{at:ue(6),verb:"$",text:"npm run typecheck"},{at:ue(5),verb:"读",text:"protocol/src/projection.ts"},{at:ue(4),verb:"读",text:"client/src/runtime/store.ts"},{at:ue(3),verb:"跑",text:"浏览器 打开 http://localhost:3000/pricing"},{at:ue(3),verb:"跑",text:"npm test -w protocol"},{at:ue(2),verb:"读",text:"client/src/chat/Transcript.tsx"},{at:ue(1),verb:"读",text:"client/src/chat/ToolRow.tsx"}];function ow(n){const a=n==="s1"||n==="s6",r=n==="s4",o=a||n==="mlist",c=!o&&n!=="mchat",f=[{id:"hob",name:"Hob",duty:"主助手",sprite:"hob",primary:!0,pinned:!0,hidden:!1,notify:!0,instructions:"输出用中文短句;编写代码的任务先询问项目目录。",createdAt:W(30,9,0),last:{text:"已交给任务处理,完成后通知你。",at:W(0,10,5)},unread:0,busy:!0},{id:"page",name:"写作",duty:"周报和文章",sprite:"page",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"口语化短句;标题不超过 20 字;配图自行生成;周报每周五提交。",models:{work:{ref:"faux/smart",thinking:"high"},allowed:["faux/smart","faux/vision"]},abilities:{exec:!1,write:!0,image:!0},createdAt:W(30,9,0),last:{text:"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。",at:W(0,10,20)},unread:2,busy:!1},{id:"server",name:"服务器",duty:"线上和机器",sprite:"server",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"清理日志前先查看保留天数的规则。",createdAt:W(28,9,0),last:{text:"凌晨 3 点清理 2.1GB 旧日志",at:W(1,3,5)},unread:0,busy:!1},{id:"bird",name:"行业动态",duty:"每天 6 条行业动态",sprite:"bird",primary:!1,pinned:!1,hidden:!1,notify:!0,instructions:"关注 agent 编排和本地部署,不包含融资新闻。",createdAt:W(7,9,0),splitFrom:{from:"hob",at:W(7,9,0),conversations:8},last:{text:"今天 6 条,挑选了 2 条重点",at:W(0,9,0)},unread:0,busy:!1},{id:"house",name:"家里 NAS",duty:"相册和备份",sprite:"house",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:W(25,9,0),last:{text:"相册备份完成,新增 312 张",at:W(0,7,30)},unread:0,busy:!1},{id:"coin",name:"记账",duty:"账单和预算",sprite:"coin",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:W(24,9,0),last:{text:"10 月账单已整理完成,比上月减少 12%",at:W(1,21,10)},unread:0,busy:!1},{id:"book",name:"读书",duty:"读书笔记",sprite:"book",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:W(20,9,0),last:{text:"本周读书笔记已整理完成",at:W(3,20,0)},unread:0,busy:!1},{id:"leaf",name:"健身",duty:"每周训练",sprite:"leaf",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:W(18,9,0),last:{text:"本周三次训练已记录",at:W(2,19,0)},unread:0,busy:!1}],h=(L,J,te,ke,me,Ne,_e,le,ve)=>({id:L,assistantId:J,title:te,detail:ke,options:me,status:Ne?"answered":"pending",chosen:Ne?_e:void 0,source:"router",ruleText:ve,createdAt:le,answeredAt:Ne?le:void 0}),p={"ap-publish":h("ap-publish","page","发到公众号吗?",void 0,de([{key:"A",label:"发布"},{key:"B",label:"暂不发布"},{key:"C",label:"以后同类内容直接发布,无需确认",always:!0}]),c,"C",W(0,7,42),"发公众号"),"ap-split":h("ap-split","hob","是否创建一个专属助手「行业动态」?",a?"这两周你让我查询了 8 次模型和 agent 产品的动态。创建后它会记住你关注的内容,每天早上 9 点提供一份简报。":"这两周你让我查询了 8 次模型和 agent 产品的动态。",[{key:"A",label:"创建专属助手"},{key:"B",label:"暂不创建"}],!o,"A",W(0,10,15))},g={id:"d-bird",assistantId:"hob",status:r?"pending":"created",name:"行业动态",sprite:"bird",duty:"跟踪模型发布、agent 产品和开源项目",dutyLong:"跟踪模型发布、agent 产品和开源项目",routines:[{name:"每日简报",instruction:"挑最值得看的几条,最多 6 条",schedule:"0 9 * * *"}],routinesText:"每天 09:00 简报,最多 6 条;重要发布随时提醒",askFirst:["花钱订阅","替你对外发消息"],instructions:["关心 agent 编排和本地部署","不看融资新闻"],carry:{conversations:8},createdAssistantId:r?void 0:"bird",createdAt:W(0,10,17)},v={id:"t-0931",assistantId:"hob",title:"排查页面卡顿",instruction:"排查页面卡顿的原因,不要修改代码。",status:"running",createdAt:ue(6),startedAt:ue(6),stats:{reads:14,commands:3,edits:0},cwd:"/srv/example/site",activity:de(rw)},b={id:"t-rounds",assistantId:"hob",title:"整理项目资料",instruction:"整理项目资料并列出缺失项。",status:"running",createdAt:ue(40),startedAt:ue(5),stats:{reads:5,commands:2,edits:0},rounds:[{status:"done",startedAt:ue(40),endedAt:ue(30),durationMs:6e5,summary:"已整理资料清单。",files:["/srv/example/list.md"],followUp:"核对缺失的文档。"},{status:"stuck",startedAt:ue(25),endedAt:ue(15),durationMs:6e5,summary:"缺少接口文档,暂时无法核对。",followUp:"先根据现有资料继续。"}],activity:[{at:ue(35),verb:"读",text:"/srv/example/资料"},{at:ue(20),verb:"搜",text:"接口文档"},{at:ue(3),verb:"读",text:"/srv/example/项目说明"}]},j={id:"t-0927",assistantId:"server",title:"清理旧日志",instruction:"清理三天前的旧日志,不要影响正在运行的服务。",status:"done",createdAt:W(1,3,0),startedAt:W(1,3,0),endedAt:W(1,3,5),stats:{reads:4,commands:2,edits:0},summary:"已清理 2.1GB 旧日志,服务均正常运行。",cwd:"/srv/example/reports",files:["/srv/example/reports/log-cleanup-1031.md","/srv/example/reports/stats.csv"],activity:[{at:W(1,3,0),verb:"$",text:"du -sh /var/log/*"},{at:W(1,3,1),verb:"读",text:"/var/log/nginx"},{at:W(1,3,3),verb:"跑",text:"find /var/log -mtime +3 -delete"},...Array.from({length:9},(L,J)=>({at:W(1,3,4),verb:"读",text:`/srv/example/reports/src/check-${J}.ts`})),{at:W(1,3,5),verb:"说",text:"已清理 2.1GB,服务均正常运行。"}]},E={id:"t-0929",assistantId:"house",title:"整理相册备份",instruction:"把手机里这个月的照片备份到 NAS,重复的跳过。",status:"done",createdAt:ue(58),startedAt:ue(58),endedAt:ue(51),stats:{reads:6,commands:2,edits:0},summary:"新增 312 张,重复跳过 87 张,占用 4.2GB。",activity:[{at:ue(57),verb:"读",text:"/mnt/nas/photos"},{at:ue(55),verb:"跑",text:"rsync -a --ignore-existing /sdcard/DCIM /mnt/nas/photos/"},{at:ue(51),verb:"说",text:"新增 312 张,占用 4.2GB。"}]},S=[{id:"r-morning",assistantId:"hob",name:"早报",instruction:"汇总昨天交代的事项和今天的重要事项,早上汇报一次。",schedules:["0 8 * * *"],active:!0,createdAt:W(20,21,0),runs:[{jobId:"t-0901",at:W(0,8,0),status:"done"}]},{id:"r-weekly-reminder",assistantId:"hob",name:"周报提醒",instruction:"周五下午提醒查看本周周报。",schedules:["0 17 * * 5"],active:!0,createdAt:W(20,21,2),runs:[]},{id:"r-reconcile",assistantId:"hob",name:"月底对账",instruction:"月末核对账单,列出不一致的项目。",schedules:["0 9 28 * *"],active:!1,createdAt:W(19,10,0),runs:[{jobId:"t-0820",at:W(4,9,0),status:"done"}]},{id:"r-daily",skill:"daily-brief",assistantId:"bird",name:"每日简报",instruction:"挑模型发布、agent 产品和开源项目里最值得看的几条,每条一句话说清为什么重要。最多 6 条,不看融资新闻。",schedules:["0 9 * * *"],active:!0,createdAt:W(7,9,0),runs:[{jobId:"t-0926",at:W(0,9,0),status:"done",durationMs:372e3,tools:95,tokens:198e3},{jobId:"t-0925",at:W(1,9,0),status:"done"},{jobId:"t-0924",at:W(2,9,1),status:"done"},{jobId:"t-0923",at:W(3,9,0),status:"done"}]},{id:"r-weekly-draft",assistantId:"page",name:"周报初稿",instruction:"每周五 17:00 撰写周报初稿,存入草稿箱,完成后通知我。",schedules:["0 17 * * 5"],active:!0,createdAt:W(0,10,21),runs:[]}],T=(L,J,te,ke)=>({kind:"assistant",id:L,at:J,text:te,routine:ke}),A=[T("i-h1",W(0,8,0),`早上好。昨晚交代的两件事均已完成:
|
|
51
|
+
|
|
52
|
+
- 写作已将周报初稿存入草稿箱
|
|
53
|
+
- 服务器凌晨 3 点清理了 2.1GB 旧日志`),{kind:"user",id:"i-h3",at:W(0,10,5),text:"页面为什么这么卡?排查一下原因,不要修改代码。"},T("i-h4",W(0,10,5),"已交给任务处理,完成后通知你。"),{kind:"job",id:"i-h5",at:W(0,10,5),jobId:"t-0931"},{kind:"question",id:"i-h6",at:W(0,10,a?9:15),approvalId:"ap-split"},{kind:"job",id:"i-round-1",at:ue(40),jobId:"t-rounds",round:0},{kind:"job",id:"i-round-2",at:ue(25),jobId:"t-rounds",round:1},{kind:"job",id:"i-round-3",at:ue(5),jobId:"t-rounds",round:2}];a||A.push({kind:"user",id:"i-h7",at:W(0,10,16),text:"创建专属助手吧。最多 6 条即可,不要包含融资新闻。"},T("i-h8",W(0,10,17),"草稿如下,需要修改请直接说明:"),{kind:"draft",id:"i-h9",at:W(0,10,17),draftId:"d-bird"});const $=r?A.filter(L=>!["i-h2","i-h3","i-h4","i-h5"].includes(L.id)):A,D=[T("i-p1",W(1,17,5),"周报初稿已完成,存放在草稿箱。"),{kind:"user",id:"i-p2",at:W(1,17,6),text:n==="mchat"?"好,周一发布。":"标题再短一些。"},T("i-p3",W(1,17,8),n==="mchat"?"好的,周一发布时我会再提醒你。":"已改为《这周:Hob 立项》。"),T("i-p4",W(0,7,40),"《Grok Bot 能借鉴什么》已完成,3200 字,包含 4 张配图。"),{kind:"file",id:"i-p5",at:W(0,7,41),path:"/srv/example/notes/Grok Bot 能借鉴什么.md",name:"Grok Bot 能借鉴什么.md",meta:"3200 字 · 4 张图"},{kind:"question",id:"i-p6",at:W(0,7,42),approvalId:"ap-publish"}];n!=="mchat"&&D.push({kind:"note",id:"i-p7",at:W(0,7,43),icon:"rule",text:"已记入写作的规则 · 发布公众号无需确认"},T("i-p8",W(0,7,44),"已发布。[查看文章](https://mp.weixin.qq.com/)"),{kind:"user",id:"i-p9",at:W(0,10,20),text:"以后周报也由你负责,周五下午提供初稿。"},T("i-p10",W(0,10,20),"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。"),{kind:"note",id:"i-p11",at:W(0,10,21),icon:"routine",text:"新增定时任务 · 周报初稿 · 每周五 17:00"});const V=[{kind:"note",id:"i-b0",at:W(7,9,0),icon:"split",text:`${new Date(W(7,9,0)).getMonth()+1}月${new Date(W(7,9,0)).getDate()}日 由 Hob 创建 · 迁移 8 段对话、14 条记忆`},T("i-b1",W(1,9,0),"昨天 5 条,没有特别要紧的。[看全部 5 条](https://example.com/)",{id:"r-daily",name:"每日简报"}),{kind:"job",id:"i-b-job",at:W(0,9,0),jobId:"t-0926"},T("i-b2",W(0,9,0),"今天 6 条,挑选 2 条重点:",{id:"r-daily",name:"每日简报",jobId:"t-0926"}),T("i-b3",W(0,9,0),`1. DeepSeek 公开 Super-agent 设计:路由只分派,任务隔离执行。
|
|
54
|
+
2. xAI 的 Grok Bot:常驻 Bot 加定时任务,结果直接回到对话。
|
|
55
|
+
|
|
56
|
+
[看全部 6 条](https://example.com/)`),{kind:"user",id:"i-b4",at:W(0,9,12),text:"这个和 Hob 相比,差异在哪里?",quote:{itemId:"i-b3",text:"xAI 的 Grok Bot:常驻 Bot 加定时任务…"}},T("i-b5",W(0,9,12),"它的 Bot 有一台云电脑,能直接操作网页;Bot 之间也能互相发消息。定时任务、审批、助手创建,我们均已具备。"),{kind:"user",id:"i-b6",at:W(0,9,14),text:"以后不需要包含融资新闻。"},T("i-b7",W(0,9,14),"好的,已记录。"),{kind:"note",id:"i-b8",at:W(0,9,14),icon:"memory",text:"记忆已更新 · 不包含融资新闻,优先关注人工智能产品和模型的重要更新与实际应用"},{kind:"note",id:"i-b8-en",at:W(0,9,14),icon:"memory",text:"记忆已更新 · Follow important AI product and model updates, focusing on practical applications."},{kind:"note",id:"i-b9",at:W(0,9,15),icon:"skill",text:"已沉淀技能「每日行业简报」,以后定时执行按它做",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md"}],N=(L,J,te,ke)=>[T(`${L}-1`,W(1,20,0),J),{kind:"user",id:`${L}-2`,at:W(1,20,2),text:te},T(`${L}-3`,W(1,20,3),ke)],k={hob:$,page:D,bird:V,server:[...N("i-s","凌晨清理日志的任务已完成,清理 2.1GB,服务均正常运行。","好的,以后每月清理一次。","已记录:每月 1 号凌晨 3 点清理一次。"),{kind:"job",id:"i-s4",at:W(1,3,5),jobId:"t-0927"}],house:N("i-ho","相册备份已完成,新增 312 张,占用 4.2GB。","硬盘还剩多少?","剩余 1.8TB,可用约半年。"),coin:N("i-c","10 月账单已整理完成,比上月减少 12%。","哪一类支出较多?","餐饮和打车,比上月增加 800。"),book:N("i-bk","本周读书笔记已整理完成,共三条。","发给我看看。","已放入文件中。"),leaf:N("i-lf","本周三次训练已记录。","下周增加到四次。","好的,下周安排四次。")};n==="image"&&(k.hob=[{kind:"user",id:"image-user",at:ue(3),text:"画几张图片给我看看。"},{kind:"image",id:"image-done",at:ue(3),startedAt:ue(3),prompt:"海边的日落",size:"1536x1024",status:"done",path:"/mock/photo.jpg"},{kind:"image",id:"image-failed",at:ue(2),startedAt:ue(2),prompt:"山间的早晨",status:"failed",error:"图像服务暂时不可用,请稍后重试。"},{kind:"image",id:"image-pending",at:ue(1),startedAt:ue(1),prompt:"安静的街道",status:"pending"}]),(n==="bubbles"||n==="bubbles-dark")&&(k.hob=[{kind:"user",id:"bubble-user",at:ue(3),text:"给我看看公式、代码和媒体。"},T("bubble-text",ue(2),"行内公式 $E=mc^2$,整行公式:\n\n$$\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}$$\n\n```js\nconst answer = 42;\n```\n\n```sh\necho hello\n```\n\n价格是 $5 和 $10。"),T("bubble-md",ue(2),"我把刚才的示意图整理成 `.md` 文件,图用 Mermaid 写,方便你看源码或直接预览。"),{kind:"job",id:"bubble-job",at:ue(2),jobId:"t-0927"},{kind:"file",id:"bubble-file",at:ue(2),path:"/mock/火星日落示意图.md",name:"火星日落示意图.md",meta:"349 字"},T("bubble-after-file",ue(2),"《火星日落示意图.md》已发给你。直接打开能看 Markdown 源码,用支持 Mermaid 的预览器可以看到光路图。"),{kind:"file",id:"bubble-page",at:ue(2),path:"/mock/sunset.html",name:"如果在地球和火星同时看日落",meta:"两幅同视角示意图:看太阳周围,再看远离太阳的天空。"},T("bubble-list",ue(2),`五个模块:
|
|
57
|
+
|
|
58
|
+
1. **两层架构。** Router 长期在线,只负责人机交互、全局协调和派发,**故意不执行任务,甚至可以没有 Bash 工具**;Worker 上下文隔离,**但从不直接对人说话**,只向 Router 报告。
|
|
59
|
+
2. **全双工。** 把同步 \`run()\` 换成异步 \`start()\` / \`stop()\`,立刻回一句"已开始"。
|
|
60
|
+
- 工具跑完再作为新事件送回来
|
|
61
|
+
- **这个机制默认没开。**
|
|
62
|
+
3. 普通的一行
|
|
63
|
+
4. 第四
|
|
64
|
+
5. 第五
|
|
65
|
+
6. 第六
|
|
66
|
+
7. 第七
|
|
67
|
+
8. 第八
|
|
68
|
+
9. 第九
|
|
69
|
+
10. 第十项,两位数的序号也要对齐`),{kind:"file",id:"bubble-audio",at:ue(1),path:"/mock/audio.mp3",name:"语音样本.mp3"},{kind:"file",id:"bubble-video",at:ue(1),path:"/mock/video.mp4",name:"视频样本.mp4"},{kind:"user",id:"bubble-photo",at:ue(1),text:"这个是什么",files:["/mock/photo.jpg"]},{kind:"user",id:"bubble-photo-only",at:ue(1),text:"",files:["/mock/photo2.jpg"]},{kind:"user",id:"bubble-photos",at:ue(1),text:"两张对比一下",files:["/mock/photo.jpg","/mock/photo2.jpg"]},{kind:"user",id:"bubble-user-file",at:ue(1),text:"帮我看看这份报告",files:["/mock/u-k2m9xq-季度报告.pdf"]},{kind:"user",id:"bubble-user-2",at:ue(1),text:"画个简单的表格给我,有几种方式?"},T("bubble-table",ue(0),`主要有四种:
|
|
70
|
+
|
|
71
|
+
| 方式 | 适合什么情况 | 能不能改 |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| 聊天里直接画 | 简单的表,看一眼就行 | 让我重画 |
|
|
74
|
+
| 发 Excel 或 CSV 文件 | 要下载、自己改或者算 | 能 |
|
|
75
|
+
| 做成页面 | 能排序、筛选,以后还要更新 | 能 |
|
|
76
|
+
| 做成图片 | 要转发给别人或者发朋友圈 | 不能 |
|
|
77
|
+
|
|
78
|
+
想要哪种?告诉我放什么内容。`)]);const C={},M={"t-0931":v,"t-rounds":b,"t-0927":j,"t-0929":E,"t-0926":{id:"t-0926",assistantId:"bird",title:"每日简报",instruction:"整理每日简报",status:"done",createdAt:W(0,8,54),startedAt:W(0,8,54),endedAt:W(0,9,0),durationMs:372e3,stats:{reads:30,commands:60,edits:5},usage:{input:18e4,output:18e3,cost:0},routineId:"r-daily",summary:"今天 6 条,挑选 2 条重点。",activity:[]}};if((n==="s1"||n==="s6")&&(C["dg-sidebar-running"]={id:"dg-sidebar-running",from:"hob",to:"page",text:"整理文章。",createdAt:ue(6),status:"running",jobIds:[]},C["dg-sidebar-waiting"]={id:"dg-sidebar-waiting",from:"hob",to:"server",text:"检查服务器。",createdAt:ue(5),status:"waiting",jobIds:[]},k.hob.push({kind:"delegation",id:"sidebar-running",at:ue(6),delegationId:"dg-sidebar-running"},{kind:"delegation",id:"sidebar-waiting",at:ue(5),delegationId:"dg-sidebar-waiting"})),n.startsWith("d-")){const L=n==="d-waiting"||n==="d-mobile"?"waiting":n==="d-done"?"done":"running",J={id:"dg-demo",from:"hob",to:"server",text:"检查服务器磁盘和服务状态,清理前先确认,不要影响正在运行的服务。",createdAt:ue(6),status:L,jobIds:["t-delegated"],approvalIds:[]};C[J.id]=J,M["t-delegated"]={...v,id:"t-delegated",assistantId:"server",delegationId:J.id,title:"检查服务器状态",status:L==="waiting"?"waiting":L},L==="waiting"&&(p["ap-delegation"]={id:"ap-delegation",assistantId:"server",title:"清理旧日志吗?",detail:"将清理七天前的日志。",options:[{key:"A",label:"清理旧日志"},{key:"B",label:"暂不清理"}],status:"pending",source:"job",jobId:"t-delegated",createdAt:ue(2)}),k.hob=[{kind:"user",id:"d-user",at:ue(7),text:"检查一下服务器的磁盘和服务状态。"},{kind:"delegation",id:"d-card",at:ue(6),delegationId:J.id}],k.server=[{kind:"user",id:"d-forward",at:ue(6),text:J.text,from:{assistantId:"hob",name:"Hob",delegationId:J.id}},{kind:"job",id:"d-job",at:ue(5),jobId:"t-delegated"},...L==="waiting"?[{kind:"question",id:"d-question",at:ue(2),approvalId:"ap-delegation"}]:[]]}if(n.startsWith("h-")){const L=f.find(J=>J.id==="server");L&&(L.dutyLong="维护服务器、监控服务状态和磁盘空间;代理配置由其他助手负责。"),C["dg-returned"]={id:"dg-returned",from:"hob",to:"server",text:"检查代理节点为什么无法连接。",createdAt:ue(4),status:"returned",reply:"退回:代理配置不属于服务器维护职责。",jobIds:[]},k.hob=[{kind:"user",id:"h-forward",at:ue(8),text:"检查代理节点为什么无法连接。",from:{assistantId:"server",name:"服务器",delegationId:"hb-demo"}},{kind:"delegation",id:"h-card",at:ue(4),delegationId:"dg-returned"}],k.server=[{kind:"user",id:"h-user",at:ue(9),text:"检查代理节点为什么无法连接。"},{kind:"note",id:"h-note",at:ue(8),icon:"info",text:"已交回 Hob:代理配置不属于我的职责。",handbackId:"hb-demo"},{kind:"user",id:"h-delegation-forward",at:ue(4),text:"检查代理节点为什么无法连接。",from:{assistantId:"hob",name:"Hob",delegationId:"dg-returned"}}]}if(n.startsWith("act-")){const L=f.find(J=>J.id==="hob");L.busy=!0,L.activity=n==="act-think"||n==="act-demo"?{state:"thinking",label:"正在想…"}:{state:"tool",label:"搜索:最新 AI 动态"},k.hob=[{kind:"user",id:"act-user",at:ue(1),text:"帮我搜索最新 AI 动态。"}],n==="act-home"&&(f.find(J=>J.id==="page").busy=!0)}return{assistants:f,items:k,jobs:M,delegations:C,approvals:p,drafts:{"d-bird":g},routines:S,assistantSkills:{bird:[{name:"daily-brief",title:"每日行业简报",description:"整理值得关注的行业动态。",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md",version:2,createdAt:W(7,9),updatedAt:W(1,9),uses:3,lastUsedAt:W(0,9),enabled:!0},{name:"release-watch",title:"重要发布追踪",description:"追踪模型和产品的重要发布。",path:"/mock/assistants/bird/skills/release-watch/SKILL.md",version:1,createdAt:W(2,9),updatedAt:W(2,9),uses:0,enabled:!0}]},rules:{hob:[{id:"rule-1",text:"花钱",mode:"ask",changedAt:W(10,9,0)},{id:"rule-2",text:"改线上服务",mode:"ask",changedAt:W(10,9,0)},{id:"rule-3",text:"清理我的文件",mode:"ask",changedAt:W(3,9,0)}],page:[{id:"rule-4",text:"删除草稿",mode:"ask",changedAt:W(9,9,0)},{id:"rule-5",text:"花钱",mode:"ask",changedAt:W(9,9,0)},{id:"rule-6",text:"发公众号",mode:"allow",changedAt:ue(120)}],bird:[{id:"rule-7",text:"花钱订阅",mode:"ask",changedAt:W(7,9,0)}]},worklog:{hob:[{at:W(0,10,5),text:"任务已完成:排查页面卡顿",jobId:"t-0931"},{at:W(0,8,2),text:"转述写作的审批:发布公众号"},{at:W(0,8,0),text:"早报:两件事均已完成"}],page:[{at:W(0,10,21),text:"新增定时任务:周报初稿",jobId:"r-weekly-draft"},{at:W(0,7,44),text:"发布的文章:Grok Bot 能借鉴什么"},{at:W(0,7,40),text:"完成《Grok Bot 能借鉴什么》,3200 字"},{at:W(1,17,8),text:"周报初稿修改标题"}],bird:[{at:W(0,9,0),text:"每日简报:今天 6 条",jobId:"t-0926"},{at:W(1,9,0),text:"每日简报:昨天 5 条",jobId:"t-0925"}],server:[{at:W(1,3,5),text:"任务已完成:清理旧日志",jobId:"t-0927"}],house:[{at:W(0,7,30),text:"相册备份:新增 312 张"}],coin:[{at:W(1,21,10),text:"10 月账单已整理"}],book:[],leaf:[]},settings:{revision:1,settings:{general:{theme:n==="d-dark"||n==="h-dark"||n==="act-dark"?"dark":"system",timezone:"Asia/Tokyo",aboutYou:{name:"小林",language:"中文",notes:""}},providers:[{kind:"builtin",id:"anthropic"},{kind:"custom",id:"my-proxy",name:"我的代理",api:"openai-completions",baseUrl:"http://127.0.0.1:8080/v1",models:[{id:"gpt-x",name:"GPT X",input:["text","image"],reasoning:!0,contextWindow:2e5}]}],models:{roster:[{ref:"faux/fast",note:"响应快、成本低,适合日常对话",thinking:"low"},{ref:"faux/smart",note:"能力最强但速度较慢,适合复杂问题",thinking:"high"},{ref:"faux/vision",note:"支持图像输入,适合截图和图片",thinking:"medium"}],conversation:{ref:"faux/fast",thinking:"low"},work:{ref:"faux/smart",thinking:"high"}},image:{source:"off"},search:[{name:"searxng",enabled:!0,baseUrl:"http://127.0.0.1:8888"},{name:"exa",enabled:!0},...Yb().filter(L=>L.name!=="searxng"&&L.name!=="exa")],work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}}}}}const cw={models:[{ref:"faux/fast",provider:"faux",id:"fast",name:"Faux Fast",reasoning:!1,thinkingLevels:["off"],input:["text"],contextWindow:128e3,maxTokens:8192,cost:{input:.1,output:.4}},{ref:"faux/smart",provider:"faux",id:"smart",name:"Faux Smart",reasoning:!0,thinkingLevels:["off","minimal","low","medium","high","xhigh","max"],input:["text"],contextWindow:4e5,maxTokens:32e3,cost:{input:3,output:15}},{ref:"faux/vision",provider:"faux",id:"vision",name:"Faux Vision",reasoning:!0,thinkingLevels:["off","minimal","low","medium","high","xhigh"],input:["text","image"],contextWindow:2e5,maxTokens:16e3,cost:{input:2,output:8}},{ref:"faux/tiny",provider:"faux",id:"tiny",name:"Faux Tiny",reasoning:!1,thinkingLevels:["off"],input:["text"],contextWindow:64e3,maxTokens:4096,cost:{input:.05,output:.2}},{ref:"sample/deep",provider:"sample",id:"deep",name:"Sample Deep",reasoning:!0,thinkingLevels:["off","minimal","low","medium","high","xhigh","max"],input:["text","image"],contextWindow:1e6,maxTokens:64e3,cost:{input:8,output:40}}],roster:[]},vx={keyConfigured:!0},uw=[{id:"anthropic",name:"Anthropic"},{id:"openai",name:"OpenAI"},{id:"google",name:"Google"},{id:"deepseek",name:"DeepSeek"},{id:"openrouter",name:"OpenRouter"}],dw={anthropic:[{id:"claude-x",name:"Claude X",reasoning:!0},{id:"claude-x-haiku",name:"Claude X Haiku",reasoning:!1}],openai:[{id:"gpt-6-astra",name:"GPT-6 Astra",reasoning:!0}]};function df(n,a){return(n.kind==="custom"?n.models.map(o=>({id:o.id,name:o.name?.trim()||o.id,reasoning:o.reasoning===!0})):dw[n.id]??[]).map(o=>{const c=`${n.id}/${o.id}`,f=a?.[c],h=sw(o.id,o.reasoning,f,n.kind==="custom"?n.api:void 0);return{ref:c,id:o.id,name:o.name,reasoning:o.reasoning,levels:h.levels.map(m=>({level:m,text:h.chars[m]??""})),custom:f!==void 0}})}const fw="/Users/me/.pi/agent",hw="/Users/me/.lore",mw=[{id:"anthropic",kind:"builtin",models:12,key:"literal",exists:!0,selectable:!0},{id:"my-proxy",kind:"custom",api:"openai-completions",baseUrl:"https://proxy.example/v1",models:4,key:"literal",exists:!1,selectable:!0},{id:"cmd-proxy",kind:"custom",api:"anthropic-messages",baseUrl:"http://127.0.0.1:8080",models:2,key:"command",exists:!1,selectable:!0,note:"Key 需通过命令获取,请导入后手动填写。"},{id:"work-laptop",kind:"builtin",models:6,key:"none",exists:!1,selectable:!1,note:"登录授权类凭据无法导入。"}],pw={anthropic:{kind:"builtin",id:"anthropic"},"my-proxy":{kind:"custom",id:"my-proxy",name:"my-proxy",api:"openai-completions",baseUrl:"https://proxy.example/v1",models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini"}]},"cmd-proxy":{kind:"custom",id:"cmd-proxy",name:"cmd-proxy",api:"anthropic-messages",baseUrl:"http://127.0.0.1:8080",models:[{id:"claude-x"}]}},xx=new Map,ff={servers:[{name:"filesystem",valid:!0,kind:"stdio",enabled:!0,exposure:"direct",command:"npx",args:["-y","@modelcontextprotocol/server-filesystem","."],description:"读写指定目录的文件"},{name:"docs",valid:!0,kind:"http",enabled:!1,exposure:"deferred",url:"https://example.com/mcp",headers:{Authorization:{redacted:!0}}}]};function gw(n="s1"){const a=ow(n);let r=[];new URLSearchParams(globalThis.location?.search??"").has("citation")&&(a.items.hob??=[]).push({kind:"assistant",id:"mock-citation",at:new Date().toISOString(),text:"这里是资料里的结论:[工作记录.md](#k/k-2/0)。"});let o=[{id:"kc-1",name:"工作资料",createdAt:ue(1e3),count:0},{id:"kc-2",name:"灵感收藏",createdAt:ue(900),count:0}],c=["项目封面.png","产品设计页面.html","工作记录.md","数据汇总.csv","参考文档.pdf","插画.png","会议纪要.md","网站方案.html","预算表.csv","资料.txt","附件.json","录音.mp3"].map((N,k)=>({id:`k-${k}`,origin:k%3===0?"chat":k%3===1?"output":"upload",name:N,description:`项目资料 · ${N},记录设计与工作进展。`,kind:N.endsWith(".png")?"image":N.endsWith(".html")?"html":N.endsWith(".csv")?"csv":N.endsWith(".pdf")?"pdf":N.endsWith(".json")?"json":N.endsWith(".mp3")?"audio":"markdown",path:`/mock/knowledge/${N}`,hash:`hash-${k}`,size:2048+k*1e3,createdAt:ue(k<6?k*60:336*60+k),updatedAt:ue(k<6?k*60:336*60+k),source:{assistantId:"hob",itemId:n==="bubbles"||n==="bubbles-dark"?["bubble-file","bubble-page","bubble-audio","bubble-video","bubble-job"][k%5]:n==="image"?"image-done":a.items.hob?.[0]?.id},collections:k%2?["kc-1"]:["kc-2"]}));const f=["queued","indexing","ready","failed","unsupported"];c.forEach((N,k)=>{N.index={state:f[k%f.length],...k%f.length===3?{error:"无法读取文件"}:{}}});const h=a.assistants.find(N=>N.id==="hob");h&&(h.knowledge=["kc-1"]);let m=!1;const p=new Set,g=N=>p.forEach(k=>k(N)),v=N=>a.assistants.find(k=>k.id===N),b=new Set(["anthropic","my-proxy"]);let j=de(iw[cc()]);const E=()=>({providers:a.settings.settings.providers.map(N=>({...N,keyConfigured:b.has(N.id)})),builtin:de(uw),settings:de(a.settings),models:Object.fromEntries(a.settings.settings.providers.map(N=>[N.id,df(N,a.settings.settings.models.thinking)]))}),S={revision:a.settings.revision,provider:"local",providerExplicit:!1,lorePlugin:"1.12.5",lore:{configured:!1,baseUrl:null,source:"none",tokenConfigured:!1}},T=[{endpoint:"https://push.example/mock-iphone",label:"iPhone",createdAt:new Date(Date.now()-3*864e5).toISOString()}],z=()=>({publicKey:"BOmockVapidPublicKeyForPreviewOnly",email:a.settings.settings.push.email,devices:de(T)}),A=N=>{const k=[];return N.activity.forEach((C,M)=>{if(C.verb==="$")return;const L=C.text.match(/^浏览器 打开 (\S+)$/),J=L?"browser_open":C.verb==="读"?"read":C.verb==="跑"?"bash":C.verb==="改"?"edit":C.verb==="说"?"report":"ls";k.push({id:`mock-${N.id}-${M}`,kind:"tool",at:C.at,name:J,title:J==="report"?"提交结果":`${C.verb} ${C.text}`,args:L?{url:L[1]}:J==="bash"?{command:C.text}:J==="report"?{outcome:"done",summary:C.text}:{path:C.text},output:J==="report"?"结果已记录。":L?"已打开页面。":`${C.text}
|
|
79
|
+
`,durationMs:120})}),N.id==="t-0931"&&k.push({id:"mock-search",kind:"tool",at:N.createdAt,name:"web_search",title:"联网搜索:浏览器页面性能优化",args:{query:"浏览器页面性能优化"},output:"演示结果:网页性能优化指南。",durationMs:120}),k};function $(N,k){const C=v(N);C&&(Object.assign(C,k),g({type:"assistant",assistant:de(C)}))}function D(N,k){const C=a.items[N]??=[],M=C.findIndex(L=>L.id===k.id);M>=0?C[M]=k:C.push(k),g({type:"item",assistantId:N,item:k})}function V(N,k){$(N,{last:{text:k,at:new Date().toISOString()}})}return{knowledge:async(N={})=>{const k=N.q?.toLowerCase(),C=c.filter(L=>(!N.origin||L.origin===N.origin)&&(!N.collection||L.collections.includes(N.collection))&&(!N.kind||Qb(L.kind)===N.kind)&&(!N.assistantId||L.source?.assistantId===N.assistantId)&&(!N.before||L.updatedAt<N.before)&&(!k||`${L.name} ${L.description}`.toLowerCase().includes(k))),M=N.limit??50;return{entries:de(C.slice(0,M).map(L=>k?{...L,snippet:L.description??L.name}:L)),hasMore:C.length>M,collections:de(o.map(L=>({...L,count:c.filter(J=>J.collections.includes(L.id)).length,indexed:c.filter(J=>J.collections.includes(L.id)&&J.index?.state==="ready").length,failed:c.filter(J=>J.collections.includes(L.id)&&J.index?.state==="failed").length,unsupported:c.filter(J=>J.collections.includes(L.id)&&J.index?.state==="unsupported").length})))}},knowledgeEntry:async(N,k)=>{const C=c.find(M=>M.id===N);if(!C)throw new He(404,"文件不存在");return{entry:de(C),...k!==void 0?{chunk:{index:k,heading:C.name,text:"模拟模式中的项目资料。"}}:{}}},reindexKnowledge:async N=>{if(!o.some(k=>k.id===N))throw new He(404,"知识库不存在");return c.filter(k=>k.collections.includes(N)&&k.index?.state==="failed").forEach(k=>{k.index={state:"queued"}}),g({type:"knowledge"}),{ok:!0}},embeddingKey:async()=>({keyConfigured:m}),putEmbedding:async(N,k,C)=>{if(N!==a.settings.revision)throw new He(409,"设置已在别处修改");return a.settings={revision:N+1,settings:{...a.settings.settings,knowledge:{embedding:k}}},C&&(m=!0),{settings:de(a.settings),keyConfigured:m}},embeddingTest:async()=>({ok:!0,dims:1024}),createKnowledgeCollection:async N=>{const k={id:`kc-${Date.now()}`,name:N,createdAt:new Date().toISOString(),count:0};return o.push(k),g({type:"knowledge"}),de(k)},renameKnowledgeCollection:async(N,k)=>{const C=o.find(M=>M.id===N);if(!C)throw new He(404,"知识库不存在");return C.name=k,g({type:"knowledge"}),de(C)},deleteKnowledgeCollection:async N=>{o=o.filter(C=>C.id!==N);const k=c.length;return c=c.filter(C=>!(C.origin==="upload"&&C.collections.length===1&&C.collections[0]===N)).map(C=>({...C,collections:C.collections.filter(M=>M!==N)})),g({type:"knowledge"}),{deleted:k-c.length}},patchKnowledgeEntry:async(N,k)=>{const C=c.find(M=>M.id===N);if(!C)throw new He(404,"文件不存在");return Object.assign(C,k),g({type:"knowledge"}),de(C)},deleteKnowledgeEntry:async N=>(c=c.filter(k=>k.id!==N),g({type:"knowledge"}),{ok:!0}),uploadKnowledge:async(N,k)=>{const C=k.map((M,L)=>({id:`k-${Date.now()}-${L}`,origin:"upload",name:M.name,kind:"other",path:URL.createObjectURL(M),hash:`mock-${Date.now()}-${L}`,size:M.size,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),collections:[N]}));return c.unshift(...C),g({type:"knowledge"}),{entries:de(C)}},me:async()=>{},login:async()=>{},logout:async()=>{},bootstrap:async()=>({assistants:de(a.assistants),jobs:de(Object.values(a.jobs)),delegations:de(Object.values(a.delegations)),routines:de(a.routines),approvals:de(Object.values(a.approvals).filter(N=>N.status==="pending")),settings:de(a.settings)}),settings:async()=>de(a.settings),rules:async()=>({rules:de(r)}),saveRules:async N=>(r=N.map(k=>({...k,id:k.id??`rule-${crypto.randomUUID()}`,changedAt:r.find(C=>C.id===k.id&&C.text===k.text&&C.mode===k.mode)?.changedAt??new Date().toISOString()})),g({type:"rules"}),{rules:de(r)}),models:async()=>({...de(cw),roster:de(a.settings.settings.models.roster)}),providers:async()=>E(),claude:async()=>({settings:de(a.settings),status:{found:!1,loggedIn:!1}}),saveClaude:async(N,k)=>{if(N!==a.settings.revision)throw new He(409,"设置已更改,请刷新后重试。");return a.settings={revision:N+1,settings:{...a.settings.settings,claude:k}},{settings:de(a.settings),status:{found:!1,loggedIn:!1}}},putThinking:async N=>{const k=a.settings.settings.providers.find(te=>N.ref.startsWith(`${te.id}/`)),C=k?df(k,a.settings.settings.models.thinking).find(te=>te.ref===N.ref):void 0;if(!k||!C)throw new He(400,`模型 ${N.ref} 不在已配置的服务商里。`);const M={...a.settings.settings.models.thinking??{}},L=N.levels===null?void 0:lw(N.levels);L?M[N.ref]=L:delete M[N.ref],a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,models:{roster:a.settings.settings.models.roster,conversation:a.settings.settings.models.conversation,work:a.settings.settings.models.work,...Object.keys(M).length?{thinking:M}:{}}}};const J=df(k,a.settings.settings.models.thinking).find(te=>te.ref===N.ref);return{settings:de(a.settings),thinking:J}},putProvider:async(N,k)=>{const C=k,M={...C,id:N};delete M.key;const L=a.settings.settings.providers.filter(J=>J.id!==N);return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...L,M]}},C.key&&b.add(N),E()},deleteProvider:async N=>(a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:a.settings.settings.providers.filter(k=>k.id!==N)}},b.delete(N),E()),discoverProvider:async()=>({models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini",name:"GPT X mini"},{id:"gpt-x-vision"}]}),providersImport:async()=>({source:fw,items:mw.map(N=>({...N,exists:N.exists||a.settings.settings.providers.some(k=>k.id===N.id)}))}),importProviders:async N=>{const k=N.map(M=>pw[M]).filter(M=>M!==void 0);if(!k.length)throw new He(400,"没有可导入的服务商:请选择状态为可导入的项目。");const C=a.settings.settings.providers.filter(M=>!k.some(L=>L.id===M.id));a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...C,...k]}};for(const M of k)b.add(M.id);return E()},testProvider:async()=>{},imageKey:async()=>de(vx),putImage:async(N,k,C)=>{if(N!==a.settings.revision)throw new He(409,"设置已在别处修改,已刷新");return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,image:k}},{settings:de(a.settings),keyConfigured:!!C||vx.keyConfigured}},assistantSkills:async N=>de(a.assistantSkills[N]??[]),patchAssistantSkill:async(N,k,C)=>{const M=a.assistantSkills[N]?.find(L=>L.name===k);if(!M)throw new Error("技能不存在");return M.enabled=C,g({type:"skills",assistantId:N}),de(M)},rollbackAssistantSkill:async(N,k)=>{const C=a.assistantSkills[N]?.find(M=>M.name===k);if(!C||C.version<=1)throw new Error("没有上一版");return C.version--,g({type:"skills",assistantId:N}),de(C)},deleteAssistantSkill:async(N,k)=>(a.assistantSkills[N]=(a.assistantSkills[N]??[]).filter(C=>C.name!==k),g({type:"skills",assistantId:N}),{ok:!0}),sedimentJob:async N=>{if(!a.jobs[N])throw new Error("任务不存在");if(a.jobs[N].status!=="done")throw new Error("任务尚未完成");return setTimeout(()=>g({type:"sediment-finished",jobId:N}),0),{ok:!0}},skills:async()=>{const N=a.settings.settings.skills?.disabled??[],k=(C,M,L,J,te=!1)=>({id:C,name:C,description:L,source:M,content:J,enabled:!N.includes(`${M}:${C}`),overridden:te});return{skills:[k("weekly-report","hob","按固定结构整理本周进展、风险和下周计划,生成可直接发出的周报。",`# 周报
|
|
80
|
+
|
|
81
|
+
1. 汇总本周完成的事项
|
|
82
|
+
2. 列出风险和需要的支持
|
|
83
|
+
3. 写下周计划`),k("research","hob","查阅可靠来源,交叉核对后整理结论,并为每条结论注明出处。",`# 研究
|
|
84
|
+
|
|
85
|
+
查阅可靠来源,整理结论并注明出处。`),k("server-checkup","hob","检查主机的磁盘、内存、服务状态和最近的错误日志,给出处理建议。",`# 主机巡检
|
|
86
|
+
|
|
87
|
+
逐台检查磁盘、内存、服务与日志。`),k("browser","common","在浏览器中打开页面、操作并截图,验证改动是否生效。",`# 浏览器
|
|
88
|
+
|
|
89
|
+
通过浏览器检查和验证页面。`),k("pdf","common","读取、拆分、合并 PDF,提取其中的表格和文字。",`# PDF
|
|
90
|
+
|
|
91
|
+
处理 PDF 文件。`),k("research","common","通用的资料检索流程。","# research",!0)],loreActive:!1,loreUrl:null}},skillsImport:async()=>({found:!0,skipped:[],skills:[{id:"review",name:"review",description:"检查代码与需求。",exists:!1},{id:"research",name:"research",description:"整理研究结果。",exists:!0}]}),importSkills:async(N,k)=>({imported:k,skipped:[],errors:[]}),deleteSkill:async()=>{},desktop:async()=>de(j),saveDesktop:async N=>(j={...j,revision:j.revision+1,url:N.url,enabled:N.enabled,tokenConfigured:j.tokenConfigured||!!N.token},de(j)),saveDesktopPublic:async(N,k)=>{if(N!==j.revision)throw new He(409,"设置已在别处修改,已刷新");return j={...j,revision:j.revision+1,publicAssistants:[...k]},de(j)},testDesktop:async()=>cc()==="failed"?{ok:!1,error:`无法连接 ${j.url},请确认云桌面已部署并启动。`}:j.url?{ok:!0,health:de(aw)}:{ok:!1,error:"请先填写云桌面地址。"},mcp:async()=>({servers:ff.servers.map(N=>({...N}))}),putMcp:async()=>({servers:ff.servers.map(N=>({...N}))}),patchMcp:async()=>({servers:ff.servers.map(N=>({...N}))}),deleteMcp:async()=>({servers:[]}),testMcp:async()=>({ok:!0,tools:[{name:"read_file",description:"读取一个文件"},{name:"list_directory",description:"列出目录内容"}]}),mcpImports:async()=>({sources:["pi(~/.pi/agent/mcp.json)"],items:[{id:"pi:github",name:"github",source:"pi",kind:"http",exists:!1,selectable:!0}]}),importMcp:async N=>({imported:N,skipped:[]}),search:async()=>({providers:a.settings.settings.search.map(N=>({...N,keyConfigured:N.name==="exa"||N.name==="tavily"}))}),putSearch:async(N,k)=>{if(N!==a.settings.revision)throw new He(409,"设置已在别处修改,已刷新");return a.settings={revision:N+1,settings:{...a.settings.settings,search:k}},de(a.settings)},testSearch:async()=>({ok:!1,error:"演示模式不连接搜索服务商。"}),imageTest:async()=>({ok:!1,error:"演示模式不连接图像生成接口;正式运行时会实际生成图片。"}),putSettings:async(N,k)=>{if(N!==a.settings.revision)throw new He(409,"设置已在别处修改,已刷新");const C=k.models??{};return a.settings={revision:a.settings.revision+1,settings:{general:{...a.settings.settings.general,...k.general??{},aboutYou:{...a.settings.settings.general.aboutYou,...k.general?.aboutYou??{}}},models:{roster:C.roster??a.settings.settings.models.roster,conversation:C.conversation??a.settings.settings.models.conversation,work:C.work??a.settings.settings.models.work,thinkingChoice:C.thinkingChoice??a.settings.settings.models.thinkingChoice,...C.thinking??a.settings.settings.models.thinking?{thinking:C.thinking??a.settings.settings.models.thinking}:{}},providers:a.settings.settings.providers,image:a.settings.settings.image,search:a.settings.settings.search,skills:k.skills??a.settings.settings.skills,work:{...a.settings.settings.work,...k.work??{}},push:{...a.settings.settings.push,...k.push??{}}}},de(a.settings)},changePassword:async N=>{if(N!=="test")throw new He(403,"旧密码不正确")},about:async()=>({version:"0.1.0",home:"/var/lib/hob"}),memory:async()=>de({...S,revision:a.settings.revision}),putMemory:async(N,k)=>{if(N!==a.settings.revision)throw new He(409,"设置已在别处修改,已刷新");if(k==="lore"&&!S.lore.configured)throw new He(400,"Lore 尚未配置:请先填写服务地址和 Token 并测试连接");return S.provider=k,S.providerExplicit=!0,a.settings.revision+=1,S.revision=a.settings.revision,de(S)},putLore:async N=>{const k=N.baseUrl.trim().replace(/\/+$/,"");if(!k)throw new He(400,"Lore 服务地址不能为空");const C=S.lore.baseUrl===k;return S.lore={configured:C?S.lore.tokenConfigured:!!N.token,baseUrl:k,source:"config",tokenConfigured:C?S.lore.tokenConfigured:!!N.token},de({...S,revision:a.settings.revision})},loreTest:async N=>{const k=(N.baseUrl??S.lore.baseUrl??"").trim().replace(/\/+$/,"");return k?k.startsWith("http://")&&!/^http:\/\/(localhost|127\.0\.0\.1|192\.168\.|10\.)/.test(k)?{ok:!1,reason:"insecure_http"}:!N.token&&!S.lore.tokenConfigured?{ok:!1,reason:"missing_token"}:{ok:!0,baseUrl:k}:{ok:!1,reason:"invalid_url"}},loreImport:async()=>({source:hw,found:!0,baseUrl:"https://api.loremem.com",tokenPresent:!0}),importLore:async()=>(S.lore={configured:!0,baseUrl:"https://api.loremem.com",source:"config",tokenConfigured:!0},de({...S,revision:a.settings.revision})),items:async N=>({items:de(a.items[N]??[]),approvals:de(Object.values(a.approvals)),jobs:de(Object.values(a.jobs)),drafts:de(Object.values(a.drafts)),delegations:de(Object.values(a.delegations)),hasMore:!1}),profile:async N=>{const k=v(N);if(!k)throw new Error(`没有这个助手:${N}`);return{assistant:de(k),rules:de(a.rules[N]??[]),routines:de(a.routines.filter(M=>M.assistantId===N)),worklog:de(a.worklog[N]??[])}},sendMessage:async(N,k)=>{if(k.text==="模拟发送失败")throw new Error("网络连接已断开");const C=new Date().toISOString();for(const L of Object.values(a.delegations))L.to!==N||L.reportedAt||L.status==="interrupted"||(Object.assign(L,{status:"takenOver",endedAt:C,reportedAt:C}),g({type:"delegation",delegation:de(L)}));for(const L of Object.values(a.approvals))L.assistantId!==N||L.source!=="router"||L.status!=="pending"||(L.status="expired",g({type:"approval",approval:de(L)}));const M={kind:"user",id:yn("mock-u"),at:C,text:k.text,quote:k.quote,files:k.files&&k.files.length?k.files:void 0};return D(N,M),V(N,k.text),$(N,{busy:!0}),setTimeout(()=>{D(N,{kind:"assistant",id:yn("mock-a"),at:new Date().toISOString(),text:"收到。"}),V(N,"收到。"),$(N,{busy:!1})},320),{item:M}},stopAssistant:async N=>$(N,{busy:!1}),markRead:async N=>$(N,{unread:0}),patchAssistant:async(N,k)=>{if(!v(N))throw new He(404,"助手不存在。");if(k.rule){const C=a.rules[N]??=[],M=k.rule.id===void 0?void 0:C.find(ke=>ke.id===k.rule.id);if(k.rule.id!==void 0&&!M)throw new He(404,"规则不存在。");const L=k.rule.text===void 0?M?.text??"":k.rule.text.trim();if(!L||L.length>1e3)throw new He(400,"规则内容不能为空或超过 1000 字。");if(C.some(ke=>ke.id!==k.rule.id&&ke.text===L))throw new He(400,"规则内容已存在。");const J=k.rule.mode??M?.mode;if(J!=="ask"&&J!=="allow")throw new He(400,"规则模式无效。");const te={id:M?.id??yn("r-"),text:L,mode:J,changedAt:new Date().toISOString()};return M?Object.assign(M,te):C.push(te),g({type:"profile",assistantId:N}),{rule:de(te)}}$(N,k)},archiveAssistant:async N=>{const k=v(N);if(!k)throw new He(404,"助手不存在");if(k.primary)throw new He(400,"主助手不能归档");if(Object.values(a.jobs).filter(M=>M.assistantId===N&&(M.status==="running"||M.status==="queued"||M.status==="waiting")).length)throw new He(409,"请等任务结束后再归档");for(const M of a.routines.filter(L=>L.assistantId===N))g({type:"routine_removed",id:M.id});a.routines=a.routines.filter(M=>M.assistantId!==N),a.assistants=a.assistants.filter(M=>M.id!==N),g({type:"assistant_removed",id:N})},deleteRule:async(N,k)=>{a.rules[N]=(a.rules[N]??[]).filter(C=>C.id!==k),g({type:"profile",assistantId:N})},answerApproval:async(N,k)=>{const C=a.approvals[N];if(!C||C.status!=="pending")return;C.status="answered",k.key?C.chosen=k.key:C.answerText=(k.text??"").trim(),C.answeredAt=new Date().toISOString(),C.options.find(L=>L.key===k.key)?.always&&C.ruleText&&((a.rules[C.assistantId]??=[]).push({id:yn("rule"),text:C.ruleText,mode:"allow",changedAt:C.answeredAt}),D(C.assistantId,{kind:"note",id:yn("mock-n"),at:C.answeredAt,icon:"rule",text:`已记入${v(C.assistantId)?.name??""}的规则 · ${C.ruleText}无需确认`}),g({type:"profile",assistantId:C.assistantId})),g({type:"approval",approval:de(C)});for(const L of Object.values(a.delegations))!L.reportedAt&&((L.approvalIds??[]).includes(C.id)||C.jobId&&L.jobIds.includes(C.jobId))&&(L.status="running",C.jobId&&a.jobs[C.jobId]?.status==="waiting"&&(a.jobs[C.jobId].status="running",g({type:"job",job:de(a.jobs[C.jobId])})),g({type:"delegation",delegation:de(L)}))},retryDelegation:async N=>{const k=a.delegations[N];if(!k||k.status!=="interrupted")throw new He(400,"只有已中断的委派可以重新转交");const C={...k,id:yn("dg-"),status:"running",createdAt:new Date().toISOString(),jobIds:[],approvalIds:[],reportedAt:void 0,endedAt:void 0};a.delegations[C.id]=C,g({type:"delegation",delegation:de(C)}),D("hob",{kind:"delegation",id:yn("item-"),at:C.createdAt,delegationId:C.id}),D(C.to,{kind:"user",id:yn("item-"),at:C.createdAt,text:C.text,from:{assistantId:"hob",name:"Hob",delegationId:C.id}})},createDraft:async N=>{const k=a.drafts[N];k&&(k.status="created",k.createdAssistantId="bird",g({type:"draft",draft:de(k)}),D(k.assistantId,{kind:"note",id:yn("mock-n"),at:new Date().toISOString(),icon:"split",text:`专属助手已创建 · ${k.name}`}))},dismissDraft:async N=>{const k=a.drafts[N];k&&(k.status="dismissed",g({type:"draft",draft:de(k)}))},createRoutine:async N=>{const k={...N,id:yn("r"),createdAt:new Date().toISOString(),runs:[]};return a.routines.push(k),g({type:"routine",routine:de(k)}),de(k)},patchRoutine:async(N,k)=>{const C=a.routines.find(J=>J.id===N);if(!C)return;const{skill:M,...L}=k;Object.assign(C,L),M===null?delete C.skill:M!==void 0&&(C.skill=M),g({type:"routine",routine:de(C)})},deleteRoutine:async N=>{a.routines=a.routines.filter(k=>k.id!==N),g({type:"routine_removed",id:N})},runRoutine:async N=>{const k=a.routines.find(J=>J.id===N);if(!k)return;const C=new Date().toISOString(),M={id:yn("t-"),assistantId:k.assistantId,title:`${k.name}(立即运行)`,instruction:k.instruction,status:"running",createdAt:C,startedAt:C,stats:{reads:0,commands:0,edits:0},routineId:k.id,activity:[{at:C,verb:"$",text:`立即运行 ${k.name}`}]};a.jobs[M.id]=M;const L={jobId:M.id,at:C,status:"running"};k.runs=[L,...k.runs].slice(0,20),D(k.assistantId,{kind:"job",id:yn("mock-j"),at:C,jobId:M.id}),g({type:"job",job:de(M)}),g({type:"routine",routine:de(k)}),V(k.assistantId,`运行定时任务:${k.name}`)},replyJob:async(N,k)=>{const C=a.jobs[N];if(!C)return;C.activity=[...C.activity,{at:new Date().toISOString(),verb:"说",text:k}],g({type:"activity",jobId:N,line:C.activity[C.activity.length-1],stats:de(C.stats)});const M=new Date().toISOString();g({type:"job_step",jobId:N,step:{id:`q${Date.now()}`,kind:"text",at:M,from:"user",text:k,queued:!0}}),setTimeout(()=>g({type:"job_step",jobId:N,step:{id:`u${Date.now()}`,kind:"text",at:new Date().toISOString(),from:"user",text:k}}),4e3)},transcript:async N=>{const k=a.jobs[N];if(!k)throw new Error(`没有这个任务:${N}`);return{job:de(k),steps:A(k)}},jobs:async(N={})=>{let k=Object.values(a.jobs).sort((L,J)=>J.createdAt.localeCompare(L.createdAt));if(N.assistantId&&(k=k.filter(L=>L.assistantId===N.assistantId)),N.status&&(k=k.filter(L=>L.status===N.status)),N.before){const L=k.findIndex(J=>J.id===N.before);L!==-1&&(k=k.slice(L+1))}const C=N.limit??30;return{jobs:de(k.slice(0,C)),hasMore:k.length>C}},stopJob:async N=>{const k=a.jobs[N];k&&(k.status="stopped",k.endedAt=new Date().toISOString(),g({type:"job",job:de(k)}))},upload:async N=>{await new Promise(C=>setTimeout(C,1200));const k=`/mock/uploads/u-${Math.random().toString(36).slice(2,8).padEnd(6,"0")}-${N.name}`;return xx.set(k,URL.createObjectURL(N)),k},fileUrl:(N,k)=>xx.get(N)??(N==="/srv/example/reports/stats.csv"?`data:text/plain;charset=utf-8,${encodeURIComponent(`项目,大小
|
|
92
|
+
旧日志,2.1GB
|
|
93
|
+
服务,正常`)}`:N==="/srv/example/reports/log-cleanup-1031.md"?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 清理报告
|
|
94
|
+
|
|
95
|
+
已清理旧日志,服务运行正常。`)}`:N.startsWith("/mock/assistants/")?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 每日行业简报
|
|
96
|
+
|
|
97
|
+
整理值得关注的行业动态。`)}`:N.startsWith("blob:")?N:N.startsWith("/mock/knowledge/")?N.endsWith(".png")?`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="600" height="400"><rect width="600" height="400" fill="#d5e3d4"/><circle cx="430" cy="110" r="55" fill="#f5d599"/><path d="M0 380L190 150 340 330 430 220 600 400" fill="#83a392"/></svg>')}`:N.endsWith(".html")?`data:text/html;charset=utf-8,${encodeURIComponent("<h1>产品设计页面</h1><p>这是模拟模式中的项目资料。</p>")}`:`data:text/plain;charset=utf-8,${encodeURIComponent("模拟模式中的项目资料。")}`:N.startsWith("/mock/")?N:`data:text/plain;charset=utf-8,${encodeURIComponent(`mock 模式没有真实文件。
|
|
98
|
+
|
|
99
|
+
${N}`)}`),fileMeta:async N=>{const k=N.split("/").pop()??N,C=k.lastIndexOf("."),M=C>0?k.slice(C).toLowerCase():"",L=[".png",".jpg",".jpeg",".webp",".gif"].includes(M)?"image":M===".md"?"markdown":M===".csv"?"csv":M===".html"?"html":M===".json"?"json":"text";return{path:N,name:k,size:2048,modifiedAt:new Date().toISOString(),mime:L==="image"?`image/${M===".jpg"?"jpeg":M.slice(1)}`:"text/plain; charset=utf-8",kind:L,text:L!=="image"}},jobFiles:async(N,k)=>{const C=a.jobs[N];if(!C)throw new He(404,"任务不存在");const M="/srv/example/reports",L=ke=>({type:"file",path:`${M}/${ke}`,rel:ke,name:ke.split("/").pop(),size:2048,modifiedAt:C.createdAt,kind:ke.endsWith(".md")?"markdown":ke.endsWith(".csv")?"csv":"code"}),J=N!=="t-0927"?[]:k?k==="src"?[{type:"directory",path:`${M}/src/checks`,rel:"src/checks",name:"checks",count:1},L("src/main.ts")]:k==="src/checks"?[L("src/checks/logs.ts")]:[]:[{type:"directory",path:`${M}/src`,rel:"src",name:"src",count:2},L("log-cleanup-1031.md"),L("stats.csv"),L("notes.txt")],te=J.filter(ke=>ke.type==="directory").length;return{files:J,total:J.length,directoryCount:te,fileCount:J.length-te}},push:async()=>z(),subscribePush:async(N,k)=>{const C=T.filter(M=>M.endpoint!==N.endpoint);return T.splice(0,T.length,...C,{endpoint:N.endpoint,label:k.trim()||"本机",createdAt:new Date().toISOString()}),z()},unsubscribePush:async N=>{const k=T.findIndex(C=>C.endpoint===N);return k>=0&&T.splice(k,1),z()},testPush:async()=>({sent:1,removed:0}),visibility:async()=>{},events:N=>{p.add(N.onEvent);const k=[];return n==="act-demo"&&(k.push(setTimeout(()=>g({type:"router-activity",assistantId:"hob",activity:{state:"tool",label:"搜索:最新 AI 动态"}}),2500)),k.push(setTimeout(()=>{g({type:"router-activity",assistantId:"hob",activity:null}),g({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"正在整理搜索结果…",streaming:!0}})},5500)),k.push(setTimeout(()=>{g({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"已整理好最新动态。"}}),g({type:"assistant",assistant:{...a.assistants.find(C=>C.id==="hob"),busy:!1,activity:null}})},7500))),()=>{k.forEach(clearTimeout),p.delete(N.onEvent)}}}}function vw(n){return/iPhone/i.test(n)?"iPhone":/iPad/i.test(n)?"iPad":/Android/i.test(n)?"Android":/Macintosh|Mac OS X/i.test(n)?"Mac":/Windows/i.test(n)?"Windows":/Linux/i.test(n)?"Linux":"浏览器"}function xw(n){const a=n.replace(/-/g,"+").replace(/_/g,"/"),r=a.padEnd(Math.ceil(a.length/4)*4,"="),o=atob(r),c=new Uint8Array(o.length);for(let f=0;f<o.length;f+=1)c[f]=o.charCodeAt(f);return c}function eh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&"Notification"in window}function bw(n,a){return!n||n.byteLength!==a.length?!1:new Uint8Array(n).every((o,c)=>o===a[c])}function yw(n){const a=n.toJSON(),r=a.keys?.p256dh??"",o=a.keys?.auth??"";return!a.endpoint||!r||!o?null:{endpoint:a.endpoint,keys:{p256dh:r,auth:o}}}async function th(){return eh()?await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription()??null:null}async function kw(n){if(!eh())return{error:"这个浏览器不支持推送"};let a=Notification.permission;if(a==="default")try{a=await Notification.requestPermission()}catch{return{error:"浏览器拒绝授予通知权限"}}if(a!=="granted")return{error:"浏览器未授予通知权限"};const r=await navigator.serviceWorker.getRegistration();if(!r)return{error:"离线页面尚未就绪,请刷新后重试"};const o=xw(n);let c=await r.pushManager.getSubscription();if(c&&!bw(c.options.applicationServerKey,o)){try{await c.unsubscribe()}catch{}c=null}if(!c)try{c=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:o.buffer})}catch(h){return{error:`浏览器订阅推送失败:${h instanceof Error?h.message:String(h)}`}}const f=yw(c);return f?{subscription:f}:{error:"浏览器返回的订阅信息不完整"}}function La(n){return n.replace(/```[^\n]*\n?([\s\S]*?)```/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^[ \t]*#{1,6}[ \t]+/gm,"").replace(/^[ \t]*>[ \t]?/gm,"").replace(/^[ \t]*(?:[-*+]|\d+[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/gm,"").replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)*\|?[ \t]*$/gm,"").replace(/[ \t]*\|[ \t]*/g," ").replace(/^[ \t]*(?:[-*_][ \t]*){3,}$/gm,"").replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,"$2").replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1").replace(/(^|[^\w*])\*(?=\S)([^*\n]*?\S)\*(?![\w*])/g,"$1$2").replace(/(^|[^\w])_(?=\S)([^_\n]*?\S)_(?!\w)/g,"$1$2").replace(/`([^`\n]+)`/g,"$1").replace(/\s+/g," ").trim()}function jw(n,a){if(a.from==="user"&&!a.queued){const c=n.findIndex(f=>f.queued&&f.text===a.text);c>=0&&(n=n.filter((f,h)=>h!==c))}const r=n.findIndex(c=>c.id===a.id);if(r<0)return[...n,a];const o=n.slice();return o[r]=a,o}function ww(n,a){const r=new Set(a.map(c=>c.id)),o=a.slice();for(const c of n)!r.has(c.id)&&!c.queued&&o.push(c);return o}function Nw(n){const a=[];let r=[];const o=()=>{if(!r.length)return;const c=r.join(`
|
|
100
|
+
|
|
101
|
+
`);return r=[],c};for(const c of n){if(c.kind==="thinking"){const h=c.text?.trim();h&&r.push(h);continue}if(c.kind==="text"&&c.from==="user"){a.push(c);continue}const f=o();a.push(f?{...c,thinking:f}:c)}return{rows:a,thinking:o()??null}}function Xo(n,a,r){const o=a&&!r?n.slice(0,8):n;return{rows:o,remaining:n.length-o.length}}const bx=400,Sw=2e5,yx=3;function Tw(n,a){const r=n===""?[]:n.split(`
|
|
102
|
+
`),o=a===""?[]:a.split(`
|
|
103
|
+
`);let c=0;for(;c<r.length&&c<o.length&&r[c]===o[c];)c+=1;let f=r.length,h=o.length;for(;f>c&&h>c&&r[f-1]===o[h-1];)f-=1,h-=1;const m=Math.min(c,yx),p=Math.min(r.length-f,yx),g=r.slice(c-m,c).map(v=>({sign:" ",text:v}));return g.push(...Cw(r.slice(c,f),o.slice(c,h))),g.push(...r.slice(f,f+p).map(v=>({sign:" ",text:v}))),g.length<=bx?g:[...g.slice(0,bx),{sign:" ",text:"…"}]}function Cw(n,a){if(!n.length)return a.map(h=>({sign:"+",text:h}));if(!a.length)return n.map(h=>({sign:"-",text:h}));if(n.length*a.length>Sw)return[...n.slice(0,190).map(m=>({sign:"-",text:m})),...n.length>190||a.length>190?[{sign:" ",text:"…"}]:[],...a.slice(0,190).map(m=>({sign:"+",text:m}))];const r=Array.from({length:n.length+1},()=>new Int32Array(a.length+1));for(let h=n.length-1;h>=0;h-=1)for(let m=a.length-1;m>=0;m-=1)r[h][m]=n[h]===a[m]?r[h+1][m+1]+1:Math.max(r[h+1][m],r[h][m+1]);const o=[];let c=0,f=0;for(;c<n.length&&f<a.length;)n[c]===a[f]?(o.push({sign:" ",text:n[c]}),c+=1,f+=1):r[c+1][f]>=r[c][f+1]?(o.push({sign:"-",text:n[c]}),c+=1):(o.push({sign:"+",text:a[f]}),f+=1);for(;c<n.length;)o.push({sign:"-",text:n[c++]});for(;f<a.length;)o.push({sign:"+",text:a[f++]});return o}function Ew(n,a){const r=n.rounds??[];return[...r,n].map((o,c)=>{const f=c===r.length,h=o.startedAt??(c===0?n.createdAt:r[c-1].endedAt),m=f?void 0:o.endedAt,p=f?void 0:r[c+1]?.startedAt??(c+1===r.length?n.startedAt:void 0);return{job:{...n,...o,statusReason:o.statusReason,summary:f&&["running","queued","waiting"].includes(n.status)?void 0:o.summary,files:f&&["running","queued","waiting"].includes(n.status)?void 0:o.files},instruction:c===0?n.instruction:r[c-1].followUp,steps:a?.filter(g=>(!h||g.at>=h)&&(!m||g.at<=m)&&(!p||g.at<p))}})}const Aw=new Set(["排队中","进行中","待确认","等你确认","已完成","受阻","失败","已停止"]);function Mw(n,a=0){const r=n.rounds?.[a];return r?{...n,status:r.status,statusReason:r.statusReason,startedAt:r.startedAt,endedAt:r.endedAt,durationMs:r.durationMs}:n}function nh(n){const a=n.statusReason?La(n.statusReason):"";if(!(!a||Aw.has(a)))return a}function zw(n){return n.split(/`/).map((a,r)=>({text:a,mono:r%2===1})).filter(a=>a.text.length>0)}function Ow(n,a){const r=n==="dark"||n==="system"&&a;return{dark:r,color:r?"#1b1b1d":"#f6f6f4"}}function _w(n,a){if(n.phase!=="ready")return a?"bg":"side";const r=n.panelStack.at(-1);return r?.kind==="file"&&(a||r.full)?"bg":a?r?.kind==="job"||r?.kind==="jobs"||n.page==="settings"||n.page==="knowledge"?"bg":r||n.sheet?"panel":"bg":n.page==="settings"||n.page==="knowledge"?"bg":"side"}function Pb(n,a){const r=document.documentElement;r.style.setProperty("--status-background",`var(--${_w(n,a)})`);const o=getComputedStyle(r).backgroundColor;document.querySelector('meta[name="theme-color"]')?.setAttribute("content",o)}function Rw(n,a){return n.kind!==a.kind?!1:n.kind==="routine"&&a.kind==="routine"||n.kind==="job"&&a.kind==="job"?n.id===a.id:n.kind==="file"&&a.kind==="file"?n.liveId||a.liveId?n.liveId===a.liveId:n.path===a.path:!0}function Wn(n,a){const r=n.findIndex(o=>Rw(o,a));return[...r<0?n:n.slice(0,r),a]}function Dw(n,a,r,o){return a!==r&&!o?[]:n}function Fb(n){return n.slice(0,-1)}function Wb(n,a){return Wn(Fb(n),a)}function Ha(n){return`${n.kind}:${"id"in n?n.id:"path"in n?n.liveId??n.path:""}`}function $w(n,a){const r=new Set(a.map(Ha)),o=a.length<n.length;return n.flatMap((c,f)=>r.has(Ha(c))?[]:[{page:c,index:f,leaving:o}])}function Uw(n,a){const r=n.map(o=>({page:o,leaving:!1}));for(const o of a)r.splice(Math.min(o.index,r.length),0,{page:o.page,leaving:o.leaving});return r}function Lw(n,a){return n.filter(r=>r.kind!=="file"||!r.liveId||!!a[r.liveId])}const Hw={general:{theme:"system",timezone:"UTC",aboutYou:{name:"",language:"",notes:""}},providers:[],models:{roster:[],conversation:{ref:"",thinking:"low"},work:{ref:"",thinking:"high"}},image:{source:"off"},search:Yb(),work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}},Al=new URLSearchParams(location.search),Ol=Al.get("mock")==="1",Bw=["image","act-demo","act-think","act-tool","act-dark","act-home","boot","bubbles","bubbles-dark","s1","s2","s3","s4","s6","mlist","mchat","d-running","d-waiting","d-done","d-dark","d-source","d-mobile","h-hob","h-dark","h-source","h-settings","h-mobile"],hf=Al.get("scene"),kc=hf&&Bw.includes(hf)?hf:"s1",P=Ol?gw(kc):q1,sh="hob.theme",e0=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;let kx=!1;function jx(n){return n==="assistant"||n==="now"||n==="routines"||n==="skills"||n==="knowledge"||n==="rules"||n==="newRoutine"?{kind:n}:n.startsWith("routine:")?{kind:"routine",id:n.slice(8)}:{kind:"now"}}function t0(){const n=localStorage.getItem(sh);return n==="light"||n==="dark"||n==="system"?n:null}const n0=Al.get("dark")==="1",Ps=U1(location.hash);function qw(){const n=Jb[Ol?kc:"s1"],a={phase:"loading",error:null,notice:null,offline:null,assistants:[],jobs:{},sedimenting:{},delegations:{},routines:[],approvals:{},drafts:{},settings:{revision:0,settings:Hw},globalRules:{rules:null,error:null,busy:!1},page:"main",knowledge:{category:"all",q:"",kind:"",assistantId:"",entries:[],collections:[],collectionsLoaded:!1,hasMore:!1,loading:!1,error:null},section:null,sub:null,items:{},itemGen:{},itemPages:{},profiles:{},assistantSkills:{},sidebarJobs:{},sidebarFiles:{},sel:"hob",panelStack:[],livePages:{},steps:{},worklog:null,collapsed:!1,nowWide:!1,theme:t0()??"system",query:"",quote:null,text:"",attachments:[],pending:{},nonce:0,mobile:"list",sheet:!1,search:!1,menu:null,tick:0,updateReady:!1,loggingIn:!1};if(Ol){a.sel=n.sel;const c=jx(n.panel);a.panelStack=c.kind==="now"?[]:[c],a.collapsed=n.collapsed,a.mobile=n.mobile,a.theme=n.dark?"dark":"light"}const r=Al.get("a");r&&(a.sel=r),Ps.sel&&(a.sel=Ps.sel),Ps.panel&&(a.panelStack=[Ps.panel]),Ps.knowledge&&(a.page="knowledge"),Ps.settings&&(a.page="settings",a.section=Ps.section);const o=Al.get("panel");if(o){const c=jx(o);a.panelStack=c.kind==="now"?[]:[c]}return Al.get("collapsed")==="1"&&(a.collapsed=!0),n0&&(a.theme="dark"),a}let ne=qw();function Iw(){return Ps.sel?!0:Ol?Jb[kc].mobile==="chat":!!Al.get("a")||window.innerWidth>=768}Ol||n0||t0();const zf=new Set;function Y(n){ne={...ne,...typeof n=="function"?n(ne):n},zf.forEach(a=>a())}function s0(n){return zf.add(n),()=>zf.delete(n)}const Fs=()=>ne;function je(){return y.useSyncExternalStore(s0,Fs,Fs)}function he(n){return n instanceof He||n instanceof Error?n.message:String(n)}function Nn(n){const a={};for(const r of n)a[r.id]=r;return a}function wx(n,a){const r=n.findIndex(c=>c.id===a.id);if(r<0)return[...n,a];const o=n.slice();return o[r]=a,o}function Yw(n,a){const r=a.models??{};return{general:{...n.general,...a.general??{},aboutYou:{...n.general.aboutYou,...a.general?.aboutYou??{}}},models:{roster:r.roster??n.models.roster,conversation:r.conversation??n.models.conversation,work:r.work??n.models.work,thinkingChoice:r.thinkingChoice??n.models.thinkingChoice,...r.thinking??n.models.thinking?{thinking:r.thinking??n.models.thinking}:{}},image:n.image,search:n.search,providers:n.providers,work:{...n.work,...a.work??{}},push:{...n.push,...a.push??{}}}}let Nx=Promise.resolve();function lh(n){const a=Nx.then(()=>Gw(typeof n=="function"?n(ne.settings.settings):n));return Nx=a.then(()=>{},()=>{}),a}async function Gw(n){const a=ne.settings,r={revision:a.revision,settings:Yw(a.settings,n)};Y({settings:r,theme:r.settings.general.theme}),n.general?.theme&&Cl(n.general.theme);try{const o=await P.putSettings(a.revision,n);return Y({settings:o,theme:o.settings.general.theme}),Cl(o.settings.general.theme),localStorage.setItem(sh,o.settings.general.theme),!0}catch(o){if(o instanceof He&&o.status===409){try{const c=await P.settings();Y({settings:c,theme:c.settings.general.theme}),Cl(c.settings.general.theme)}catch{Y({settings:a})}return Y({notice:"设置已在别处修改,已刷新"}),!1}return Y({settings:a,theme:a.settings.general.theme,notice:`保存失败:${he(o)}`}),Cl(a.settings.general.theme),!1}}async function Kw(n,a){try{return await P.changePassword(n,a),null}catch(r){return he(r)}}async function Vw(){try{return await P.about()}catch(n){return Y({notice:`无法读取版本信息:${he(n)}`}),null}}async function ah(){try{return await P.models()}catch(n){return Y({notice:`无法读取模型列表:${he(n)}`}),null}}let lc=0;async function Of(){const n=++lc;try{const{rules:a}=await P.rules();n===lc&&Y(r=>({globalRules:{...r.globalRules,rules:a,error:null}}))}catch(a){n===lc&&Y(r=>({globalRules:{...r.globalRules,error:`无法读取全局规则:${he(a)}`}}))}}async function Xw(n){if(ne.globalRules.busy)return!1;Y(a=>({globalRules:{...a.globalRules,busy:!0,error:null}}));try{const a=await P.saveRules(n);return++lc,Y({globalRules:{rules:a.rules,error:null,busy:!1}}),!0}catch(a){return Y(r=>({globalRules:{...r.globalRules,busy:!1,error:`保存失败:${he(a)}`}})),!1}}async function Zw(){const n=await P.claude();return Y({settings:n.settings}),n}async function Qw(n){const a=await P.saveClaude(ne.settings.revision,n);return Y({settings:a.settings}),a}async function ih(n){return Y({settings:n.settings}),n}async function Jw(){try{return{ok:!0,view:await P.providers()}}catch(n){return{ok:!1,error:he(n)}}}async function Sx(n,a){try{return{ok:!0,view:await ih(await P.putProvider(n,a))}}catch(r){return{ok:!1,error:he(r)}}}async function Pw(n,a){try{const r=await P.putThinking({ref:n,levels:a});return Y({settings:r.settings}),{ok:!0,settings:r.settings,thinking:r.thinking}}catch(r){return{ok:!1,error:he(r)}}}async function Fw(n){try{return{ok:!0,view:await ih(await P.deleteProvider(n))}}catch(a){return{ok:!1,error:he(a)}}}async function Tx(n){try{return await P.testProvider(n),null}catch(a){return he(a)}}async function Ww(n){try{return{ok:!0,models:(await P.discoverProvider(n)).models}}catch(a){return{ok:!1,error:he(a)}}}async function eN(){try{return{ok:!0,view:await P.providersImport()}}catch(n){return{ok:!1,error:he(n)}}}async function tN(n){try{return{ok:!0,view:await ih(await P.importProviders(n))}}catch(a){return{ok:!1,error:he(a)}}}const nN=()=>P.skills(),sN=n=>P.skillsImport(n),lN=(n,a,r)=>P.importSkills(n,a,r),aN=n=>P.deleteSkill(n),iN=()=>P.desktop();async function rN(n){const a=await P.saveDesktop(n);return Y({settings:await P.settings()}),a}async function oN(n,a){const r=await P.saveDesktopPublic(n,a);return Y({settings:await P.settings()}),r}const cN=()=>P.testDesktop(),Cx=()=>P.mcp(),uN=(n,a)=>P.putMcp(n,a),l0=(n,a)=>P.patchMcp(n,a),dN=n=>P.deleteMcp(n),fN=(n,a=!0)=>P.testMcp(n,a),hN=()=>P.mcpImports(),mN=n=>P.importMcp(n),pN=()=>P.search(),gN=(n,a,r)=>P.testSearch(n,a,r);async function vN(n,a){try{const r=await P.putSearch(ne.settings.revision,n,a);return Y({settings:r}),null}catch(r){return r instanceof He&&r.status===409&&Y({settings:await P.settings()}),he(r)}}const xN=()=>P.embeddingKey(),bN=n=>P.embeddingTest(n);async function yN(n,a){try{const r=await P.putEmbedding(ne.settings.revision,n,a);return Y({settings:r.settings}),r}catch(r){throw r instanceof He&&r.status===409&&Y({settings:await P.settings()}),r}}const kN=(n,a)=>P.knowledgeEntry(n,a),jN=n=>P.reindexKnowledge(n);async function wN(){try{return await P.imageKey()}catch(n){return Y({notice:`无法读取图像生成设置:${he(n)}`}),null}}async function Ex(n,a){try{const r=await P.putImage(ne.settings.revision,n,a);return Y({settings:r.settings}),{ok:!0,keyConfigured:r.keyConfigured}}catch(r){if(r instanceof He&&r.status===409){try{Y({settings:await P.settings()})}catch{}return{ok:!1,error:"设置已在别处修改,已刷新,请重新保存",conflict:!0}}return{ok:!1,error:he(r),conflict:!1}}}async function Ax(n){try{return await P.imageTest(n)}catch(a){return{ok:!1,error:`生成测试图片的请求失败:${he(a)}`}}}async function mf(){try{return{ok:!0,config:await P.memory()}}catch(n){return{ok:!1,error:`无法读取记忆设置:${he(n)}`}}}async function Mx(n,a){try{const r=await P.putMemory(n,a);return Y(o=>({settings:{...o.settings,revision:Math.max(o.settings.revision,r.revision)}})),{ok:!0,config:r}}catch(r){return{ok:!1,error:he(r)}}}async function NN(n){try{return{ok:!0,config:await P.putLore(n)}}catch(a){return{ok:!1,error:he(a)}}}async function zx(n){try{return{ok:!0,result:await P.loreTest(n)}}catch(a){return{ok:!1,error:`测试请求失败:${he(a)}`}}}async function SN(){try{return{ok:!0,view:await P.loreImport()}}catch(n){return{ok:!1,error:he(n)}}}async function TN(){try{return{ok:!0,config:await P.importLore()}}catch(n){return{ok:!1,error:he(n)}}}async function er(){try{return{ok:!0,view:await P.push()}}catch(n){return{ok:!1,error:`无法读取推送设置:${he(n)}`}}}async function CN(){const n=await er();if(!n.ok)return n;try{const a=await kw(n.view.publicKey);return"error"in a?{ok:!1,error:a.error}:{ok:!0,view:await P.subscribePush(a.subscription,vw(navigator.userAgent))}}catch(a){return{ok:!1,error:`订阅推送失败:${he(a)}`}}}async function EN(){try{const n=await th();if(n)try{await n.unsubscribe()}catch{}return a0(n?.endpoint??await AN())}catch(n){return{ok:!1,error:`关闭推送失败:${he(n)}`}}}async function AN(){const n=await er();return n.ok?n.view.devices[0]?.endpoint??"":""}async function a0(n){if(!n)return er();try{return{ok:!0,view:await P.unsubscribePush(n)}}catch(a){return{ok:!1,error:`删除设备失败:${he(a)}`}}}async function MN(){const n=await th();try{const a=await P.testPush(n?.endpoint);return{ok:!0,sent:a.sent,removed:a.removed}}catch(a){return{ok:!1,error:he(a)}}}const i0=window.matchMedia("(prefers-color-scheme: dark)");function Cl(n){const{dark:a}=Ow(n,i0.matches);document.documentElement.classList.toggle("dark",a),document.documentElement.style.colorScheme=a?"dark":"light",Pb(ne,window.innerWidth<768)}i0.addEventListener("change",()=>Cl(ne.theme));let Ox=!1,_x=null;async function zN(){if(!Ox){if(Ox=!0,Cl(ne.theme),Ol){if(kc==="boot")return;await uc();return}try{await P.me()}catch(n){if(n instanceof He&&n.status===401){Y({phase:"login"});return}Y({phase:"error",error:he(n)});return}await uc()}}async function ON(n){if(!ne.loggingIn){Y({loggingIn:!0,error:null});try{await P.login(n)}catch(a){Y({loggingIn:!1,error:a instanceof He&&a.status===401?"密码不正确":`登录失败:${he(a)}`});return}Y({loggingIn:!1,phase:"loading"}),await uc()}}async function uc(){try{const n=await P.bootstrap();Y({phase:"ready",error:null,offline:null,assistants:n.assistants,jobs:Nn(n.jobs),delegations:Nn(n.delegations??[]),routines:n.routines,approvals:Nn(n.approvals),settings:n.settings,theme:n.settings.settings.general.theme}),Cl(n.settings.settings.general.theme),localStorage.setItem(sh,n.settings.settings.general.theme),_x||(_x=P.events({onEvent:_f,onReconnect:()=>{Y({offline:null,sedimenting:{}}),uc()},onDown:o=>Y({offline:o})},e0),RN());const a=ne.sel&&n.assistants.some(o=>o.id===ne.sel)?ne.sel:n.assistants.find(o=>o.primary)?.id??n.assistants[0]?.id??null;a&&await Vt(a,Iw()),ne.page==="knowledge"&&zt();const r=ne.panelStack.at(-1);r?.kind==="job"&&dh(r.id),r?.kind==="jobs"&&!ne.worklog&&mc()}catch(n){Y({phase:"error",error:he(n)})}}const rh=new Set;function _f(n){switch((n.type==="item"||n.type==="delta")&&Ki.get(n.assistantId)?.push(n),n.type){case"rules":ne.page==="settings"&&ne.section==="rules"&&Of();break;case"sediment-finished":Y(a=>({sedimenting:{...a.sedimenting,[n.jobId]:!1}}));break;case"page-live":{const a=!ne.livePages[n.callId];Y(r=>({livePages:{...r.livePages,[n.callId]:n},...K1(n,{seen:!a,closed:rh.has(n.callId),assistantId:r.sel,inChat:r.page==="main"&&(r.mobile==="chat"||!window.matchMedia("(max-width: 767px)").matches)})?{panelStack:Wn(r.panelStack,{kind:"file",path:"",full:!1,liveId:n.callId})}:{}}));break}case"assistant":{const a=n.assistant.unread>0&&r0(n.assistant.id);a&&P.markRead(n.assistant.id).catch(()=>{});const r=a?{...n.assistant,unread:0}:n.assistant;Y(o=>({assistants:wx(o.assistants,r),profiles:o.profiles[r.id]?{...o.profiles,[r.id]:{...o.profiles[r.id],assistant:r}}:o.profiles}));break}case"router-activity":Y(a=>({assistants:a.assistants.map(r=>r.id===n.assistantId?{...r,activity:n.activity}:r)}));break;case"assistant_removed":Y(a=>({assistants:a.assistants.filter(r=>r.id!==n.id),sel:a.sel===n.id?a.assistants.find(r=>r.primary)?.id??null:a.sel}));break;case"item":{const a=ne.items[n.assistantId];if(!a)break;const r=ne.pending[n.assistantId]??[],o=r.find(c=>F1(c,n.item));!o&&!a.some(c=>c.id===n.item.id)&&Vb([n.item.id]),Y(c=>({items:{...c.items,[n.assistantId]:Gb(a,n.item)},...o?{pending:{...c.pending,[n.assistantId]:r.filter(f=>f!==o)}}:{}}));break}case"delta":{const a=ne.items[n.assistantId];if(!a)break;const r=G1(a,n.itemId,n.text);r!==a&&Y(o=>({items:{...o.items,[n.assistantId]:r}}));break}case"job":Y(a=>({jobs:{...a.jobs,[n.job.id]:n.job}})),_N(n.job.status)&&ne.panelStack.some(a=>a.kind==="job"&&a.id===n.job.id)&&ne.steps[n.job.id]&&dh(n.job.id);break;case"delegation":Y(a=>({delegations:{...a.delegations,[n.delegation.id]:n.delegation}}));break;case"job_step":{const a=ne.steps[n.jobId];if(!a)break;Y(r=>({steps:{...r.steps,[n.jobId]:jw(a,n.step)}}));break}case"activity":{const a=ne.jobs[n.jobId];if(!a)break;Y(r=>({jobs:{...r.jobs,[n.jobId]:{...a,stats:n.stats,activity:[...a.activity,n.line].slice(-200)}}}));break}case"approval":Y(a=>({approvals:{...a.approvals,[n.approval.id]:n.approval}}));break;case"draft":Y(a=>({drafts:{...a.drafts,[n.draft.id]:n.draft}}));break;case"routine":Y(a=>({routines:wx(a.routines,n.routine)}));break;case"routine_removed":Y(a=>({routines:a.routines.filter(r=>r.id!==n.id),panelStack:a.panelStack.filter(r=>r.kind!=="routine"||r.id!==n.id)}));break;case"skills":bs(n.assistantId);break;case"knowledge":ne.page==="knowledge"&&zt(!1,!0);break;case"profile":o0(n.assistantId);break}}function _N(n){return n==="done"||n==="stuck"||n==="failed"||n==="stopped"}function Rx(){P.visibility(e0,document.visibilityState==="visible").catch(()=>{});const n=ne.assistants.find(a=>a.id===ne.sel);n&&n.unread>0&&r0(n.id)&&(Y(a=>({assistants:a.assistants.map(r=>r.id===n.id?{...r,unread:0}:r)})),P.markRead(n.id).catch(()=>{}))}function r0(n){return ne.sel===n&&ne.page==="main"&&globalThis.document?.visibilityState==="visible"&&(window.innerWidth>=768||ne.mobile==="chat")}function RN(){kx||(kx=!0,document.addEventListener("visibilitychange",Rx),Rx())}async function Vt(n,a=!0,r=!1){Y(c=>({sel:n,panelStack:Dw(c.panelStack,c.sel,n,r),...c.sel!==n&&!r?{worklog:null}:{},...a?{mobile:"chat",...r?{}:{sheet:!1},search:!1}:{},quote:null}));const o=ne.assistants.find(c=>c.id===n);o&&o.unread>0&&(Y(c=>({assistants:c.assistants.map(f=>f.id===n?{...f,unread:0}:f)})),P.markRead(n).catch(()=>{})),await Promise.all([DN(n),o0(n)])}const El=new Map,Gi=new Map,Ki=new Map;async function DN(n){const a=(El.get(n)??0)+1;El.set(n,a),Gi.delete(n),Ki.set(n,[]),Y(o=>({itemPages:{...o.itemPages,[n]:{hasMore:!1,loading:!1,error:null}}}));const r=new Set(Object.keys(ne.livePages));try{const o=await P.items(n);if(El.get(n)!==a)return;const c=Ki.get(n)??[];Ki.delete(n),Q1();const f=new Set((o.pageLive??[]).map(h=>h.callId));Y(h=>{const m=Object.fromEntries(Object.entries(h.livePages).filter(([p,g])=>g.assistantId!==n||g.state==="done"||!r.has(p)||f.has(p)));return{livePages:m,panelStack:Lw(h.panelStack,m)}});for(const h of o.pageLive??[])_f({type:"page-live",...h});Y(h=>({items:{...h.items,[n]:o.items},itemGen:{...h.itemGen,[n]:(h.itemGen[n]??0)+1},itemPages:{...h.itemPages,[n]:{hasMore:o.hasMore,loading:!1,error:null}},jobs:{...h.jobs,...Nn(o.jobs)},approvals:{...h.approvals,...Nn(o.approvals)},drafts:{...h.drafts,...Nn(o.drafts)},delegations:{...h.delegations,...Nn(o.delegations??[])}}));for(const h of c)_f(h)}catch(o){if(El.get(n)!==a)return;Ki.delete(n),Y({notice:`无法加载对话:${he(o)}`})}}function oh(n,a=!1){const r=Gi.get(n);if(r)return r;const o=ne.itemPages[n],c=ne.items[n]?.[0]?.id;if(!o?.hasMore||!c||o.error&&!a)return Promise.resolve();const f=El.get(n);Y(m=>({itemPages:{...m.itemPages,[n]:{...o,loading:!0,error:null}}}));const h=(async()=>{try{const m=await P.items(n,c);if(El.get(n)!==f||ne.sel!==n)return;Y(p=>{const g=p.items[n]??[],v=new Set(g.map(b=>b.id));return{items:{...p.items,[n]:[...m.items.filter(b=>!v.has(b.id)),...g]},itemPages:{...p.itemPages,[n]:{hasMore:m.hasMore,loading:!1,error:null}},jobs:{...Nn(m.jobs),...p.jobs},approvals:{...Nn(m.approvals),...p.approvals},drafts:{...Nn(m.drafts),...p.drafts},delegations:{...Nn(m.delegations??[]),...p.delegations}}})}catch(m){El.get(n)===f&&ne.sel===n&&Y(p=>({itemPages:{...p.itemPages,[n]:{...p.itemPages[n],loading:!1,error:he(m)}}}))}})();return Gi.set(n,h),h.finally(()=>{Gi.get(n)===h&&Gi.delete(n)}),h}async function o0(n){try{const a=await P.profile(n);Y(r=>({profiles:{...r.profiles,[n]:a}}))}catch(a){Y({notice:`无法加载档案:${he(a)}`})}}function ch(n){Y({text:n})}function dc(n){Y({quote:n,nonce:ne.nonce+1})}const c0=new Map,Rf=new Map,fc=new Map;function Dl(n){return fc.get(n)??P.fileUrl(n,{thumb:!0})}function Dx(n,a){const r=o=>o.some(c=>c.id===n)?o.map(c=>c.id===n?{...c,...a}:c):o;Y(o=>({attachments:r(o.attachments),pending:Object.fromEntries(Object.entries(o.pending).map(([c,f])=>[c,f.map(h=>({...h,attachments:r(h.attachments)}))]))}))}function u0(n){const a=c0.get(n.id),r=P.upload(a).then(o=>{const c=fc.get(yc(n));return c&&fc.set(o,c),Dx(n.id,{status:"done",path:o}),o},o=>{throw Rf.delete(n.id),Dx(n.id,{status:"failed"}),o});return r.catch(()=>{}),Rf.set(n.id,r),r}function $N(n){const a=Array.from(n).map(r=>{const o={id:`att-${Math.random().toString(36).slice(2,10)}`,name:r.name,status:"uploading"};return c0.set(o.id,r),Ji(r.name)&&fc.set(yc(o),URL.createObjectURL(r)),o});Y(r=>({attachments:[...r.attachments,...a]})),a.forEach(r=>void u0(r))}function $x(n){Y(a=>({attachments:a.attachments.filter(r=>r.id!==n)}))}async function UN(n){return Promise.all(n.attachments.map(a=>Rf.get(a.id)??u0(a)))}function Df(n,a,r){Y(o=>{const c=o.pending[n]??[],f=r?c.map(h=>h.localId===a?{...h,...r}:h):c.filter(h=>h.localId!==a);return{pending:{...o.pending,[n]:f}}})}async function d0(n){Df(n.assistantId,n.localId,{status:"sending",error:void 0});try{const a=await UN(n),r=await P.sendMessage(n.assistantId,{text:n.text,quote:n.quote,files:a.length?a:void 0});Y(o=>({pending:{...o.pending,[n.assistantId]:(o.pending[n.assistantId]??[]).filter(c=>c.localId!==n.localId)},...r?.item?{items:{...o.items,[n.assistantId]:Gb(o.items[n.assistantId]??[],r.item)}}:{}}))}catch(a){Df(n.assistantId,n.localId,{status:"failed",error:he(a)})}}async function Ux(){const n=ne.sel,a=ne.text.trim();if(!n||!a&&!ne.attachments.length)return;const r={localId:`local-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,assistantId:n,at:new Date().toISOString(),text:a,...ne.quote?{quote:ne.quote}:{},attachments:ne.attachments,status:"sending"};Vb([r.localId]),Y(o=>({text:"",quote:null,attachments:[],nonce:o.nonce+1,pending:{...o.pending,[n]:[...o.pending[n]??[],r]}})),await d0(r)}function Lx(n,a){const r=ne.pending[n]?.find(o=>o.localId===a);r&&d0(r)}function LN(n,a){Df(n,a,null)}function f0(n,a){if(!a)return[];const r=n.pending[a]??[],o=n.items[a]??[];return r.length?[...o,...r.map(P1)]:o}function HN(n,a,r){return a?n.pending[a]?.find(o=>o.localId===r):void 0}async function BN(n){try{await P.stopAssistant(n)}catch(a){Y({notice:`停止失败:${he(a)}`})}}async function Hx(n,a){const r=ne.approvals[n];if(r){Y(o=>({approvals:{...o.approvals,[n]:{...r,status:"answered",...a.key?{chosen:a.key}:{answerText:(a.text??"").trim()}}}}));try{await P.answerApproval(n,a)}catch(o){Y({approvals:{...ne.approvals,[n]:r},notice:`提交失败:${he(o)}`})}}}async function qN(n){try{await P.createDraft(n)}catch(a){Y({notice:`创建助手失败:${he(a)}`})}}async function IN(n){try{await P.archiveAssistant(n);const a=ne.assistants.find(r=>r.primary);ne.sel===n&&a&&await Vt(a.id)}catch(a){Y({notice:`归档失败:${he(a)}`})}}async function YN(n){try{await P.retryDelegation(n)}catch(a){Y({notice:`重新转交失败:${he(a)}`})}}async function Bx(n,a,r){await m0(n,a,r?"forward":"handback")}async function uh(n,a,r){await m0(n,a,r?"forward":"delegation")}async function h0(n,a){for(;ne.sel===n&&!(ne.items[n]??[]).some(a)&&ne.itemPages[n]?.hasMore;){const r=ne.items[n]?.[0]?.id;if(await oh(n),ne.itemPages[n]?.error)throw new Error(ne.itemPages[n].error);if(!r||ne.items[n]?.[0]?.id===r)break}return(ne.items[n]??[]).some(a)}async function m0(n,a,r){(ne.sel!==n||!ne.items[n])&&await Vt(n);const o=c=>r==="forward"?c.kind==="user"&&c.from?.delegationId===a:r==="handback"?c.kind==="note"&&c.handbackId===a:c.kind==="delegation"&&c.delegationId===a;try{if(!await h0(n,o)){Y({notice:"未找到对应的转交消息"});return}requestAnimationFrame(()=>requestAnimationFrame(()=>document.getElementById(`${r}-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})))}catch(c){Y({notice:`无法定位转交消息:${he(c)}`})}}async function $f(n,a){try{return await P.replyJob(n,a),!0}catch(r){return Y({notice:`发送失败:${he(r)}`}),!1}}async function p0(n){try{await P.stopJob(n)}catch(a){Y({notice:`停止失败:${he(a)}`})}}const Zo={};async function bs(n){const a=Zo[n]=(Zo[n]??0)+1;Y(r=>({assistantSkills:{...r.assistantSkills,[n]:{skills:r.assistantSkills[n]?.skills??[],loaded:r.assistantSkills[n]?.loaded??!1,loading:!0,error:null}}}));try{const r=await P.assistantSkills(n);Zo[n]===a&&Y(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:r,loaded:!0,loading:!1,error:null}}}))}catch(r){Zo[n]===a&&Y(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:o.assistantSkills[n]?.skills??[],loaded:o.assistantSkills[n]?.loaded??!1,loading:!1,error:he(r)}}}))}}async function pf(n,a,r){try{r==="rollback"?await P.rollbackAssistantSkill(n,a):r==="delete"?await P.deleteAssistantSkill(n,a):await P.patchAssistantSkill(n,a,r==="enable"),await bs(n)}catch(o){Y({notice:`操作失败:${he(o)}`})}}async function GN(n){Y(a=>({sedimenting:{...a.sedimenting,[n]:!0}}));try{return await P.sedimentJob(n),!0}catch(a){return Y(r=>({notice:`沉淀失败:${he(a)}`,sedimenting:{...r.sedimenting,[n]:!1}})),!1}}async function wl(n,a){const r=ne.routines.find(f=>f.id===n);if(!r)return;const{skill:o,...c}=a;Y(f=>({routines:f.routines.map(h=>h.id===n?{...h,...c,...o!==void 0?{skill:o??void 0}:{}}:h)}));try{await P.patchRoutine(n,a)}catch(f){Y({routines:ne.routines.map(h=>h.id===n?r:h),notice:`保存失败:${he(f)}`})}}async function KN(n){const a=new Set(ne.routines.map(c=>c.id));let r;try{r=await P.createRoutine(n)}catch(c){Y({notice:`创建失败:${he(c)}`});return}const o=r?.id?r:ne.routines.find(c=>!a.has(c.id));o&&Y(c=>({panelStack:Wb(c.panelStack,{kind:"routine",id:o.id})}))}async function VN(n){try{await P.deleteRoutine(n)}catch(a){Y({notice:`删除失败:${he(a)}`})}}async function XN(n){try{await P.runRoutine(n)}catch(a){Y({notice:`运行失败:${he(a)}`})}}async function hc(n,a){const r=ne.assistants.find(c=>c.id===n),o=ne.profiles[n];if(!r)return"助手不存在。";Y(c=>({assistants:c.assistants.map(f=>f.id===n?{...f,...a}:f),profiles:c.profiles[n]?{...c.profiles,[n]:{...c.profiles[n],assistant:{...c.profiles[n].assistant,...a}}}:c.profiles}));try{return await P.patchAssistant(n,a),null}catch(c){const f=`保存失败:${he(c)}`;return Y(h=>({assistants:h.assistants.map(m=>m.id===n?r:m),profiles:o?{...h.profiles,[n]:o}:h.profiles,notice:f})),f}}async function ZN(n,a,r){try{const o=await P.patchAssistant(n,{rule:{text:a,mode:r}});if(!o?.rule)throw new Error("保存响应缺少规则。");const c=o.rule;return Y(f=>{const h=f.profiles[n];return!h||h.rules.some(m=>m.id===c.id)?{}:{profiles:{...f.profiles,[n]:{...h,rules:[...h.rules,c]}}}}),null}catch(o){return`保存失败:${he(o)}`}}async function QN(n,a){try{return await P.patchAssistant(n,{rule:a}),Y(r=>{const o=r.profiles[n];return o?{profiles:{...r.profiles,[n]:{...o,rules:o.rules.map(c=>c.id===a.id?{...c,...a,changedAt:new Date().toISOString()}:c)}}}:{}}),null}catch(r){return`保存失败:${he(r)}`}}async function JN(n,a){const r=ne.profiles[n];if(r){Y(o=>({profiles:{...o.profiles,[n]:{...r,rules:r.rules.filter(c=>c.id!==a)}}}));try{await P.deleteRule(n,a)}catch(o){Y({profiles:{...ne.profiles,[n]:r},notice:`删除失败:${he(o)}`})}}}async function dh(n){try{const{job:a,steps:r}=await P.transcript(n);Y(o=>({jobs:{...o.jobs,[a.id]:a},steps:{...o.steps,[a.id]:o.steps[a.id]?ww(o.steps[a.id],r):r}}))}catch(a){Y({notice:`无法加载任务过程:${he(a)}`})}}function Un(n,a){Y(r=>({panelStack:Wn(r.panelStack,{kind:"job",id:n,round:a})})),dh(n)}function g0(n=null){Y(a=>({panelStack:Wn(a.panelStack,{kind:"jobs"})})),mc({assistantId:n,status:null})}function rr(){const n=ne.panelStack.at(-1);n?.kind==="file"&&n.liveId&&rh.add(n.liveId),Y(a=>({panelStack:Fb(a.panelStack)}))}function or(){for(const n of ne.panelStack)n.kind==="file"&&n.liveId&&rh.add(n.liveId);Y({panelStack:[]})}async function mc(n={}){const a=n.assistantId??null,r=n.status??null;Y({worklog:{jobs:[],assistantId:a,status:r,hasMore:!1,loading:!0}});try{const o=await P.jobs({...a?{assistantId:a}:{},...r?{status:r}:{},limit:30});v0(o,a,r)}catch(o){Y({worklog:null,notice:`无法加载任务记录:${he(o)}`})}}async function qx(){const n=ne.worklog;if(!n||!n.hasMore||n.loading)return;const a=n.jobs[n.jobs.length-1];Y({worklog:{...n,loading:!0}});try{const r=await P.jobs({...n.assistantId?{assistantId:n.assistantId}:{},...n.status?{status:n.status}:{},...a?{before:a.id}:{},limit:30});v0(r,n.assistantId,n.status)}catch(r){Y(o=>({worklog:o.worklog?{...o.worklog,loading:!1}:null,notice:`无法加载更多:${he(r)}`}))}}function v0(n,a,r){Y(o=>{const c=new Set((o.worklog?.jobs??[]).map(h=>h.id));return{worklog:{jobs:o.worklog&&o.worklog.assistantId===a&&o.worklog.status===r?[...o.worklog.jobs,...n.jobs.filter(h=>!c.has(h.id))]:n.jobs,assistantId:a,status:r,hasMore:n.hasMore,loading:!1},jobs:{...o.jobs,...Nn(n.jobs)}}})}function tr(){Y({nonce:ne.nonce+1,mobile:"chat",sheet:!1})}function x0(){const n=ne.assistants.find(a=>a.primary);n&&(Vt(n.id),Y({text:"我想创建一个专属助手,负责:",nonce:ne.nonce+1,mobile:"chat",sheet:!1}))}async function PN(n,a){(ne.sel!==n||!ne.items[n])&&await Vt(n),requestAnimationFrame(()=>{document.getElementById(`job-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})})}function b0(n){Y(a=>({panelStack:Wn(a.panelStack,{kind:"routine",id:n})}))}function FN(){Y(n=>({panelStack:Wn(n.panelStack,{kind:"newRoutine"})}))}function fh(){Y(n=>({panelStack:Wn(n.panelStack,{kind:"assistant"})}))}function Qo(n){Y(a=>({panelStack:Wn(a.panelStack,{kind:n})}))}async function y0(n,a,r){const o={items:[],loaded:!1,loading:!1,loadingMore:!1,hasMore:!1,error:null},c=ne[n][a]??o;if(!(c.loading||r&&(!c.loaded||!c.hasMore))){Y(f=>({[n]:{...f[n],[a]:{...c,loading:!0,loadingMore:r,error:null}}}));try{const f=r?c.cursor:void 0,h=n==="sidebarJobs"?await P.jobs({assistantId:a,before:f,limit:20}).then(E=>({items:E.jobs,hasMore:E.hasMore})):await P.knowledge({origin:"output",assistantId:a,before:f,limit:30}).then(E=>({items:E.entries,hasMore:E.hasMore})),m=r?[...c.items,...h.items]:[...h.items,...c.items],p=new Set,g=m.filter(E=>!p.has(E.id)&&!!p.add(E.id)),v=h.items.at(-1),b=r||!c.loaded?v&&("createdAt"in v&&n==="sidebarJobs"?v.id:v.updatedAt):c.cursor,j=r||!c.loaded?h.hasMore:c.hasMore||h.hasMore;Y(E=>({[n]:{...E[n],[a]:{items:g,loaded:!0,loading:!1,loadingMore:!1,hasMore:j,error:null,cursor:b}}}))}catch(f){Y(h=>({[n]:{...h[n],[a]:{...c,loading:!1,loadingMore:!1,failedMore:r,error:he(f)}}}))}}}function gf(n,a=!1){return y0("sidebarJobs",n,a)}function vf(n,a=!1){return y0("sidebarFiles",n,a)}let Ix=!1;async function WN(){if(Ix)return;const n=await P.knowledge({limit:1});Ix=!0,Y(a=>({knowledge:{...a.knowledge,collections:n.collections,collectionsLoaded:!0}}))}function Yx(n,a,r){Y({menu:{id:n,x:a,y:r}})}function xf(){ne.menu&&Y({menu:null})}let bf=0;async function zt(n=!1,a=!1){if(n&&(ne.knowledge.loading||!ne.knowledge.hasMore))return;const r=ne.knowledge,o=++bf;Y({knowledge:{...r,loading:n||r.entries.length===0,error:null}});try{const c=await P.knowledge({...r.category==="output"||r.category==="chat"?{origin:r.category}:r.category!=="all"?{collection:r.category}:{},q:r.q,kind:r.kind||void 0,assistantId:r.assistantId,before:n?r.entries.at(-1)?.updatedAt:void 0,limit:a?Math.min(200,Math.max(50,r.entries.length)):50});if(o!==bf)return;Y({knowledge:{...ne.knowledge,entries:n?[...r.entries,...c.entries]:c.entries,collections:c.collections,collectionsLoaded:!0,hasMore:c.hasMore,loading:!1}})}catch(c){o===bf&&Y({knowledge:{...ne.knowledge,loading:!1,error:he(c)}})}}function Ml(n){Y({knowledge:{...ne.knowledge,...n,hasMore:!1}}),zt()}async function k0(n,a=!0){try{const r=await P.createKnowledgeCollection(n.trim());return a?Ml({category:r.id}):await zt(!1,!0),r}catch(r){return Y({notice:`新建失败:${he(r)}`}),null}}async function eS(n,a){try{return await P.renameKnowledgeCollection(n,a.trim()),await zt(!1,!0),!0}catch(r){return Y({notice:`改名失败:${he(r)}`}),!1}}async function tS(n){try{const{deleted:a}=await P.deleteKnowledgeCollection(n);ne.knowledge.category===n?Ml({category:"all"}):await zt(!1,!0),Y({notice:a?`已删除知识库,一起删掉 ${a} 个文件`:"已删除知识库"})}catch(a){Y({notice:`删除失败:${he(a)}`})}}async function ac(n,a){try{return await P.patchKnowledgeEntry(n,a),await zt(!1,!0),!0}catch(r){return Y({notice:`保存失败:${he(r)}`}),!1}}async function nS(n){try{await P.deleteKnowledgeEntry(n),await zt(!1,!0)}catch(a){Y({notice:`删除失败:${he(a)}`})}}async function sS(n,a){try{await P.uploadKnowledge(n,a),await zt(!1,!0)}catch(r){Y({notice:`上传失败:${he(r)}`})}}function hh(){Y({page:"knowledge",panelStack:[],sheet:!1}),zt()}function nr(){Y({page:"main",panelStack:[]})}async function lS(n,a){Y({page:"main",panelStack:[]}),await Vt(n);try{if(!await h0(n,c=>c.id===a)){Y({notice:"未找到对应的对话消息"});return}const r=performance.now()+1500,o=()=>{if(ne.page!=="main"||ne.sel!==n)return;const c=Array.from(document.querySelectorAll("[data-item-id]")).find(f=>f.dataset.itemId===a);if(!c){performance.now()<r?requestAnimationFrame(o):Y({notice:"没能定位到这条消息"});return}Xb(c)};requestAnimationFrame(o)}catch(r){Y({notice:`无法定位对话消息:${he(r)}`})}}function jc(){Y({page:"settings",section:null,sub:null,sheet:!1,search:!1,panelStack:[]})}function Uf(){Y({page:"main",panelStack:[]})}function zl(n){Y({section:n,sub:null})}function Tn(n){Y({sub:n})}function Ht(){Y({sub:null})}function yf(){Y(n=>({nowWide:!n.nowWide}))}function aS(){Y({collapsed:!0,sheet:!1})}function iS(){Y({collapsed:!1,panelStack:[]})}function j0(n){Y({query:n})}function Lf(n){Y({mobile:n,sheet:!1,search:!1})}function rS(){Y({sheet:!0})}function w0(){Y({sheet:!1})}function Gx(n){Y({search:n,query:n?ne.query:""})}function oS(){Y({notice:null})}function Ga(n){Y({notice:n})}function cS(){Y({updateReady:!0})}function uS(){Y({tick:ne.tick+1})}function Lt(n,a){return P.fileUrl(n,a)}function mh(n){return P.fileMeta(n)}function N0(n,a){return P.jobFiles(n,a)}function Ct(n,a,r){Y(o=>({panelStack:Wn(o.panelStack,{kind:"file",path:n,full:!1,...a?{title:a}:{},...r})}))}function dS(n){Y(a=>({panelStack:Wn(a.panelStack,{kind:"file",path:"",full:!1,liveId:n})}))}function fS(){Y(n=>{const a=n.panelStack.at(-1);return a?.kind==="file"?{panelStack:Wb(n.panelStack,{...a,full:!a.full})}:{}})}const hS=500,Kx=10;function S0(n){const a=y.useRef(null),r=y.useRef(null),o=y.useRef(!1),c=()=>{a.current!==null&&window.clearTimeout(a.current),a.current=null,r.current=null};return y.useEffect(()=>c,[]),{handlers:{onContextMenu(h){h.preventDefault(),c(),Yx(n.id,h.clientX,h.clientY)},onPointerDown(h){h.pointerType==="touch"&&(c(),o.current=!1,r.current={x:h.clientX,y:h.clientY},a.current=window.setTimeout(()=>{a.current=null;const m=r.current;m&&(o.current=!0,window.setTimeout(()=>o.current=!1,1e3),Yx(n.id,m.x,m.y))},hS))},onPointerMove(h){const m=r.current;m&&(Math.abs(h.clientX-m.x)>Kx||Math.abs(h.clientY-m.y)>Kx)&&c()},onPointerUp:c,onPointerCancel:c},takeHeld(){return o.current?(o.current=!1,!0):!1}}}function Vx(){const n=je(),a=n.menu,r=y.useRef(null);if(y.useEffect(()=>{if(!a)return;const p=v=>{r.current&&!r.current.contains(v.target)&&xf()},g=v=>{v.key==="Escape"&&xf()};return document.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",g),()=>{document.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",g)}},[a]),!a)return null;const o=n.assistants.find(p=>p.id===a.id);if(!o)return null;const c=p=>{xf(),p()},f=o.primary?1:3,h=Math.max(8,Math.min(a.x,window.innerWidth-172)),m=Math.max(8,Math.min(a.y,window.innerHeight-(f*34+16)));return l.jsxs("div",{className:"amenu",ref:r,style:{left:h,top:m,transformOrigin:`${a.x-h}px ${a.y-m}px`},onContextMenu:p=>p.preventDefault(),children:[o.primary?null:l.jsx("button",{onClick:()=>c(()=>void hc(o.id,{pinned:!o.pinned})),children:o.pinned?"取消置顶":"放在顶部"}),o.primary?null:l.jsx("button",{onClick:()=>c(()=>void hc(o.id,{hidden:!o.hidden})),children:o.hidden?"放回列表":"收起这个助手"}),l.jsx("button",{onClick:()=>c(()=>{Vt(o.id,!1),fh()}),children:"助手设置"})]})}const T0={};for(const[n,a]of Object.entries({image:"png jpg jpeg gif webp bmp ico avif",table:"csv tsv xls xlsx ods",code:"ts tsx js jsx mjs cjs py go sh bash zsh json jsonl yaml yml toml xml css scss java c cpp h rs rb php sql vue svelte",doc:"md markdown txt pdf doc docx odt rtf",globe:"html htm svg",archive:"zip rar 7z tar gz bz2 xz tgz"}))for(const r of a.split(" "))T0[r]=n;function $l(n){const a=n.split(/[\\/]/).pop()??"",r=a.lastIndexOf(".");return r>0?T0[a.slice(r+1).toLowerCase()]??"file":"file"}const C0={search:'<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',plus:'<path d="M12 5v14M5 12h14"/>',edit:'<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>',gear:'<path d="M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>',dbl:'<path d="m6 17 5-5-5-5M13 17l5-5-5-5"/>',left:'<path d="m15 18-6-6 6-6"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7.5V12l3 2"/>',pause:'<circle cx="12" cy="12" r="9"/><path d="M10 9v6M14 9v6"/>',check:'<path d="M5 12.5 10 17l9-10"/>',spin:'<path d="M12 3a9 9 0 1 0 9 9" />',out:'<path d="M7 17 17 7M8.5 7H17v8.5"/>',reply:'<path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v3"/>',smile:'<circle cx="12" cy="12" r="9"/><path d="M8.5 14.5s1.3 1.8 3.5 1.8 3.5-1.8 3.5-1.8M9 9.5h.01M15 9.5h.01"/>',more:'<circle cx="5" cy="12" r="1.2"/><circle cx="12" cy="12" r="1.2"/><circle cx="19" cy="12" r="1.2"/>',doc:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',folder:'<path d="M3 6a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',table:'<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><path d="M3.5 9.5h17M3.5 14.5h17M10 9.5v10"/>',code:'<path d="m8 8-4 4 4 4M16 8l4 4-4 4M14 5l-4 14"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/>',archive:'<rect x="4" y="7" width="16" height="13" rx="2"/><rect x="3" y="4" width="18" height="4" rx="1"/><path d="M10 12h4"/>',panel:'<rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M15 4v16"/>',mem:'<path d="M12 3.5 14 9l5.5 2-5.5 2-2 5.5-2-5.5L4.5 11 10 9z"/>',rule:'<path d="M12 3 4 6v6c0 4.5 3.4 8.2 8 9 4.6-.8 8-4.5 8-9V6z"/><path d="m8.5 12 2.5 2.5 4.5-5"/>',chev:'<path d="m9 6 6 6-6 6"/>',down:'<path d="m6 9 6 6 6-6"/>',updown:'<path d="m8 9 4-4 4 4M8 15l4 4 4-4"/>',bulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6M10 22h4"/>',user:'<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>',send:'<path d="M12 20V5M5.5 11.5 12 5l6.5 6.5"/>',close:'<path d="m6 6 12 12M18 6 6 18"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M15 6.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h1.5"/>',split:'<path d="M4 5h4l8 14h4M4 19h4l8-14h4"/>',stop:'<rect x="6" y="6" width="12" height="12" rx="2"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 7.9h.01"/>',term:'<path d="m5 16 5-4-5-4M12 17h7"/>',dl:'<path d="M12 4v11M7.5 11.5 12 16l4.5-4.5"/><path d="M5 20h14"/>',expand:'<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/>',shrink:'<path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/>',pointer:'<path d="m5 3 6.5 17 2.3-7.2L21 10.5Z"/>',image:'<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><circle cx="9" cy="10" r="1.6"/><path d="m20.5 16-4.5-4.5L7 19.5"/>'};function pc(n,a=16){return`<svg class="i" width="${a}" height="${a}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${C0[n]}</svg>`}function X({name:n,size:a=16,w:r=1.7,className:o,style:c}){return l.jsx("svg",{className:`i${o?` ${o}`:""}`,width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",style:c,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:C0[n]}})}const Oa=["......k.....",".....kok....",".....kook...","..k.koook...",".kokoooook..",".kooooooook.","kooyyyyyyook","koyyeyyeyyok","koyyeyyeyyok","koyyyyyyyyok",".kooyyyyook.","..kkkkkkkk.."],jn=16,Xx="#40261a",Ba={orange:{name:"橙",o:"#ff7a2e",y:"#ffcf4a",bg:"#ffe6d3"},red:{name:"红",o:"#ff5a3c",y:"#ffd2a8",bg:"#ffe3dc"},pink:{name:"粉",o:"#ff6b8a",y:"#ffd6de",bg:"#ffe4ef"},purple:{name:"紫",o:"#8f7bff",y:"#ddd6ff",bg:"#e9e5ff"},blue:{name:"蓝",o:"#4ea3ff",y:"#cfe6ff",bg:"#fff0c4"},slate:{name:"灰蓝",o:"#6f8fb3",y:"#d8e5f2",bg:"#e3eeff"},teal:{name:"青",o:"#20b8b0",y:"#c2f0ea",bg:"#d6f3f1"},green:{name:"绿",o:"#2fbf71",y:"#c9f2da",bg:"#e4f5d9"}},Ze=(n,a)=>[...Array(n).fill(""),...a],_l={hob:{label:"主助手",color:"orange",dx:2,pal:{},art:[]},page:{label:"写作/文档",color:"purple",dx:1,pal:{p:"#ff9db0",g:"#b9c0c8",h:"#ffc21a",b:"#f2c58f"},art:Ze(5,["............kkkk","............kppk","............kppk","............kggk","............khhk","............khhk","............khhk","............khhk","............kbbk",".............kk."])},server:{label:"服务器/运维",color:"slate",dx:2,pal:{h:"#ffc21a",w:"#fff1b8"},art:Ze(2,["......kkkk......",".....khhwwk.....","....khhhhwhk....","....khhhhhhk....","...kkkkkkkkkk..."])},bird:{label:"资讯/动态",color:"blue",dx:0,pal:{l:"#dff3ff",w:"#ffffff"},art:Ze(6,["..........kkkk..",".........kllllk.",".........kwlllk.",".........kllllk.",".........kllllk.","..........kkkk..",".............kk.","..............kk","...............k"])},house:{label:"家/NAS/生活",color:"teal",dx:0,pal:{r:"#ff8b6a",w:"#fff7ea",d:"#9b6b52"},art:Ze(9,["............k...","...........krk..","..........krrrk.",".........krrrrrk","..........kwwwk.","..........kwdwk.","..........kkkkk."])},coin:{label:"钱/记账",color:"green",dx:0,pal:{h:"#ffc21a",w:"#fff1b8",d:"#d18f00"},art:Ze(9,["...........kkk..","..........khhhk.",".........khwdhhk",".........khwdhhk",".........khhdhhk","..........khhhk.","...........kkk.."])},book:{label:"学习/读书",color:"red",dx:2,pal:{d:"#3a3f58",t:"#ffc21a"},art:Ze(1,[".......kk.......",".....kkddkk.....","...kkddddddkk...",".kkddddddddddkk.","...kkddddddkk.t.","....kddddddk..t.","....kkkkkkkk..t.","..............t."])},leaf:{label:"健康/植物",color:"pink",dx:2,pal:{g:"#5ccf6b",s:"#3a9a4f"},art:Ze(0,["....kk.....kk...","...kggk...kggk..","....kggkskggk...",".....kk.s.kk...."])},wifi:{label:"网络/路由器",color:"teal",dx:2,pal:{},art:Ze(0,["......kkkkk.....",".....k.....k....",".......kkk......","......k...k....."])},calendar:{label:"日程/提醒",color:"purple",dx:0,pal:{r:"#ff4d4d",w:"#ffffff"},art:Ze(8,["..........k...k.",".........kkkkkkk",".........krrrrrk",".........kkkkkkk",".........kwwwwwk",".........kwwkwwk",".........kwwwwwk",".........kkkkkkk"])},chef:{label:"做饭/饮食",color:"red",dx:2,pal:{w:"#ffffff",g:"#d9dde2"},art:Ze(1,[".....kk..kk.....","....kwwkkwwk....","...kwwwwwwwwk...","...kwwwwwwwwk...","....kwwwwwwk....","....kggggggk....","....kkkkkkkk...."])},chart:{label:"股票/数据",color:"slate",dx:0,pal:{w:"#ffffff",g:"#f04848"},art:Ze(9,[".........kkkkkkk",".........kwwwwgk",".........kwwgwgk",".........kwwgwgk",".........kgwgwgk",".........kgwgwgk",".........kkkkkkk"])},bag:{label:"旅行/出行",color:"blue",dx:0,pal:{b:"#e8833a",s:"#ffd59a"},art:Ze(9,["...........kkk..","...........k.k..",".........kkkkkkk",".........kbsbsbk",".........kbsbsbk",".........kbsbsbk",".........kkkkkkk"])},paw:{label:"宠物",color:"purple",dx:0,pal:{c:"#ffb36b",p:"#ff8fa6"},art:Ze(9,[".........k.....k",".........kck.kck",".........kccccck",".........kckckck",".........kccpcck","..........kkkkk."])},note:{label:"音乐",color:"pink",dx:1,pal:{},art:Ze(2,["..............k.","..............kk","..............kk","..............k.","..............k.","............kkk.","............kkk."])},code:{label:"代码/开发",color:"green",dx:0,pal:{d:"#2b3240",g:"#6ef0a0"},art:Ze(10,[".........kkkkkkk",".........kgddddk",".........kdgdddk",".........kgdggdk",".........kdddddk",".........kkkkkkk"])},gym:{label:"健身/运动",color:"blue",dx:2,pal:{r:"#ff3b5c"},art:Ze(9,["...krrrrrrrrk...","..krrrrrrrrrrkr.","...............r"])},sticky:{label:"需求/产品负责人",color:"purple",dx:0,pal:{n:"#ffe066",d:"#c9a227"},art:Ze(9,[".........kkkkkkk",".........knnnnnk",".........kdddnnk",".........knnnnnk",".........kddddnk",".........knnnnkk",".........kkkkkk."])},timer:{label:"迭代/敏捷教练",color:"teal",dx:0,pal:{w:"#ffffff",r:"#ff5a3c"},art:Ze(8,["...........kkk..","............k...","..........kkkkk.",".........kwwrwwk",".........kwwrwwk",".........kwwkkwk",".........kwwwwwk","..........kkkkk."])},bug:{label:"测试/质量",color:"green",dx:0,pal:{r:"#ff4d4d"},art:Ze(8,["..........k...k.","...........kkk..","..........krrrk.",".........krkrkrk",".........krrrrrk",".........krkrkrk","..........krrrk.","...........kkk.."])},magnifier:{label:"代码审查/调研",color:"blue",dx:0,pal:{l:"#cfe8ff",w:"#ffffff",h:"#8a5a3c"},art:Ze(8,["..........kkk...",".........kwllk..",".........kllllk.",".........kllllk.","..........kkkk..",".............hh.","..............hh"])},blocks:{label:"架构/系统设计",color:"slate",dx:0,pal:{a:"#ff8b6a",b:"#4ea3ff",c:"#ffc21a"},art:Ze(9,["...........kkkk.","...........kaak.","...........kaak.",".........kkkkkkk",".........kbbkcck",".........kbbkcck",".........kkkkkkk"])},rocket:{label:"发布/部署",color:"purple",dx:0,pal:{w:"#e8edf3",r:"#ff5a3c",b:"#4ea3ff",f:"#ffb020"},art:Ze(6,["............k...","...........krk..","...........krk..","..........kwwwk.","..........kwbwk.","..........kwwwk.","..........kwwwk.",".........krwwwrk",".........kkkkkkk","...........kfk.."])},shield:{label:"安全/权限",color:"blue",dx:0,pal:{s:"#5b8def",w:"#ffffff"},art:Ze(9,[".........kkkkkkk",".........kssswsk",".........kwswssk",".........kswsssk","..........ksssk.","...........ksk..","............k..."])},database:{label:"数据库/数据",color:"teal",dx:0,pal:{d:"#5fa8ff",t:"#cfe6ff"},art:Ze(8,["..........kkkkk.",".........ktttttk",".........kkkkkkk",".........kdddddk",".........kkkkkkk",".........kdddddk","..........kkkkk."])},palette:{label:"界面/视觉设计",color:"pink",dx:0,pal:{p:"#f2c58f",a:"#ff4d4d",b:"#4ea3ff",c:"#5ccf6b"},art:Ze(9,["..........kkkkk.",".........kpppppk",".........kpapbpk",".........kppppk.",".........kpcppk.","..........kkkk.."])},siren:{label:"值班/告警",color:"red",dx:2,pal:{r:"#ff3b3b",w:"#ffd0d0"},art:Ze(1,["..k...kkkk...k..","...k.krwrrk.k...",".....krrrrk.....","....kkkkkkkk...."])},kanban:{label:"项目管理/看板",color:"green",dx:0,pal:{w:"#ffffff",a:"#ff8b6a",b:"#ffc21a",c:"#5ccf6b"},art:Ze(9,[".........kkkkkkk",".........kakbkck",".........kakwkck",".........kwkbkwk",".........kwkwkwk",".........kkkkkkk"])},wrench:{label:"维护/修复",color:"slate",dx:0,pal:{g:"#b9c0c8"},art:Ze(8,["............k.k.","...........kgkgk","...........kgggk","..........kgggk.",".........kggk...","........kggk....","........kgk.....","........kk......"])},bolt:{label:"性能/优化",color:"purple",dx:0,pal:{b:"#ffc21a"},art:Ze(8,["............kkk.","...........kbbk.","..........kbbk..",".........kbbbbk.","..........kkbbk.","...........kbk..","..........kbk...","..........kk...."])}},mS=Object.keys(_l),pS=Object.keys(Ba);function E0(n){if(n==="custom")return{prop:"custom",color:"orange"};if(n.startsWith("custom:")){const f=n.slice(7);return Object.hasOwn(Ba,f)?{prop:"custom",color:f}:void 0}const[a,r,...o]=n.split(":");if(o.length||!Object.hasOwn(_l,a))return;const c=a;return r===void 0?{prop:c,color:_l[c].color}:Object.hasOwn(Ba,r)?{prop:c,color:r}:void 0}function kf(n){return n==="orange"?"custom":`custom:${n}`}const gS=/^#[0-9a-f]{6}$/;function vS(n){if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,error:"prop_art 要是一个对象:art(字符串数组)、pal(字母 → 颜色)、dx(0|1|2)"};const{art:a,pal:r,dx:o}=n;if(!Array.isArray(a)||a.length===0)return{ok:!1,error:"prop_art.art 要是非空的字符串数组"};if(a.length>jn)return{ok:!1,error:`prop_art.art 最多 ${jn} 行,收到 ${a.length} 行`};for(const p of a){if(typeof p!="string")return{ok:!1,error:"prop_art.art 的每行都要是字符串"};if([...p].length!==jn)return{ok:!1,error:`prop_art.art 每行要正好 ${jn} 个字符,这一行是 ${[...p].length} 个:「${p}」`}}if(!r||typeof r!="object"||Array.isArray(r))return{ok:!1,error:"prop_art.pal 要是对象:单个小写字母 → #rrggbb"};const c=Object.entries(r);if(c.length>6)return{ok:!1,error:`prop_art.pal 最多 6 种颜色,收到 ${c.length} 种`};for(const[p,g]of c){if(!/^[a-z]$/.test(p))return{ok:!1,error:`pal 的键要是单个小写字母,收到「${p}」`};if(p==="k")return{ok:!1,error:"pal 不能有 k:描边色是固定的,art 里直接用 k 就行"};if("oye".includes(p))return{ok:!1,error:`pal 不能用 ${p}:这是火苗自己的颜色`};if(typeof g!="string"||!gS.test(g))return{ok:!1,error:`pal[${p}] 要是 #rrggbb 格式的颜色,收到「${String(g)}」`}}const f=a.join("");for(const p of new Set([...f].filter(g=>g!==".")))if(p!=="k"&&!Object.hasOwn(r,p))return{ok:!1,error:`art 里的「${p}」没有在 pal 里定义颜色`};const h=[...f].filter(p=>p!==".").length;if(h<6)return{ok:!1,error:`至少要画 6 个像素,现在只有 ${h} 个`};if(o!==0&&o!==1&&o!==2)return{ok:!1,error:`prop_art.dx 要是 0、1 或 2,收到 ${String(o)}`};const m=jn-Oa.length;for(let p=0;p<Oa.length;p++)for(let g=0;g<Oa[p].length;g++){if(Oa[p][g]!=="e")continue;const b=a[m+p]?.[o+g];if(b&&b!==".")return{ok:!1,error:`art 第 ${m+p+1} 行第 ${o+g+1} 列会盖住火苗的眼睛,把图案挪开(或调小 dx)`}}return{ok:!0,prop:{art:a,pal:r,dx:o}}}function jf(n,a){return a===_l[n].color?n:`${n}:${a}`}function xS(n,a){const r=E0(n)??{prop:"hob",color:"slate"},o=r.prop==="custom"&&a?vS(a):void 0,c=r.prop==="custom"?o?.ok?o.prop:_l.hob:_l[r.prop],f=Ba[r.color],h=[...Array(jn-Oa.length).fill(""),...Oa].map((b,j)=>{const E=b?`${".".repeat(c.dx)}${b}`.padEnd(jn,"."):".".repeat(jn),S=c.art[j]??"";return[...E].map((T,z)=>S[z]&&S[z]!=="."?S[z]:T).join("")});let[m,p,g,v]=[jn,jn,0,0];return h.forEach((b,j)=>[...b].forEach((E,S)=>{E!=="."&&([m,p,g,v]=[Math.min(m,S),Math.min(p,j),Math.max(g,S+1),Math.max(v,j+1)])})),{rows:h,pal:{k:Xx,e:Xx,o:f.o,y:f.y,...c.pal},bg:f.bg,offset:[(m+g-jn)/2,(p+v-jn)/2]}}function bS(n){const a=[];return{body:n.rows.map((o,c)=>[...o].map((f,h)=>f!=="e"?f:(a.push([h,c]),"y")).join("")),eyes:a}}function Zx({art:n}){const a=[];return n.rows.forEach((r,o)=>{for(let c=0;c<r.length;){const f=r[c];let h=c+1;for(;h<r.length&&r[h]===f;)h++;f!=="."&&n.pal[f]&&a.push({x:c,y:o,w:h-c,fill:n.pal[f]}),c=h}}),l.jsx(l.Fragment,{children:a.map((r,o)=>l.jsx("rect",{x:r.x,y:r.y,width:r.w+.02,height:1.02,fill:r.fill},o))})}const yS={busy:"正在工作",ask:"等你确认",stuck:"受阻",done:"已完成,未读"},kS=4,jS=7;function rt({sprite:n,prop:a,size:r,title:o,onClick:c,motion:f,mark:h,free:m,slot:p}){const g=y.useRef(h);h&&(g.current=h);const v=h??g.current,b=xS(n,a),j=f?bS(b):void 0,E=f==="peek"?`${(p??0)%jS*kS}s`:f?`${-([...n].reduce((S,T)=>(S*31+T.charCodeAt(0))%9973,7)%4e3)/1e3}s`:void 0;return l.jsxs("div",{className:`av${m?" av-free":""}${f?` av-motion av-${f}`:""} av-marked`,title:o,onClick:c,style:{"--av-size":`${r}px`,"--av-bg":b.bg},children:[l.jsx("svg",{viewBox:`${b.offset[0]} ${b.offset[1]} 16 16`,shapeRendering:"crispEdges","aria-hidden":"true",style:E?{"--eye-delay":E}:void 0,children:j?l.jsxs(l.Fragment,{children:[l.jsx(Zx,{art:{...b,rows:j.body}}),l.jsx("g",{className:"av-eyes",children:l.jsx("g",{className:"av-blink",children:j.eyes.map(([S,T])=>l.jsx("rect",{x:S,y:T,width:1.02,height:1.02,fill:b.pal.e},`${S}-${T}`))})})]}):l.jsx(Zx,{art:b})}),l.jsx("span",{className:`av-mark${h?" present":""}${v?` ${v}`:""}`,"aria-label":h?yS[h]:void 0,"aria-hidden":!h,children:l.jsx("span",{className:"av-mark-icon",children:v==="busy"?l.jsxs("svg",{viewBox:"0 0 13 5",children:[l.jsx("circle",{cx:"2.5",cy:"2.5",r:"1.5"}),l.jsx("circle",{cx:"6.5",cy:"2.5",r:"1.5"}),l.jsx("circle",{cx:"10.5",cy:"2.5",r:"1.5"})]}):v==="done"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",children:l.jsx("path",{d:"M3 8.5 6.5 12 13 4.5",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}):v==="ask"?"?":v==="stuck"?"!":null},v)})]})}var cr=Ib();async function ph(n){try{const a=navigator.clipboard;return a?.writeText?(await a.writeText(n),!0):!1}catch{return!1}}const wS="modulepreload",NS=function(n){return"/"+n},Qx={},ur=function(a,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=h(r.map(g=>{if(g=NS(g),g in Qx)return;Qx[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const j=document.createElement("link");if(j.rel=v?"stylesheet":wS,v||(j.as="script"),j.crossOrigin="",j.href=g,p&&j.setAttribute("nonce",p),document.head.appendChild(j),v)return new Promise((E,S)=>{j.addEventListener("load",E),j.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function f(h){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=h,window.dispatchEvent(m),!m.defaultPrevented)throw h}return c.then(h=>{for(const m of h||[])m.status==="rejected"&&f(m.reason);return a().catch(f)})};function gh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ul=gh();function A0(n){Ul=n}var Tl={exec:()=>null};function Nl(n){let a=[];return r=>{let o=Math.max(0,Math.min(3,r-1)),c=a[o];return c||(c=n(o),a[o]=c),c}}function Te(n,a=""){let r=typeof n=="string"?n:n.source,o={replace:(c,f)=>{let h=typeof f=="string"?f:f.source;return h=h.replace(mt.caret,"$1"),r=r.replace(c,h),o},getRegex:()=>new RegExp(r,a)};return o}var M0=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),mt={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Nl(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Nl(n=>new RegExp(`^ {0,${n}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Nl(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Nl(n=>new RegExp(`^ {0,${n}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:Nl(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Nl(n=>new RegExp(`^ {0,${n}}(?:</?(?:${fr})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:Nl(n=>new RegExp(`^ {0,${n}}>`))},SS=/^(?:[ \t]*(?:\n|$))+/,TS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,CS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,dr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ES=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,z0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,O0=Te(z0).replace(/bull/g,vh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),AS=Te(z0).replace(/bull/g,vh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,MS=/^[^\n]+/,bh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,zS=Te(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",bh).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),OS=Te(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,vh).getRegex(),fr="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_S=Te("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yh).replace("tag",fr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_0=n=>Te(xh).replace("hr",dr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",fr).getRegex(),RS=_0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),DS=_0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),$S=Te(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",DS).getRegex(),kh={blockquote:$S,code:TS,def:zS,fences:CS,heading:ES,hr:dr,html:_S,lheading:O0,list:OS,newline:SS,paragraph:RS,table:Tl,text:MS},Jx=Te("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",dr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",fr).getRegex(),US={...kh,lheading:AS,table:Jx,paragraph:Te(xh).replace("hr",dr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jx).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",fr).getRegex()},LS={...kh,html:Te(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",yh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Tl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Te(xh).replace("hr",dr).replace("heading",` *#{1,6} *[^
|
|
104
|
+
]`).replace("lheading",O0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},HS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,BS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,R0=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,qS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,es=/[\p{P}\p{S}]/u,Ka=/[\s\p{P}\p{S}]/u,hr=/[^\s\p{P}\p{S}]/u,IS=Te(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ka).getRegex(),YS=/[\p{Pi}\p{Ps}"']/u,D0=/(?!~)[\p{P}\p{S}]/u,GS=/(?!~)[\s\p{P}\p{S}]/u,KS=/(?:[^\s\p{P}\p{S}]|~)/u,VS=Te(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",M0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,XS=Te($0,"u").replace(/punct/g,es).getRegex(),ZS=Te($0,"u").replace(/punct/g,D0).getRegex(),QS=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,JS=Te(QS,"u").replace(/openQuote/g,YS).replace(/punct/g,es).getRegex(),U0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",PS=Te(U0,"gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,Ka).replace(/punct/g,es).getRegex(),FS=Te(U0,"gu").replace(/notPunctSpace/g,KS).replace(/punctSpace/g,GS).replace(/punct/g,D0).getRegex(),WS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",e2=Te(WS,"gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,Ka).replace(/punct/g,es).getRegex(),t2=Te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,Ka).replace(/punct/g,es).getRegex(),n2="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",s2=Te(n2,"gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,Ka).replace(/punct/g,es).getRegex(),l2=Te(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,es).getRegex(),a2="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",i2=Te(a2,"gu").replace(/notPunctSpace/g,hr).replace(/punctSpace/g,Ka).replace(/punct/g,es).getRegex(),r2=Te(/\\(punct)/,"gu").replace(/punct/g,es).getRegex(),o2=Te(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,es).getRegex(),c2=Te(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),u2=Te(yh).replace("(?:-->|$)","-->").getRegex(),d2=Te("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",u2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),L0=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,gc=Te(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",L0).getRegex(),f2=Te(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",gc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),h2=Te(/^!?\[(label)\]\[(ref)\]/).replace("label",gc).replace("ref",bh).getRegex(),m2=Te(/^!?\[(ref)\](?:\[\])?/).replace("ref",bh).getRegex(),Px=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,p2=Te(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",L0).getRegex(),g2=Te("reflink|nolink(?!\\()","g").replace("reflink",Te(/^!?\[(label)\]\[(ref)\]/).replace("label",p2).replace("ref",Px).getRegex()).replace("nolink",Te(/^!?\[(ref)\](?:\[\])?/).replace("ref",Px).getRegex()).getRegex(),Fx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,v2=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,x2=Te(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,v2).getRegex(),jh={_backpedal:Tl,anyPunctuation:r2,anyPunctuationOutsideCode:o2,autolink:c2,blockSkip:VS,br:R0,code:BS,del:Tl,delLDelim:Tl,delRDelim:Tl,emStrongLDelim:XS,emStrongRDelimAst:PS,emStrongRDelimUnd:t2,escape:HS,link:f2,nolink:m2,punctuation:IS,reflink:h2,reflinkSearch:g2,tag:d2,text:qS,url:Tl},b2={...jh,emStrongLDelim:JS,emStrongRDelimAst:e2,emStrongRDelimUnd:s2,link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",gc).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gc).getRegex()},Hf={...jh,emStrongRDelimAst:FS,emStrongLDelim:ZS,delLDelim:l2,delRDelim:i2,url:Te(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",x2).replace("protocol",Fx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Te(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Fx).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",M0?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},y2={...Hf,br:Te(R0).replace("{2,}","*").getRegex(),text:Te(Hf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Jo={normal:kh,gfm:US,pedantic:LS},Yi={normal:jh,gfm:Hf,breaks:y2,pedantic:b2},k2={"&":"&","<":"<",">":">",'"':""","'":"'"},Wx=n=>k2[n];function rn(n,a){if(a){if(mt.escapeTest.test(n))return n.replace(mt.escapeReplace,Wx)}else if(mt.escapeTestNoEncode.test(n))return n.replace(mt.escapeReplaceNoEncode,Wx);return n}function j2(n){return mt.numericCharacterReference.test(n)?n.replace(mt.numericCharacterReferenceOrAmpersand,(a,r,o)=>{if(r===void 0&&o===void 0)return"&";let c=r===void 0?Number.parseInt(o,16):Number.parseInt(r,10);return c===0||c>1114111||c>=55296&&c<=57343?"�":c===38?"&":String.fromCodePoint(c)}):n}function eb(n){try{n=encodeURI(n).replace(mt.percentDecode,"%")}catch{return null}return n}function tb(n,a){let r=n.replace(mt.findPipe,(f,h,m)=>{let p=!1,g=h;for(;--g>=0&&m[g]==="\\";)p=!p;return p?"|":" |"}),o=r.split(mt.splitPipe),c=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),a)if(o.length>a)o.splice(a);else for(;o.length<a;)o.push("");for(;c<o.length;c++)o[c]=o[c].trim().replace(mt.slashPipe,"|");return o}function vs(n,a,r){let o=n.length;if(o===0)return"";let c=0;for(;c<o&&n.charAt(o-c-1)===a;)c++;return n.slice(0,o-c)}function nb(n){let a=n.split(`
|
|
105
|
+
`),r=a.length-1;for(;r>=0&&mt.blankLine.test(a[r]);)r--;return a.length-r<=2?n:a.slice(0,r+1).join(`
|
|
106
|
+
`)}function vc(n){return n.trim().replace(mt.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function sb(n,a){if(n.indexOf(a[0])===-1&&n.indexOf(a[1])===-1)return-1;let r=0;for(let o=0;o<n.length;o++)if(n[o]==="\\")o++;else if(n[o]===a[0])r++;else if(n[o]===a[1]&&(r--,r<0))return o;return r>0?-2:-1}var qa=new WeakMap;function wh(n){let a={"*":-1,_:-1},r=-1,o=n.length;for(let c=0;c<o;c++){let f=n[c];if(f!=="*"&&f!=="_"&&f!=="~")continue;let h=c===0?`
|
|
107
|
+
`:n[c-1],m=c+1;for(;m<o&&n[m]===f;)m++;h!==" "&&h!==" "&&h!==`
|
|
108
|
+
`&&h!=="\r"&&h!=="\f"&&(f==="~"?r=c:a[f]=c),c=m-1}return{maskedSrc:n,lastPossibleEmStrongCloserIndex:a,lastPossibleDelCloserIndex:r}}function w2(n,a){let r=wh(a),o=qa.get(n);o?o.push(r):qa.set(n,[r])}function N2(n){let a=qa.get(n);a&&(a.pop(),a.length===0&&qa.delete(n))}function S2(n,a,r){let o=qa.get(n)?.at(-1);return o&&o.maskedSrc===a?o.lastPossibleEmStrongCloserIndex[r]:wh(a).lastPossibleEmStrongCloserIndex[r]}function T2(n,a){let r=qa.get(n)?.at(-1);return r&&r.maskedSrc===a?r.lastPossibleDelCloserIndex:wh(a).lastPossibleDelCloserIndex}function Po(n,a=0){let r=a,o="";for(let c of n)if(c===" "){let f=4-r%4;o+=" ".repeat(f),r+=f}else o+=c,r++;return o}function lb(n,a,r,o,c){let f=a.href,h=a.title||null,m=n[1].replace(c.other.outputLinkReplace,"$1"),p=n[0].charAt(0)==="!",g=o.state.inLink,v=o.state.linkEmitted,b=o.state.inRawBlock;o.state.inLink=!0,o.state.linkEmitted=!1;let j=o.inlineTokens(m),E=o.state.linkEmitted;if(o.state.linkEmitted=v,o.state.inLink=g,!p){if(E){o.state.inRawBlock=b;return}o.state.linkEmitted=!0}return{type:p?"image":"link",raw:r,href:f,title:h,text:m,tokens:j}}function C2(n,a,r){let o=n.match(r.other.indentCodeCompensation);if(o===null)return a;let c=o[1];return a.split(`
|
|
109
|
+
`).map(f=>{let h=f.match(r.other.beginningSpace);if(h===null)return f;let[m]=h;return f.slice(Math.min(m.length,c.length))}).join(`
|
|
110
|
+
`)}function ab(n,a,r,o){if(!a.includes("<"))return!1;for(let c=0;c<a.length;c++){if(a[c]==="\\"){c++;continue}if(a[c]==="`"){let m=o.inline.code.exec(a.slice(c));if(m){c+=m[0].length-1;continue}}if(a[c]!=="<")continue;let f=n.slice(r+c),h=o.inline.tag.exec(f)||o.inline.autolink.exec(f);if(h){if(h[0].length>a.length-c)return!0;c+=h[0].length-1}}return!1}var Da=class{options;rules;lexer;constructor(a){this.options=a||Ul}space(a){let r=this.rules.block.newline.exec(a);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(a){let r=this.rules.block.code.exec(a);if(r){let o=this.options.pedantic?r[0]:nb(r[0]),c=o.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:o,codeBlockStyle:"indented",text:c}}}fences(a){let r=this.rules.block.fences.exec(a);if(r){let o=r[0],c=C2(o,r[3]||"",this.rules);return{type:"code",raw:o,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:c}}}heading(a){let r=this.rules.block.heading.exec(a);if(r){let o=r[2].trim();if(this.rules.other.endingHash.test(o)){let c=vs(o,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceTabChar.test(c))&&(o=c.trim())}return{type:"heading",raw:vs(r[0],`
|
|
111
|
+
`),depth:r[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(a){let r=this.rules.block.hr.exec(a);if(r)return{type:"hr",raw:vs(r[0],`
|
|
112
|
+
`)}}blockquote(a){let r=this.rules.block.blockquote.exec(a);if(r){let o=vs(r[0],`
|
|
113
|
+
`).split(`
|
|
114
|
+
`),c="",f="",h=[];for(;o.length>0;){let m=!1,p=[],g;for(g=0;g<o.length;g++)if(this.rules.other.blockquoteStart.test(o[g]))p.push(o[g]),m=!0;else if(!m)p.push(o[g]);else break;o=o.slice(g);let v=p.join(`
|
|
115
|
+
`),b=v.replace(this.rules.other.blockquoteMarkerWhitespace,(S,T,z)=>T+Po(z,T.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
116
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
|
|
117
|
+
${v}`:v,f=f?`${f}
|
|
118
|
+
${b}`:b;let j=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,h,!0),this.lexer.state.top=j,o.length===0)break;let E=h.at(-1);if(E?.type==="code"||E?.type==="heading"||E?.type==="hr"||E?.type==="html"||E?.type==="table")break;if(E?.type==="blockquote"){let S=E,T=o.join(`
|
|
119
|
+
`),z=S.raw+`
|
|
120
|
+
`+T.replace(this.rules.other.blockquoteSetextReplace2,""),A=this.blockquote(z);h[h.length-1]=A;let $=z.substring(A.raw.length).replace(/^\n/,""),D=$?$.split(`
|
|
121
|
+
`).length:0,V=D?o.slice(0,-D):o;if(V.length>0&&(c=`${c}
|
|
122
|
+
${V.join(`
|
|
123
|
+
`)}`),f=f.substring(0,f.length-S.text.length)+A.text,o=o.slice(V.length),o.length>0&&this.rules.other.blockquoteStart.test(o[0]))continue;break}else if(E?.type==="list"){let S=E,T=S.raw+`
|
|
124
|
+
`+o.join(`
|
|
125
|
+
`),z=this.list(T);h[h.length-1]=z;let A=z.raw.length>S.raw.length?T.slice(S.raw.length+1,z.raw.length).split(`
|
|
126
|
+
`).length:0;if(A>0){let $=o.slice(0,A).join(`
|
|
127
|
+
`);c=`${c}
|
|
128
|
+
${$}`,f=`${f}
|
|
129
|
+
${$}`}o=o.slice(A);continue}}return{type:"blockquote",raw:c,tokens:h,text:f}}}list(a){let r=this.rules.block.list.exec(a);if(r){let o=a,c=()=>o.length-a.length,f=r[1].trim(),h=f.length>1,m={type:"list",raw:"",ordered:h,start:h?+f.slice(0,-1):"",loose:!1,items:[]};f=h?`\\d{1,9}\\${f.slice(-1)}`:`\\${f}`,this.options.pedantic&&(f=h?f:"[*+-]");let p=this.rules.other.listItemRegex(f),g=!1;for(;a;){let b=!1,j="";if(!(r=p.exec(a))||this.rules.block.hr.test(a))break;let E=c();a=a.substring(r[0].length);let S=r[2].split(`
|
|
130
|
+
`,1)[0],T=r[1].length,z=this.options.pedantic?Po(S,T):S.replace(this.rules.other.leadingSpaceTab,N=>Po(N,T)),A=a.split(`
|
|
131
|
+
`,1)[0],$=!z.trim(),D=0;if(this.options.pedantic?(D=2,j=z.trimStart()):$?D=T+1:(D=z.search(this.rules.other.nonSpaceChar),D=D>4?1:D,j=z.slice(D),D+=T),$&&this.rules.other.blankLine.test(A)&&(a=a.substring(A.length+1),b=!0),!b){let N=this.rules.other.nextBulletRegex(D),k=this.rules.other.hrRegex(D),C=this.rules.other.fencesBeginRegex(D),M=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(D):this.rules.other.headingBeginRegex(D),L=this.rules.other.htmlBeginRegex(D),J=this.rules.other.blockquoteBeginRegex(D);for(;a;){let te=a.split(`
|
|
132
|
+
`,1)[0],ke;if(A=te,this.options.pedantic?(A=A.replace(this.rules.other.listReplaceNesting," "),ke=A):ke=A.replace(this.rules.other.leadingSpaceTab,me=>Po(me)),C.test(A)||M.test(A)||L.test(A)||J.test(A)||N.test(A)||k.test(A))break;if(ke.search(this.rules.other.nonSpaceChar)>=D||!A.trim())j+=`
|
|
133
|
+
`+ke.slice(D);else{if($||z.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(z)||M.test(z)||L.test(z)||k.test(z))break;let me=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(A)&&this.rules.block.lheading.test(`${z}
|
|
134
|
+
${A}`)?` ${ke.replace(/^ {0,3}/,"")}`:A;j+=`
|
|
135
|
+
`+me}$=!A.trim(),a=a.substring(te.length+1),z=ke.slice(D)}}let V=o.slice(E,c());m.loose||(g?m.loose=!0:this.rules.other.doubleBlankLine.test(V)&&(g=!0)),m.items.push({type:"list_item",raw:V,task:!!this.options.gfm&&this.rules.other.listIsTask.test(j),loose:!1,text:j,tokens:[]})}let v=m.items.at(-1);if(v)v.raw=v.raw.trimEnd(),v.text=v.text.trimEnd();else return;m.raw=o.slice(0,c()).trimEnd();for(let b of m.items)if(this.lexer.state.top=!1,b.tokens=this.lexer.blockTokens(b.text,[]),!m.loose){let j=b.tokens.filter(S=>S.type==="space"),E=j.length>0&&j.some(S=>this.rules.other.anyLine.test(S.raw));m.loose=E}for(let b of m.items){let j=b.tokens[0];if(b.task&&(j?.type==="text"||j?.type==="paragraph")){b.text=b.text.replace(this.rules.other.listReplaceTask,""),j.raw=j.raw.replace(this.rules.other.listReplaceTask,""),j.text=j.text.replace(this.rules.other.listReplaceTask,"");for(let S=this.lexer.inlineQueue.length-1;S>=0;S--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[S].src)){this.lexer.inlineQueue[S].src=this.lexer.inlineQueue[S].src.replace(this.rules.other.listReplaceTask,"");break}let E=this.rules.other.listTaskCheckbox.exec(b.raw);if(E){let S={type:"checkbox",raw:E[0]+" ",checked:E[0]!=="[ ]"};b.checked=S.checked,m.loose?b.tokens[0]&&["paragraph","text"].includes(b.tokens[0].type)&&"tokens"in b.tokens[0]&&b.tokens[0].tokens?(b.tokens[0].raw=S.raw+b.tokens[0].raw,b.tokens[0].text=S.raw+b.tokens[0].text,b.tokens[0].tokens.unshift(S)):b.tokens.unshift({type:"paragraph",raw:S.raw,text:S.raw,tokens:[S]}):b.tokens.unshift(S)}}else b.task&&(b.task=!1)}if(m.loose)for(let b of m.items){b.loose=!0;for(let j of b.tokens)j.type==="text"&&(j.type="paragraph")}return m}}html(a){let r=this.rules.block.html.exec(a);if(r){let o=nb(r[0]);return{type:"html",block:!0,raw:o,pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:o}}}def(a){let r=this.rules.block.def.exec(a);if(r){if(!this.rules.other.startAngleBracket.test(r[2])&&sb(r[2],"()")!==-1)return;let o=vc(r[1]),c=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",f=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:o,raw:vs(r[0],`
|
|
136
|
+
`),href:c,title:f}}}table(a){let r=this.rules.block.table.exec(a);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let o=tb(r[1]),c=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),f=r[3]?.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
137
|
+
`):[],h={type:"table",raw:vs(r[0],`
|
|
138
|
+
`),header:[],align:[],rows:[]};if(o.length===c.length){for(let m of c)this.rules.other.tableAlignRight.test(m)?h.align.push("right"):this.rules.other.tableAlignCenter.test(m)?h.align.push("center"):this.rules.other.tableAlignLeft.test(m)?h.align.push("left"):h.align.push(null);for(let m=0;m<o.length;m++)h.header.push({text:o[m],tokens:this.lexer.inline(o[m]),header:!0,align:h.align[m]});for(let m of f)h.rows.push(tb(m,h.header.length).map((p,g)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:h.align[g]})));return h}}lheading(a){let r=this.rules.block.lheading.exec(a);if(r){let o=r[1].trim();return{type:"heading",raw:vs(r[0],`
|
|
139
|
+
`),depth:r[2].charAt(0)==="="?1:2,text:o,tokens:this.lexer.inline(o)}}}paragraph(a){let r=this.rules.block.paragraph.exec(a);if(r){let o=r[1].charAt(r[1].length-1)===`
|
|
140
|
+
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:o,tokens:this.lexer.inline(o)}}}text(a){let r=this.rules.block.text.exec(a);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(a){let r=this.rules.inline.escape.exec(a);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(a){let r=this.rules.inline.tag.exec(a);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(a){if(this.lexer.state.linkParenPossible===!1)return;let r=this.rules.inline.link.exec(a);if(r){let o=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ab(a,r[1],o,this.rules))return;let c=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(c)){if(!this.rules.other.endAngleBracket.test(c))return;let p=vs(c.slice(0,-1),"\\");if((c.length-p.length)%2===0)return}else{let p=sb(r[2],"()");if(p===-2)return;if(p>-1){let g=(r[0].indexOf("!")===0?5:4)+r[1].length+p;r[2]=r[2].substring(0,p),r[0]=r[0].substring(0,g).trim(),r[3]=""}}let f=vs(r[0].slice(0,-1),"\\");if((r[0].length-f.length)%2===0)return;let h=r[2],m="";if(this.options.pedantic){let p=this.rules.other.pedanticHrefTitle.exec(h);p&&(h=p[1],m=p[3])}else m=r[3]?r[3].slice(1,-1):"";return h=h.trim(),this.rules.other.startAngleBracket.test(h)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(c)?h=h.slice(1):h=h.slice(1,-1)),lb(r,{href:h&&h.replace(this.rules.inline.anyPunctuation,"$1"),title:m&&m.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(a,r){let o;if((o=this.rules.inline.reflink.exec(a))||(o=this.rules.inline.nolink.exec(a))){let c=o[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ab(a,o[1],c,this.rules))return;let f=r[vc(o[2]||o[1])];if(!f){let h=o[0].charAt(0);return{type:"text",raw:h,text:h}}return lb(o,f,o[0],this.lexer,this.rules)}}emStrong(a,r,o=""){let c=this.rules.inline.emStrongLDelim.exec(a);if(!c||!c[1]&&!c[2]&&!c[3]&&!c[4])return;let f=c[0][0],h=o===f,m=r.length-a.length,p=m;for(;!this.options.pedantic&&p>0&&r[p-1]===f;)p--;let g=[...r.slice(Math.max(0,p-2),p)].at(-1)??"",v=g==="*"||g==="_"||!!this.rules.inline.punctuation.exec(g);p<m&&(o=g);let b=p<m?v:!!this.rules.inline.punctuation.exec(o);if(c[4]&&o.match(this.rules.other.unicodeAlphaNumeric))return;let j=c[1]||c[3]||"";if(!j||!o||b){let E=[...c[0]].length-1,S,T,z=E,A=0,$=m-p+E,D=!this.options.pedantic&&!!g.trim()&&(!!j||f==="*"&&!v);if(f!=="*"&&f!=="_")return;let V=f==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,N=S2(this,r,f),k=r.length-a.length+E;if(N<k)return;r=r.slice(-1*a.length+E);let C=N-k;for(V.lastIndex=0;(c=V.exec(r))!==null&&!(c.index>C);){if(S=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!S)continue;if(T=[...S].length,c[3]||c[4]){z+=T;continue}else if(c[5]||c[6]||D){if(h&&(c[5]||c[6]))break;if($%3&&!(($+T)%3)){A+=T;continue}}if(z-=T,z>0)continue;T=Math.min(T,T+z+A);let M=[...c[0]][0].length,L=a.slice(0,E+c.index+M+T);if(Math.min(E,T)%2){let te=L.slice(1,-1);return{type:"em",raw:L,text:te,tokens:this.lexer.inlineTokens(te)}}let J=L.slice(2,-2);return{type:"strong",raw:L,text:J,tokens:this.lexer.inlineTokens(J)}}}}codespan(a){let r=this.rules.inline.code.exec(a);if(r){let o=r[2].replace(this.rules.other.newLineCharGlobal," "),c=this.rules.other.nonSpaceChar.test(o),f=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return c&&f&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:r[0],text:o}}}br(a){let r=this.rules.inline.br.exec(a);if(r)return{type:"br",raw:r[0]}}del(a,r,o=""){let c=this.rules.inline.delLDelim.exec(a);if(c&&(!c[1]||!o||this.rules.inline.punctuation.exec(o))){let f=[...c[0]].length-1,h,m,p=f,g=this.rules.inline.delRDelim,v=T2(this,r),b=r.length-a.length+f;if(v<b)return;r=r.slice(-1*a.length+f);let j=v-b;for(g.lastIndex=0;(c=g.exec(r))!==null&&!(c.index>j);){if(h=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!h||(m=[...h].length,m!==f))continue;if(c[3]||c[4]){p+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p);let E=[...c[0]][0].length,S=a.slice(0,f+c.index+E+m),T=S.slice(f,-f);return{type:"del",raw:S,text:T,tokens:this.lexer.inlineTokens(T)}}}}autolink(a){let r=this.rules.inline.autolink.exec(a);if(r){let o,c;return r[2]==="@"?(o=r[1],c="mailto:"+o):(o=r[1],c=o),{type:"link",raw:r[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}url(a){let r;if(r=this.rules.inline.url.exec(a)){let o,c;if(r[2]==="@")o=r[0],c="mailto:"+o;else{let f;do f=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(f!==r[0]);o=r[0],r[1]==="www."?c="http://"+r[0]:c=r[0]}return{type:"link",raw:r[0],text:o,href:c,autolink:!0,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(a){let r=this.rules.inline.text.exec(a);if(r){let o=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:o?r[0]:j2(r[0]),escaped:o}}}},Dn=class Bf{tokens;options;state;inlineQueue;tokenizer;constructor(a){this.tokens=[],this.tokens.links=Object.create(null),this.options=a||Ul,this.options.tokenizer=this.options.tokenizer||new Da,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:mt,block:Jo.normal,inline:Yi.normal};this.options.pedantic?(r.block=Jo.pedantic,r.inline=Yi.pedantic):this.options.gfm&&(r.block=Jo.gfm,this.options.breaks?r.inline=Yi.breaks:r.inline=Yi.gfm),this.tokenizer.rules=r}static get rules(){return{block:Jo,inline:Yi}}static lex(a,r){return new Bf(r).lex(a)}static lexInline(a,r){return new Bf(r).inlineTokens(a)}lex(a){a=a.replace(mt.carriageReturn,`
|
|
141
|
+
`),this.blockTokens(a,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let o=this.inlineQueue[r];this.state.inRawBlock=!1,this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(a,r=[],o=!1){this.tokenizer.lexer=this,this.options.pedantic&&(a=a.replace(mt.tabCharGlobal," ").replace(mt.spaceLine,""));let c=1/0;for(;a;){if(a.length<c)c=a.length;else{this.infiniteLoopError(a.charCodeAt(0));break}let f;if(this.options.extensions?.block?.some(m=>(f=m.call({lexer:this},a,r))?(a=a.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.space(a)){a=a.substring(f.raw.length);let m=r.at(-1);f.raw.length===1&&m!==void 0?m.raw+=`
|
|
142
|
+
`:r.push(f);continue}if(f=this.tokenizer.code(a)){a=a.substring(f.raw.length);let m=r.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
143
|
+
`)?"":`
|
|
144
|
+
`)+f.raw,m.text+=`
|
|
145
|
+
`+f.text,this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(f=this.tokenizer.fences(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.heading(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.hr(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.blockquote(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.list(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.html(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.def(a)){a=a.substring(f.raw.length);let m=r.at(-1);m?.type==="paragraph"||m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
146
|
+
`)?"":`
|
|
147
|
+
`)+f.raw,m.text+=`
|
|
148
|
+
`+f.raw,this.inlineQueue.at(-1).src=m.text):(this.tokens.links[f.tag]||(this.tokens.links[f.tag]={href:f.href,title:f.title}),r.push(f));continue}if(f=this.tokenizer.table(a)){a=a.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.lheading(a)){a=a.substring(f.raw.length),r.push(f);continue}let h=a;if(this.options.extensions?.startBlock){let m=1/0,p=a.slice(1),g;this.options.extensions.startBlock.forEach(v=>{g=v.call({lexer:this},p),typeof g=="number"&&g>=0&&(m=Math.min(m,g))}),m<1/0&&m>=0&&(h=a.substring(0,m+1))}if(this.state.top&&(f=this.tokenizer.paragraph(h))){let m=r.at(-1);o&&m?.type==="paragraph"?(m.raw+=(m.raw.endsWith(`
|
|
149
|
+
`)?"":`
|
|
150
|
+
`)+f.raw,m.text+=`
|
|
151
|
+
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f),o=h.length!==a.length,a=a.substring(f.raw.length);continue}if(f=this.tokenizer.text(a)){a=a.substring(f.raw.length);let m=r.at(-1);m?.type==="text"?(m.raw+=(m.raw.endsWith(`
|
|
152
|
+
`)?"":`
|
|
153
|
+
`)+f.raw,m.text+=`
|
|
154
|
+
`+f.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(f);continue}if(a){this.infiniteLoopError(a.charCodeAt(0));break}}return this.state.top=!0,r}inline(a,r=[]){return this.inlineQueue.push({src:a,tokens:r}),r}linkInText(a){if(!a.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let o of a.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(o[0])&&a.charAt(o.index-1)!=="!")return!0;for(let o of a.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let c=o[0],f=c.lastIndexOf("[");if(!(c.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,vc(c.slice(f+1,-1))))&&!(f>1&&this.linkInText(c.slice(1,f-1))))return!0}return!1}inlineTokens(a,r=[]){this.tokenizer.lexer=this;let o=this.state.linkParenPossible;this.state.linkParenPossible=o&&a.includes(")");try{return this.#e(a,r)}finally{this.state.linkParenPossible=o}}#e(a,r){let o=a.includes("*")||a.includes("_")||a.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==Da.prototype.emStrong||this.tokenizer.del!==Da.prototype.del?this.#n(a):a;w2(this.tokenizer,o);try{return this.#t(a,o,r)}finally{N2(this.tokenizer)}}#t(a,r,o){let c=!1,f="",h=1/0;for(;a;){if(a.length<h)h=a.length;else{this.infiniteLoopError(a.charCodeAt(0));break}c||(f=""),c=!1;let m;if(this.options.extensions?.inline?.some(g=>(m=g.call({lexer:this},a,o))?(a=a.substring(m.raw.length),o.push(m),!0):!1))continue;if(m=this.tokenizer.escape(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.tag(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.link(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(m.raw.length);let g=o.at(-1);m.type==="text"&&g?.type==="text"?(g.raw+=m.raw,g.text+=m.text):o.push(m);continue}if(m=this.tokenizer.emStrong(a,r,f)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.codespan(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.br(a)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.del(a,r,f)){a=a.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.autolink(a)){a=a.substring(m.raw.length),o.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(a))){a=a.substring(m.raw.length),o.push(m);continue}let p=a;if(this.options.extensions?.startInline){let g=1/0,v=a.slice(1),b;this.options.extensions.startInline.forEach(j=>{b=j.call({lexer:this},v),typeof b=="number"&&b>=0&&(g=Math.min(g,b))}),g<1/0&&g>=0&&(p=a.substring(0,g+1))}if(m=this.tokenizer.inlineText(p)){a=a.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(f=m.raw.slice(-1)),c=!0;let g=o.at(-1);g?.type==="text"?(g.raw+=m.raw,g.text+=m.text):o.push(m);continue}if(a){this.infiniteLoopError(a.charCodeAt(0));break}}return o}#n(a){let r=a;if(this.tokens.links&&a.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,c=f=>{let h=f.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,vc(f.slice(h+1,-1))))return f;if(h>1&&f.charAt(0)!=="!"){let m=f.slice(1,h-1);if(this.linkInText(m))return"["+m.replace(o,c)+"]["+"a".repeat(f.length-h-2)+"]"}return"["+"a".repeat(f.length-2)+"]"};r=r.replace(o,c)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(o,c,f)=>f?"+".repeat(o.length):c?c+o.slice(c.length,-c.length).replace(/`/g,"+")+c:o),r=r.replace(this.tokenizer.rules.inline.blockSkip,(o,c,f)=>{let h=f?f.length:0;return o.slice(0,h)+"["+"a".repeat(o.length-h-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(a){let r="Infinite loop on byte: "+a;if(this.options.silent)console.error(r);else throw new Error(r)}},xc=class{options;parser;constructor(n){this.options=n||Ul}space(n){return""}code({text:n,lang:a,escaped:r}){let o=(a||"").match(mt.notSpaceStart)?.[0],c=n?n.replace(mt.endingNewline,"")+`
|
|
155
|
+
`:"";return o?'<pre><code class="language-'+rn(o)+'">'+(r?c:rn(c,!0))+`</code></pre>
|
|
156
|
+
`:"<pre><code>"+(r?c:rn(c,!0))+`</code></pre>
|
|
157
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
158
|
+
${this.parser.parse(n)}</blockquote>
|
|
159
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:a}){return`<h${a}>${this.parser.parseInline(n)}</h${a}>
|
|
160
|
+
`}hr(n){return`<hr>
|
|
161
|
+
`}list(n){let a=n.ordered,r=n.start,o="";for(let h=0;h<n.items.length;h++){let m=n.items[h];o+=this.listitem(m)}let c=a?"ol":"ul",f=a&&r!==1?' start="'+r+'"':"";return"<"+c+f+`>
|
|
162
|
+
`+o+"</"+c+`>
|
|
163
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
164
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
165
|
+
`}table(n){let a="",r="";for(let c=0;c<n.header.length;c++)r+=this.tablecell(n.header[c]);a+=this.tablerow({text:r});let o="";for(let c=0;c<n.rows.length;c++){let f=n.rows[c];r="";for(let h=0;h<f.length;h++)r+=this.tablecell(f[h]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
166
|
+
<thead>
|
|
167
|
+
`+a+`</thead>
|
|
168
|
+
`+o+`</table>
|
|
169
|
+
`}tablerow({text:n}){return`<tr>
|
|
170
|
+
${n}</tr>
|
|
171
|
+
`}tablecell(n){let a=this.parser.parseInline(n.tokens),r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+a+`</${r}>
|
|
172
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${rn(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:a,text:r,tokens:o,autolink:c}){let f=c?rn(r,!0):this.parser.parseInline(o),h=eb(n);if(h===null)return f;n=rn(h,c);let m='<a href="'+n+'"';return a&&(m+=' title="'+rn(a)+'"'),m+=">"+f+"</a>",m}image({href:n,title:a,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let c=eb(n);if(c===null)return rn(r);n=c;let f=`<img src="${rn(n)}" alt="${rn(r)}"`;return a&&(f+=` title="${rn(a)}"`),f+=">",f}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:rn(n.text)}},Nh=class{parser;strong({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}em({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}codespan({text:n}){return n}del({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}html({text:n}){return n}text({text:n}){return n}link({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}image({text:n,tokens:a}){return a?this.parser.parseInline(a,this):n}br(){return""}checkbox({raw:n}){return n}},$n=class qf{options;renderer;textRenderer;constructor(a){this.options=a||Ul,this.options.renderer=this.options.renderer||new xc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Nh,this.textRenderer.parser=this}static parse(a,r){return new qf(r).parse(a)}static parseInline(a,r){return new qf(r).parseInline(a)}parse(a){this.renderer.parser=this;let r="";for(let o=0;o<a.length;o++){let c=a[o];if(this.options.extensions?.renderers?.[c.type]){let h=c,m=this.options.extensions.renderers[h.type].call({parser:this},h);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(h.type)){r+=m||"";continue}}let f=c;switch(f.type){case"space":{r+=this.renderer.space(f);break}case"hr":{r+=this.renderer.hr(f);break}case"heading":{r+=this.renderer.heading(f);break}case"code":{r+=this.renderer.code(f);break}case"table":{r+=this.renderer.table(f);break}case"blockquote":{r+=this.renderer.blockquote(f);break}case"list":{r+=this.renderer.list(f);break}case"checkbox":{r+=this.renderer.checkbox(f);break}case"html":{r+=this.renderer.html(f);break}case"def":{r+=this.renderer.def(f);break}case"paragraph":{r+=this.renderer.paragraph(f);break}case"text":{r+=this.renderer.text(f);break}default:{let h='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}parseInline(a,r=this.renderer){this.renderer.parser=this;let o="";for(let c=0;c<a.length;c++){let f=a[c];if(this.options.extensions?.renderers?.[f.type]){let m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}let h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"checkbox":{o+=r.checkbox(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{let m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},Vi=class{options;block;constructor(n){this.options=n||Ul}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Dn.lex:Dn.lexInline}provideParser(n=this.block){return n?$n.parse:$n.parseInline}};function Js(n,a){if(Array.isArray(a))for(let r=0;r<a.length;r++)n.push(a[r]);else n.push(a)}var H0=class{defaults=gh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$n;Renderer=xc;TextRenderer=Nh;Lexer=Dn;Tokenizer=Da;Hooks=Vi;constructor(...n){this.use(...n)}walkTokens(n,a){let r=[];for(let o of n)switch(Js(r,a.call(this,o)),o.type){case"table":{let c=o;for(let f of c.header)Js(r,this.walkTokens(f.tokens,a));for(let f of c.rows)for(let h of f)Js(r,this.walkTokens(h.tokens,a));break}case"list":{let c=o;Js(r,this.walkTokens(c.items,a));break}default:{let c=o;this.defaults.extensions?.childTokens?.[c.type]?this.defaults.extensions.childTokens[c.type].forEach(f=>{let h=c[f].flat(1/0);Js(r,this.walkTokens(h,a))}):c.tokens&&Js(r,this.walkTokens(c.tokens,a))}}return r}use(...n){let a=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return n.forEach(r=>{let o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let f=a.renderers[c.name];f?a.renderers[c.name]=function(...h){let m=c.renderer.apply(this,h);return m===!1&&(m=f.apply(this,h)),m}:a.renderers[c.name]=c.renderer}if("tokenizer"in c){if(!c.level||c.level!=="block"&&c.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let f=a[c.level];f?f.unshift(c.tokenizer):a[c.level]=[c.tokenizer],c.start&&(c.level==="block"?a.startBlock?a.startBlock.push(c.start):a.startBlock=[c.start]:c.level==="inline"&&(a.startInline?a.startInline.push(c.start):a.startInline=[c.start]))}"childTokens"in c&&c.childTokens&&(a.childTokens[c.name]=c.childTokens)}),o.extensions=a),r.renderer){let c=this.defaults.renderer||new xc(this.defaults);for(let f in r.renderer){if(!(f in c))throw new Error(`renderer '${f}' does not exist`);if(["options","parser"].includes(f))continue;let h=f,m=r.renderer[h],p=c[h];c[h]=(...g)=>{let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v===!1?"":v??""}}o.renderer=c}if(r.tokenizer){let c=this.defaults.tokenizer||new Da(this.defaults);for(let f in r.tokenizer){if(!(f in c))throw new Error(`tokenizer '${f}' does not exist`);if(["options","rules","lexer"].includes(f))continue;let h=f,m=r.tokenizer[h],p=c[h];c[h]=(...g)=>{let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v}}o.tokenizer=c}if(r.hooks){let c=this.defaults.hooks||new Vi;for(let f in r.hooks){if(!(f in c))throw new Error(`hook '${f}' does not exist`);if(["options","block"].includes(f))continue;let h=f,m=r.hooks[h],p=c[h];Vi.passThroughHooks.has(f)?c[h]=g=>{if(c.options.async&&Vi.passThroughHooksRespectAsync.has(f))return(async()=>{let b=await m.call(c,g);return p.call(c,b)})();let v=m.call(c,g);return p.call(c,v)}:c[h]=(...g)=>{if(c.options.async)return(async()=>{let b=await m.apply(c,g);return b===!1&&(b=await p.apply(c,g)),b})();let v=m.apply(c,g);return v===!1&&(v=p.apply(c,g)),v}}o.hooks=c}if(r.walkTokens){let c=this.defaults.walkTokens,f=r.walkTokens;o.walkTokens=function(h){let m=[];return Js(m,f.call(this,h)),c&&Js(m,c.call(this,h)),m}}this.defaults={...this.defaults,...o}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,a){return Dn.lex(n,a??this.defaults)}parser(n,a){return $n.parse(n,a??this.defaults)}parseMarkdown(n){return(a,r)=>{let o={...r},c={...this.defaults,...o},f=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&o.async===!1)return f(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof a>"u"||a===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof a!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(a)+", string expected"));if(c.hooks&&(c.hooks.options=c,c.hooks.block=n),c.async)return(async()=>{let h=c.hooks?await c.hooks.preprocess(a):a,m=await(c.hooks?await c.hooks.provideLexer(n):n?Dn.lex:Dn.lexInline)(h,c),p=c.hooks?await c.hooks.processAllTokens(m):m;c.walkTokens&&await Promise.all(this.walkTokens(p,c.walkTokens));let g=await(c.hooks?await c.hooks.provideParser(n):n?$n.parse:$n.parseInline)(p,c);return c.hooks?await c.hooks.postprocess(g):g})().catch(f);try{c.hooks&&(a=c.hooks.preprocess(a));let h=(c.hooks?c.hooks.provideLexer(n):n?Dn.lex:Dn.lexInline)(a,c);c.hooks&&(h=c.hooks.processAllTokens(h)),c.walkTokens&&this.walkTokens(h,c.walkTokens);let m=(c.hooks?c.hooks.provideParser(n):n?$n.parse:$n.parseInline)(h,c);return c.hooks&&(m=c.hooks.postprocess(m)),m}catch(h){return f(h)}}}onError(n,a){return r=>{if(r.message+=`
|
|
173
|
+
Please report this to https://github.com/markedjs/marked.`,n){let o="<p>An error occurred:</p><pre>"+rn(r.message+"",!0)+"</pre>";return a?Promise.resolve(o):o}if(a)return Promise.reject(r);throw r}}},Rl=new H0;function Pe(n,a){return Rl.parse(n,a)}Pe.options=Pe.setOptions=function(n){return Rl.setOptions(n),Pe.defaults=Rl.defaults,A0(Pe.defaults),Pe};Pe.getDefaults=gh;Pe.defaults=Ul;function E2(...n){return Rl.use(...n),Pe.defaults=Rl.defaults,A0(Pe.defaults),Pe}Pe.use=E2;Pe.walkTokens=function(n,a){return Rl.walkTokens(n,a)};Pe.parseInline=Rl.parseInline;Pe.Parser=$n;Pe.parser=$n.parse;Pe.Renderer=xc;Pe.TextRenderer=Nh;Pe.Lexer=Dn;Pe.lexer=Dn.lex;Pe.Tokenizer=Da;Pe.Hooks=Vi;Pe.parse=Pe;Pe.options;Pe.setOptions;Pe.walkTokens;Pe.parseInline;$n.parse;Dn.lex;const Ln="\\u1100-\\u11ff\\u20a9\\u2329-\\u232a\\u2630-\\u2637\\u268a-\\u268f\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303e\\u3041-\\u3096\\u3099-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u31e5\\u31ef-\\u321e\\u3220-\\u3247\\u3250-\\ua48c\\ua490-\\ua4c6\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufaff\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe66\\ufe68-\\ufe6b\\uff01-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\\uffe0-\\uffe6\\uffe8-\\uffee\\u{16fe0}-\\u{16fe4}\\u{16ff0}-\\u{16ff6}\\u{17000}-\\u{18cda}\\u{18cff}-\\u{18d20}\\u{18d80}-\\u{18df2}\\u{18e00}-\\u{19191}\\u{191a0}-\\u{191d2}\\u{1aff0}-\\u{1aff3}\\u{1aff5}-\\u{1affb}\\u{1affd}-\\u{1affe}\\u{1b000}-\\u{1b128}\\u{1b132}\\u{1b150}-\\u{1b152}\\u{1b155}\\u{1b164}-\\u{1b168}\\u{1b170}-\\u{1b2fb}\\u{1d300}-\\u{1d356}\\u{1d360}-\\u{1d376}\\u{1f1ae}\\u{1f200}\\u{1f202}\\u{1f210}-\\u{1f219}\\u{1f21b}-\\u{1f22e}\\u{1f230}-\\u{1f231}\\u{1f237}\\u{1f23b}\\u{1f240}-\\u{1f248}\\u{1f260}-\\u{1f265}\\u{1f7da}\\u{20000}-\\u{3fffd}",Ia=new RegExp(`[${Ln}]`,"u"),A2=new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${Ln}])`,"u");function B0(n,a,r){return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${n}(\\*+)(?=[\\s]|$)|${r}(\\*+)(?!\\*)(?=${a}|$)|(?!\\*)${a}(\\*+)(?=${r})|[\\s](\\*+)(?!\\*)(?=${n})|(?!\\*)${n}(\\*+)(?!\\*)(?=${n})|${r}(\\*+)(?=${r})`,"gu")}function M2(n,a,r){return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${n}(_+)(?=[\\s]|$)|${r}(_+)(?!_)(?=${a}|$)|(?!_)${a}(_+)(?=${r})|[\\s](_+)(?!_)(?=${n})|(?!_)${n}(_+)(?!_)(?=${n})`,"gu")}function z2(n,a,r){return new RegExp(`^[^~]+(?=[^~])|(?!~)${n}(~~?)(?=[\\s]|$)|${r}(~~?)(?!~)(?=${a}|$)|(?!~)${a}(~~?)(?=${r})|[\\s](~~?)(?!~)(?=${n})|(?!~)${n}(~~?)(?!~)(?=${n})|${r}(~~?)(?=${r})`,"gu")}const q0=`[\\p{P}\\p{S}${Ln}]`,I0=`[\\s\\p{P}\\p{S}${Ln}]`,Y0=`[^\\s\\p{P}\\p{S}${Ln}]`,O2=`(?![*_])[\\p{P}\\p{S}${Ln}]`,_2=`(?![*_])[\\s\\p{P}\\p{S}${Ln}]`,R2=`(?:[^\\s\\p{P}\\p{S}${Ln}]|[*_])`,D2=`(?!~)[\\p{P}\\p{S}${Ln}]`,$2=`(?!~)[\\s\\p{P}\\p{S}${Ln}]`,U2=`(?:[^\\s\\p{P}\\p{S}${Ln}]|~)`,L2=B0(q0,I0,Y0),H2=B0(D2,$2,U2),B2=M2(q0,I0,Y0),ib=z2(O2,_2,R2);function rb(n,a,r){let o=A2.test(n);if(!o&&n){const c=a.length-r.length;if(c>=1){let f=c-1,h=a.charCodeAt(f);if(h>=65024&&h<=65038&&f>=1&&(f--,h=a.charCodeAt(f)),(h&64512)===56320&&f>=1){const m=a.codePointAt(f-1);m!==void 0&&m>65535&&(m>=917760&&m<=917999?o=!0:o=Ia.test(String.fromCodePoint(m)))}else o=Ia.test(String.fromCharCode(h))}}return o}function ob(n,a){if(!(n[1]||n[2]||n[3]||n[4]))return!1;const r=String.fromCodePoint(n[0].codePointAt(0)),o=n.index+n[0].length,c=o<a.length?String.fromCodePoint(a.codePointAt(o)):"";return Ia.test(r)||Ia.test(c)}function Sh(n){return n.length>=5}function q2(n){return!!(n[1]||n[2]||n[3]||n[4])}function I2(n){return Sh(n)?!!n[4]:!!n[3]}function Y2(n){return Sh(n)?n[1]||n[3]||"":n[1]||n[2]||""}function Fo(n){let a=n.length;const r=a-1;for(let o=0;o<r;){const c=n.charCodeAt(o++);if(c<55296||56320<=c)continue;const f=n.charCodeAt(o);f<56320||57344<=f||(o++,a--)}return a}function G2(){return{tokenizer:{emStrong(n,a,r=""){const{rules:o}=this,c=o.inline.emStrongLDelim.exec(n);if(!c)return!1;const f=Sh(c);if(f&&!q2(c))return;if(I2(c)&&r.match(o.other.unicodeAlphaNumeric))return!1;const h=Y2(c),m=rb(r,a,n);if(!h||!r||o.inline.punctuation.exec(r)||m||Ia.test(h)){const p=Fo(c[0])-1;let g,v,b=p,j=0;const E=f&&r===c[0][0],S=o.inline.emStrongRDelimAst.source.includes("(?!~)");let T;c[0][0]==="*"?T=S?H2:L2:T=B2,T.lastIndex=0;const z=a.slice(-1*n.length+p);let A;for(;(A=T.exec(z))!=null;){if(g=A[1]||A[2]||A[3]||A[4]||A[5]||A[6],!g)continue;v=Fo(g);const $=ob(A,z),D=!!(A[3]||A[4]),V=!!(A[5]||A[6]);if(D&&!$){b+=v;continue}if(V||$){if(p%3&&!((p+v)%3)){j+=v;continue}if(E&&V)break}if(b-=v,b>0)continue;v=Math.min(v,v+b+j);const N=A[0].codePointAt(0)>65535?2:1,k=n.slice(0,p+A.index+N+v);if(Math.min(p,v)%2){const M=k.slice(1,-1);return{type:"em",raw:k,text:M,tokens:this.lexer.inlineTokens(M)}}const C=k.slice(2,-2);return{type:"strong",raw:k,text:C,tokens:this.lexer.inlineTokens(C)}}}},del(n,a,r=""){const{rules:o}=this,c=o.inline.delLDelim.exec(n);if(!c)return!1;const f=c[1]||"",h=rb(r,a,n);if(!f||!r||o.inline.punctuation.exec(r)||h||Ia.test(f)){const m=Fo(c[0])-1;let p,g,v=m;ib.lastIndex=0;const b=a.slice(-1*n.length+m);let j;for(;(j=ib.exec(b))!=null;){if(p=j[1]||j[2]||j[3]||j[4]||j[5]||j[6],!p||(g=Fo(p),g!==m))continue;const E=ob(j,b);if((j[3]||j[4])&&!E){v+=g;continue}if(v-=g,v>0)continue;g=Math.min(g,g+v);const S=j[0].codePointAt(0)>65535?2:1,T=n.slice(0,m+j.index+S+g),z=T.slice(m,-m);return{type:"del",raw:T,text:z,tokens:this.lexer.inlineTokens(z)}}}}}}}function Pi(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let If,K2;function V2(){return K2??=ur(()=>import("./math-weKGDUmL.js"),__vite__mapDeps([0,1])).then(n=>{If=n.default})}function X2(n){let a=!1;return sr.walkTokens(sr.lexer(n),r=>{(r.type==="inlineMath"||r.type==="displayMath")&&(a=!0)}),a}function cb(n,a,r){if(!If)return Pi(r);try{return If.renderToString(n,{displayMode:a,throwOnError:!0,trust:!1})}catch{return Pi(r)}}const sr=new H0({extensions:[{name:"displayMath",level:"block",start(n){return n.search(/\$\$|\\\[/)},tokenizer(n){const a=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])(?:\n|$)/.exec(n);if(a)return{type:"displayMath",raw:a[0],text:a[1]??a[2]}},renderer(n){return`<div class="math-display">${cb(String(n.text),!0,n.raw.trimEnd())}</div>`}},{name:"inlineMath",level:"inline",start(n){return n.search(/\$|\\\(/)},tokenizer(n){const a=/^(?:\$(?!\$|\s)([^$`\n]*?[^$`\s])\$(?!\d)|\\\((.+?)\\\))/.exec(n);if(a)return{type:"inlineMath",raw:a[0],text:a[1]??a[2]}},renderer(n){return cb(String(n.text),!1,n.raw)}}],renderer:{html(n){return Pi(n.text??"")},code(n){const a=n.lang?.trim().split(/\s+/)[0]??"";return`<div class="code-block">${a?`<div class="code-head">${Pi(a)}</div>`:""}<button type="button" class="code-copy" aria-label="复制代码" title="复制代码">${pc("copy",15)}</button><pre><code>${Pi(n.text)}
|
|
174
|
+
</code></pre></div>`}}});sr.use(G2());const Z2=/^(https?:|mailto:|\/|#|\.)/i;function Q2(n){return sr.parse(n,{async:!1,gfm:!0,breaks:!0}).replace(/<a href="([^"]*)"/g,(r,o)=>Zb(o)?`<a class="knowledge-citation" href="${o}"`:Z2.test(o.trim())?`<a target="_blank" rel="noreferrer" href="${o}"`:"<a").replace(/(<a class="knowledge-citation"[^>]*>)/g,`$1${pc("doc",13)}`).replace(/[((]\s*(<a class="knowledge-citation"[^>]*>[\s\S]*?<\/a>)\s*[))]/g,"$1")}function J2(n){const a=[];for(const o of sr.lexer(n,{gfm:!0})){const c=o.type==="table",f=a.at(-1);f&&!f.table&&!c?f.md+=o.raw:a.push({table:c,md:o.raw})}const r=a.filter(o=>o.table||o.md.trim());return r.length?r:[{table:!1,md:n}]}const Yf=/[\p{L}\p{N}]/u;function P2(n){const a=n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s*[#>\-*]+\s*/gm,"");return Array.from(a).filter(r=>Yf.test(r)).join("")}function F2(n,a){const r=[];let o="";for(const g of n)for(let v=0;v<g.data.length;){const b=String.fromCodePoint(g.data.codePointAt(v));if(Yf.test(b)){o+=b;for(let j=0;j<b.length;j++)r.push({node:g,offset:v,end:v+b.length})}v+=b.length}const c=Array.from(a).filter(g=>Yf.test(g)).join("");if(!c)return null;let f=o.indexOf(c),h=f+c.length;if(f<0){const g=Array.from(c),v=g.slice(0,40).join(""),b=g.slice(-40).join("");if(f=o.indexOf(v),f<0)return null;const j=o.lastIndexOf(b,f+c.length*2-b.length);h=j>=f+v.length?j+b.length:f+v.length}const m=r[f],p=r[h-1];return{start:{node:m.node,offset:m.offset},end:{node:p.node,offset:p.end}}}async function W2(n,a){try{const r=await kN(n,a);Ct(r.entry.path,r.entry.name,{find:r.chunk?P2(r.chunk.text):void 0,page:r.chunk?.page})}catch(r){Ga(r instanceof He&&r.status===404?"这份资料已经删除":`无法打开资料:${r instanceof Error?r.message:String(r)}`)}}function Ya({text:n,className:a,streaming:r,onMathRendered:o}){const[c,f]=y.useState(0);return y.useEffect(()=>{let h=!0;return X2(n)&&V2().then(()=>{h&&f(m=>m+1)}).catch(()=>{}),()=>{h=!1}},[n]),y.useEffect(()=>{c&&o?.()},[c,o]),l.jsx("div",{className:a,onClick:h=>{const m=h.target.closest("a.knowledge-citation"),p=m&&Zb(m.getAttribute("href")??"");if(p){h.preventDefault(),h.stopPropagation(),W2(p.entryId,p.chunk);return}const g=h.target.closest(".code-copy");if(!g)return;h.stopPropagation();const v=g.closest(".code-block")?.querySelector("code")?.textContent??"";ph(v.endsWith(`
|
|
175
|
+
`)?v.slice(0,-1):v).then(b=>{if(!b){Ga("复制失败:浏览器不允许写入剪贴板");return}g.innerHTML=pc("check",15),g.setAttribute("aria-label","已复制"),window.setTimeout(()=>{g.innerHTML=pc("copy",15),g.setAttribute("aria-label","复制代码")},1500)})},dangerouslySetInnerHTML:{__html:Q2(n)+(r?'<span class="cur"></span>':"")}})}const eT={".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".webp":"image",".avif":"image",".bmp":"image",".ico":"image",".svg":"svg",".pdf":"pdf",".mp3":"audio",".wav":"audio",".ogg":"audio",".m4a":"audio",".flac":"audio",".aac":"audio",".mp4":"video",".webm":"video",".mov":"video",".m4v":"video",".md":"markdown",".markdown":"markdown",".json":"json",".jsonl":"json",".ndjson":"json",".csv":"csv",".tsv":"csv",".html":"html",".htm":"html",".xml":"xml",".ts":"code",".tsx":"code",".js":"code",".jsx":"code",".mjs":"code",".cjs":"code",".py":"code",".sh":"code",".bash":"code",".zsh":"code",".go":"code",".rs":"code",".java":"code",".kt":"code",".swift":"code",".c":"code",".h":"code",".cc":"code",".cpp":"code",".hpp":"code",".cs":"code",".rb":"code",".php":"code",".scala":"code",".lua":"code",".pl":"code",".css":"code",".scss":"code",".less":"code",".vue":"code",".svelte":"code",".yaml":"code",".yml":"code",".toml":"code",".ini":"code",".conf":"code",".cfg":"code",".properties":"code",".sql":"code",".graphql":"code",".proto":"code",".diff":"code",".patch":"code",".log":"text",".txt":"text",".text":"text"};function tT(n){const a=n.lastIndexOf(".");return a>0?n.slice(a).toLowerCase():""}function nT(n){return eT[tT(n)]}function sT(n,a){return Array.from({length:a},(r,o)=>{const c=Math.floor(o*n.length/a),f=Math.floor((o+1)*n.length/a);let h=0;for(let m=c;m<f;m++)h=Math.max(h,Math.abs(n[m]));return h})}let Aa=null;function lT({path:n,name:a,fallback:r,itemId:o}){const c=y.useRef(null),[f,h]=y.useState(null),[m,p]=y.useState(0),[g,v]=y.useState(0),[b,j]=y.useState(!0),[E,S]=y.useState(1);y.useEffect(()=>{const A=new AbortController;let $;return(async()=>{try{const D=await fetch(Lt(n),{signal:A.signal});if(!D.ok||Number(D.headers.get("content-length"))>20*1024*1024)return;const V=D.body?.getReader();if(!V)return;const N=[];let k=0;for(;;){const{done:J,value:te}=await V.read();if(J)break;if(k+=te.byteLength,k>20*1024*1024){await V.cancel();return}N.push(te)}const C=new Uint8Array(k);let M=0;for(const J of N)C.set(J,M),M+=J.byteLength;$=new AudioContext;const L=await $.decodeAudioData(C.buffer);A.signal.aborted||h(sT(L.getChannelData(0),50))}catch{}finally{$&&$.close()}})(),()=>{A.abort(),Aa===c.current&&(Aa=null)}},[n]);const T=g?Math.min(1,m/g):0,z=A=>`${Math.floor(A/60)}:${String(Math.floor(A%60)).padStart(2,"0")}`;return l.jsxs("div",{className:"media-audio","data-item-id":o,children:[l.jsx("audio",{ref:c,src:Lt(n),preload:"metadata",onError:r,onPlay:A=>{Aa&&Aa!==A.currentTarget&&Aa.pause(),Aa=A.currentTarget,j(!1)},onPause:()=>j(!0),onTimeUpdate:A=>p(A.currentTarget.currentTime),onLoadedMetadata:A=>v(A.currentTarget.duration)}),l.jsx("button",{className:"audio-play","aria-label":b?"播放":"暂停",onClick:()=>{const A=c.current;A&&(A.paused?A.play().catch(r):A.pause())},children:l.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",fill:"currentColor",children:b?l.jsx("path",{d:"M8.5 5.8v12.4a1 1 0 0 0 1.5.86l10-6.2a1 1 0 0 0 0-1.72l-10-6.2a1 1 0 0 0-1.5.86Z"}):l.jsx("path",{d:"M7 5h3.5v14H7zM13.5 5H17v14h-3.5z"})})}),l.jsxs("div",{className:"audio-main",children:[l.jsx("button",{className:"audio-name",onClick:()=>Ct(n,a),children:a}),l.jsxs("div",{className:"audio-track",children:[f?l.jsx("div",{className:"audio-bars","aria-hidden":"true",children:f.map((A,$)=>l.jsx("i",{className:$/f.length<T?"played":"",style:{height:`${Math.max(12,A*100)}%`}},$))}):l.jsx("div",{className:"audio-line",children:l.jsx("i",{style:{width:`${T*100}%`}})}),l.jsx("input",{type:"range","aria-label":"播放进度",min:0,max:g||0,step:"0.01",value:Math.min(m,g||0),onChange:A=>{c.current&&(c.current.currentTime=Number(A.target.value))}})]})]}),l.jsx("span",{className:"audio-time",children:z(g||0)}),l.jsxs("button",{className:"audio-rate",onClick:()=>{const A=E===1?1.5:E===1.5?2:1;S(A),c.current&&(c.current.playbackRate=A)},children:[E,"×"]})]})}function ub({path:n,name:a,fallback:r,itemId:o}){const[c,f]=y.useState(!1);if(c)return r;const h=nT(n);return h==="audio"?l.jsx(lT,{path:n,name:a,fallback:()=>f(!0),itemId:o}):h==="video"?l.jsxs("div",{className:"media-video","data-item-id":o,children:[l.jsx("video",{controls:!0,playsInline:!0,preload:"metadata",src:Lt(n),onError:()=>f(!0)}),l.jsx("button",{onClick:()=>Ct(n,a),children:a})]}):r}const Ma=13,aT=2.7,db=700;function iT(n){const a=/^(\d{2,5})x(\d{2,5})$/.exec(n??""),r=a?Number(a[1])/Number(a[2]):1;return Math.min(16/9,Math.max(9/16,r))}function rT(n){return Math.min(.96,1-Math.exp(-n/30))}function oT(n){return n<.2?"正在构思":n<.55?"正在勾勒草图":n<.85?"正在上色":"正在润色细节"}function cT(){return[[.22,.6,.3],[.18,.5,.7]].map(([n,a,r])=>{const o=.3+Math.random()*.4;return{x:r,y:o,tx:r,ty:o,next:0,r:n,gain:a}})}function uT(n,a){for(let r=0;r<6;r++)if(n.tx=.2+Math.random()*.6,n.ty=.2+Math.random()*.6,Math.hypot(n.tx-a.tx,n.ty-a.ty)>.35)return}const wf=[3500,7500];function dT(n,a,r,o){const c=(a-n.at)/n.dur;if(c<0||c>=1)return 0;const f=Math.hypot(r,o);if(n.kind==="ring"){const h=f-c*.85;return .75*(1-c)*Math.exp(-(h*h)/.008)}return .7*Math.sin(Math.PI*c)*Math.exp(-(f*f)/.03)}function fT({status:n,prompt:a,size:r,path:o,error:c,startedAt:f,fresh:h,itemId:m}){const p=y.useRef(null),[g,v]=y.useState(n==="done"?"shown":"live"),[b,j]=y.useState(()=>Date.now()),E=Date.parse(f)||Date.now(),S=y.useRef(g);S.current=g,y.useEffect(()=>{if(n!=="pending")return;const A=setInterval(()=>j(Date.now()),1e3);return()=>clearInterval(A)},[n]),y.useEffect(()=>{if(g!=="reveal")return;const A=setTimeout(()=>v("shown"),db+200);return()=>clearTimeout(A)},[g]),y.useEffect(()=>{const A=p.current;if(!A||g==="shown")return;const $=A.getContext("2d");if(!$)return;const D=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let V=0,N=!0,k=0,C=[];const M=cT();let L=[],J=0,te=0;const ke=new IntersectionObserver(([Ne])=>{N=Ne.isIntersecting,N&&!V&&(V=requestAnimationFrame(me))});ke.observe(A);function me(Ne){V=0;const _e=Math.min(2,window.devicePixelRatio||1),{width:le,height:ve}=A.getBoundingClientRect();(A.width!==Math.round(le*_e)||A.height!==Math.round(ve*_e))&&(A.width=Math.round(le*_e),A.height=Math.round(ve*_e)),$.setTransform(_e,0,0,_e,0,0),$.clearRect(0,0,le,ve);const pe=Math.max(1,Math.floor(le/Ma)),Oe=Math.max(1,Math.floor(ve/Ma)),Ae=(le-(pe-1)*Ma)/2,bt=(ve-(Oe-1)*Ma)/2;C.length!==pe*Oe&&(C=Array.from({length:pe*Oe},()=>Math.random()));const Ot=document.documentElement.classList.contains("dark");S.current==="reveal"&&!k&&(k=Ne);const Et=k?Math.min(1,(Ne-k)/db):0,R=n==="pending"&&!D,F=te?Math.min(.1,(Ne-te)/1e3):0;if(te=Ne,R){if(J||(J=Ne+1200+Math.random()*1500),Ne>J){const ie=Math.random()<.5;L.push({kind:ie?"ring":"swell",x:.2+Math.random()*.6,y:.2+Math.random()*.6,at:Ne,dur:ie?2600:1800}),J=Ne+wf[0]+Math.random()*(wf[1]-wf[0])}L=L.filter(ie=>Ne-ie.at<ie.dur);for(const[ie,ae]of M.entries()){Ne>ae.next&&(uT(ae,M[1-ie]),ae.next=Ne+3e3+Math.random()*2500);const ce=1-Math.exp(-F*.7);ae.x+=(ae.tx-ae.x)*ce,ae.y+=(ae.ty-ae.y)*ce}}$.fillStyle=Ot?"rgb(232,232,230)":"rgb(38,38,36)";const ee=le/ve,oe=Ne/1e3;for(let ie=0;ie<Oe;ie++)for(let ae=0;ae<pe;ae++){const ce=C[ie*pe+ae],xe=pe>1?ae/(pe-1):.5,st=Oe>1?ie/(Oe-1):.5,Cn=Math.min(1,Math.min(xe,1-xe,st,1-st)/.3);let Hn=.12;if(n!=="failed"){for(const _t of M){const En=(xe-_t.x)*ee,Ws=st-_t.y;Hn+=_t.gain*Math.exp(-(En*En+Ws*Ws)/(_t.r*_t.r))}for(const _t of L)Hn+=dT(_t,Ne,(xe-_t.x)*ee,st-_t.y)}const un=R?Math.sin(oe*1.3+ce*6.28)*.03:0,ot=Math.min(1,Math.max(0,.08+.92*(.35+.65*Cn)*Math.min(1,Hn)+un)),Ge=Math.min(1,Math.max(0,(Et-ce*.6)/.4)),Zt=(.45+(aT-.45)*ot)*(1-Ge);Zt<.3||($.globalAlpha=(.16+.84*ot)*(1-Ge),$.beginPath(),$.arc(Ae+ae*Ma,bt+ie*Ma,Zt,0,Math.PI*2),$.fill())}$.globalAlpha=1,(S.current==="reveal"?Et<1:R)&&N&&(V=requestAnimationFrame(me))}return V=requestAnimationFrame(me),()=>{cancelAnimationFrame(V),ke.disconnect()}},[g,n,E]);const T=Math.max(0,Math.floor((b-E)/1e3)),z=rT(T);return l.jsxs("div",{className:`igen ${g}${n==="failed"?" failed":""}${h?" enter":""}`,"data-item-id":m,children:[g==="live"&&n!=="failed"?l.jsx("div",{className:"igen-stage",role:"status",title:a,children:oT(z)}):null,l.jsxs("div",{className:"igen-frame",style:{aspectRatio:String(iT(r))},children:[o?l.jsx("button",{className:"igen-img",onClick:()=>Ct(o),title:a,tabIndex:g==="live"?-1:0,children:l.jsx("img",{src:Dl(o),alt:a,onLoad:()=>{S.current==="live"&&v("reveal")}})}):null,g==="shown"?null:l.jsx("canvas",{ref:p,"aria-hidden":"true"}),g==="live"&&n==="pending"?l.jsxs("span",{className:"igen-pct",children:[Math.floor(z*100),"%"]}):null]}),n==="failed"&&g==="live"?l.jsxs("div",{className:"igen-cap",role:"status",title:a,children:[l.jsx("span",{children:"没有生成出来"}),l.jsx("span",{className:"igen-note",children:c||"图片生成失败。"})]}):null]})}const hT=50,mT=110;function pT({photos:n,onOpen:a}){const[r,o]=y.useState(0),[c,f]=y.useState(0),h=y.useRef(null),m=n.length,p=Math.min(1,Math.abs(c)/mT),g=v=>{const b=h.current;h.current=null,b&&(b.moved?Math.abs(c)>hT&&o((r+1)%m):v&&a(n[r]),f(0))};return l.jsx("div",{className:`album-stack${c?" dragging":""}`,role:"group","aria-label":`${m} 张图片,左右滑动切换,点一下查看`,onPointerDown:v=>{h.current={id:v.pointerId,x:v.clientX,moved:!1},v.currentTarget.setPointerCapture(v.pointerId)},onPointerMove:v=>{const b=h.current;if(!b||b.id!==v.pointerId)return;const j=v.clientX-b.x;!b.moved&&Math.abs(j)<6||(b.moved=!0,f(j))},onPointerUp:()=>g(!0),onPointerCancel:()=>g(!1),children:n.map((v,b)=>{const j=(b-r+m)%m;if(j>2)return null;const S={"--d":j===0?0:j-p,"--dx":j===0?`${c}px`:"0px","--rot":j===0?`${c*.06}deg`:"0deg",zIndex:m-j};return l.jsx("img",{src:Dl(v),alt:"",draggable:!1,style:S},v)})})}const G0=["日","一","二","三","四","五","六"];function Xi(n){return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function Th(n,a){const r=new Date(n),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime();return Math.round((o-c)/864e5)}function on(n,a=new Date){const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const o=Th(n,a);return o===0?`今天 ${Xi(r)}`:o===1?`昨天 ${Xi(r)}`:o===-1?`明天 ${Xi(r)}`:`${r.getMonth()+1}月${r.getDate()}日 ${Xi(r)}`}function ic(n,a=new Date){if(!n)return"";const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const o=Th(n,a);return o===0?Xi(r):o===1?"昨天":`${r.getMonth()+1}月${r.getDate()}日`}function mr(n,a=Date.now()){const r=Math.max(0,Math.round((a-new Date(n).getTime())/6e4));if(r<1)return"刚刚";if(r<60)return`${r} 分钟`;const o=Math.floor(r/60),c=r%60;return c?`${o} 小时 ${c} 分钟`:`${o} 小时`}function Ll(n){const a=Math.max(0,Math.round(n/1e3));if(a<60)return`${a} 秒`;const r=Math.floor(a/60);if(r<60){const o=a%60;return o?`${r} 分 ${o} 秒`:`${r} 分钟`}return`${Math.floor(r/60)} 小时 ${r%60} 分钟`}function Gf(n){if(n<1e3)return String(n);const a=n/1e3;return`${a<10?a.toFixed(1):Math.round(a)}k`}function gT(n){return[n.durationMs!==void 0?Ll(n.durationMs):void 0,n.tools!==void 0?`${n.tools} 次操作`:void 0,n.tokens!==void 0?`${Gf(n.tokens)} token`:void 0].filter(Boolean).join(" · ")}function Va(n){return n<1024?`${n} B`:n<1024*1024?`${n<10240?(n/1024).toFixed(1):Math.round(n/1024)} KB`:n<1024*1024*1024?`${(n/1024/1024).toFixed(1)} MB`:`${(n/1024/1024/1024).toFixed(1)} GB`}function vT(n,a=new Date){return Th(n,a)===0}function xT(n,a){return n?new Date(a).getTime()-new Date(n).getTime()>300*1e3:!1}function Ch(n){const a={kind:"raw",hour:9,minute:0,weekday:5,day:1,raw:n},r=n.trim().split(/\s+/);if(r.length!==5)return a;const[o,c,f,h,m]=r;if(!/^\d+$/.test(o)||!/^\d+$/.test(c)||h!=="*")return a;const p=Number(o),g=Number(c);return p>59||g>23?a:f==="*"&&m==="*"?{...a,kind:"daily",hour:g,minute:p}:f==="*"&&/^\d$/.test(m)?{...a,kind:"weekly",hour:g,minute:p,weekday:Number(m)}:/^\d{1,2}$/.test(f)&&m==="*"?{...a,kind:"monthly",hour:g,minute:p,day:Number(f)}:a}function bT(n){const a=String(n.minute).padStart(2,"0"),r=String(n.hour).padStart(2,"0");return n.kind==="daily"?`${n.minute} ${n.hour} * * *`:n.kind==="weekly"?`${n.minute} ${n.hour} * * ${n.weekday}`:n.kind==="monthly"?`${n.minute} ${n.hour} ${n.day} * *`:n.raw.trim()||`${a} ${r} * * *`}function Eh(n){const a=Ch(n),r=`${String(a.hour).padStart(2,"0")}:${String(a.minute).padStart(2,"0")}`;return a.kind==="daily"?`每天 ${r}`:a.kind==="weekly"?`每周${G0[a.weekday]??"?"} ${r}`:a.kind==="monthly"?`每月${a.day}日 ${r}`:n}function yT(n,a,r){const o=a-n.x,c=r-n.y;let f=n.direction;return f==="pending"&&Math.hypot(o,c)>8&&(o<-8&&Math.abs(o)>Math.abs(c)*1.5?f="horizontal":(Math.abs(c)>Math.abs(o)||o>8)&&(f="vertical")),{...n,direction:f,distance:f==="horizontal"?Math.max(0,-o):0}}function fb(n){return n.direction==="horizontal"&&n.distance>48}function kT(n,a){return{top:n.bottom+8+92<=a.bottom?n.bottom+8:Math.max(a.top+8,n.top-92-8),left:Math.max(a.left+8,Math.min(n.right-160,a.right-168))}}function jT(n,a){return a.type==="open"?a.id:a.type==="outside"&&a.inside?n:null}const Pn={queued:{text:"排队中",icon:"clock",color:"",spin:!1},running:{text:"进行中",icon:"spin",color:"live",spin:!0},waiting:{text:"等助手回复",icon:"pause",color:"",spin:!1},done:{text:"已完成",icon:"check",color:"ok",spin:!1},stuck:{text:"受阻",icon:"close",color:"bad",spin:!1},failed:{text:"失败",icon:"close",color:"bad",spin:!1},stopped:{text:"已停止",icon:"stop",color:"",spin:!1}},K0={running:{text:"进行中",icon:"spin",color:"live",spin:!0},waiting:{text:"等你确认",icon:"pause",color:"",spin:!1},done:{text:"已完成",icon:"check",color:"ok",spin:!1},stuck:{text:"受阻",icon:"close",color:"bad",spin:!1},interrupted:{text:"已中断",icon:"close",color:"bad",spin:!1},returned:{text:"已退回",icon:"close",color:"bad",spin:!1},takenOver:{text:"已被你接手",icon:"user",color:"",spin:!1}};function Ah(n,a,r){const o=Pn[n];return l.jsx(X,{name:o.icon,size:a,w:r,className:o.spin?"spin":""})}function ks({meta:n,card:a=!1,animated:r=!1,swapped:o=!1,children:c}){const f=a?`st${n.color==="ok"?" done":n.color==="bad"?" bad":""}`:`jt-st${n.color?` ${n.color}`:""}`;return l.jsxs("span",{className:f,children:[r?l.jsxs("span",{className:"stico",children:[l.jsx(X,{name:"spin",size:14,w:2,className:`spin stspin${n.spin?"":" off"}`}),n.spin?null:l.jsx(X,{name:n.icon,size:14,w:2,className:`stic${n.color==="ok"?" pop":""}${o?" anim":""}`})]}):l.jsx(X,{name:n.icon,size:a?14:13,className:n.spin?"spin":""}),n.text,c]})}const wT={memory:"mem",skill:"bulb",rule:"rule",routine:"clock",split:"split",info:"info"};function NT(){const[n,a]=y.useState(()=>window.matchMedia("(hover: none)").matches);return y.useEffect(()=>{const r=window.matchMedia("(hover: none)"),o=()=>a(r.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),n}function Kf({text:n,itemId:a,menu:r=!1,close:o}){const[c,f]=y.useState(!1),h=y.useRef(0);y.useEffect(()=>()=>window.clearTimeout(h.current),[]);const m=async()=>{if(!await ph(n)){Ga("复制失败:浏览器不允许写入剪贴板");return}if(r){o?.();return}f(!0),window.clearTimeout(h.current),h.current=window.setTimeout(()=>f(!1),1500)};return l.jsxs("div",{className:`tools${r?" menu":""}`,children:[l.jsxs("button",{title:"回复","aria-label":"回复",onClick:()=>{dc({itemId:a,text:La(n).slice(0,60)}),tr(),o?.()},children:[l.jsx(X,{name:"reply",size:16}),r?"回复":null]}),l.jsxs("button",{className:c?"copied":"",title:c?"已复制":"复制","aria-label":c?"已复制":"复制",onClick:()=>void m(),children:[l.jsx(X,{name:c?"check":"copy",size:16}),r?"复制":null]})]})}function hb({anchor:n,text:a,itemId:r,close:o}){const[c,f]=y.useState(null),h=y.useRef(null);if(y.useLayoutEffect(()=>{const v=n.current,b=v?.closest(".mmsgs, .msgs");v&&b&&f({bubble:v.getBoundingClientRect(),area:b.getBoundingClientRect()})},[n]),y.useLayoutEffect(()=>{!c||!h.current||!n.current||h.current.replaceChildren(n.current.cloneNode(!0))},[n,c]),!c)return null;const{bubble:m,area:p}=c,g=kT(m,p);return cr.createPortal(l.jsxs("div",{className:"message-popup",onPointerDown:v=>v.stopPropagation(),children:[l.jsx("div",{className:"message-shade",style:{left:p.left,top:p.top,width:p.width,height:p.height},onPointerDown:o}),l.jsx("div",{ref:h,className:"message-popup-bubble",style:{left:m.left,top:m.top,width:m.width}}),l.jsx("div",{className:"message-popup-menu",style:g,children:l.jsx(Kf,{text:a,itemId:r,menu:!0,close:o})})]}),document.body)}function ST(n,a){const o=[...n.currentTarget.closest(".col")?.querySelectorAll(".message-row[data-item-id]")??[]].find(c=>c.dataset.itemId===a);o&&Xb(o)}function mb(n){const a=n.durationMs??(n.startedAt&&n.endedAt?Date.parse(n.endedAt)-Date.parse(n.startedAt):void 0);return a===void 0?void 0:Ll(a)}function TT({job:n,round:a,fresh:r,itemId:o}){const c=je(),f=Mw(n,a),h=f!==n,[m,p]=y.useState(!1),[g,v]=y.useState(""),[b,j]=y.useState(!1),E=wn(m,200),S=f.status==="running",T=!h&&(S||f.status==="waiting"),z=f.status==="stuck"||f.status==="failed",A=nh(f),$=c.assistants.find(V=>V.id===f.assistantId),D=y.useRef(f.status);return y.useEffect(()=>{if(D.current===f.status)return;D.current=f.status,j(!0);const V=window.setTimeout(()=>j(!1),400);return()=>window.clearTimeout(V)},[f.status]),l.jsx("div",{className:`hov${r?" enter":""}`,id:h?void 0:`job-${f.id}`,"data-item-id":o,children:l.jsxs("div",{className:"b jobcard",role:"button",tabIndex:0,onClick:()=>Un(f.id,a??0),onKeyDown:V=>{V.key==="Enter"&&Un(f.id,a??0)},children:[l.jsxs("div",{className:"tt",children:[$?l.jsx("span",{className:"jav",children:l.jsx(rt,{sprite:$.sprite,prop:$.prop,size:40})}):null,l.jsxs("span",{className:"jt",children:[f.routineId?l.jsx(X,{name:"clock",size:14}):null,f.title]}),l.jsx(ks,{meta:Pn[f.status],card:!0,animated:!0,swapped:b,children:S?` · ${mr(f.startedAt??f.createdAt)}`:mb(f)?` · 用时 ${mb(f)}`:null})]}),A?l.jsx("div",{className:`meta${z?" bad":""}`,children:A}):null,T||S?l.jsxs("div",{className:"acts",children:[T?l.jsxs("button",{className:`hob-btn job-reply${m?" selected":""}`,"aria-pressed":m,onClick:V=>{V.stopPropagation(),p(N=>!N)},children:[l.jsx(X,{name:"edit",size:14}),"补充要求"]}):null,S?l.jsxs("button",{className:"hob-btn hob-btn-danger job-stop",onClick:V=>{V.stopPropagation(),p0(f.id)},children:[l.jsx(X,{name:"stop",size:14}),"停止"]}):null]}):null,E.mounted?l.jsx("div",{className:`replywrap${E.leaving?" leaving":""}`,onClick:V=>V.stopPropagation(),children:l.jsx("div",{className:"replyclip",children:l.jsxs("div",{className:"replybox",children:[l.jsx("input",{autoFocus:!0,value:g,placeholder:"补充说明或更正方向",onChange:V=>v(V.target.value),onKeyDown:V=>{V.key==="Enter"&&g.trim()&&($f(f.id,g.trim()),v(""),p(!1)),V.key==="Escape"&&p(!1)}}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{g.trim()&&$f(f.id,g.trim()),v(""),p(!1)},children:"发送"})]})})}):null]})})}function pb({draft:n}){const a=je(),r=n.status==="created"&&n.createdAssistantId,o=r?a.assistants.find(h=>h.id===n.createdAssistantId):void 0,c=o?.prop??n.prop,f=!!r&&!o;return l.jsxs("div",{className:"draft",children:[l.jsxs("div",{className:"top",children:[l.jsx(rt,{sprite:o?.sprite??n.sprite,prop:c,size:46}),l.jsxs("div",{children:[l.jsx("div",{className:"dn",children:n.name}),l.jsx("div",{className:"ds",children:n.status==="created"?"新助手 · 已创建":"新助手 · 草稿"})]})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"职责"}),l.jsx("span",{children:n.dutyLong})]}),l.jsx("div",{className:`expand${r?"":" open"}`,inert:!!r,children:l.jsxs("div",{children:[l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"定时任务"}),l.jsx("span",{className:n.routinesText?void 0:"none",children:n.routinesText||"没有"})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"执行前确认"}),l.jsx("span",{className:n.askFirst.length?void 0:"none",children:n.askFirst.join(" · ")||"没有"})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"补充说明"}),n.instructions.length?l.jsx("span",{children:n.instructions.map((h,m)=>l.jsx("span",{className:"line",children:h},m))}):l.jsx("span",{className:"none",children:"没有"})]}),l.jsxs("div",{className:"kv",children:[l.jsx("span",{className:"k",children:"迁移"}),l.jsxs("span",{children:[n.carry.conversations," 段对话"]})]})]})}),l.jsxs("div",{className:"acts swap",style:{marginTop:12},children:[l.jsxs("div",{className:r?"off":void 0,children:[l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void qN(n.id),children:"创建"}),l.jsx("button",{className:"hob-btn",onClick:()=>{ch("请修改草稿:"),tr()},children:"修改草稿"})]}),l.jsx("div",{className:r?void 0:"off",children:l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:f,onClick:()=>void Vt(n.createdAssistantId),children:f?"已归档":"已创建 · 查看"})})]})]})}function CT({delegation:n,fresh:a}){const r=je(),[o,c]=y.useState(!1),f=y.useRef(n.status),h=f.current!==n.status;y.useEffect(()=>{f.current=n.status},[n.status]);const m=r.assistants.find(v=>v.id===n.to),p=m?.name??n.to,g=Object.values(r.approvals).filter(v=>v.status==="pending"&&((n.approvalIds??[]).includes(v.id)||!!(v.jobId&&n.jobIds.includes(v.jobId))));return l.jsx("div",{className:`hov${a?" enter":""}`,id:`delegation-${n.id}`,children:l.jsxs("div",{className:"b jobcard delegation-card",children:[l.jsxs("div",{className:"tt",children:[m?l.jsx("span",{className:"jav",children:l.jsx(rt,{sprite:m.sprite,prop:m.prop,size:40})}):null,l.jsxs("span",{className:"jt",children:["交给「",p,"」"]}),l.jsx("span",{className:h?"status-fade":void 0,children:l.jsx(ks,{meta:K0[n.status],card:!0})},n.status)]}),l.jsx("button",{className:`delegation-text${o?" expanded":""}`,onClick:()=>c(!o),title:o?"收起":"查看全文",children:n.text}),n.status==="returned"&&n.reply?l.jsx("div",{className:"note",children:n.reply}):null,n.jobIds.map(v=>{const b=r.jobs[v];return b?l.jsxs("button",{className:`delegation-job ${b.status}`,onClick:()=>Un(v),title:Pn[b.status].text,children:[Ah(b.status,14,2),l.jsx("span",{children:b.title}),l.jsx(X,{name:"chev",size:14,className:"go"})]},v):null}),g.map(v=>l.jsx(V0,{approval:v,fresh:!1},v.id)),l.jsxs("div",{className:"delegation-actions",children:[l.jsxs("button",{onClick:()=>void uh(n.to,n.id,!0),children:["去「",p,"」看看 →"]}),n.status==="interrupted"?l.jsx("button",{onClick:()=>void YN(n.id),children:"重新转交"}):null]})]})})}function V0({approval:n,fresh:a}){const r=y.useRef(n.status),o=r.current!==n.status;y.useEffect(()=>{r.current=n.status},[n.status]);const c=n.options.find(T=>T.key===n.chosen),f=n.status==="answered"&&c?n.chosen:void 0,[h,m]=y.useState(null),[p,g]=y.useState(""),v=h??f,b=h!==null,j=n.status==="answered"?n.answerText:void 0,E=p.trim(),S=()=>{E&&Hx(n.id,{text:E})};return l.jsxs("div",{className:`b q${a?" enter":""}`,children:[l.jsx("div",{className:"qt",children:n.title}),n.detail?l.jsx("div",{className:"qs",children:n.detail}):null,l.jsxs("div",{className:"opts",children:[n.status==="expired"?l.jsx("div",{className:`opt${o?" status-fade":""}`,children:"已结束"}):j?l.jsxs("div",{className:"opt chosen",children:[l.jsx("span",{className:"key",children:l.jsx(X,{name:"user",size:12})}),j,l.jsx("span",{className:`ck${o?" check-enter":""}`,children:l.jsx(X,{name:"check",size:16})})]}):v&&!b?l.jsxs("div",{className:"opt chosen",children:[l.jsx("span",{className:"key",children:v}),n.options.find(T=>T.key===v)?.label,l.jsx("span",{className:"ck",children:l.jsx(X,{name:"check",size:16})})]}):n.options.map(T=>{const z=T.key===v;return l.jsx("div",{className:`optrow${b&&!z?" away":""}`,children:l.jsx("div",{className:"optclip",children:l.jsxs("button",{className:`opt${z?" chosen":""}`,disabled:b,onClick:()=>{m(T.key),Hx(n.id,{key:T.key})},children:[l.jsx("span",{className:"key",children:T.key}),T.label,z&&b?l.jsx("span",{className:"ck",children:l.jsx(X,{name:"check",size:16})}):null]})})},T.key)}),n.status==="expired"||j||b||v?null:l.jsxs("div",{className:"other",children:[l.jsx("input",{value:p,placeholder:"其他想法…",onChange:T=>g(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.nativeEvent.isComposing&&S()}}),E?l.jsx("button",{className:"hob-icon-btn other-send",title:"发送",onClick:S,children:l.jsx(X,{name:"send",size:16})}):null]})]})]})}function ET({name:n,path:a,meta:r,fresh:o,itemId:c}){return l.jsxs("button",{className:`att filecard${o?" enter":""}`,"data-item-id":c,onClick:()=>Ct(a,n),children:[l.jsx("span",{className:"ico",children:l.jsx(X,{name:$l(a),size:18})}),l.jsxs("span",{children:[l.jsx("span",{className:"n",style:{display:"block"},children:n}),r?l.jsx("span",{className:"m",children:r}):null]})]})}function AT({name:n,path:a,fresh:r,itemId:o}){return l.jsx("button",{className:`imgcard${r?" enter":""}`,"data-item-id":o,onClick:()=>Ct(a),title:n,children:l.jsx("img",{src:Dl(a),alt:n,loading:"lazy"})})}function MT(n){const a=y.useRef(null);return y.useLayoutEffect(()=>{const r=a.current;if(!r||(r.style.maxWidth="",n===void 0))return;let o=!0;const c=()=>{if(!o)return;r.style.maxWidth="";const f=r.getBoundingClientRect();if(!f.width)return;let h=0;const m=document.createRange(),p=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let v=p.nextNode();v;v=p.nextNode()){let b;if(v instanceof Element){if(getComputedStyle(v).display!=="inline")continue;b=v.getClientRects()}else m.selectNodeContents(v),b=m.getClientRects();for(const j of b)h=Math.max(h,j.right)}if(!h)return;const g=Math.ceil(h-f.left+parseFloat(getComputedStyle(r).paddingRight));g>=f.width-1||(r.style.maxWidth=`${g}px`,r.getBoundingClientRect().height>f.height+.5&&(r.style.maxWidth=""))};return c(),document.fonts.ready.then(c),()=>{o=!1}},[n]),a}function zT({item:n,inlineDraft:a,fresh:r,tools:o}){const c=je(),f=r?" enter":"",[h,m]=y.useState(!1),p=MT(n.kind==="user"&&!n.files?.length?n.text:void 0),g=o.touch?E=>E.preventDefault():void 0,v=o.distance?{transform:`translateX(-${Math.min(64,o.distance*.8)}px)`,transition:"none"}:void 0,b=Math.min(1,o.distance/48),j=o.distance>0?l.jsx("span",{className:`swipe-reply${o.ready?" ready":""}`,style:{opacity:b,transform:`scale(${b})`},children:l.jsx("span",{className:"swipe-reply-inner",children:l.jsx(X,{name:"reply",size:18})})}):null;if(n.kind==="user"){const E=n.files?.filter(Ji)??[],S=n.files?.filter(k=>!Ji(k))??[],T=E.length===1,z=E.length>1,A=!!(n.from||n.quote||n.text||S.length),$=HN(c,c.sel,n.id),D=k=>{k.startsWith("pending/")||Ct(k,Ii(k))},V=(k,C)=>l.jsx("button",{className:C,onClick:()=>D(k),title:Ii(k),children:l.jsx("img",{src:Dl(k),alt:Ii(k),loading:"lazy"})},k),N=k=>l.jsxs("button",{className:"ufile",onClick:()=>D(k),children:[l.jsx("span",{className:"fi",children:l.jsx(X,{name:$l(k),size:16})}),l.jsx("span",{className:"fn",children:Ii(k)})]});return l.jsxs("div",{className:"message-row right",id:n.from?`forward-${n.from.delegationId}`:void 0,"data-item-id":n.id,onPointerDown:o.start,onContextMenu:g,children:[j,$?.status==="failed"?l.jsx("button",{className:"send-failed",title:"重试","aria-label":"未送达,重试",onClick:()=>Lx($.assistantId,$.localId),children:"!"}):$&&n.files?.length?l.jsx("span",{className:"send-progress","aria-label":"正在发送",children:l.jsx(X,{name:"spin",size:16,w:2.2,className:"spin"})}):null,l.jsxs("div",{className:`hov right msg${r?" enter-right":""}${$?" pending":""}`,children:[z?l.jsxs("div",{className:`u-album${h?" open":""}`,ref:A?void 0:p,style:A?void 0:v,children:[l.jsx("button",{className:"album-pill",onClick:()=>m(!h),children:h?"收起":`展开 ${E.length}`}),h?l.jsx("div",{className:"album-list",children:E.map(k=>V(k,"u-photo album-item"))}):l.jsx(pT,{photos:E,onOpen:D})]}):null,T?l.jsx("div",{className:"u-solo",ref:A?void 0:p,style:A?void 0:v,children:V(E[0],"u-photo album-item")}):null,A?l.jsxs("div",{className:"u",ref:p,style:v,children:[n.from?l.jsxs("button",{className:"forward-label",onClick:()=>void(n.from.assistantId==="hob"?uh(n.from.assistantId,n.from.delegationId,!1):Bx(n.from.assistantId,n.from.delegationId,!1)),children:[(()=>{const k=c.assistants.find(C=>C.id===n.from.assistantId);return k?l.jsx(rt,{sprite:k.sprite,prop:k.prop,size:16}):null})(),"转自 ",n.from.assistantId==="hob"?n.from.name:`「${n.from.name}」`]}):null,n.quote?l.jsx("button",{className:"quote",onClick:k=>ST(k,n.quote.itemId),children:n.quote.text}):null,n.text?l.jsx("span",{className:"u-text",children:n.text}):null,S.map(k=>k.startsWith("pending/")?l.jsx(y.Fragment,{children:N(k)},k):l.jsx(ub,{path:k,name:Ii(k),fallback:N(k)},k))]}):null,$?.status==="failed"?l.jsxs("div",{className:"send-status",children:["未送达",l.jsx("button",{onClick:()=>Lx($.assistantId,$.localId),children:"重试"}),l.jsx("button",{onClick:()=>LN($.assistantId,$.localId),children:"删除"})]}):null,$?null:l.jsx(Kf,{text:n.text,itemId:n.id})]}),o.open?l.jsx(hb,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})}if(n.kind==="assistant")return l.jsxs(l.Fragment,{children:[n.routine?l.jsx("div",{className:`tag${r?" enter-fade":""}`,children:n.routine.jobId?l.jsxs("button",{onClick:()=>Un(n.routine.jobId),children:[l.jsx(X,{name:"clock",size:13}),n.routine.name]}):l.jsxs(l.Fragment,{children:[l.jsx(X,{name:"clock",size:13}),n.routine.name]})}):null,l.jsxs("div",{className:"message-row","data-item-id":n.id,onPointerDown:o.start,onContextMenu:g,children:[j,l.jsxs("div",{className:`hov msg${f}`,children:[J2(n.text).map((E,S,T)=>E.table?l.jsx("div",{className:"tablecard",ref:S===0?p:void 0,style:S===0?v:void 0,children:l.jsx(Ya,{text:E.md})},S):l.jsxs("div",{className:`b${a&&S===T.length-1?" wide":""}`,ref:S===0?p:void 0,style:S===0?v:void 0,children:[l.jsx(Ya,{text:E.md,streaming:n.streaming&&S===T.length-1}),a&&S===T.length-1?l.jsx(pb,{draft:a}):null]},S)),l.jsx(Kf,{text:n.text,itemId:n.id})]}),o.open?l.jsx(hb,{anchor:p,text:n.text,itemId:n.id,close:o.close}):null]})]});if(n.kind==="note")return l.jsxs("div",{className:`sys${r?" enter-fade":""}`,id:n.handbackId?`handback-${n.handbackId}`:void 0,children:[n.icon!=="split"?l.jsx(X,{name:wT[n.icon],size:14}):null,n.handbackId?l.jsx("button",{onClick:()=>void Bx("hob",n.handbackId,!0),children:n.text}):n.icon==="skill"&&n.path?l.jsx("button",{onClick:()=>Ct(n.path),children:n.text}):n.icon==="memory"?l.jsx("span",{className:"sys-memory",title:n.text,children:n.text.replace(/[::,,;;、]+\s*$/u,"")}):n.text]});if(n.kind==="question"){const E=c.approvals[n.approvalId];return E?l.jsx(V0,{approval:E,fresh:r}):null}if(n.kind==="job"){const E=c.jobs[n.jobId];return E?l.jsx(TT,{job:E,round:n.round,fresh:r,itemId:n.id}):null}if(n.kind==="draft"){const E=c.drafts[n.draftId];return E?l.jsx("div",{className:`b wide${f}`,children:l.jsx(pb,{draft:E})}):null}if(n.kind==="delegation"){const E=c.delegations[n.delegationId];return E?l.jsx(CT,{delegation:E,fresh:r}):null}return n.kind==="image"?l.jsx(fT,{...n,fresh:r,itemId:n.id}):Ji(n.path)?l.jsx(AT,{path:n.path,name:n.name,fresh:r,itemId:n.id}):l.jsx(ub,{path:n.path,name:n.name,itemId:n.id,fallback:l.jsx(ET,{path:n.path,name:n.name,meta:n.meta,fresh:r,itemId:n.id})})}function OT(n,a){return n?n.kind==="user"!=(a.kind==="user")||!!a.lead:!1}function X0({items:n}){const a=je(),r=NT(),[o,c]=y.useReducer(jT,null),f=y.useRef(null),[h,m]=y.useState(null);y.useEffect(()=>{const g=()=>{f.current&&window.clearTimeout(f.current.timer),f.current=null,m(null)},v=S=>{c({type:"outside",inside:S.target instanceof Element&&!!S.target.closest(".tools.menu")})},b=S=>{const T=f.current;if(!T||T.pointerId!==S.pointerId)return;if(T.swipe=yT(T.swipe,S.clientX,S.clientY),Math.hypot(S.clientX-T.swipe.x,S.clientY-T.swipe.y)>10&&window.clearTimeout(T.timer),T.swipe.direction==="vertical"){g();return}if(T.swipe.direction!=="horizontal")return;window.clearTimeout(T.timer);const z=fb(T.swipe);if(z&&!T.ready&&navigator.vibrate?.(10),T.ready=z,window.matchMedia("(prefers-reduced-motion: reduce)").matches){z&&(dc({itemId:T.id,text:La(T.text).slice(0,60)}),tr(),g());return}m({id:T.id,distance:T.swipe.distance,ready:z})},j=S=>{const T=f.current;!T||T.pointerId!==S.pointerId||(fb(T.swipe)&&(dc({itemId:T.id,text:La(T.text).slice(0,60)}),tr()),g())},E=()=>{g(),c({type:"close"})};return document.addEventListener("pointerdown",v,!0),document.addEventListener("pointermove",b,!0),document.addEventListener("pointerup",j,!0),document.addEventListener("pointercancel",g,!0),document.addEventListener("scroll",E,!0),()=>{g(),document.removeEventListener("pointerdown",v,!0),document.removeEventListener("pointermove",b,!0),document.removeEventListener("pointerup",j,!0),document.removeEventListener("pointercancel",g,!0),document.removeEventListener("scroll",E,!0)}},[]);const p=[];n.length&&!vT(n[0].at)&&n[0].kind!=="note"&&p.push(l.jsx("div",{className:"div",children:on(n[0].at)},"first-div"));for(let g=0;g<n.length;g++){const v=n[g],b=n[g-1],j=n[g+1],E=Z1(v.id),S=v.kind==="assistant"&&j?.kind==="draft"?a.drafts[j.draftId]:void 0,T={open:r&&o===v.id,touch:r,distance:h?.id===v.id?h.distance:0,ready:h?.id===v.id&&h.ready,close:()=>c({type:"close"}),start:r?z=>{if(z.pointerType!=="touch"||v.kind!=="user"&&v.kind!=="assistant"||z.target.closest("a,button,input,textarea,select,[contenteditable],.draft,.album-stack"))return;f.current&&window.clearTimeout(f.current.timer);const{clientX:A,clientY:$,pointerId:D}=z,V=window.setTimeout(()=>{f.current=null,c({type:"open",id:v.id})},500);f.current={timer:V,pointerId:D,id:v.id,text:v.text,swipe:{x:A,y:$,direction:"pending",distance:0},ready:!1}}:void 0};S&&g++,p.push(l.jsxs(y.Fragment,{children:[xT(b?.at,v.at)?l.jsx("div",{className:`div${E?" enter-fade":""}`,children:on(v.at)}):OT(b,v)?l.jsx("div",{className:"g"}):null,l.jsx(zT,{item:v,inlineDraft:S,fresh:E,tools:T})]},v.id))}for(const g of V1(Object.values(a.livePages),a.sel))p.push(l.jsxs("button",{className:`att filecard${g.state==="failed"?" bad":""}`,onClick:()=>dS(g.callId),children:[l.jsx("span",{className:"ico",children:l.jsx(X,{name:g.state==="writing"?"spin":"close",className:g.state==="writing"?"spin":"",size:18})}),l.jsxs("span",{children:[l.jsx("span",{className:"n",style:{display:"block"},children:g.title||"正在写页面…"}),l.jsx("span",{className:"m",children:g.state==="failed"?`生成失败:${g.error}`:"生成中"})]})]},g.callId));return l.jsx(l.Fragment,{children:p})}function ze({children:n,action:a,large:r=!1}){return l.jsxs("div",{className:`empty${r?" empty-large":""}`,children:[n,a?l.jsxs(l.Fragment,{children:[" · ",l.jsx("button",{onClick:a.onClick,children:a.label})]}):null]})}function Fn({text:n}){const[a,r]=y.useState(!1);return y.useEffect(()=>{const o=setTimeout(()=>r(!0),300);return()=>clearTimeout(o)},[]),a?n:null}function Z0({leaving:n,gap:a,a:r}){return l.jsxs(l.Fragment,{children:[a?l.jsx("div",{className:"g"}):null,l.jsx("div",{className:`hov think${n?" leaving":""}`,children:l.jsxs("div",{className:"activity-line",role:"status",children:[l.jsx(rt,{sprite:r.sprite,prop:r.prop,size:46,free:!0,motion:r.activity?.state==="tool"?"work":"think"}),l.jsx("span",{className:"activity-shimmer",children:r.activity?.label??"正在想…"})]})})]})}function Q0(n,a,r,o,c){const f=y.useRef(!0),h=y.useRef({key:"",len:0});y.useEffect(()=>{const m=n.current;if(!m)return;let p=m.scrollTop;const g=()=>{m.scrollHeight-m.scrollTop-m.clientHeight<80?f.current=!0:m.scrollTop<p-2&&(f.current=!1),p=m.scrollTop},v=new ResizeObserver(()=>{f.current&&(m.scrollTop=m.scrollHeight,p=m.scrollTop)});m.addEventListener("scroll",g,{passive:!0}),v.observe(m);for(const b of Array.from(m.children))v.observe(b);return()=>{m.removeEventListener("scroll",g),v.disconnect()}},[n]),y.useLayoutEffect(()=>{const m=n.current;if(!m)return;const p=h.current;h.current={key:a,len:r,firstId:o},p.key!==a||r<p.len?(f.current=!0,m.scrollTop=m.scrollHeight):r>p.len&&p.firstId===o&&(f.current||c)&&(f.current=!0,m.scrollTo({top:m.scrollHeight,behavior:"smooth"}))},[n,a,r,o,c])}function J0(n,a,r,o){const c=y.useRef(null),f=y.useRef({key:""}),h=()=>{const m=n.current;if(!m)return;const p=m.getBoundingClientRect().top,g=Array.from(m.querySelectorAll("[data-item-id]")).find(v=>v.getBoundingClientRect().bottom>p);c.current=g?{id:g.dataset.itemId,top:g.getBoundingClientRect().top,key:r}:null};return y.useLayoutEffect(()=>{const m=n.current,p=f.current;if(m&&p.key===r&&p.id&&p.id!==o&&c.current?.key===r){const g=Array.from(m.querySelectorAll("[data-item-id]")).find(v=>v.dataset.itemId===c.current?.id);g&&(m.scrollTop+=g.getBoundingClientRect().top-c.current.top)}f.current={key:r,id:o}},[n,r,o]),()=>{const m=n.current;!m||!a||(h(),m.scrollTop<120&&oh(a))}}function P0({id:n}){const a=je().itemPages[n??""];return!a?.hasMore&&!a?.loading&&!a?.error?null:l.jsx("div",{className:"older-messages",role:"status",children:a.error?l.jsxs("button",{onClick:()=>n&&void oh(n,!0),children:["读取失败:",a.error," · 重试"]}):a.loading?l.jsx(Fn,{text:"正在读取更早的消息…"}):null})}function F0(n){return n?.kind==="user"&&!n.from}const _T=["查看这台电脑的磁盘和内存占用","每天早上 9 点给我一份科技新闻简报","把附件里的会议记录整理成要点"];function W0({a:n}){const r=je().settings.settings.models,o=r.roster.length>0&&r.conversation.ref!=="";return l.jsxs("div",{className:"hello",children:[l.jsx(rt,{sprite:n.sprite,prop:n.prop,size:88,free:!0,motion:"home"}),l.jsx("div",{className:"t",children:`我是${ey(n.name,!1)}${n.primary?",你的主助手":""}`}),l.jsx("div",{className:"d",children:n.primary?"交给我的事,我会分派给后台任务执行,完成、受阻或需要你确认时再告诉你;也可以让我定时执行。同类工作多了,我会建议创建专属助手。":`负责${n.duty}。`}),o?n.primary?l.jsx("div",{className:"ex",children:_T.map(c=>l.jsx("button",{className:"hob-btn",onClick:()=>{ch(c),tr()},children:c},c))}):null:l.jsxs("div",{className:"setup",children:[l.jsx("div",{children:"开始使用前,请先添加模型服务商并选择模型。"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{jc(),zl("providers")},children:"前往设置"})]})]})}function ey(n,a=!0){const r=o=>!!(o&&/[A-Za-z0-9]/.test(o));return`${r(n[0])?" ":""}${n}${a&&r(n.at(-1))?" ":""}`}function ty(n,a){return`${n??""}|${a??0}`}function RT(){const n=je(),a=n.assistants.find(g=>g.id===n.sel),r=f0(n,n.sel),o=!!(a&&n.sel&&r.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=y.useRef(null),f=ty(n.sel,n.sel?n.itemGen[n.sel]:0),h=!!a?.busy&&!Kb(r),m=wn(h,180),p=J0(c,n.sel,f,r[0]?.id);return Q0(c,f,r.length,r[0]?.id,F0(r.at(-1))),l.jsxs("main",{className:"chat",children:[l.jsxs("div",{className:"head",children:[a?l.jsx(rt,{sprite:a.sprite,prop:a.prop,size:24}):null,l.jsx("span",{className:"nm",children:a?.name??""}),l.jsx("span",{className:"sp"}),n.collapsed?l.jsx("button",{className:"hob-icon-btn",title:"展开右栏",onClick:iS,children:l.jsx(X,{name:"panel",size:18})}):null]}),l.jsx("div",{className:"msgs",ref:c,onScroll:p,children:l.jsxs("div",{className:`col${o?" mid":""}`,children:[l.jsx(P0,{id:n.sel}),o&&a?l.jsx(W0,{a}):l.jsx(X0,{items:r}),m.mounted&&a?l.jsx(Z0,{a,leaving:m.leaving,gap:r.at(-1)?.kind==="user"}):null]})}),l.jsx(ny,{})]})}function ny({variant:n="desktop"}){const a=je(),r=a.assistants.find(p=>p.id===a.sel),o=y.useRef(null),c=a.text.trim().length>0||a.attachments.length>0,f=wn(a.quote!==null,180);y.useLayoutEffect(()=>{const p=o.current;if(!p)return;p.style.height="auto";const g=n==="mobile"?120:180;p.style.height=`${Math.min(p.scrollHeight,g)}px`},[a.text,a.nonce,n]),y.useEffect(()=>{a.nonce&&o.current?.focus()},[a.nonce]);const h=y.useRef(null);y.useLayoutEffect(()=>{const p=h.current,g=p?.closest(".chat");if(!p||!g)return;const v=new ResizeObserver(()=>g.style.setProperty("--comp-h",`${p.offsetHeight}px`));return v.observe(p),()=>v.disconnect()},[n]);const m=l.jsxs("div",{className:n==="mobile"?"mcomp":"comp",children:[f.mounted?l.jsxs("div",{className:`comp-quote${f.leaving?" leaving":""}`,children:[l.jsx("div",{className:"quote",children:a.quote?.text}),l.jsx("button",{className:"hob-icon-btn",style:{width:20,height:20},onClick:()=>dc(null),title:"取消引用",children:l.jsx(X,{name:"close",size:13})})]}):null,a.attachments.length?l.jsx("div",{className:"comp-files",children:a.attachments.map(p=>{const g=p.path??yc(p),v=p.status==="uploading"?" uploading":p.status==="failed"?" failed":"";return Ji(p.name)?l.jsxs("span",{className:`comp-thumb${v}`,children:[l.jsx("img",{src:Dl(g),alt:p.name}),p.status==="uploading"?l.jsx("span",{className:"att-spin",children:l.jsx(X,{name:"spin",size:18,w:2.2,className:"spin"})}):null,p.status==="failed"?l.jsx("span",{className:"att-bad",children:"!"}):null,l.jsx("button",{onClick:()=>$x(p.id),title:"移除","aria-label":"移除",children:l.jsx(X,{name:"close",size:11,w:2.2})})]},p.id):l.jsxs("span",{className:`filechip${v}`,children:[l.jsx("span",{className:"fi",children:p.status==="uploading"?l.jsx(X,{name:"spin",size:16,w:2.2,className:"spin"}):l.jsx(X,{name:$l(p.name),size:16})}),l.jsx("span",{className:"fn",children:p.name}),l.jsx("button",{onClick:()=>$x(p.id),title:"移除","aria-label":"移除",children:l.jsx(X,{name:"close",size:12})})]},p.id)})}):null,l.jsxs("div",{className:"comp-main",children:[l.jsxs("label",{className:"pl",title:"加文件",children:[l.jsx(X,{name:"plus",size:19}),l.jsx("input",{type:"file",multiple:!0,hidden:!0,onChange:p=>{const g=Array.from(p.target.files??[]);p.target.value="",g.length&&$N(g)}})]}),l.jsx("textarea",{ref:o,className:"ta",rows:1,value:a.text,placeholder:`给${ey(r?.name??"")}发消息`,onChange:p=>ch(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),Ux())}}),r?.busy&&!c?l.jsx("button",{className:"sendbtn stop",title:"停止",onClick:()=>void BN(r.id),children:l.jsx(X,{name:"stop",size:18})}):l.jsx("button",{className:"sendbtn",title:"发送",disabled:!c,onClick:()=>void Ux(),children:l.jsx(X,{name:"send",size:17})})]})]});return n==="mobile"?l.jsx("div",{className:"mcomp-wrap",ref:h,children:m}):l.jsx("div",{className:"compwrap",ref:h,children:l.jsx("div",{className:"col",children:m})})}function DT(){const n=je(),a=n.assistants.find(g=>g.id===n.sel),r=f0(n,n.sel),o=!!(a&&n.sel&&r.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=y.useRef(null),f=!!a?.busy&&!Kb(r),h=wn(f,180),m=ty(n.sel,n.sel?n.itemGen[n.sel]:0),p=J0(c,n.sel,m,r[0]?.id);return Q0(c,m,r.length,r[0]?.id,F0(r.at(-1))),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mchat-head",children:[l.jsx("button",{className:"hob-icon-btn",style:{marginLeft:-8},title:"返回",onClick:()=>Lf("list"),children:l.jsx(X,{name:"left",size:22})}),a?l.jsx(rt,{sprite:a.sprite,prop:a.prop,size:30}):null,l.jsx("span",{className:"nm",children:a?.name??""}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"hob-icon-btn",title:"助手信息",onClick:rS,children:l.jsx(X,{name:"more",size:20})})]}),l.jsx("div",{className:"mmsgs",ref:c,onScroll:p,children:l.jsxs("div",{className:`col${o?" mid":""}`,children:[l.jsx(P0,{id:n.sel}),o&&a?l.jsx(W0,{a}):l.jsx(X0,{items:r}),h.mounted&&a?l.jsx(Z0,{a,leaving:h.leaving,gap:r.at(-1)?.kind==="user"}):null]})}),l.jsx(ny,{variant:"mobile"})]})}const $T="document.addEventListener('click',function(e){if(!e.isTrusted)return;const a=e.target.closest('a[href]');if(!a||!/^https?:\\/\\//i.test(a.getAttribute('href')||''))return;let u;try{u=new URL(a.href)}catch{return}if(!['http:','https:'].includes(u.protocol))return;e.preventDefault();if(window.parent!==window)window.parent.postMessage({type:'hob-page-link',url:u.href},'*');else window.open(u.href,'_blank','noopener')});",UT="addEventListener('DOMContentLoaded',function(){document.querySelectorAll('main table').forEach(function(t){if(t.parentElement.classList.contains('tw'))return;var w=document.createElement('div');w.className='tw';t.before(w);w.append(t)});document.querySelectorAll('main figure>svg').forEach(function(g){var v=g.viewBox&&g.viewBox.baseVal;if(v&&v.width)g.style.minWidth=Math.round(v.width*0.75)+'px'})});",LT="(function(){function f(){var h=location.hash;document.documentElement.classList.toggle('dark',h==='#dark'||(h!=='#light'&&matchMedia('(prefers-color-scheme: dark)').matches))}f();addEventListener('hashchange',f)})();",HT="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: https:; media-src data: https:; font-src data:",BT=`:root{--bg:#fff;--soft:#f5f5f2;--line:#e8e8e5;--ink:#18181a;--muted:#6d6d72;--faint:#a4a4a9;--accent:#ff6a2b;--accent-soft:#fff0e7;--ok:#1f9a5f;--ok-soft:#e8f5ee;--warn:#b7740a;--warn-soft:#fbf2df;--bad:#d92d20;--bad-soft:#fcebe9;color-scheme:light}
|
|
176
|
+
:root.dark{--bg:#151516;--soft:#1f1f21;--line:#2c2c2f;--ink:#ececed;--muted:#a1a1a7;--faint:#6b6b71;--accent:#ff7a42;--accent-soft:#36211a;--ok:#3cc183;--ok-soft:#15281e;--warn:#e9a53a;--warn-soft:#2c2414;--bad:#ff6b5e;--bad-soft:#321b19;color-scheme:dark}
|
|
177
|
+
*{box-sizing:border-box}
|
|
178
|
+
html{background:var(--bg);color:var(--ink);font:16px/1.75 system-ui,-apple-system,"PingFang SC","Hiragino Sans GB","Noto Sans CJK SC","Microsoft YaHei",sans-serif;-webkit-text-size-adjust:100%;text-rendering:optimizeLegibility}
|
|
179
|
+
body{margin:0;padding:52px 24px 80px}
|
|
180
|
+
.page{max-width:760px;margin:0 auto}
|
|
181
|
+
.hd{margin-bottom:40px;padding-bottom:28px;border-bottom:1px solid var(--line)}
|
|
182
|
+
.hd h1{font-size:32px;line-height:1.25;letter-spacing:-.015em;margin:0 0 10px;font-weight:700}
|
|
183
|
+
.hd p{margin:0;color:var(--muted);font-size:17px;line-height:1.6}
|
|
184
|
+
h2{font-size:22px;line-height:1.35;letter-spacing:-.01em;margin:48px 0 14px;font-weight:700}
|
|
185
|
+
h3{font-size:16.5px;line-height:1.45;margin:28px 0 8px;font-weight:650}
|
|
186
|
+
main>h2:first-child,main>section:first-child>h2:first-child{margin-top:0}
|
|
187
|
+
p,ul,ol,table,pre,figure,blockquote,.note,.cards,.cols,.kpis,.steps{margin:0 0 18px}
|
|
188
|
+
ul,ol{padding-left:1.4em}li{margin:5px 0}li::marker{color:var(--faint)}
|
|
189
|
+
a{color:var(--accent);text-decoration:none;border-bottom:1px solid color-mix(in srgb,var(--accent) 35%,transparent)}
|
|
190
|
+
strong,b{font-weight:650}
|
|
191
|
+
.muted{color:var(--muted)}.accent{color:var(--accent)}.ok{color:var(--ok)}.warn{color:var(--warn)}.bad{color:var(--bad)}
|
|
192
|
+
code{font:.88em/1.5 ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;background:var(--soft);padding:.12em .4em;border-radius:5px}
|
|
193
|
+
pre{background:var(--soft);border-radius:12px;padding:14px 18px;overflow:auto;line-height:1.6}pre code{background:none;padding:0;font-size:13.5px}
|
|
194
|
+
blockquote{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted)}
|
|
195
|
+
hr{border:0;border-top:1px solid var(--line);margin:36px 0}
|
|
196
|
+
table{width:100%;border-collapse:collapse;font-size:14.5px;line-height:1.6}
|
|
197
|
+
.tw{overflow-x:auto;margin:0 0 18px}.tw>table{margin:0}
|
|
198
|
+
th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top}
|
|
199
|
+
th{font-size:13px;font-weight:600;color:var(--muted);border-bottom-width:1.5px;white-space:nowrap}
|
|
200
|
+
td{min-width:5.5em}
|
|
201
|
+
th:first-child,td:first-child{padding-left:0}th:last-child,td:last-child{padding-right:0}
|
|
202
|
+
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
|
|
203
|
+
.card{background:var(--soft);border-radius:14px;padding:16px 18px}.card h3{margin:0 0 6px;font-size:15.5px}
|
|
204
|
+
.cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px 28px}
|
|
205
|
+
.cols>div>h3:first-child{margin-top:0}
|
|
206
|
+
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
|
|
207
|
+
.kpi{border:1px solid var(--line);border-radius:14px;padding:14px 16px 12px}
|
|
208
|
+
.kpi b{display:block;font-size:28px;line-height:1.2;font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums}.kpi span{color:var(--muted);font-size:13.5px}
|
|
209
|
+
.steps{list-style:none;padding:0;counter-reset:s}
|
|
210
|
+
.steps>li{position:relative;margin:0;padding:1px 0 20px 44px;counter-increment:s}
|
|
211
|
+
.steps>li::before{content:counter(s);position:absolute;left:0;top:0;width:28px;height:28px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-weight:700;font-size:14px;line-height:28px;text-align:center}
|
|
212
|
+
.steps>li::after{content:"";position:absolute;left:13.5px;top:34px;bottom:6px;width:1px;background:var(--line)}
|
|
213
|
+
.steps>li:last-child{padding-bottom:0}.steps>li:last-child::after{display:none}.steps>li>b:first-child{display:block}
|
|
214
|
+
.note{border-radius:12px;padding:12px 16px;background:var(--accent-soft)}.note.ok{background:var(--ok-soft)}.note.warn{background:var(--warn-soft)}.note.bad{background:var(--bad-soft)}
|
|
215
|
+
.card>:last-child,.note>:last-child,.cols>div>:last-child,section>:last-child{margin-bottom:0}
|
|
216
|
+
.tag{display:inline-block;font-size:12px;line-height:1.7;padding:0 8px;border-radius:99px;background:var(--soft);color:var(--muted);vertical-align:.08em;white-space:nowrap}
|
|
217
|
+
.card .tag{background:var(--bg)}
|
|
218
|
+
.tag.accent{background:var(--accent-soft);color:var(--accent)}.tag.ok{background:var(--ok-soft);color:var(--ok)}.tag.warn{background:var(--warn-soft);color:var(--warn)}.tag.bad{background:var(--bad-soft);color:var(--bad)}
|
|
219
|
+
figure{margin:28px 0;overflow-x:auto}img,svg{max-width:100%;height:auto}figure>svg,figure>img{display:block;margin:0 auto}
|
|
220
|
+
figcaption{color:var(--muted);font-size:13.5px;margin-top:10px;text-align:center}
|
|
221
|
+
svg{color:var(--ink)}svg text{fill:var(--ink);font-family:inherit;font-size:13px}
|
|
222
|
+
svg .box{fill:var(--bg);stroke:var(--line);stroke-width:1.5}svg .hl{fill:var(--accent-soft);stroke:var(--accent);stroke-width:1.5}
|
|
223
|
+
svg .line{fill:none;stroke:var(--faint);stroke-width:1.5}svg text.muted{fill:var(--muted)}svg text.accent{fill:var(--accent)}
|
|
224
|
+
@media (max-width:600px){body{padding:32px 18px 64px}.hd{margin-bottom:32px}.hd h1{font-size:26px}h2{font-size:19.5px;margin-top:40px}}`,Nf=n=>n.replace(/[&<>"]/g,a=>({"&":"&","<":"<",">":">",'"':"""})[a]);function qT(){return IT("","","").replace("</body>",`<script>
|
|
225
|
+
(function(){
|
|
226
|
+
let latest, scheduled = false, follow = true;
|
|
227
|
+
addEventListener('scroll', function(){ follow = document.documentElement.scrollHeight - innerHeight - scrollY < 48; }, {passive:true});
|
|
228
|
+
addEventListener('message', function(e){
|
|
229
|
+
if(e.source !== parent || e.data?.type !== 'hob-page-live') return;
|
|
230
|
+
latest = e.data;
|
|
231
|
+
if(scheduled) return;
|
|
232
|
+
scheduled = true;
|
|
233
|
+
requestAnimationFrame(function(){
|
|
234
|
+
scheduled = false;
|
|
235
|
+
document.documentElement.classList.toggle('dark', !!latest.dark);
|
|
236
|
+
document.title = latest.title || '';
|
|
237
|
+
document.querySelector('.hd h1').textContent = latest.title || '';
|
|
238
|
+
document.querySelector('.hd p').textContent = latest.summary || '';
|
|
239
|
+
const main = document.querySelector('main');
|
|
240
|
+
const template = document.createElement('template');
|
|
241
|
+
template.innerHTML = (latest.html || '').replace(/<[^>]*$/, '');
|
|
242
|
+
template.content.querySelectorAll('script,iframe,object,embed').forEach(function(el){el.remove()});
|
|
243
|
+
template.content.querySelectorAll('*').forEach(function(el){
|
|
244
|
+
Array.from(el.attributes).forEach(function(a){if(/^on/i.test(a.name)||a.name.toLowerCase()==='srcdoc'||/^\\s*javascript:/i.test(a.value))el.removeAttribute(a.name)});
|
|
245
|
+
});
|
|
246
|
+
main.innerHTML = template.innerHTML;
|
|
247
|
+
main.querySelectorAll('table').forEach(function(t){const w=document.createElement('div');w.className='tw';t.before(w);w.append(t)});
|
|
248
|
+
main.querySelectorAll('figure>svg').forEach(function(g){const v=g.viewBox&&g.viewBox.baseVal;if(v&&v.width)g.style.minWidth=Math.round(v.width*.75)+'px'});
|
|
249
|
+
if(follow) scrollTo(0, document.documentElement.scrollHeight);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
})();<\/script></body>`)}function IT(n,a,r){return`<!doctype html>
|
|
253
|
+
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
254
|
+
<meta http-equiv="Content-Security-Policy" content="${HT}">
|
|
255
|
+
<title>${Nf(n)}</title><script>${LT}${UT}<\/script><style>${BT}</style></head>
|
|
256
|
+
<body><div class="page"><header class="hd"><h1>${Nf(n)}</h1><p>${Nf(a)}</p></header>
|
|
257
|
+
<main>
|
|
258
|
+
${r}
|
|
259
|
+
</main></div><script>${$T}<\/script></body></html>
|
|
260
|
+
`}function YT(n){const[a,...r]=n;return a?a.map((o,c)=>r.length>0&&r.every(f=>{const h=f[c]?.trim();return!!h&&/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(h)&&Number.isFinite(Number(h))})):[]}function lr({title:n,children:a,root:r=!1,close:o=!1,className:c=""}){const f=je(),h=r||f.page!=="main"&&f.panelStack.length<=1;return l.jsxs("div",{className:`panel-head ${c}`,children:[l.jsx("button",{className:`hob-icon-btn${h?" panel-mobile-back":""}`,title:"返回",onClick:r?w0:rr,children:l.jsx(X,{name:"left",size:18})}),n,a,o?l.jsx("button",{className:"hob-icon-btn panel-close",title:"关闭",onClick:or,children:l.jsx(X,{name:"close",size:17})}):null]})}const GT=1024*1024;function rc({embedded:n=!1,page:a}){const r=je(),o=a??r.panelStack.at(-1),c=o?.kind==="file"?o:null,f=wn(!!c,180),h=y.useRef(c);c&&(h.current=c);const m=c??h.current;return!f.mounted||!m?null:l.jsx("div",{className:`${n?"fp-embedded":"fpwrap"}${f.leaving?" leaving":""}`,onClick:n?void 0:or,children:l.jsx("div",{className:`fp${m.full?" full":""}`,onClick:p=>p.stopPropagation(),children:m.liveId&&r.livePages[m.liveId]?l.jsx(KT,{page:r.livePages[m.liveId]}):l.jsx(VT,{path:m.path,title:m.title,find:m.find,page:m.page})})})}function KT({page:n}){const a=y.useRef(null),r=y.useRef(n);r.current=n;const[o,c]=y.useState(null),f=y.useMemo(()=>qT(),[]),h=()=>a.current?.contentWindow?.postMessage({type:"hob-page-live",title:r.current.title,summary:r.current.summary,html:r.current.html,dark:document.documentElement.classList.contains("dark")},"*");y.useEffect(()=>{h()},[n]),y.useEffect(()=>{const p=new MutationObserver(h);p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const g=v=>{if(!(v.source!==a.current?.contentWindow||v.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const b=new URL(v.data.url);["http:","https:"].includes(b.protocol)&&window.open(b.href,"_blank","noopener")}catch{}};return window.addEventListener("message",g),()=>{p.disconnect(),window.removeEventListener("message",g)}},[]),y.useEffect(()=>{let p=!0;return n.path&&mh(n.path).then(g=>{p&&c(g)}).catch(g=>Ga(`无法加载文件信息:${g instanceof Error?g.message:String(g)}`)),()=>{p=!1}},[n.path]);const m=n.state!=="done";return l.jsxs(l.Fragment,{children:[l.jsx(sy,{name:n.title||"正在写页面…",meta:o,path:n.path||"page.html",liveStatus:n.state==="writing"?"正在生成…":n.state==="failed"?`生成失败:${n.error}`:void 0,disabled:m}),l.jsx("div",{className:"fp-body",children:n.state==="done"&&/<\s*script\b/i.test(n.html)&&o?l.jsx(ly,{meta:o}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),l.jsx("iframe",{ref:a,className:"fp-frame",sandbox:"allow-scripts",srcDoc:f,onLoad:h,title:n.title||"正在写页面"})]})})]})}function VT({path:n,title:a,find:r,page:o}){const[c,f]=y.useState({state:"loading"});y.useEffect(()=>{let p=!0;return f({state:"loading"}),mh(n).then(g=>{p&&f({state:"ok",meta:g})}).catch(g=>{if(!p)return;const v=g instanceof Error?g.message:String(g),b=v.includes("只允许读 Hob 自己的文件");f({state:"error",outside:b,message:v})}),()=>{p=!1}},[n]);const h=c.state==="ok"?c.meta:null,m=a??h?.name??n.split("/").pop()??n;return l.jsxs(l.Fragment,{children:[l.jsx(sy,{name:m,meta:h,path:n}),l.jsx("div",{className:"fp-body",children:c.state==="loading"?l.jsx("div",{className:"fp-center dim",children:l.jsx(Fn,{text:"正在读取文件信息…"})}):c.state==="error"?l.jsx("div",{className:"fp-center",children:l.jsxs("div",{className:"fp-nofile",children:[l.jsx(X,{name:"doc",size:22}),l.jsx("div",{children:c.outside?"这个文件不在 Hob 的数据目录或任务的工作目录里,无法预览":c.message}),l.jsx("button",{className:"hob-btn",onClick:()=>void ph(n).then(p=>Ga(p?"路径已复制":"复制失败:浏览器不允许写入剪贴板")),children:"复制路径"})]})}):l.jsx(XT,{meta:c.meta,find:r,page:o})})]})}function sy({name:n,meta:a,path:r,liveStatus:o,disabled:c}){const f=je().panelStack.at(-1),h=f?.kind==="file"&&f.full;return l.jsxs(lr,{className:"fphead",close:!0,children:[l.jsx(X,{name:$l(r),size:18,className:"fp-file-icon"}),l.jsxs("div",{className:"fpt",children:[l.jsx("div",{className:"n",title:n,children:n}),o?l.jsx("div",{className:"m",children:o}):a?l.jsxs("div",{className:"m",children:[Va(a.size)," · ",on(a.modifiedAt)]}):null]}),c?l.jsx("button",{className:"hob-icon-btn fp-act",title:"下载",disabled:!0,children:l.jsx(X,{name:"dl",size:17})}):l.jsx("a",{className:"hob-icon-btn fp-act",title:"下载",href:Lt(r),download:n,children:l.jsx(X,{name:"dl",size:17})}),l.jsx("button",{className:"hob-icon-btn fp-act",title:"在新窗口打开",disabled:c,onClick:()=>window.open(Lt(r,{inline:!0}),"_blank","noopener"),children:l.jsx(X,{name:"out",size:17})}),l.jsx("button",{className:"hob-icon-btn fp-act fp-wide-btn",title:"切换全宽",onClick:fS,children:l.jsx(X,{name:h?"shrink":"expand",size:17})})]})}function ly({meta:n}){const a=y.useRef(null);return y.useEffect(()=>{const r=o=>{if(!(!n.page||o.source!==a.current?.contentWindow||o.data?.type!=="hob-page-link"||!navigator.userActivation?.isActive))try{const c=new URL(o.data.url);(c.protocol==="https:"||c.protocol==="http:")&&window.open(c.href,"_blank","noopener")}catch{}};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)},[n.page]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-note",children:"网页在隔离环境中显示,不能访问 Hob 的数据。"}),l.jsx("iframe",{ref:a,className:"fp-frame",sandbox:"allow-scripts",src:Lt(n.path,{inline:!0})+(n.page?document.documentElement.classList.contains("dark")?"#dark":"#light":""),title:n.name})]})}function XT({meta:n,find:a,page:r}){switch(n.kind){case"image":return l.jsx(gb,{path:n.path,name:n.name,svg:!1});case"svg":return l.jsx(gb,{path:n.path,name:n.name,svg:!0});case"pdf":return l.jsx("iframe",{className:"fp-frame",src:Lt(n.path)+(r?`#page=${r}`:""),title:n.name});case"audio":return l.jsx("div",{className:"fp-center",children:l.jsx("audio",{controls:!0,src:Lt(n.path)})});case"video":return l.jsx("div",{className:"fp-center",children:l.jsx("video",{controls:!0,src:Lt(n.path)})});case"html":return l.jsx(ly,{meta:n});case"other":return l.jsx("div",{className:"fp-center",children:l.jsxs("div",{className:"fp-nofile",children:[l.jsx(X,{name:"doc",size:22}),l.jsx("div",{children:"这种文件不在浏览器里预览,可以下载后打开。"}),l.jsx("a",{className:"hob-btn hob-btn-primary",href:Lt(n.path),download:n.name,children:"下载"})]})});default:return l.jsx(ZT,{meta:n,find:a})}}function gb({path:n,name:a,svg:r}){const[o,c]=y.useState(!1),f=Lt(n,r?{inline:!0}:void 0),[h,m]=y.useState(r);return y.useEffect(()=>{if(!o)return;const p=g=>{g.key==="Escape"&&(g.stopImmediatePropagation(),c(!1))};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[o]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-img",children:l.jsxs("button",{onClick:()=>c(!0),title:"放大",className:h?void 0:"fp-img-loading",children:[h?null:l.jsx("img",{className:"fp-img-thumb",src:Dl(n),alt:"","aria-hidden":"true"}),l.jsx("img",{src:f,alt:a,onLoad:()=>m(!0),onError:()=>m(!0),style:h?void 0:{position:"absolute",opacity:0}})]})}),o?l.jsx("div",{className:"lightbox",role:"dialog","aria-label":a,onClick:()=>c(!1),children:l.jsx("img",{src:f,alt:a})}):null]})}function ZT({meta:n,find:a}){const[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(0),p=y.useCallback(()=>m(v=>v+1),[]);if(y.useEffect(()=>{let v=!0;return o(null),f(null),(async()=>{try{const b=await fetch(Lt(n.path,{truncate:!0}));if(!b.ok)throw new Error(`读取失败(${b.status})`);v&&o(await b.text())}catch(b){v&&f(b instanceof Error?b.message:String(b))}})(),()=>{v=!1}},[n.path]),c)return l.jsx("div",{className:"fp-center fp-nofile",children:c});if(r===null)return l.jsx("div",{className:"fp-center dim",children:l.jsx(Fn,{text:"正在读取内容…"})});const g=n.size>GT?l.jsxs("div",{className:"fp-note",children:["文件有 ",Va(n.size),",只显示前 1 MB,完整内容请下载。"]}):null;if(n.kind==="markdown")return l.jsxs(l.Fragment,{children:[g,l.jsx(Wo,{find:a,text:r,mathVersion:h,children:l.jsx(Ya,{className:"fp-md markdown-body",text:r,onMathRendered:p})})]});if(n.kind==="json"){let v=r;try{v=JSON.stringify(JSON.parse(r),null,2)}catch{}return l.jsxs(l.Fragment,{children:[g,l.jsx(Wo,{find:a,text:r,children:l.jsx(vb,{text:v})})]})}return n.kind==="csv"?l.jsxs(l.Fragment,{children:[g,l.jsx(Wo,{find:a,text:r,children:l.jsx(QT,{text:r,tsv:n.mime.includes("tab-separated")})})]}):l.jsxs(l.Fragment,{children:[g,l.jsx(Wo,{find:a,text:r,children:l.jsx(vb,{text:r})})]})}function Wo({find:n,text:a,mathVersion:r,children:o}){const c=y.useRef(null);return y.useEffect(()=>{const f=CSS.highlights;if(!c.current||!n||!f||typeof Highlight>"u")return;const h=document.createTreeWalker(c.current,NodeFilter.SHOW_TEXT,{acceptNode(j){return j.parentElement?.closest(".ln, .code-copy, .fp-codebar, .katex-mathml")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),m=[];for(;h.nextNode();)m.push(h.currentNode);const p=F2(m,n);if(!p)return;const{start:g,end:v}=p,b=document.createRange();return b.setStart(g.node,g.offset),b.setEnd(v.node,v.offset),f.set("knowledge-source",new Highlight(b)),g.node.parentElement?.scrollIntoView({block:"center"}),()=>{f.delete("knowledge-source")}},[n,a,r]),l.jsx("div",{ref:c,children:o})}function vb({text:n}){const[a,r]=y.useState(!0),o=y.useMemo(()=>n.split(`
|
|
261
|
+
`),[n]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"fp-codebar",children:[l.jsxs("span",{className:"dim",children:[o.length," 行"]}),l.jsx("button",{className:"hob-btn",onClick:()=>r(!a),children:a?"不自动换行":"自动换行"})]}),l.jsx("div",{className:`fp-code mono${a?" wrap":""}`,children:o.map((c,f)=>l.jsxs("div",{className:"cl",children:[l.jsx("span",{className:"ln",children:f+1}),l.jsx("span",{className:"ct",children:c||" "})]},f))})]})}function QT({text:n,tsv:a}){const r=y.useMemo(()=>JT(n,a?" ":","),[n,a]),o=y.useMemo(()=>YT(r),[r]),c=r.slice(0,1e3),[f,...h]=c;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fp-codebar",children:l.jsxs("span",{className:"dim",children:[r.length," 行",r.length>1e3?"(只显示前 1000 行)":""]})}),l.jsx("div",{className:"fp-table-wrap",children:l.jsxs("table",{className:"fp-table",children:[f?l.jsx("thead",{children:l.jsx("tr",{children:f.map((m,p)=>l.jsx("th",{className:o[p]?"numeric":void 0,children:m},p))})}):null,l.jsx("tbody",{children:h.map((m,p)=>l.jsx("tr",{children:m.map((g,v)=>l.jsx("td",{className:o[v]?"numeric":void 0,children:g},v))},p))})]})})]})}function JT(n,a){const r=[];let o=[],c="",f=!1;for(let h=0;h<n.length;h+=1){const m=n[h];f?m==='"'?n[h+1]==='"'?(c+='"',h+=1):f=!1:c+=m:m==='"'?f=!0:m===a?(o.push(c),c=""):m===`
|
|
262
|
+
`?(o.push(c),r.push(o),o=[],c=""):m!=="\r"&&(c+=m)}return(c||o.length)&&(o.push(c),r.push(o)),r}const PT=y.lazy(()=>ur(()=>import("./DesktopView-lixZfbYr.js"),[]).then(n=>({default:n.DesktopView}))),FT={off:"关",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},WT=["running","waiting","queued","done","stuck","failed","stopped"],eC={bash:"term",overview:"clock",generate_image:"image",read:"doc",write:"edit",edit:"edit",ls:"doc",grep:"search",find:"search",report:"rule",ask_user:"info"};function ar(n){return n.status==="running"||n.status==="queued"||n.status==="waiting"}function Sf({embedded:n=!1,page:a}){const r=je(),o=a??r.panelStack.at(-1),c=o?.kind==="job"||o?.kind==="jobs"?o:null,f=wn(!!c,180),h=y.useRef(c);c&&(h.current=c);const m=c??h.current;return!f.mounted||!m?null:l.jsx("div",{className:`${n?"jd-embedded":"jd-overlay"}${f.leaving?" leaving":""}`,onClick:n?void 0:or,children:l.jsx("div",{className:"jd",onClick:p=>p.stopPropagation(),children:m.kind==="jobs"?l.jsxs(l.Fragment,{children:[l.jsx(lr,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务记录"}),close:!0}),l.jsx(hC,{})]}):l.jsx(tC,{id:m.id,round:m.round},`${m.id}-${m.round??"default"}`)})})}function tC({id:n,round:a}){const r=je(),o=r.jobs[n],c=r.steps[n],f=y.useRef(null),h=y.useRef(a===void 0&&(o?ar(o):!0)),[m,p]=y.useState(null),[g,v]=y.useState(!1),[b,j]=y.useState(a);if(y.useEffect(()=>{ah().then(D=>p(D?.models??null))},[]),y.useEffect(()=>{const D=f.current;if(!D)return;const V=()=>{h.current=D.scrollHeight-D.scrollTop-D.clientHeight<80};return D.addEventListener("scroll",V),()=>D.removeEventListener("scroll",V)},[]),y.useEffect(()=>{const D=f.current,V=c?.[c.length-1]?.queued;D&&(h.current||V)&&(D.scrollTop=D.scrollHeight,h.current=!0)},[c?.length,c?.[c.length-1]?.id]),!o)return l.jsxs("div",{className:"jdbody",children:[l.jsx(lr,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务"}),close:!0}),l.jsx(ze,{children:"无法读取这个任务。"})]});const E=r.assistants.find(D=>D.id===o.assistantId),S=o.model?m?.find(D=>D.ref===o.model)?.name??o.model:"",T=o.startedAt??o.createdAt,z=o.durationMs??(ar(o)?Date.now()-new Date(T).getTime():void 0),A=o.usage,$=nh(o);return l.jsxs(l.Fragment,{children:[l.jsxs(lr,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务"}),close:!0,children:[o.status==="done"?l.jsxs("button",{className:"hob-btn hob-btn-compact",disabled:!!r.sedimenting[o.id],onClick:()=>{GN(o.id)},children:[l.jsx(X,{name:"mem",size:14}),r.sedimenting[o.id]?"正在沉淀…":"沉淀成技能"]}):null,c?.some(D=>D.name?.startsWith("browser_")||D.name?.startsWith("desktop_"))?l.jsxs("button",{className:"hob-btn hob-btn-compact",onClick:()=>v(!0),children:[l.jsx(X,{name:"pointer",size:14}),"看桌面"]}):null]}),l.jsxs("div",{className:"jdbody",ref:f,children:[l.jsx("div",{className:"jd-title",children:o.title}),l.jsxs("div",{className:"jd-meta",children:[l.jsx(ks,{meta:Pn[o.status]}),E||o.assistantName?l.jsxs("span",{className:"jd-owner",children:[E?l.jsx(rt,{sprite:E.sprite,prop:E.prop,size:16}):null,E?.name??o.assistantName]}):null,l.jsx("span",{children:on(T)}),z!==void 0?l.jsxs("span",{children:["用时 ",Ll(z)]}):null]}),o.model||A?l.jsxs("div",{className:"jd-meta dim",children:[o.model?l.jsx("span",{className:S===o.model?"mono":void 0,title:o.model,children:S}):null,o.thinking?l.jsxs("span",{children:["思考 ",FT[o.thinking]??o.thinking]}):null,o.modelReason?l.jsx("span",{children:o.modelReason}):null,A?l.jsxs("span",{children:["输入 ",Gf(A.input)," · 输出 ",Gf(A.output),A.cost>0?` · $${A.cost.toFixed(4)}`:""]}):null]}):null,$?l.jsx("div",{className:"jd-reason",children:$}):null,o.rounds?.length?(()=>{const D=Ew(o,c),V=Math.min(b??D.length-1,D.length-1);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"seg jd-rounds",role:"tablist",style:{"--seg-count":D.length,"--seg-index":V},children:D.map((N,k)=>l.jsxs("button",{role:"tab","aria-selected":k===V,className:k===V?"on":void 0,onClick:()=>j(k),children:["第 ",k+1," 轮"]},k))}),l.jsx("div",{className:b!==a?"jd-round-content":void 0,children:l.jsx(xb,{part:D[V],last:V===D.length-1,index:V})},V)]})})():l.jsx(l.Fragment,{children:l.jsx(xb,{part:{job:o,instruction:o.instruction,steps:c},last:!0,index:0})})]}),l.jsx(nC,{job:o}),g?l.jsx(y.Suspense,{fallback:l.jsx("div",{children:"正在打开云桌面…"}),children:l.jsx(PT,{onClose:()=>v(!1)})}):null]})}function xb({part:n,last:a,index:r}){const[o,c]=y.useState(!1),f=n.steps===void 0?void 0:Nw(n.steps),h=nh(n.job),m=!ar(n.job),p=new Set(f?Xo(f.rows,m,!1).rows.map(g=>g.id):[]);return l.jsxs(l.Fragment,{children:[a?null:l.jsxs("div",{className:"jd-meta",children:[l.jsx(ks,{meta:Pn[n.job.status]}),n.job.durationMs!==void 0?l.jsxs("span",{children:["用时 ",Ll(n.job.durationMs)]}):null]}),h&&!a?l.jsx("div",{className:"jd-reason",children:h}):null,m?l.jsxs(l.Fragment,{children:[l.jsx(oC,{job:n.job}),l.jsx(cC,{job:n.job})]}):null,n.instruction?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:r===0?"任务内容":"这一轮的要求"}),l.jsx("div",{className:"jd-instruction",children:n.instruction})]}):null,l.jsx("div",{className:"lbl",children:"执行过程"}),l.jsx("div",{className:"jd-timeline",children:f===void 0?l.jsx(ze,{children:l.jsx(Fn,{text:"正在读取执行过程…"})}):f.rows.length||f.thinking?l.jsxs(l.Fragment,{children:[Xo(f.rows,m,o).rows.map(g=>o&&!p.has(g.id)?l.jsx("div",{className:"jd-unfold",children:l.jsx("div",{children:l.jsx(bb,{step:g,cwd:n.job.cwd})})},g.id):l.jsx(bb,{step:g,cwd:n.job.cwd},g.id)),Xo(f.rows,m,o).remaining?l.jsx("div",{className:"jd-tool",children:l.jsxs("button",{className:"jd-tool-head",onClick:()=>c(!0),children:[l.jsx("span",{className:"ico",children:l.jsx(X,{name:"more",size:14})}),l.jsxs("span",{className:"tt",children:["还有 ",Xo(f.rows,m,o).remaining," 步"]})]})}):null,f.thinking?l.jsx(sC,{text:f.thinking}):null]}):l.jsx(ze,{children:"还没有执行步骤。"})}),a?l.jsx(dC,{jobId:n.job.id}):null]})}function nC({job:n}){const[a,r]=y.useState(""),o=a.trim().length>0,c=()=>{if(!o)return;const f=a.trim();r(""),$f(n.id,f).then(h=>{h||r(m=>m||f)})};return l.jsxs("div",{className:"jd-foot",children:[l.jsx("input",{value:a,placeholder:ar(n)?"补充说明或更正方向":"接着说…",onChange:f=>r(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.nativeEvent.isComposing&&c()}}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!o,onClick:c,children:"发送"}),n.status==="running"?l.jsx("button",{className:"hob-btn",onClick:()=>void p0(n.id),children:"停止"}):null]})}function bb({step:n,cwd:a}){const[r,o]=y.useState(!1),c=wn(r,180);if(n.kind==="text")return n.from==="user"?l.jsxs("div",{className:`jd-mine${n.queued?" queued":""}`,children:[n.text,n.queued?l.jsx("div",{className:"jd-mine-note",children:"已送达,当前这一步做完后读取"}):null]}):l.jsxs("div",{className:"jd-textrow",children:[n.thinking?l.jsx(ay,{text:n.thinking,open:!1}):null,l.jsx(Ya,{className:"jd-text",text:n.text??""})]});const f=n.title??n.name??"",h=zw(f);return l.jsxs("div",{className:`jd-tool${n.isError?" bad":""}${r?" open":""}`,children:[l.jsxs("button",{className:"jd-tool-head",onClick:()=>o(m=>!m),children:[l.jsx("span",{className:"ico",children:n.running?l.jsx(X,{name:"spin",size:14,className:"spin"}):l.jsx(X,{name:eC[n.name??""]??(/^(lore|memory)_/.test(n.name??"")?"mem":"more"),size:14})}),l.jsx("span",{className:"tt",children:h.map((m,p)=>l.jsx("span",{className:m.mono?"mono":void 0,children:m.text},p))}),n.thinking?l.jsx("span",{className:"blb",title:"有思考过程",children:l.jsx(X,{name:"bulb",size:13})}):null,l.jsx("span",{className:"tm",children:n.isError?"出错":n.durationMs&&n.durationMs>=1e3?Ll(n.durationMs):""}),l.jsx(X,{name:r?"down":"chev",size:13})]}),l.jsx("div",{className:`expand${r?" open":""}`,inert:!r,children:l.jsx("div",{children:c.mounted?l.jsx(aC,{step:n,cwd:a}):null})})]})}function ay({text:n,open:a}){const[r,o]=y.useState(a);return l.jsxs("div",{className:"jd-think-in",children:[l.jsxs("button",{className:"jd-think-head",title:r?"收起思考过程":"展开思考过程",onClick:()=>o(c=>!c),children:[l.jsx("span",{className:"ico",children:l.jsx(X,{name:"bulb",size:13})}),l.jsx("span",{className:"tt",children:"思考过程"}),l.jsx(X,{name:r?"down":"chev",size:12})]}),r?l.jsx("div",{className:"jd-think-body",children:n}):null]})}function sC({text:n}){const[a,r]=y.useState(!1);return l.jsxs("div",{className:"jd-think",children:[l.jsxs("button",{onClick:()=>r(o=>!o),children:[l.jsx("span",{className:"ico",children:l.jsx(X,{name:"bulb",size:14})}),l.jsx("span",{className:"tt",children:"思考中"}),l.jsx(X,{name:a?"down":"chev",size:13})]}),a?l.jsx("div",{className:"jd-think-body",children:n}):null]})}function lC(n){const a=n.args?.edits;return Array.isArray(a)?a.map(r=>({oldText:String(r?.oldText??""),newText:String(r?.newText??"")})):[]}function Vf({path:n,cwd:a}){if(!n)return null;const r=n.startsWith("/")?n:a?`${a.replace(/\/+$/,"")}/${n}`:null;return r?l.jsx("button",{className:"jd-kv mono jd-path",title:r,onClick:()=>Ct(r),children:n}):l.jsx("div",{className:"jd-kv mono",children:n})}function aC({step:n,cwd:a}){const r=n.args??{},o=lC(n);return l.jsxs("div",{className:"jd-tool-body",children:[n.thinking?l.jsx(ay,{text:n.thinking,open:!0}):null,o.length?l.jsxs(l.Fragment,{children:[l.jsx(Vf,{path:String(r.path??""),cwd:a}),o.map((c,f)=>l.jsx(rC,{before:c.oldText,after:c.newText},f))]}):l.jsx(iC,{step:n,args:r,cwd:a}),n.output?l.jsx(Xf,{text:n.output,className:"jd-out mono"}):null,n.outputPath?l.jsxs("button",{className:"jd-file",onClick:()=>Ct(n.outputPath),children:[l.jsx(X,{name:"doc",size:12}),"完整输出"]}):null]})}function iC({step:n,args:a,cwd:r}){if(n.name==="bash")return l.jsx(Xf,{text:String(a.command??""),className:"jd-arg mono",lines:8});if(n.name==="write")return l.jsxs("div",{className:"jd-kv-wrap",children:[l.jsx(Vf,{path:String(a.path??""),cwd:r}),l.jsxs("span",{className:"jd-kv-len",children:[String(a.contentLength??0)," 字"]})]});if(n.name==="read"||n.name==="ls"||n.name==="edit")return l.jsx(Vf,{path:String(a.path??""),cwd:r});const o=JSON.stringify(a,null,2);return o==="{}"?null:l.jsx(Xf,{text:o,className:"jd-arg mono",lines:6})}function rC({before:n,after:a}){const[r,o]=y.useState(!1),c=Tw(n,a),f=r?c:c.slice(0,24);return l.jsxs("div",{className:"jd-diff",children:[f.map((h,m)=>l.jsxs("div",{className:`dl ${h.sign==="-"?"del":h.sign==="+"?"add":""}`,children:[l.jsx("span",{className:"sg",children:h.sign}),l.jsx("span",{className:"mono",children:h.text||" "})]},m)),c.length>f.length?l.jsxs("button",{className:"jd-more",onClick:()=>o(!0),children:["展开全部 ",c.length," 行"]}):null]})}function Xf({text:n,className:a,lines:r=12}){const[o,c]=y.useState(!1),f=n.split(`
|
|
263
|
+
`).length;return l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:`${a}${o?" all":""}`,style:o?void 0:{maxHeight:`${r*1.6}em`},children:n}),f>r?l.jsx("button",{className:"jd-more",onClick:()=>c(!o),children:o?"收起":`展开全部 ${f} 行`}):null]})}function oC({job:n}){return n.summary?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"报告"}),l.jsx(Ya,{className:"jd-report",text:n.summary})]}):null}function cC({job:n}){const a=[...new Set(n.files??[])];return a.length?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"产出文件"}),l.jsx("div",{className:"jd-files",children:a.map(r=>l.jsx(uC,{path:r},r))})]}):null}function uC({path:n}){const[a,r]=y.useState(),[o,c]=y.useState("");return y.useEffect(()=>{let f=!0;return mh(n).then(h=>{f&&r(h.size)}).catch(h=>{f&&c(h instanceof Error?h.message:String(h))}),()=>{f=!1}},[n]),l.jsxs("button",{className:"jd-file-row",onClick:()=>Ct(n),children:[l.jsx(X,{name:$l(n),size:18}),l.jsx("span",{children:n.split("/").pop()}),o?l.jsx("small",{title:o,children:"大小读取失败"}):a!==void 0?l.jsx("small",{children:Va(a)}):null]})}function dC({jobId:n}){const[a,r]=y.useState(!1),[o,c]=y.useState(),[f,h]=y.useState(""),[m,p]=y.useState(0);return y.useEffect(()=>{let g=!0;return h(""),N0(n).then(v=>{g&&c(v)}).catch(v=>{g&&h(v instanceof Error?v.message:String(v))}),()=>{g=!1}},[n,m]),o&&!o.total&&!f?null:l.jsxs("div",{className:"jd-directory",children:[l.jsxs("button",{className:"jd-directory-head",onClick:()=>r(!a),children:[l.jsx(X,{name:a?"down":"chev",size:15}),"工作目录",o?` · ${o.fileCount} 个文件、${o.directoryCount} 个文件夹`:""]}),f?l.jsxs("div",{className:"jd-dir-error",children:[f," ",l.jsx("button",{className:"jd-more",onClick:()=>p(m+1),children:"重试"})]}):null,a&&o?l.jsx(iy,{jobId:n,view:o}):null]})}function iy({jobId:n,view:a}){return l.jsxs("div",{className:"jd-files",children:[a.files.map(r=>r.type==="file"?l.jsxs("button",{className:"jd-file-row",onClick:()=>Ct(r.path),children:[l.jsx(X,{name:$l(r.name),size:18}),l.jsx("span",{children:r.name}),l.jsx("small",{children:Va(r.size)})]},r.rel):l.jsx(fC,{jobId:n,entry:r},r.rel)),a.total>a.files.length?l.jsxs("div",{className:"jd-dir-more",children:["还有 ",a.total-a.files.length," 项"]}):null]})}function fC({jobId:n,entry:a}){const[r,o]=y.useState(!1),[c,f]=y.useState(),[h,m]=y.useState(""),[p,g]=y.useState(0);return y.useEffect(()=>{if(!r||c)return;let v=!0;return m(""),N0(n,a.rel).then(b=>{v&&f(b)}).catch(b=>{v&&m(b instanceof Error?b.message:String(b))}),()=>{v=!1}},[r,c,n,a.rel,p]),l.jsxs("div",{children:[l.jsxs("button",{className:"jd-file-row",onClick:()=>o(!r),children:[l.jsx(X,{name:r?"down":"chev",size:14}),l.jsx(X,{name:"folder",size:18}),l.jsx("span",{children:a.name}),l.jsxs("small",{children:[a.count," 项"]})]}),r?l.jsx("div",{className:"jd-dir-child",children:h?l.jsxs("div",{className:"jd-dir-error",children:[h," ",l.jsx("button",{className:"jd-more",onClick:()=>g(p+1),children:"重试"})]}):c?l.jsx(iy,{jobId:n,view:c}):l.jsx("div",{className:"jd-dir-more",children:"正在读取…"})}):null]})}function hC(){const n=je(),a=n.worklog,r=a?.assistantId??null,o=a?.status??null;return l.jsxs("div",{className:"jdbody",onScroll:c=>{const f=c.currentTarget;a?.hasMore&&!a.loading&&f.scrollHeight-f.scrollTop-f.clientHeight<100&&qx()},children:[l.jsxs("div",{className:"jd-filters",children:[l.jsxs("select",{className:"pick",value:r??"",onChange:c=>void mc({assistantId:c.target.value||null,status:o}),children:[l.jsx("option",{value:"",children:"全部助手"}),n.assistants.map(c=>l.jsx("option",{value:c.id,children:c.name},c.id))]}),l.jsxs("select",{className:"pick",value:o??"",onChange:c=>void mc({assistantId:r,status:c.target.value||null}),children:[l.jsx("option",{value:"",children:"全部状态"}),WT.map(c=>l.jsx("option",{value:c,children:Pn[c].text},c))]}),l.jsx("span",{className:"sp"}),a?l.jsxs("span",{className:"dim",children:[a.jobs.length," 个"]}):null]}),a===null?l.jsx(ze,{children:l.jsx(Fn,{text:"正在读取任务记录…"})}):a.jobs.length?l.jsx("div",{className:"jd-rows",children:a.jobs.map(c=>{const f=n.jobs[c.id]??c,h=n.assistants.find(m=>m.id===f.assistantId);return l.jsxs("button",{className:"list-row history-row",onClick:()=>{h&&Vt(f.assistantId,!0,!0),Un(f.id)},children:[h?l.jsx(rt,{sprite:h.sprite,prop:h.prop,size:26}):l.jsx("span",{style:{width:26}}),l.jsxs("span",{className:"history-content",children:[l.jsx("span",{className:"n",children:f.title}),l.jsxs("span",{className:"tm",children:[on(f.startedAt??f.createdAt),f.durationMs!==void 0?` · ${Ll(f.durationMs)}`:ar(f)?` · ${mr(f.startedAt??f.createdAt)}`:""]})]}),l.jsx(ks,{meta:Pn[f.status]})]},f.id)})}):l.jsx(ze,{children:"没有符合条件的任务。"}),a?.hasMore?l.jsx("button",{className:"hob-btn jd-morebtn",onClick:()=>void qx(),children:a.loading?"正在读取…":"加载更多"}):null]})}function mC(){const n=je(),[a,r]=y.useState(""),[o,c]=y.useState(!1);y.useEffect(()=>{if(!n.error)return;c(!0);const h=window.setTimeout(()=>c(!1),260);return()=>window.clearTimeout(h)},[n.error]);const f=()=>{a&&ON(a)};return l.jsx("div",{className:"login",children:l.jsxs("div",{className:"card",children:[l.jsx(rt,{sprite:"hob",size:88,free:!0,motion:"home"}),l.jsx("div",{className:"nm",children:"Hob"}),l.jsx("div",{className:"ds",children:"请输入密码"}),l.jsx("label",{className:`field${o?" shake":""}`,children:l.jsx("input",{type:"password",autoFocus:!0,value:a,placeholder:"密码",onChange:h=>r(h.target.value),onKeyDown:h=>{h.key==="Enter"&&f()}})}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:f,disabled:n.loggingIn,children:n.loggingIn?"正在登录…":"登录"}),n.error?l.jsx("div",{className:"err",style:{width:"100%"},children:n.error}):null]})})}const pC=[["","全部类型"],["image","图片"],["document","文档"],["table","表格"],["page","网页"],["other","其他"]],gC=n=>`删除知识库「${n}」?直接上传到这里、又不在别的知识库里的文件会一起删除,其余文件只是移出。`;function wc(n="right"){const[a,r]=y.useState(null),o=y.useRef(null);return y.useLayoutEffect(()=>{if(!a||!o.current)return;const c=a.anchor.getBoundingClientRect(),f=o.current.getBoundingClientRect(),h=n==="left"?c.left:c.right-f.width;o.current.style.left=`${Math.max(8,Math.min(h,window.innerWidth-f.width-8))}px`,o.current.style.top=`${Math.max(8,Math.min(c.bottom+4,window.innerHeight-f.height-8))}px`}),y.useEffect(()=>{if(!a)return;const c=m=>{!o.current?.contains(m.target)&&!a.anchor.contains(m.target)&&r(null)},f=m=>{m.key==="Escape"&&(m.stopPropagation(),r(null))},h=m=>{o.current?.contains(m.target)||r(null)};return document.addEventListener("pointerdown",c,!0),window.addEventListener("keydown",f,!0),document.addEventListener("scroll",h,!0),()=>{document.removeEventListener("pointerdown",c,!0),window.removeEventListener("keydown",f,!0),document.removeEventListener("scroll",h,!0)}},[a]),{menu:a,box:o,close:()=>r(null),toggle:(c,f)=>r(h=>h?.id===c?null:{id:c,anchor:f})}}function bc({initial:n="",label:a,save:r,cancel:o}){const[c,f]=y.useState(n),[h,m]=y.useState(!1);return l.jsx("form",{className:"knowledge-name",onSubmit:p=>{p.preventDefault(),!(!c.trim()||h)&&(m(!0),r(c.trim()).then(g=>{g?o():m(!1)}))},children:l.jsx("input",{autoFocus:!0,"aria-label":a,value:c,disabled:h,onChange:p=>f(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),o())}})})}function vC({collections:n,selected:a,narrow:r}){const[o,c]=y.useState(!1),[f,h]=y.useState(null),m=wc(),p=n.find(g=>g.id===m.menu?.id);return l.jsxs("nav",{className:r?"knowledge-categories":"setnav","aria-label":"知识库分类",children:[!r&&l.jsx("div",{className:"setnavtitle",children:"知识库"}),[["all","全部"],["output","助手产出"],["chat","对话上传"]].map(([g,v])=>l.jsx("div",{children:l.jsx("button",{className:`navrow${a===g?" sel":""}`,onClick:()=>Ml({category:g}),children:v})},g)),!r&&l.jsx("div",{className:"knowledge-label",children:"我的知识库"}),n.map(g=>l.jsxs("div",{className:`knowledge-category${m.menu?.id===g.id?" menu-open":""}${a===g.id?" selected":""}`,onContextMenu:v=>{v.preventDefault();const b=v.currentTarget.querySelector(".category-dots");b&&m.toggle(g.id,b)},children:[f===g.id?l.jsx(bc,{initial:g.name,label:"知识库名称",save:v=>eS(g.id,v),cancel:()=>h(null)}):l.jsxs("button",{className:`navrow${a===g.id?" sel":""}`,onClick:()=>Ml({category:g.id}),children:[l.jsx("span",{children:g.name}),l.jsx("span",{className:"knowledge-count",children:g.count})]}),l.jsx("button",{className:"knowledge-dots category-dots","aria-label":`${g.name}的操作`,onClick:v=>m.toggle(g.id,v.currentTarget),children:l.jsx(X,{name:"more",size:18})})]},g.id)),l.jsx("div",{children:o?l.jsx(bc,{label:"新知识库名称",save:async g=>!!await k0(g),cancel:()=>c(!1)}):l.jsx("button",{className:"navrow knowledge-new",onClick:()=>c(!0),children:"+ 新建"})}),!r&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sp"}),l.jsx("button",{className:"navrow",onClick:nr,children:"返回 Hob"})]}),p&&cr.createPortal(l.jsxs("div",{className:"amenu knowledge-popup",ref:m.box,children:[l.jsx("button",{onClick:()=>{m.close(),h(p.id)},children:"改名"}),l.jsx("button",{onClick:()=>{m.close(),window.confirm(gC(p.name))&&tS(p.id)},children:"删除"})]}),document.body)]})}function xC({knowledge:n,assistants:a,uploading:r,upload:o}){const[c,f]=y.useState(n.q),[h,m]=y.useState(!1),p=y.useRef(null),g=n.collections.some(v=>v.id===n.category);return y.useEffect(()=>{if(h||c===n.q)return;const v=window.setTimeout(()=>Ml({q:c}),250);return()=>window.clearTimeout(v)},[c,h,n.q]),l.jsxs("div",{className:"knowledge-filters",children:[l.jsxs("label",{className:"knowledge-search",children:[l.jsx(X,{name:"search",size:16}),l.jsx("input",{placeholder:"搜索知识库",value:c,onChange:v=>f(v.target.value),onCompositionStart:()=>m(!0),onCompositionEnd:v=>{f(v.currentTarget.value),m(!1)}})]}),l.jsx("select",{"aria-label":"类型",value:n.kind,onChange:v=>Ml({kind:v.target.value}),children:pC.map(([v,b])=>l.jsx("option",{value:v,children:b},v))}),l.jsxs("select",{"aria-label":"助手",value:n.assistantId,onChange:v=>Ml({assistantId:v.target.value}),children:[l.jsx("option",{value:"",children:"全部助手"}),a.map(v=>l.jsx("option",{value:v.id,children:v.name},v.id))]}),g&&l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:p,type:"file",multiple:!0,hidden:!0,onChange:v=>{o(Array.from(v.target.files??[])),v.target.value=""}}),l.jsx("button",{className:"hob-btn hob-btn-upload",disabled:r,onClick:()=>p.current?.click(),children:r?"正在上传…":"上传"})]})]})}function bC({entry:n,collections:a}){return l.jsx(l.Fragment,{children:a.map(r=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:n.collections.includes(r.id),onChange:o=>{const c=o.target.checked?[...n.collections,r.id]:n.collections.filter(f=>f!==r.id);ac(n.id,{collections:c})}}),r.name]},r.id))})}function yC({entry:n,collections:a,category:r,join:o,rename:c,remove:f,confirm:h}){return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:o,children:"加入知识库"}),l.jsx("button",{onClick:c,children:"改名"}),l.jsx("a",{href:Lt(n.path),download:n.name,children:"下载"}),a.some(m=>m.id===r)&&l.jsx("button",{onClick:f,children:"移出这个知识库"}),l.jsx("button",{onClick:h,children:"删除"})]})}function kC({entry:n,collections:a,assistants:r,selected:o,category:c}){const f=wc(),[h,m]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(!1),j=Qb(n.kind),E=r.find(A=>A.id===n.source?.assistantId),S=n.source,T=n.index?.state==="queued"||n.index?.state==="indexing"?"正在建索引…":n.index?.state==="failed"?`未能建索引:${n.index.error||"未知原因"}`:n.index?.state==="unsupported"?"这类文件还不能建索引":"",z=[n.origin==="upload"?"上传":E?.name,on(n.updatedAt),Va(n.size),n.versions?.length?`第 ${n.versions.length+1} 版`:"",T].filter(Boolean).join(" · ");return l.jsxs("div",{className:`knowledge-row${o?" selected":""}`,children:[l.jsxs("div",{className:"knowledge-open",role:"button",tabIndex:0,onClick:()=>{v||Ct(n.path,n.name)},onKeyDown:A=>{!v&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),Ct(n.path,n.name))},children:[l.jsx("span",{className:"knowledge-thumb",children:j==="image"?l.jsx("img",{src:Dl(n.path),alt:""}):l.jsx(X,{name:j==="table"?"table":j==="page"?"globe":"doc",size:24})}),l.jsxs("div",{className:"knowledge-info",children:[v?l.jsx(bc,{initial:n.name,label:"文件名称",save:A=>ac(n.id,{name:A}),cancel:()=>b(!1)}):l.jsx("strong",{children:n.name}),n.snippet||n.description?l.jsx("span",{className:"knowledge-description",children:n.snippet||n.description}):null,l.jsxs("span",{className:"knowledge-meta",children:[l.jsx("span",{className:"knowledge-meta-text",children:z}),l.jsx("span",{className:"knowledge-tags",children:n.collections.map(A=>{const $=a.find(D=>D.id===A);return $?l.jsx("span",{children:$.name},A):null})})]})]})]}),S&&(S.itemId||S.jobId)?l.jsx("button",{className:"knowledge-source",onClick:()=>{S.itemId?lS(S.assistantId,S.itemId):S.jobId&&(nr(),Un(S.jobId))},children:"出处"}):null,l.jsx("div",{className:"knowledge-actions",children:l.jsx("button",{className:"knowledge-dots","aria-label":`${n.name}的操作`,onClick:A=>{f.toggle(n.id,A.currentTarget),m(!1)},children:l.jsx(X,{name:"more",size:18})})}),f.menu&&cr.createPortal(l.jsx("div",{className:"amenu knowledge-popup",ref:f.box,children:h?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"knowledge-menu-title",children:"加入知识库"}),l.jsx(bC,{entry:n,collections:a}),p?l.jsx(bc,{label:"新知识库名称",save:async A=>{const $=await k0(A,!1);return!!$&&await ac(n.id,{collections:[...n.collections,$.id]})},cancel:()=>g(!1)}):l.jsx("button",{onClick:()=>g(!0),children:"+ 新建知识库"})]}):l.jsx(yC,{entry:n,collections:a,category:c,join:()=>m(!0),rename:()=>{f.close(),b(!0)},remove:()=>{f.close(),ac(n.id,{collections:n.collections.filter(A=>A!==c)})},confirm:()=>{f.close(),window.confirm(`删除「${n.name}」?会从所有知识库里移除,不能恢复。`)&&nS(n.id)}})}),document.body)]})}function jC({knowledge:n,assistants:a,previewPath:r,upload:o}){const c=n.collections.some(h=>h.id===n.category),f=n.category==="output"&&!n.q?"还没有助手产出。助手交给你的文件、图片和页面会自动收在这里。":n.category==="chat"&&!n.q?"还没有对话上传的文件。":n.q?"没有找到匹配的资料。":"这里还没有资料。";return l.jsxs("div",{className:"knowledge-list",onDragOver:h=>{c&&h.preventDefault()},onDrop:h=>{c&&(h.preventDefault(),o(Array.from(h.dataTransfer.files)))},onScroll:h=>{const m=h.currentTarget;m.scrollHeight-m.scrollTop-m.clientHeight<120&&zt(!0)},children:[n.error?l.jsxs(ze,{large:!0,action:{label:"重试",onClick:()=>void zt()},children:["加载失败:",n.error]}):!n.entries.length&&!n.loading?l.jsx(ze,{large:!0,children:f}):null,n.entries.map(h=>l.jsx(kC,{entry:h,collections:n.collections,assistants:a,selected:h.path===r,category:n.category},h.id)),n.loading?l.jsx(ze,{large:!0,children:"正在加载…"}):null,n.hasMore&&!n.loading?l.jsx("button",{className:"knowledge-more",onClick:()=>void zt(!0),children:"加载更多"}):null]})}function wC({collectionId:n,collections:a,assistants:r,busy:o,setBusy:c}){return l.jsx(l.Fragment,{children:r.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:f.knowledge?.includes(n)??!1,disabled:o,onChange:()=>{const h=(f.knowledge??[]).filter(m=>a.some(p=>p.id===m));c(!0),hc(f.id,{knowledge:h.includes(n)?h.filter(m=>m!==n):[...h,n]}).finally(()=>c(!1))}}),f.name]},f.id))})}function NC({id:n,busy:a,setBusy:r}){return l.jsx("button",{disabled:a,onClick:()=>{r(!0),jN(n).then(()=>zt(!1,!0)).catch(o=>Ga(`重试失败:${o instanceof Error?o.message:String(o)}`)).finally(()=>r(!1))},children:"重试"})}function SC({collection:n,collections:a,assistants:r,embedding:o}){const c=wc("left"),f=r.filter(p=>p.knowledge?.includes(n.id)),[h,m]=y.useState(!1);return l.jsxs("div",{className:"knowledge-status",children:[l.jsxs("div",{children:[f.length?`给 ${f.map(p=>p.name).join("、")} 用`:l.jsx("strong",{children:"还没有助手用这个库"})," · ",l.jsx("button",{onClick:p=>c.toggle(n.id,p.currentTarget),children:f.length?"修改":"选择助手"})]}),c.menu&&cr.createPortal(l.jsx("div",{className:"amenu knowledge-popup",ref:c.box,children:l.jsx(wC,{collectionId:n.id,collections:a,assistants:r,busy:h,setBusy:m})}),document.body),l.jsxs("div",{children:["已建索引 ",n.indexed??0,"/",n.count-(n.unsupported??0),(n.failed??0)>0?l.jsxs(l.Fragment,{children:[" · ",n.failed," 个失败 · ",l.jsx(NC,{id:n.id,busy:h,setBusy:m})]}):null,o?null:l.jsxs(l.Fragment,{children:[" · 只按关键词查 · ",l.jsx("button",{onClick:()=>{jc(),zl("knowledge")},children:"去设置向量模型"})]})]})]})}function TC({narrow:n,leaving:a}){const r=je(),o=r.knowledge,c=r.panelStack.at(-1),f=c?.kind==="file"?c:null,[h,m]=y.useState(!1),p=g=>{!g.length||h||(m(!0),sS(o.category,g).finally(()=>m(!1)))};return y.useEffect(()=>{if(r.page!=="knowledge"||f)return;const g=v=>{v.key==="Escape"&&nr()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[r.page,f]),l.jsxs("main",{className:`setpage knowledge${n?" narrow":""}${f&&!n?" has-preview":""}${f?.full&&!n?" preview-full":""}${a?" leaving":""}`,children:[n?l.jsxs("div",{className:"sethead",children:[l.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:nr,children:l.jsx(X,{name:"left",size:17})}),l.jsx("span",{className:"t",children:"知识库"})]}):null,l.jsx(vC,{collections:o.collections,selected:o.category,narrow:n}),l.jsxs("section",{className:"knowledge-main",children:[l.jsx(xC,{knowledge:o,assistants:r.assistants,uploading:h,upload:p}),o.collections.find(g=>g.id===o.category)?l.jsx(SC,{collection:o.collections.find(g=>g.id===o.category),collections:o.collections,assistants:r.assistants,embedding:r.settings.settings.knowledge?.embedding.source==="openai"}):null,l.jsx(jC,{knowledge:o,assistants:r.assistants,previewPath:f?.path,upload:p})]}),!n&&f?l.jsx("aside",{className:"knowledge-preview",children:l.jsx(rc,{embedded:!0})}):null]})}const CC=5,EC=24*3600*1e3;function Fi(n,a){const r=a.trim();return r?n.name.includes(r)||n.duty.includes(r)||(n.last?.text??"").includes(r):!0}function yb(n,a){return(a.last?.at??"").localeCompare(n.last?.at??"")}const kb=n=>n.status==="running"||n.status==="queued"||n.status==="waiting";function AC(n,a){return(a.startedAt??a.createdAt).localeCompare(n.startedAt??n.createdAt)}function MC(n,a){return(a.endedAt??a.createdAt).localeCompare(n.endedAt??n.createdAt)}function jb(n){const a=Ch(n.schedules[0]??"");return a.kind==="raw"?1440:a.hour*60+a.minute}function zC(n,a=Date.now()){const r=n.query.trim().length>0,o=new Date(a-EC).toISOString(),c=Object.values(n.jobs),f=n.assistants.filter(E=>E.pinned&&!E.hidden&&Fi(E,n.query)),h=n.assistants.filter(E=>!E.pinned&&!E.hidden&&Fi(E,n.query)).sort(yb),m=n.assistants.filter(E=>E.hidden&&Fi(E,n.query)).sort(yb),p=r?[]:Object.values(n.approvals).filter(E=>E.status==="pending").sort((E,S)=>S.createdAt.localeCompare(E.createdAt)),g=r?[]:c.filter(kb).sort(AC),v=r?[]:c.filter(E=>!kb(E)&&(E.endedAt??E.createdAt)>o).sort(MC).slice(0,CC),b=r?[]:n.routines.filter(E=>E.active).sort((E,S)=>jb(E)-jb(S)),j=!r&&!p.length&&!g.length&&!h.length&&!m.length&&!v.length&&!b.length;return{searching:r,pins:f,rows:h,hidden:m,asks:p,live:g,recent:v,routines:b,empty:j}}function Mt(n,a,r,o,c,f,h,m){return Mt.fromTZ(Mt.tp(n,a,r,o,c,f,h),m)}Mt.fromTZISO=(n,a,r)=>Mt.fromTZ(OC(n,a),r);Mt.fromTZ=function(n,a){let r=new Date(Date.UTC(n.y,n.m-1,n.d,n.h,n.i,n.s)),o=Tf(n.tz,r),c=new Date(r.getTime()-o),f=Tf(n.tz,c);if(f-o===0)return c;{let h=new Date(r.getTime()-f),m=Tf(n.tz,h);if(m-f===0||!a&&m-f>0)return h;if(a)throw new Error("Invalid date passed to fromTZ()");return c}};Mt.toTZ=function(n,a){let r=n.toLocaleString("en-US",{timeZone:a}).replace(/[\u202f]/," "),o=new Date(r);return{y:o.getFullYear(),m:o.getMonth()+1,d:o.getDate(),h:o.getHours(),i:o.getMinutes(),s:o.getSeconds(),tz:a}};Mt.tp=(n,a,r,o,c,f,h)=>({y:n,m:a,d:r,h:o,i:c,s:f,tz:h});function Tf(n,a=new Date){let r=a.toLocaleString("en-US",{timeZone:n,timeZoneName:"shortOffset"}).split(" ").slice(-1)[0],o=a.toLocaleString("en-US").replace(/[\u202f]/," ");return Date.parse(`${o} GMT`)-Date.parse(`${o} ${r}`)}function OC(n,a){let r=new Date(Date.parse(n));if(isNaN(r))throw new Error("minitz: Invalid ISO8601 passed to parser.");let o=n.substring(9);return n.includes("Z")||o.includes("-")||o.includes("+")?Mt.tp(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),"Etc/UTC"):Mt.tp(r.getFullYear(),r.getMonth()+1,r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),a)}Mt.minitz=Mt;var Mh=32,Wi=31|Mh,ry=[1,2,4,8,16],wb=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(n,a){this.pattern=n,this.timezone=a,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw new TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let n=this.pattern.replace(/\s+/g," ").split(" ");if(n.length<5||n.length>6)throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five or six space separated parts are required.");if(n.length===5&&n.unshift("0"),n[3].indexOf("L")>=0&&(n[3]=n[3].replace("L",""),this.lastDayOfMonth=!0),n[3]=="*"&&(this.starDOM=!0),n[4].length>=3&&(n[4]=this.replaceAlphaMonths(n[4])),n[5].length>=3&&(n[5]=this.replaceAlphaDays(n[5])),n[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0){let a=new kn(new Date,this.timezone).getDate(!0);n[0]=n[0].replace("?",a.getSeconds().toString()),n[1]=n[1].replace("?",a.getMinutes().toString()),n[2]=n[2].replace("?",a.getHours().toString()),this.starDOM||(n[3]=n[3].replace("?",a.getDate().toString())),n[4]=n[4].replace("?",(a.getMonth()+1).toString()),this.starDOW||(n[5]=n[5].replace("?",a.getDay().toString()))}this.throwAtIllegalCharacters(n),this.partToArray("second",n[0],0,1),this.partToArray("minute",n[1],0,1),this.partToArray("hour",n[2],0,1),this.partToArray("day",n[3],-1,1),this.partToArray("month",n[4],-1,1),this.partToArray("dayOfWeek",n[5],0,Wi),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(n,a,r,o){let c=this[n],f=n==="day"&&this.lastDayOfMonth;if(a===""&&!f)throw new TypeError("CronPattern: configuration entry "+n+" ("+a+") is empty, check for trailing spaces.");if(a==="*")return c.fill(o);let h=a.split(",");if(h.length>1)for(let m=0;m<h.length;m++)this.partToArray(n,h[m],r,o);else a.indexOf("-")!==-1&&a.indexOf("/")!==-1?this.handleRangeWithStepping(a,n,r,o):a.indexOf("-")!==-1?this.handleRange(a,n,r,o):a.indexOf("/")!==-1?this.handleStepping(a,n,r,o):a!==""&&this.handleNumber(a,n,r,o)}throwAtIllegalCharacters(n){for(let a=0;a<n.length;a++)if((a===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(n[a]))throw new TypeError("CronPattern: configuration entry "+a+" ("+n[a]+") contains illegal characters.")}handleNumber(n,a,r,o){let c=this.extractNth(n,a),f=parseInt(c[0],10)+r;if(isNaN(f))throw new TypeError("CronPattern: "+a+" is not a number: '"+n+"'");this.setPart(a,f,c[1]||o)}setPart(n,a,r){if(!Object.prototype.hasOwnProperty.call(this,n))throw new TypeError("CronPattern: Invalid part specified: "+n);if(n==="dayOfWeek"){if(a===7&&(a=0),a<0||a>6)throw new RangeError("CronPattern: Invalid value for dayOfWeek: "+a);this.setNthWeekdayOfMonth(a,r);return}if(n==="second"||n==="minute"){if(a<0||a>=60)throw new RangeError("CronPattern: Invalid value for "+n+": "+a)}else if(n==="hour"){if(a<0||a>=24)throw new RangeError("CronPattern: Invalid value for "+n+": "+a)}else if(n==="day"){if(a<0||a>=31)throw new RangeError("CronPattern: Invalid value for "+n+": "+a)}else if(n==="month"&&(a<0||a>=12))throw new RangeError("CronPattern: Invalid value for "+n+": "+a);this[n][a]=r}handleRangeWithStepping(n,a,r,o){let c=this.extractNth(n,a),f=c[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(f===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+n+"'");let[,h,m,p]=f,g=parseInt(h,10)+r,v=parseInt(m,10)+r,b=parseInt(p,10);if(isNaN(g))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(v))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(b))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(b===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(b>this[a].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[a].length+")");if(g>v)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let j=g;j<=v;j+=b)this.setPart(a,j,c[1]||o)}extractNth(n,a){let r=n,o;if(r.includes("#")){if(a!=="dayOfWeek")throw new Error("CronPattern: nth (#) only allowed in day-of-week field");o=r.split("#")[1],r=r.split("#")[0]}return[r,o]}handleRange(n,a,r,o){let c=this.extractNth(n,a),f=c[0].split("-");if(f.length!==2)throw new TypeError("CronPattern: Syntax error, illegal range: '"+n+"'");let h=parseInt(f[0],10)+r,m=parseInt(f[1],10)+r;if(isNaN(h))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(m))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(h>m)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let p=h;p<=m;p++)this.setPart(a,p,c[1]||o)}handleStepping(n,a,r,o){let c=this.extractNth(n,a),f=c[0].split("/");if(f.length!==2)throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+n+"'");f[0]===""&&(f[0]="*");let h=0;f[0]!=="*"&&(h=parseInt(f[0],10)+r);let m=parseInt(f[1],10);if(isNaN(m))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(m===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(m>this[a].length)throw new TypeError("CronPattern: Syntax error, max steps for part is ("+this[a].length+")");for(let p=h;p<this[a].length;p+=m)this.setPart(a,p,c[1]||o)}replaceAlphaDays(n){return n.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaMonths(n){return n.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(n){let a=n.trim().toLowerCase();return a==="@yearly"||a==="@annually"?"0 0 1 1 *":a==="@monthly"?"0 0 1 * *":a==="@weekly"?"0 0 * * 0":a==="@daily"?"0 0 * * *":a==="@hourly"?"0 * * * *":n}setNthWeekdayOfMonth(n,a){if(typeof a!="number"&&a==="L")this.dayOfWeek[n]=this.dayOfWeek[n]|Mh;else if(a===Wi)this.dayOfWeek[n]=Wi;else if(a<6&&a>0)this.dayOfWeek[n]=this.dayOfWeek[n]|ry[a-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${a}, Type: ${typeof a}`)}},Nb=[31,28,31,30,31,30,31,31,30,31,30,31],xs=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],kn=class oy{tz;ms;second;minute;hour;day;month;year;constructor(a,r){if(this.tz=r,a&&a instanceof Date)if(!isNaN(a))this.fromDate(a);else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");else if(a===void 0)this.fromDate(new Date);else if(a&&typeof a=="string")this.fromString(a);else if(a instanceof oy)this.fromCronDate(a);else throw new TypeError("CronDate: Invalid type ("+typeof a+") passed to CronDate constructor")}isNthWeekdayOfMonth(a,r,o,c){let f=new Date(Date.UTC(a,r,o)).getUTCDay(),h=0;for(let m=1;m<=o;m++)new Date(Date.UTC(a,r,m)).getUTCDay()===f&&h++;if(c&Wi&&ry[h-1]&c)return!0;if(c&Mh){let m=new Date(Date.UTC(a,r+1,0)).getUTCDate();for(let p=o+1;p<=m;p++)if(new Date(Date.UTC(a,r,p)).getUTCDay()===f)return!1;return!0}return!1}fromDate(a){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes()+this.tz,this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),this.apply();else{let r=Mt.toTZ(a,this.tz);this.ms=a.getMilliseconds(),this.second=r.s,this.minute=r.i,this.hour=r.h,this.day=r.d,this.month=r.m-1,this.year=r.y}else this.ms=a.getMilliseconds(),this.second=a.getSeconds(),this.minute=a.getMinutes(),this.hour=a.getHours(),this.day=a.getDate(),this.month=a.getMonth(),this.year=a.getFullYear()}fromCronDate(a){this.tz=a.tz,this.year=a.year,this.month=a.month,this.day=a.day,this.hour=a.hour,this.minute=a.minute,this.second=a.second,this.ms=a.ms}apply(){if(this.month>11||this.day>Nb[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let a=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes(),this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),!0}else return!1}fromString(a){if(typeof this.tz=="number"){let r=Mt.fromTZISO(a);this.ms=r.getUTCMilliseconds(),this.second=r.getUTCSeconds(),this.minute=r.getUTCMinutes(),this.hour=r.getUTCHours(),this.day=r.getUTCDate(),this.month=r.getUTCMonth(),this.year=r.getUTCFullYear(),this.apply()}else return this.fromDate(Mt.fromTZISO(a,this.tz))}findNext(a,r,o,c){let f=this[r],h;o.lastDayOfMonth&&(this.month!==1?h=Nb[this.month]:h=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let m=!o.starDOW&&r=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let p=this[r]+c;p<o[r].length;p++){let g=o[r][p];if(r==="day"&&o.lastDayOfMonth&&p-c==h&&(g=1),r==="day"&&!o.starDOW){let v=o.dayOfWeek[(m+(p-c-1))%7];if(v&&v&Wi)v=this.isNthWeekdayOfMonth(this.year,this.month,p-c,v)?1:0;else if(v)throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${v}`);a.legacyMode&&!o.starDOM?g=g||v:g=g&&v}if(g)return this[r]=p-c,f!==this[r]?2:1}return 3}recurse(a,r,o){let c=this.findNext(r,xs[o][0],a,xs[o][2]);if(c>1){let f=o+1;for(;f<xs.length;)this[xs[f][0]]=-xs[f][2],f++;if(c===3)return this[xs[o][1]]++,this[xs[o][0]]=-xs[o][2],this.apply(),this.recurse(a,r,0);if(this.apply())return this.recurse(a,r,o-1)}return o+=1,o>=xs.length?this:this.year>=3e3?null:this.recurse(a,r,o)}increment(a,r,o){return this.second+=r.interval!==void 0&&r.interval>1&&o?r.interval:1,this.ms=0,this.apply(),this.recurse(a,r,0)}getDate(a){return a||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):Mt.fromTZ(Mt.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function _C(n){if(n===void 0&&(n={}),delete n.name,n.legacyMode=n.legacyMode===void 0?!0:n.legacyMode,n.paused=n.paused===void 0?!1:n.paused,n.maxRuns=n.maxRuns===void 0?1/0:n.maxRuns,n.catch=n.catch===void 0?!1:n.catch,n.interval=n.interval===void 0?0:parseInt(n.interval.toString(),10),n.utcOffset=n.utcOffset===void 0?void 0:parseInt(n.utcOffset.toString(),10),n.unref=n.unref===void 0?!1:n.unref,n.startAt&&(n.startAt=new kn(n.startAt,n.timezone)),n.stopAt&&(n.stopAt=new kn(n.stopAt,n.timezone)),n.interval!==null){if(isNaN(n.interval))throw new Error("CronOptions: Supplied value for interval is not a number");if(n.interval<0)throw new Error("CronOptions: Supplied value for interval can not be negative")}if(n.utcOffset!==void 0){if(isNaN(n.utcOffset))throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(n.utcOffset<-870||n.utcOffset>870)throw new Error("CronOptions: utcOffset out of bounds.");if(n.utcOffset!==void 0&&n.timezone)throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(n.unref!==!0&&n.unref!==!1)throw new Error("CronOptions: Unref should be either true, false or undefined(false).");return n}function Zi(n){return Object.prototype.toString.call(n)==="[object Function]"||typeof n=="function"||n instanceof Function}function RC(n){return Zi(n)}function DC(n){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(n):n&&typeof n.unref<"u"&&n.unref()}var Sb=30*1e3,ec=[],$C=class{name;options;_states;fn;constructor(n,a,r){let o,c;if(Zi(a))c=a;else if(typeof a=="object")o=a;else if(a!==void 0)throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(Zi(r))c=r;else if(typeof r=="object")o=r;else if(r!==void 0)throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=o?.name,this.options=_C(o),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:o?o.maxRuns:void 0,paused:o?o.paused:!1,pattern:new wb("* * * * *")},n&&(n instanceof Date||typeof n=="string"&&n.indexOf(":")>0)?this._states.once=new kn(n,this.options.timezone||this.options.utcOffset):this._states.pattern=new wb(n,this.options.timezone),this.name){if(ec.find(f=>f.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");ec.push(this)}return c!==void 0&&RC(c)&&(this.fn=c,this.schedule()),this}nextRun(n){let a=this._next(n);return a?a.getDate(!1):null}nextRuns(n,a){this._states.maxRuns!==void 0&&n>this._states.maxRuns&&(n=this._states.maxRuns);let r=[],o=a||this._states.currentRun||void 0;for(;n--&&(o=this.nextRun(o));)r.push(o);return r}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let n=this.nextRun(this._states.currentRun),a=!this._states.paused,r=this.fn!==void 0,o=!this._states.kill;return a&&r&&o&&n!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(n){let a=this._next(n);return a?n instanceof kn||n instanceof Date?a.getTime()-n.getTime():a.getTime()-new kn(n).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let n=ec.indexOf(this);n>=0&&ec.splice(n,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(n){if(n&&this.fn)throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");n&&(this.fn=n);let a=this.msToNext(),r=this.nextRun(this._states.currentRun);return a==null||isNaN(a)||r===null?this:(a>Sb&&(a=Sb),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),a),this._states.currentTimeout&&this.options.unref&&DC(this._states.currentTimeout),this)}async _trigger(n){if(this._states.blocking=!0,this._states.currentRun=new kn(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(a){Zi(this.options.catch)&&this.options.catch(a,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new kn(n,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(n){let a=new Date,r=!this._states.paused&&a.getTime()>=n.getTime(),o=this._states.blocking&&this.options.protect;r&&!o?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):r&&o&&Zi(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(n){let a=!!(n||this._states.currentRun),r=!1;!n&&this.options.startAt&&this.options.interval&&([n,a]=this._calculatePreviousRun(n,a),r=!n),n=new kn(n,this.options.timezone||this.options.utcOffset),this.options.startAt&&n&&n.getTime()<this.options.startAt.getTime()&&(n=this.options.startAt);let o=this._states.once||new kn(n,this.options.timezone||this.options.utcOffset);return!r&&o!==this._states.once&&(o=o.increment(this._states.pattern,this.options,a)),this._states.once&&this._states.once.getTime()<=n.getTime()||o===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&o.getTime()>=this.options.stopAt.getTime()?null:o}_calculatePreviousRun(n,a){let r=new kn(void 0,this.options.timezone||this.options.utcOffset),o=n;if(this.options.startAt.getTime()<=r.getTime()){o=this.options.startAt;let c=o.getTime()+this.options.interval*1e3;for(;c<=r.getTime();)o=new kn(o,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),c=o.getTime()+this.options.interval*1e3;a=!0}return o===null&&(o=void 0),[o,a]}};function cy(n,a,r=new Date){let o;for(const c of n)if(c.active)for(const f of c.schedules)try{const h=new $C(f,{timezone:a}).nextRun(r);h&&(!o||h<o.at)&&(o={routine:c,at:h})}catch{}return o}function zh(n,a,r,o){const c=a.filter(f=>f.assistantId===n.id);return r.some(f=>f.status==="pending"&&(f.assistantId===n.id||c.some(h=>h.id===f.jobId)))||c.some(f=>f.status==="waiting")?"等你确认":n.busy||c.some(f=>f.status==="running")||o.some(f=>f.status==="running"&&(f.from===n.id||f.to===n.id))?"执行中":c.some(f=>f.status==="queued")?"排队中":"空闲"}function UC(n,a){const r=n.filter(h=>h.assistantId===a),o=r.filter(h=>["running","queued","waiting"].includes(h.status)).sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0],c=r.filter(h=>!["running","queued","waiting"].includes(h.status)&&h.endedAt).sort((h,m)=>m.endedAt.localeCompare(h.endedAt))[0],f=r.filter(h=>h.status==="running").sort((h,m)=>(m.startedAt??m.createdAt).localeCompare(h.startedAt??h.createdAt))[0];return{active:o,running:f,last:c,recent:r.sort((h,m)=>m.createdAt.localeCompare(h.createdAt)).slice(0,20)}}function uy(n,a,r=new Date){const o=b=>new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"}).format(b),c=o(n),[f,h,m]=o(r).split("-").map(Number),p=new Date(Date.UTC(f,h-1,m+1)).toISOString().slice(0,10),g=new Intl.DateTimeFormat("zh-CN",{timeZone:a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(n);return c===o(r)?`今天 ${g}`:c===p?`明天 ${g}`:`${new Intl.DateTimeFormat("zh-CN",{timeZone:a,month:"numeric",day:"numeric"}).format(n)} ${g}`}function LC(n,a,r=new Date){if(!n.length)return"没有";const o=cy(n,a,r);return o?`${n.length} 个 · ${uy(o.at,a,r)}`:`${n.length} 个 · ${n.some(c=>c.active)?"无下次执行时间":"已暂停"}`}function HC(n,a,r){return{skills:n?`${n} 个`:"没有",knowledge:a.length?a.join("、"):"未开启",rules:r?`${r} 条`:"没有"}}function BC(n,a=new Date){const r=new Date(a.getFullYear(),a.getMonth(),a.getDate());return r.setDate(r.getDate()-(r.getDay()+6)%7),{week:n.filter(o=>new Date(o.updatedAt)>=r),older:n.filter(o=>new Date(o.updatedAt)<r)}}function Tb(n,a=new Date){return`${n.uses?`用过 ${n.uses} 次${n.lastUsedAt?` · 上次${on(n.lastUsedAt,a)}`:""}`:"还没用过"} · 第 ${n.version} 版`}function dy(n){let a=n.trim();for(;;){const o=a.replace(/^cd\s+(?:"[^"]*"|'[^']*'|[^\s;&|]+)\s*(?:&&|;)\s*/,"").replace(/^timeout\s+(?:-[ks]\s+\S+\s+|-\S+\s+)*\d+(?:\.\d+)?[smhd]?\s+/,"");if(o===a)break;a=o}const r=qC.exec(a);if(r){let o=r[2];const c=Cb(o);if(c){let[f,h]=c;const m=/^(?:ba)?sh\s+-l?c\s+/.exec(f),p=m?Cb(f.slice(m[0].length)):void 0;p&&(f=p[0]+p[1]),o=f+h}a=`${r[1]}: ${dy(o)}`}return a||n.trim()}const qC=/^ssh\s+(?:-[BbcDEeFIiJLlmOoPpQRSWw]\s*\S+\s+|-[46AaCfGgKkMNnqsTtVvXxYy]+\s+)*([^\s'"-]\S*)\s+(.+)$/s;function Cb(n){const a=/^'([^']*)'?/.exec(n)??/^"((?:[^"\\]|\\.)*)"?/s.exec(n);return a?[n[0]==='"'?a[1].replace(/\\(["\\$`])/g,"$1"):a[1],n.slice(a[0].length)]:void 0}function IC(){return l.jsx("div",{className:"sidebar-loading",role:"status",children:l.jsx(Fn,{text:"正在读取…"})})}function YC(){const n=je(),a=n.sel??"hob",r=n.profiles[a],o=r?.assistant??n.assistants.find(M=>M.id===a),c=n.routines.filter(M=>M.assistantId===a),f=n.assistantSkills[a],[h,m]=y.useState("任务"),[p,g]=y.useState(""),[v,b]=y.useState(!n.knowledge.collectionsLoaded),j=n.sidebarJobs?.[a],E=n.sidebarFiles?.[a],S=E?.items??[],T=Object.values({...Object.fromEntries((j?.items??[]).map(M=>[M.id,M])),...n.jobs}).filter(M=>M.assistantId===a).sort((M,L)=>L.createdAt.localeCompare(M.createdAt)),z=y.useRef(null),A=y.useRef(!1);(!z.current||z.current.aid!==a)&&(z.current={aid:a,ids:new Set},A.current=!1);const $=j?.loaded?new Set(T.filter(M=>!z.current.ids.has(M.id)).map(M=>M.id)):new Set;y.useEffect(()=>{if(!j?.loaded){A.current=!1;return}T.forEach(M=>z.current?.ids.add(M.id)),A.current=!0}),y.useEffect(()=>{m("任务"),bs(a),gf(a)},[a]),y.useEffect(()=>{WN().catch(M=>g(M instanceof Error?M.message:String(M))).finally(()=>b(!1))},[]),y.useEffect(()=>{h==="文件"&&vf(a)},[a,h]);const D=h==="任务"?j:E,V=y.useRef(null);y.useEffect(()=>{const M=V.current;if(!M||!D?.hasMore||D.loading||D.error)return;const L=new IntersectionObserver(J=>{J.some(te=>te.isIntersecting)&&(h==="任务"?gf(a,!0):vf(a,!0))},{root:M.closest(".panel")});return L.observe(M),()=>L.disconnect()},[a,h,D?.hasMore,D?.loading,D?.error,D?.cursor]);const N=(o?.knowledge??[]).map(M=>n.knowledge.collections.find(L=>L.id===M)?.name).filter(M=>!!M),k=HC(f?.skills.length??0,N,r?.rules.length??0),C=BC(S);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"group-card sidebar-info",children:[l.jsxs("button",{className:"sidebar-instructions",onClick:fh,children:[l.jsx("small",{children:"补充说明"}),l.jsx("span",{className:o?.instructions?"":"muted",children:o?.instructions||"添加这个助手特有的做法"}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Qo("routines"),children:[l.jsx(X,{name:"clock",size:15}),l.jsx("span",{children:"定时任务"}),l.jsx("small",{children:LC(c,n.settings.settings.general.timezone)}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Qo("skills"),children:[l.jsx(X,{name:"mem",size:15}),l.jsx("span",{children:"技能"}),l.jsx("small",{children:f?.error?"加载失败":f?.loaded?k.skills:l.jsx(Fn,{text:"正在加载…"},a)}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Qo("knowledge"),children:[l.jsx(X,{name:"archive",size:15}),l.jsx("span",{children:"知识库"}),l.jsx("small",{children:p?"加载失败":v?l.jsx(Fn,{text:"正在加载…"}):k.knowledge}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Qo("rules"),children:[l.jsx(X,{name:"rule",size:15}),l.jsx("span",{children:"执行前确认"}),l.jsx("small",{children:k.rules}),l.jsx("b",{children:"›"})]})]}),l.jsx("div",{className:"sidebar-tabs",children:l.jsx("div",{className:"seg",style:{"--seg-count":2,"--seg-index":["任务","文件"].indexOf(h)},children:["任务","文件"].map(M=>l.jsx("button",{className:h===M?"on":"",onClick:()=>m(M),children:M},M))})}),l.jsx("div",{className:"sidebar-tab-content",children:l.jsxs("div",{className:"group-card sidebar-list",children:[h==="任务"?T.map(M=>l.jsx("div",{className:`srow${A.current&&$.has(M.id)?" enter":""}`,children:l.jsx("div",{className:"srowclip",children:l.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Un(M.id),children:[Ah(M.status,16),l.jsxs("span",{children:[l.jsxs("strong",{children:[M.routineId?"⏱ ":"",M.title]}),l.jsxs("small",{children:[on(M.startedAt??M.createdAt),M.status==="running"||M.status==="waiting"?` · 已进行 ${mr(M.startedAt??M.createdAt)}`:M.durationMs!==void 0?` · 用时 ${Ll(M.durationMs)}`:""]})]}),l.jsx("b",{children:"›"})]})})},M.id)):[["本周",C.week],["更早",C.older]].map(([M,L])=>L.length?l.jsxs("div",{children:[l.jsx("div",{className:"sidebar-group-label",children:M}),L.map(J=>l.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Ct(J.path,J.name),children:[l.jsx(X,{name:$l(J.name),size:18}),l.jsxs("span",{children:[l.jsx("strong",{children:J.name}),l.jsxs("small",{children:[Va(J.size)," · ",on(J.updatedAt)]})]}),l.jsx("b",{children:"›"})]},J.id))]},M):null),D?.loaded&&!(h==="任务"?T.length:S.length)&&!D.error?l.jsx(ze,{children:h==="任务"?"分派的任务会显示在这里":"还没有产出文件"}):null,D?.error?l.jsxs("div",{className:"badline",children:["加载失败:",D.error," ",l.jsx("button",{onClick:()=>void(h==="任务"?gf(a,D.failedMore):vf(a,D.failedMore)),children:"重试"})]}):null,!D?.loaded&&!D?.error||D?.loadingMore?l.jsx(IC,{}):null,D?.hasMore&&!D.error?l.jsx("div",{ref:V}):null]})},h)]})}const _a=["off","minimal","low","medium","high","xhigh","max"];function fy(n){return n?.thinkingLevels??["off"]}function ir(n,a){const r=fy(n);if(!n||r.includes(a))return a;const o=_a.indexOf(a);return[...r].reverse().find(c=>_a.indexOf(c)<=o)??"off"}function GC(n,a){const r=a.trim().toLowerCase();return r?n.filter(o=>o.name.toLowerCase().includes(r)||o.ref.toLowerCase().includes(r)):n}function KC(n){const a=[];for(const r of n){let o=a.find(c=>c.provider===r.provider);o||(o={provider:r.provider,models:[]},a.push(o)),o.models.push(r)}return a}function VC(){const[n,a]=y.useState({screens:[],profiles:{}});return y.useEffect(()=>{if(Ol){(cc()==="ready"||cc()==="deployed")&&a({screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}],profiles:{hob:"hob"}});return}let r=!0,o=0;const c=async()=>{const h=o;try{const m=await fetch("/api/desktop/screens");if(!m.ok)throw new Error("无法读取屏幕状态。");const p=await m.json();r&&a(g=>({profiles:p.profiles,screens:o===h?p.screens:g.screens}))}catch{r&&a({screens:[],profiles:{}})}},f=new EventSource("/api/events");return f.onopen=()=>{c()},f.onerror=()=>{r&&a(h=>({...h,screens:[]}))},f.onmessage=h=>{try{const m=JSON.parse(h.data);m.type==="desktop-screens"&&Array.isArray(m.screens)?(o++,a(p=>({...p,screens:m.screens}))):(m.type==="assistant"||m.type==="assistant_removed")&&c()}catch{}},()=>{r=!1,f.close()}},[]),n}async function x3(n){const a=await fetch(`/api/desktop/screens/${encodeURIComponent(n)}/start`,{method:"POST"});if(!a.ok){const r=await a.json().catch(()=>({}));throw new Error(r.error??"无法启动屏幕。")}}const XC=y.lazy(()=>ur(()=>import("./DesktopView-lixZfbYr.js"),[]).then(n=>({default:n.DesktopMini}))),ZC=y.lazy(()=>ur(()=>import("./DesktopView-lixZfbYr.js"),[]).then(n=>({default:n.DesktopView}))),QC={读:"读取",跑:"运行",改:"修改",写:"写入",搜:"搜索"};function Zf(n){return[QC[n.verb]??n.verb,n.verb==="跑"?dy(n.text):n.text]}function Qf({mobile:n=!1,page:a}){const r=je(),o=a===void 0?r.panelStack.at(-1):a,c=o&&o.kind!=="job"&&o.kind!=="jobs"&&o.kind!=="file"?o:{kind:"now"},f=c.kind,[h,m]=y.useState(!1),p=r.profiles[r.sel??"hob"]?.assistant??r.assistants.find(v=>v.id===(r.sel??"hob"));y.useEffect(()=>m(!1),[r.sel]);const g=c.kind==="routine"?r.routines.find(v=>v.id===c.id)?.name??"定时任务":f==="newRoutine"?"新建定时任务":f==="routines"?"定时任务":f==="skills"?"技能":f==="knowledge"?"知识库":f==="rules"?"执行前确认":f==="now"?"":"编辑助手";return l.jsxs("aside",{className:"panel",onScroll:v=>{if(f==="now"){const b=v.currentTarget.querySelector(".sidebar-card"),j=v.currentTarget.querySelector(".phead");m(!!b&&!!j&&b.getBoundingClientRect().bottom<=j.getBoundingClientRect().bottom)}},children:[l.jsxs(lr,{className:"phead",root:f==="now",title:l.jsx("span",{className:"t",children:f==="now"&&h&&p?l.jsxs("span",{className:"sidebar-head-identity",children:[l.jsx(rt,{sprite:p.sprite,prop:p.prop,size:24}),p.name]}):g}),children:[f==="now"?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"hob-icon-btn",title:"编辑助手",onClick:fh,children:l.jsx(X,{name:"edit",size:17})}),l.jsx("button",{className:"hob-icon-btn panel-close",title:"收起右栏",onClick:aS,children:l.jsx(X,{name:"dbl",size:17})})]}):null,f==="routines"?l.jsx("button",{className:"hob-icon-btn",title:"新建定时任务",onClick:FN,children:l.jsx(X,{name:"plus",size:17})}):null,c.kind==="routine"?l.jsx("button",{className:"hob-btn hob-btn-primary hob-btn-compact",onClick:()=>void XN(c.id),children:"立即运行"}):null]}),l.jsx("div",{className:`pbody sidebar-page-${f}`,children:f==="routine"?l.jsx(eE,{id:c.kind==="routine"?c.id:""},c.kind==="routine"?c.id:""):f==="newRoutine"?l.jsx(WC,{}):f==="assistant"?l.jsx(oE,{},r.sel??"hob"):f==="routines"?l.jsx(PC,{}):f==="skills"?l.jsx(lE,{aid:r.sel??"hob"}):f==="knowledge"?l.jsx(sE,{aid:r.sel??"hob"}):f==="rules"?l.jsx(FC,{aid:r.sel??"hob"}):l.jsxs(l.Fragment,{children:[l.jsx(JC,{}),l.jsx(YC,{})]})})]})}function JC(){const n=je(),a=n.sel??"hob",r=n.profiles[a]?.assistant??n.assistants.find(N=>N.id===a),o=Object.values(n.jobs),{running:c,last:f}=UC(o,a),h=r?zh(r,o,Object.values(n.approvals),Object.values(n.delegations)):"空闲",m=cy(n.routines.filter(N=>N.assistantId===a),n.settings.settings.general.timezone),p=VC(),g=p.profiles[n.sel??"hob"],v=!!g&&p.screens.some(N=>N.id===g&&N.running),[b,j]=y.useState(null),E=v&&n.nowWide,S=y.useRef([]);c&&(S.current=c.activity);const T=(c?.activity??S.current).slice(v&&!E?-2:-8),z=wn(!!c&&!v),A=T.map(N=>`${N.at}|${N.verb}|${N.text}`),$=y.useRef(null);$.current===null&&($.current=new Set(A));const D=new Set(A.filter(N=>!$.current.has(N)));y.useEffect(()=>{for(const N of A)$.current.add(N)});const V=(N,k,C)=>l.jsxs("button",{className:`screen ${N}`,title:k,onClick:C,children:[T.map((M,L)=>M.verb==="$"?l.jsxs("div",{className:D.has(A[L])?"new":void 0,children:[l.jsx("span",{className:"p",children:"$"})," ",M.text]},A[L]):l.jsxs("div",{className:D.has(A[L])?"new":void 0,children:[l.jsx("span",{className:"v",children:Zf(M)[0]}),Zf(M)[1]]},A[L])),l.jsx("div",{children:l.jsx("span",{className:"cur"})})]});return l.jsxs("div",{className:"group-card sidebar-card",children:[r?l.jsxs("div",{className:"sidebar-identity",children:[l.jsx(rt,{sprite:r.sprite,prop:r.prop,size:44}),l.jsxs("span",{children:[l.jsx("strong",{children:r.name}),l.jsx("small",{children:r.duty})]}),l.jsx("em",{className:h!=="空闲"?"active":"",children:l.jsx("span",{children:h},h)})]}):null,v?l.jsxs("div",{className:"now-desk",children:[l.jsxs("div",{className:"now-screen",children:[l.jsx("button",{className:"now-hit",title:E?"收起":"在侧栏展开","aria-label":E?"收起":"在侧栏展开",onClick:yf}),l.jsx(y.Suspense,{fallback:null,children:l.jsx(XC,{screen:g},g)}),l.jsx("span",{className:"now-live",children:"实时"}),l.jsxs("div",{className:"now-acts",children:[E?l.jsx("button",{className:"now-btn",title:"收起","aria-label":"收起",onClick:yf,children:l.jsx(X,{name:"shrink",size:15})}):null,l.jsx("button",{className:"now-btn",title:"全屏","aria-label":"全屏查看云桌面",onClick:()=>j("view"),children:l.jsx(X,{name:"expand",size:15})}),l.jsxs("button",{className:"now-btn txt",title:"接管云桌面",onClick:()=>j("take"),children:[l.jsx(X,{name:"pointer",size:14}),"接管"]})]})]}),c?V("strip",E?"收起":"在侧栏展开",yf):null]}):null,b&&g?l.jsx(y.Suspense,{fallback:null,children:l.jsx(ZC,{initialScreen:g,takeOver:b==="take",onClose:()=>j(null)})}):null,v?null:l.jsx("div",{className:`now-log${c?" open":""}`,inert:!c,children:l.jsx("div",{children:z.mounted&&c?V("jd-open","打开任务详情",()=>Un(c.id)):z.mounted?V("jd-open","打开任务详情",()=>{}):null})}),c?l.jsx(l.Fragment,{children:l.jsxs("div",{className:"caprow",children:[l.jsxs("span",{className:"cap",children:[c.title,c.routineId?" · 定时执行":""," · 已进行 ",mr(c.startedAt??c.createdAt)]}),l.jsx("button",{className:"more",onClick:()=>Un(c.id),children:"任务详情 ›"})]})}):l.jsxs("div",{className:"sidebar-facts",children:[f?l.jsxs("button",{onClick:()=>Un(f.id),children:["上次 ",l.jsxs("span",{children:[Ah(f.status,14),l.jsx("span",{children:f.title})]}),l.jsx("small",{children:on(f.endedAt)})]}):null,m?l.jsxs("div",{children:["下一次 ",l.jsxs("span",{children:[l.jsx("span",{"aria-hidden":"true",children:"⏱"}),l.jsx("span",{children:m.routine.name})]}),l.jsx("small",{children:uy(m.at,n.settings.settings.general.timezone)})]}):null]}),n.sel==="hob"?Object.values(n.delegations).filter(N=>N.status==="running"||N.status==="waiting").map(N=>{const k=n.assistants.find(C=>C.id===N.to);return l.jsxs("button",{className:"sidebar-delegation",onClick:()=>void uh("hob",N.id,!1),children:[k?l.jsx(rt,{sprite:k.sprite,prop:k.prop,size:22}):null,l.jsxs("span",{children:["交给「",k?.name??N.to,"」"]}),l.jsx("small",{children:l.jsx(ks,{meta:K0[N.status]})})," ›"]},N.id)}):null]})}function PC(){const n=je(),a=n.routines.filter(r=>r.assistantId===(n.sel??"hob"));return a.length?l.jsx("div",{className:"group-card sidebar-card-group card-rows",children:a.map(r=>l.jsxs("button",{className:"list-row sidebar-row",onClick:()=>b0(r.id),children:[l.jsx(X,{name:r.active?"clock":"pause",size:18}),l.jsxs("span",{children:[l.jsx("strong",{children:r.name}),l.jsx("small",{children:r.active?l.jsxs(l.Fragment,{children:[Eh(r.schedules[0]??""),r.runs[0]?l.jsxs(l.Fragment,{children:[" · 上次 ",l.jsx(ks,{meta:Pn[r.runs[0].status]})," ",on(r.runs[0].at)]}):null]}):"已暂停"})]}),l.jsx("b",{children:"›"})]},r.id))}):l.jsx(ze,{children:"这个助手还没有定时任务"})}function FC({aid:n}){const a=je().profiles[n]?.rules??[];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"note",children:"标为「需确认」的事项,助手执行前会先征求你的同意。"}),a.length?null:l.jsx(ze,{children:"还没有执行前确认事项"}),l.jsxs("div",{className:"group-card sidebar-card-group card-rows",children:[a.map(r=>l.jsx(iE,{aid:n,rule:r},r.id)),l.jsx(rE,{aid:n})]})]})}function hy({value:n,onSave:a,onRemove:r}){const[o,c]=y.useState(!1),f=Ch(n);if(!o)return l.jsxs("button",{className:"w",onClick:()=>c(!0),children:[l.jsx(X,{name:"clock",size:15}),Eh(n)]});const h=p=>{const g=f.kind==="raw"?{...f,kind:"daily"}:f;a(bT({...g,...p}))},m=`${String(f.hour).padStart(2,"0")}:${String(f.minute).padStart(2,"0")}`;return l.jsxs("div",{className:"w sched-edit",children:[l.jsxs("select",{value:f.kind,onChange:p=>h({kind:p.target.value}),children:[l.jsx("option",{value:"daily",children:"每天"}),l.jsx("option",{value:"weekly",children:"每周"}),l.jsx("option",{value:"monthly",children:"每月"}),l.jsx("option",{value:"raw",children:"自定义"})]}),f.kind==="weekly"?l.jsx("select",{value:f.weekday,onChange:p=>h({weekday:Number(p.target.value)}),children:G0.map((p,g)=>l.jsxs("option",{value:g,children:["周",p]},g))}):null,f.kind==="monthly"?l.jsx("input",{type:"number",min:1,max:28,value:f.day,onChange:p=>h({day:Number(p.target.value)||1})}):null,f.kind==="raw"?l.jsx("input",{className:"rawcron",value:f.raw,onChange:p=>a(p.target.value)}):l.jsx("input",{type:"time",value:m,onChange:p=>{const[g,v]=p.target.value.split(":").map(Number);h({hour:g||0,minute:v||0})}}),r?l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:r,children:"删除"}):null,l.jsx("button",{className:"hob-btn",onClick:()=>c(!1),children:"完成"})]})}function WC(){const n=je(),[a,r]=y.useState(""),[o,c]=y.useState(""),[f,h]=y.useState("0 9 * * *"),[m,p]=y.useState(!0),[g,v]=y.useState(""),[b,j]=y.useState(!1),E=n.sel??"hob";y.useEffect(()=>{bs(E)},[E]);const S=a.trim()!==""&&o.trim()!==""&&!b,T=async()=>{j(!0),await KN({assistantId:n.sel??"hob",name:a.trim(),instruction:o.trim(),schedules:[f],active:m,...g?{skill:g}:{}}),j(!1)};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsxs("div",{className:"ctl",children:[l.jsx("span",{children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${m?"":" off"}`,title:m?"暂停":"启用",onClick:()=>p(!m)})]})}),l.jsx("div",{className:"lbl",children:"名称"}),l.jsx("label",{className:"field",children:l.jsx("input",{autoFocus:!0,value:a,placeholder:"如「每日简报」",onChange:z=>r(z.target.value)})}),l.jsx("div",{className:"lbl",children:"任务内容"}),l.jsx("label",{className:"field",children:l.jsx("textarea",{rows:4,value:o,placeholder:"到点后交给后台任务执行的内容,写清楚需要什么结果",onChange:z=>c(z.target.value)})}),l.jsx("div",{className:"lbl",children:"执行时间"}),l.jsx("div",{className:"when",children:l.jsx(hy,{value:f,onSave:h})}),l.jsx("div",{className:"lbl",children:"技能"}),n.assistantSkills[E]?.error?l.jsxs("div",{className:"badline",children:["加载失败:",n.assistantSkills[E].error," ",l.jsx("button",{onClick:()=>void bs(E),children:"重试"})]}):null,l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsxs("select",{className:"pick","aria-label":"技能",value:g,disabled:!n.assistantSkills[E]||n.assistantSkills[E].loading||!!n.assistantSkills[E].error,onChange:z=>v(z.target.value),children:[l.jsx("option",{value:"",children:"不用技能"}),(n.assistantSkills[E]?.skills??[]).filter(z=>z.enabled).map(z=>l.jsx("option",{value:z.name,children:z.title},z.name))]})}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"sp"}),l.jsx("button",{className:"hob-btn",onClick:rr,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!S,onClick:()=>void T(),children:"创建"})]})]})}function eE({id:n}){const a=je(),r=a.routines.find(c=>c.id===n),o=r?.assistantId;return y.useEffect(()=>{o&&bs(o)},[o]),r?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${r.active?"":" off"}`,title:r.active?"暂停":"启用",onClick:()=>void wl(r.id,{active:!r.active})})]})}),l.jsx("div",{className:"lbl",children:"名称"}),l.jsx("label",{className:"field",children:l.jsx("input",{defaultValue:r.name,onBlur:c=>{const f=c.target.value.trim();f&&f!==r.name&&wl(r.id,{name:f})}})}),l.jsx("div",{className:"lbl",children:"任务内容"}),l.jsx("label",{className:"field",children:l.jsx("textarea",{rows:4,defaultValue:r.instruction,onBlur:c=>{c.target.value!==r.instruction&&wl(r.id,{instruction:c.target.value})}})}),l.jsx("div",{className:"lbl",children:"执行时间"}),l.jsxs("div",{className:"when",children:[r.schedules.map((c,f)=>l.jsx(hy,{value:c,onSave:h=>{const m=r.schedules.slice();m[f]=h,wl(r.id,{schedules:m})},onRemove:r.schedules.length>1?()=>void wl(r.id,{schedules:r.schedules.filter((h,m)=>m!==f)}):void 0},f)),l.jsxs("button",{className:"w",onClick:()=>void wl(r.id,{schedules:[...r.schedules,"0 9 * * *"]}),children:[l.jsx(X,{name:"plus",size:14}),"添加执行时间"]})]}),l.jsx("div",{className:"lbl",children:"技能"}),a.assistantSkills[r.assistantId]?.error?l.jsxs("div",{className:"badline",children:["加载失败:",a.assistantSkills[r.assistantId].error," ",l.jsx("button",{onClick:()=>void bs(r.assistantId),children:"重试"})]}):null,l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsxs("select",{className:"pick","aria-label":"技能",value:r.skill??"",disabled:!a.assistantSkills[r.assistantId]||a.assistantSkills[r.assistantId].loading||!!a.assistantSkills[r.assistantId].error,onChange:c=>void wl(r.id,{skill:c.target.value||null}),children:[l.jsx("option",{value:"",children:"不用技能"}),r.skill&&!a.assistantSkills[r.assistantId]?.skills.some(c=>c.name===r.skill&&c.enabled)?l.jsx("option",{value:r.skill,disabled:!0,children:r.skill}):null,(a.assistantSkills[r.assistantId]?.skills??[]).filter(c=>c.enabled).map(c=>l.jsx("option",{value:c.name,children:c.title},c.name))]})}),l.jsx("div",{className:"lbl",children:"运行记录"}),l.jsx("div",{className:"group-card sidebar-card-group sidebar-runs",children:r.runs.length?r.runs.map(c=>{const h=a.jobs[c.jobId]?.status??c.status,m=h==="running"||h==="queued",p=h==="failed"||h==="stuck",g=gT(c);return l.jsxs("button",{className:`run${p?" bad":""}`,onClick:()=>void PN(r.assistantId,c.jobId),children:[l.jsxs("span",{className:"rt",children:[on(c.at),g?l.jsx("small",{children:g}):null]}),l.jsx(X,{name:m?"spin":p?"close":"check",size:16,className:m?"spin":""})]},c.jobId)}):l.jsx(ze,{children:"还没有运行记录"})}),l.jsx("div",{className:"group-card sidebar-card-group sidebar-danger",style:{marginTop:18},children:l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:async()=>{window.confirm(`删除定时任务「${r.name}」?已有的运行记录会保留在对话里。`)&&(await VN(r.id),rr())},children:"删除定时任务"})})]}):l.jsx(ze,{children:"这个定时任务已不存在。"})}function pr(n){const[a,r]=y.useState(null),[o,c]=y.useState(!1);return y.useEffect(()=>{if(a!=="已保存")return;const h=setTimeout(()=>r(null),3e3);return()=>clearTimeout(h)},[a]),{save:async h=>{c(!0);const m=await hc(n,h);return c(!1),r(m??"已保存"),!m},busy:o,message:a,fail:h=>r(h)}}function gr({message:n}){return n?l.jsx("div",{role:"status",className:n==="已保存"?"okline":"badline",children:n}):null}function tc({value:n,multiline:a,placeholder:r,save:o}){const[c,f]=y.useState(n);y.useEffect(()=>f(n),[n]);const h={value:c,placeholder:r,onChange:m=>f(m.target.value),onBlur:()=>{c!==n&&o(c).then(m=>{m||f(n)})},onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),m.currentTarget.blur())}};return l.jsx("label",{className:"field",children:a?l.jsx("textarea",{rows:2,...h}):l.jsx("input",{...h})})}function tE({aid:n}){const a=je(),r=pr(n),o=a.profiles[n],[c,f]=y.useState(null);y.useEffect(()=>{ah().then(f)},[]);const h=a.settings.settings.models.roster;if(!o)return null;const m=o.assistant.models??{},p=a.settings.settings.models,g=z=>c?.models.find(A=>A.ref===z)?.name??z,v=z=>h.find(A=>A.ref===z),b=z=>void r.save({models:z}),j=z=>A=>{const $={...m};if(A){const D=z==="conversation"?p.conversation.thinking:p.work.thinking;$[z]={ref:A,thinking:ir(c?.models.find(V=>V.ref===A),v(A)?.thinking??D)}}else delete $[z];b($)},E=m.allowed??[],S=z=>{const A={...m};z.length?A.allowed=z:delete A.allowed,b(A)},T=(z,A)=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:z}),l.jsx("div",{className:"ctl",children:l.jsxs("select",{className:"pick grow",value:m[A]?.ref??"",onChange:$=>j(A)($.target.value),children:[l.jsxs("option",{value:"",children:["跟随全局(",g(A==="conversation"?p.conversation.ref:p.work.ref),")"]}),h.map($=>l.jsx("option",{value:$.ref,children:g($.ref)},$.ref))]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(gr,{message:r.message}),T("对话模型","conversation"),T("默认任务模型","work"),l.jsx("div",{className:"lbl",children:"可分派的模型"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`hob-btn${E.length?"":" hob-btn-primary"}`,onClick:()=>S([]),children:"全部"}),l.jsx("button",{className:`hob-btn${E.length?" hob-btn-primary":""}`,onClick:()=>S(h.map(z=>z.ref)),children:"指定"}),l.jsx("span",{className:"note",style:{margin:0},children:E.length?`已选 ${E.length} 个`:`可用模型共 ${h.length} 个`})]}),E.length?l.jsx("div",{className:"chips",style:{marginTop:8},children:h.map(z=>{const A=E.includes(z.ref);return l.jsx("button",{className:`chip${A?" on":""}`,onClick:()=>S(A?E.filter($=>$!==z.ref):[...E,z.ref]),children:g(z.ref)},z.ref)})}):null]})}function nE({aid:n}){const a=je(),r=pr(n),o=a.profiles[n];if(!o)return null;const c=o.assistant.abilities??{exec:!0,write:!0,image:!0},f=a.settings.settings.image.source!=="off",h=p=>void r.save({abilities:{...c,...p}}),m=(p,g,v,b)=>l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:p}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${g?"":" off"}`,title:g?"关闭":"开启",onClick:v})]}),b?l.jsx("div",{className:"note",children:b}):null]});return l.jsxs(l.Fragment,{children:[l.jsx(gr,{message:r.message}),m("执行命令",c.exec,()=>h({exec:!c.exec}),"开启后,任务可以运行命令,并可通过命令访问网络。"),m("修改文件",c.write,()=>h({write:!c.write}),"开启后,任务可以创建和修改文件。"),f?m("图像生成",c.image,()=>h({image:!c.image}),"开启后,任务可以生成图片,图片以缩略图显示在对话中。"):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctl",style:{marginTop:8},children:[l.jsx("span",{style:{fontSize:14,color:"var(--text3)"},children:"图像生成"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"tog off",disabled:!0,title:"需要先在 设置 → 图像生成 中完成配置"})]}),l.jsx("div",{className:"note",children:"需要先在 设置 → 图像生成 中完成配置。"})]}),l.jsx("div",{className:"note",children:"读取文件始终可用。"})]})}function my(){const[n,a]=y.useState(!1);return y.useEffect(()=>{const r=setTimeout(()=>a(!0),300);return()=>clearTimeout(r)},[]),l.jsx("div",{className:"sidebar-loading",role:"status",children:n?"正在加载…":null})}function sE({aid:n}){const a=je(),r=pr(n);y.useEffect(()=>{zt()},[]);const o=(a.profiles[n]?.assistant.knowledge??[]).filter(c=>a.knowledge.collections.some(f=>f.id===c));return l.jsxs(l.Fragment,{children:[l.jsx(gr,{message:r.message}),a.knowledge.error?l.jsxs("div",{className:"badline",children:["加载失败:",a.knowledge.error," ",l.jsx("button",{onClick:()=>void zt(),children:"重试"})]}):null,a.knowledge.collectionsLoaded?a.knowledge.collections.length?l.jsx("div",{className:"group-card sidebar-card-group card-rows",children:a.knowledge.collections.map(c=>l.jsxs("div",{className:"ctl",children:[l.jsx("span",{children:c.name}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${o.includes(c.id)?"":" off"}`,"aria-label":c.name,"aria-pressed":o.includes(c.id),disabled:r.busy,onClick:()=>void r.save({knowledge:o.includes(c.id)?o.filter(f=>f!==c.id):[...o,c.id]})})]},c.id))}):l.jsx(ze,{action:{label:"去知识库",onClick:hh},children:"还没有知识库"}):a.knowledge.error?null:l.jsx(my,{})]})}function lE({aid:n}){const a=je().assistantSkills[n],r=wc();y.useEffect(()=>{a?.loading||bs(n)},[n]);const o=a?.skills.find(c=>c.name===r.menu?.id);return l.jsxs(l.Fragment,{children:[a?.error?l.jsxs("div",{className:"badline",children:["加载失败:",a.error," ",l.jsx("button",{onClick:()=>void bs(n),children:"重试"})]}):null,a?.loaded?a.skills.length?l.jsx("div",{className:"group-card sidebar-card-group card-rows",children:a.skills.map(c=>l.jsxs("div",{className:"list-row assistant-skill",children:[l.jsxs("button",{className:"assistant-skill-info",onClick:()=>Ct(c.path),title:`${c.description} · ${Tb(c)}`,children:[l.jsx("strong",{children:c.title}),l.jsxs("span",{children:[c.description," · ",Tb(c)]})]}),l.jsx("button",{className:`tog${c.enabled?"":" off"}`,"aria-label":c.title,"aria-pressed":c.enabled,onClick:()=>void pf(n,c.name,c.enabled?"disable":"enable")}),l.jsx("button",{className:"knowledge-dots","aria-label":`${c.title}的操作`,onClick:f=>r.toggle(c.name,f.currentTarget),children:l.jsx(X,{name:"more",size:18})})]},c.name))}):l.jsx(ze,{children:"还没有技能。任务完成后会自动沉淀,也可以在任务详情里点「沉淀成技能」。"}):a?.error?null:l.jsx(my,{}),o&&r.menu&&cr.createPortal(l.jsxs("div",{className:"amenu knowledge-popup",ref:r.box,children:[l.jsx("button",{onClick:()=>{r.close(),Ct(o.path)},children:"查看"}),o.version>1?l.jsx("button",{onClick:()=>{r.close(),pf(n,o.name,"rollback")},children:"回退到上一版"}):null,l.jsx("button",{onClick:()=>{r.close(),window.confirm(`删除「${o.title}」?`)&&pf(n,o.name,"delete")},children:"删除"})]}),document.body)]})}function aE({aid:n,sprite:a,prop:r,onDone:o}){const c=pr(n),f=E0(a)??{prop:"hob",color:"slate"},h=m=>{m!==a&&c.save({sprite:m})};return l.jsxs(l.Fragment,{children:[l.jsx(gr,{message:c.message}),l.jsxs("div",{className:"sprite-pick",children:[r?l.jsx("button",{className:f.prop==="custom"?"on":void 0,title:"自画道具",onClick:()=>h(kf(f.color)),children:l.jsx(rt,{sprite:kf(f.color),prop:r,size:34})}):null,mS.map(m=>l.jsx("button",{className:m===f.prop?"on":void 0,title:_l[m].label,onClick:()=>h(jf(m,f.color)),children:l.jsx(rt,{sprite:jf(m,f.color),size:34})},m))]}),l.jsxs("div",{className:"sprite-colors",children:[pS.map(m=>l.jsx("button",{className:m===f.color?"on":void 0,title:Ba[m].name,style:{background:Ba[m].o},onClick:()=>h(f.prop==="custom"?kf(m):jf(f.prop,m))},m)),l.jsx("button",{className:"hob-btn",onClick:o,children:"完成"})]})]})}function iE({aid:n,rule:a}){const[r,o]=y.useState(!1),[c,f]=y.useState(a.text),[h,m]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(null),j=y.useRef(!1);y.useEffect(()=>{if(v!=="已保存")return;const T=setTimeout(()=>b(null),3e3);return()=>clearTimeout(T)},[v]);const E=async T=>{g(!0);const z=await QN(n,{id:a.id,...T});g(!1),b(z??"已保存"),z||o(!1)},S=()=>{if(j.current){j.current=!1;return}const T=c.trim();if(T===a.text){o(!1);return}if(!T){b("规则内容不能为空。");return}E({text:T})};return l.jsxs("div",{className:"rule-wrap",children:[l.jsxs("div",{className:"rule",children:[r?l.jsx("input",{className:"rule-input",autoFocus:!0,value:c,maxLength:1e3,disabled:p,onChange:T=>f(T.target.value),onBlur:S,onKeyDown:T=>{T.key==="Enter"&&T.currentTarget.blur(),T.key==="Escape"&&(j.current=!0,f(a.text),o(!1))}}):l.jsx("button",{className:"rule-text",onClick:()=>{j.current=!1,f(a.text),o(!0)},disabled:p,title:"编辑规则",children:a.text}),l.jsxs("span",{className:"v",children:[l.jsx("button",{className:`rule-mode ${a.mode}`,disabled:p,onClick:()=>void E({mode:a.mode==="ask"?"allow":"ask"}),title:"切换确认方式",children:a.mode==="ask"?"需确认":"直接执行"}),l.jsx("button",{className:"del",title:"删除这条规则",disabled:p,onClick:()=>m(!0),children:l.jsx(X,{name:"close",size:13})})]})]}),h?l.jsxs("div",{className:"rule-confirm",children:[l.jsx("span",{children:"确定删除这条规则?"}),l.jsx("button",{className:"hob-btn",onClick:()=>m(!1),children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void JN(n,a.id),children:"确认删除"})]}):null,v?l.jsx("div",{className:v==="已保存"?"okline":"badline",role:"status",children:v}):null]})}function rE({aid:n}){const[a,r]=y.useState(!1),[o,c]=y.useState(""),[f,h]=y.useState("ask"),[m,p]=y.useState(!1),[g,v]=y.useState(null);y.useEffect(()=>{if(g!=="已保存")return;const E=setTimeout(()=>v(null),3e3);return()=>clearTimeout(E)},[g]);const b=()=>{r(!1),c(""),h("ask"),v(null)},j=async()=>{if(m||!o.trim())return;p(!0),v(null);const E=await ZN(n,o.trim(),f);if(p(!1),E){v(E);return}c(""),h("ask"),r(!1),v("已保存")};return l.jsxs("div",{className:"rule-wrap",children:[a?l.jsxs("form",{className:"rule-new",onSubmit:E=>{E.preventDefault(),j()},onKeyDown:E=>{E.key==="Escape"&&!m&&(E.preventDefault(),b())},children:[l.jsx("input",{className:"rule-input",autoFocus:!0,"aria-label":"规则文字",placeholder:"输入规则内容",maxLength:1e3,value:o,disabled:m,onChange:E=>c(E.target.value)}),l.jsxs("div",{className:"ctl",children:[l.jsxs("select",{className:"pick","aria-label":"规则确认方式",value:f,disabled:m,onChange:E=>h(E.target.value),children:[l.jsx("option",{value:"ask",children:"需确认"}),l.jsx("option",{value:"allow",children:"直接执行"})]}),l.jsx("span",{className:"sp"}),l.jsx("button",{type:"button",className:"hob-btn",disabled:m,onClick:b,children:"取消"}),l.jsx("button",{type:"submit",className:"hob-btn hob-btn-primary",disabled:m||!o.trim(),children:m?"正在保存…":"保存"})]})]}):l.jsx("button",{className:"rule-add",onClick:()=>{v(null),r(!0)},children:"+ 新增规则"}),g?l.jsx("div",{className:g==="已保存"?"okline":"badline",role:"status",children:g}):null]})}function oE(){const n=je(),a=n.sel??"hob",r=n.profiles[a],[o,c]=y.useState(!1),[f,h]=y.useState(!1),m=pr(a);if(!r)return l.jsx(ze,{children:l.jsx(Fn,{text:"正在读取档案…"})});const p=r.assistant;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"bigav",children:l.jsx(rt,{sprite:p.sprite,prop:p.prop,size:96,motion:"home",onClick:()=>c(g=>!g),title:"换头像"})}),l.jsx("div",{className:"avatar-hint",children:"点头像更换"}),o?l.jsx(aE,{aid:a,sprite:p.sprite,prop:p.prop,onDone:()=>c(!1)}):null,l.jsx(gr,{message:m.message}),l.jsx("div",{className:"sech",children:l.jsx("span",{children:"基本信息"})}),l.jsxs("div",{className:"group-card sidebar-card-group",children:[l.jsx("div",{className:"lbl",children:"名字"}),l.jsx(tc,{value:p.name,save:g=>g.trim()?m.save({name:g.trim()}):(m.fail("名字不能为空。"),Promise.resolve(!1))}),l.jsx("div",{className:"lbl",children:"职责简介"}),l.jsx(tc,{value:p.duty,save:g=>m.save({duty:g})}),l.jsx("div",{className:"lbl",children:"详细职责"}),l.jsx(tc,{multiline:!0,value:p.dutyLong??"",save:g=>m.save({dutyLong:g})}),l.jsx("div",{className:"lbl",children:"补充说明"}),l.jsx(tc,{multiline:!0,value:p.instructions,placeholder:"这个助手特有的做法,如“周报先列要点再展开”",save:g=>m.save({instructions:g})})]})]}),l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"sech",children:l.jsx("span",{children:"模型"})}),l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsx(tE,{aid:a})}),l.jsx("div",{className:"sech",children:l.jsx("span",{children:"能力"})}),l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsx(nE,{aid:a})})]}),l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"sech",children:l.jsx("span",{children:"通知与位置"})}),l.jsxs("div",{className:"group-card sidebar-card-group",children:[l.jsx("div",{className:"lbl",children:"通知"}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"需要确认时通知我"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${p.notify?"":" off"}`,title:p.notify?"关闭通知":"开启通知",disabled:m.busy,onClick:()=>void m.save({notify:!p.notify})})]}),l.jsx("div",{className:"note",children:"要在手机上接收推送,请先在 设置 → 通知 中开启本机推送。"}),p.primary?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"位置"}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"放在顶部"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${p.pinned?"":" off"}`,title:p.pinned?"取消置顶":"放在顶部",disabled:m.busy,onClick:()=>void m.save({pinned:!p.pinned})})]})]}),p.primary?null:l.jsx("div",{className:"mergebar",children:l.jsx("button",{className:"hob-btn",onClick:()=>void m.save({hidden:!p.hidden}),children:p.hidden?"放回列表":"收起这个助手"})})]})]}),p.primary?null:l.jsxs("div",{className:"pgroup",children:[l.jsx("div",{className:"sech",children:l.jsx("span",{children:"危险操作"})}),l.jsx("div",{className:"mergebar sidebar-group",children:f?l.jsxs("div",{className:"mergeconfirm",children:["归档「",p.name,"」?它会从列表中移除,定时任务一并停掉。对话、规则和历史任务都留着,不会转给 Hob。",l.jsxs("div",{className:"acts",children:[l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void IN(a),children:"确认归档"}),l.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"取消"})]})]}):l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>h(!0),children:"归档这个助手"})})]})]})}function Eb(n,a){return zh(a,Object.values(n.jobs),Object.values(n.approvals),Object.values(n.delegations))!=="空闲"}function Oh(n){const a=je();return!n||!Eb(a,n)?{busy:!1,slot:0}:{busy:!0,slot:a.assistants.filter(r=>Eb(a,r)).findIndex(r=>r.id===n.id)}}function py(n,a){const r=je();if(zh(n,Object.values(r.jobs),Object.values(r.approvals),Object.values(r.delegations))==="等你确认")return"ask";const o=Object.values(r.jobs).filter(c=>c.assistantId===n.id&&c.endedAt&&(!n.readAt||c.endedAt>n.readAt)).sort((c,f)=>(f.endedAt??"").localeCompare(c.endedAt??""))[0];if(n.unread>0&&o&&(o.status==="stuck"||o.status==="failed"))return"stuck";if(a)return"busy";if(n.unread>0&&o?.status==="done")return"done"}function gy({a:n,sel:a,size:r=52}){const o=S0(n),{busy:c,slot:f}=Oh(n),h=py(n,c);return l.jsxs("button",{className:`pin${a?" sel":""}`,...o.handlers,onClick:()=>{o.takeHeld()||Vt(n.id)},children:[l.jsx(rt,{sprite:n.sprite,prop:n.prop,size:r,motion:c&&!a?"peek":void 0,slot:f,mark:h}),l.jsx("div",{className:"nm",children:n.name}),l.jsx("div",{className:"sub",children:n.duty})]})}function vy(n){return n===1?{cls:" n1",size:72}:n===2?{cls:" n2",size:62}:{cls:"",size:52}}function Ab({a:n,sel:a,size:r=42,onClick:o}){const c=S0(n),{busy:f,slot:h}=Oh(n),m=py(n,f);return l.jsxs("button",{className:`list-row home-row${a?" sel":""}`,...c.handlers,onClick:()=>{c.takeHeld()||(o?o():Vt(n.id))},children:[l.jsx(rt,{sprite:n.sprite,prop:n.prop,size:r,motion:f&&!a?"peek":void 0,slot:h,mark:m}),l.jsxs("div",{className:"main",children:[l.jsxs("div",{className:"l1",children:[l.jsx("span",{className:"nm",children:n.name}),l.jsx("span",{className:"tm",children:ic(n.last?.at)})]}),l.jsx("div",{className:"pv",children:n.last?La(n.last.text):n.duty})]})]})}function cE(n,a){const r=n.activity.at(-1);return[a?.name,r?Zf(r).join(" "):""].filter(Boolean).join(" · ")}function Mb(n,a){or(),a&&Vt(n.assistantId),Un(n.id)}function zb({job:n,owner:a,time:r,text:o,size:c,onClick:f,moving:h}){return l.jsxs("button",{className:"list-row home-row job",onClick:f,children:[l.jsx(Jf,{owner:a,size:c,moving:h}),l.jsxs("span",{className:"nm",children:[n.routineId?l.jsx(X,{name:"clock",size:14}):null,n.title]}),l.jsx("span",{className:"tm",children:r}),l.jsx("span",{className:"pv",children:La(o)}),l.jsx(ks,{meta:Pn[n.status]})]})}function za({title:n,more:a,children:r}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"gt",children:[l.jsx("span",{children:n}),a]}),r]})}function Jf({owner:n,size:a,moving:r}){const{slot:o}=Oh(n);return n?l.jsx(rt,{sprite:n.sprite,prop:n.prop,size:a,motion:r?"peek":void 0,slot:o}):l.jsx("span",{style:{width:a,flex:"none"}})}function Ob({title:n,text:a}){return l.jsx(za,{title:n,children:l.jsx(ze,{children:a})})}function xy({size:n=42,markSel:a=!1}){const r=je(),[o,c]=y.useState(!0),f=zC(r),h=v=>r.assistants.find(b=>b.id===v),m=!o||f.searching,p=new Set,g=v=>{const b=h(v.assistantId);return!b?.hidden||m||a&&b.id===r.sel||p.has(b.id)?!1:(p.add(b.id),!0)};return l.jsxs(l.Fragment,{children:[f.asks.length?l.jsx(za,{title:"等你确认",children:f.asks.map(v=>l.jsxs("button",{className:"list-row home-row",onClick:()=>void Vt(v.assistantId),children:[l.jsx(Jf,{owner:h(v.assistantId),size:n}),l.jsxs("div",{className:"main",children:[l.jsxs("div",{className:"l1",children:[l.jsx("span",{className:"nm",children:v.title}),l.jsx("span",{className:"tm",children:ic(v.createdAt)})]}),l.jsxs("div",{className:"pv",children:[h(v.assistantId)?.name??""," · 等待你的选择"]})]})]},v.id))}):null,f.live.length?l.jsx(za,{title:"进行中",children:f.live.map(v=>l.jsx(zb,{job:v,owner:h(v.assistantId),moving:g(v),time:mr(v.startedAt??v.createdAt),text:cE(v,h(v.assistantId)),size:n,onClick:()=>Mb(v,h(v.assistantId))},v.id))}):null,f.rows.length||f.hidden.length?l.jsxs(za,{title:"日常",children:[f.rows.map(v=>l.jsx(Ab,{a:v,size:n,sel:a&&v.id===r.sel},v.id)),f.hidden.length&&!f.searching?l.jsxs("button",{className:"fold",onClick:()=>c(v=>!v),children:[l.jsx("span",{children:"收起的助手"}),l.jsxs("span",{children:[f.hidden.length,l.jsx(X,{name:o?"chev":"down",size:13})]})]}):null,l.jsx("div",{className:`expand${m?" open":""}`,inert:!m,children:l.jsx("div",{children:f.hidden.map(v=>l.jsx(Ab,{a:v,size:n,sel:a&&v.id===r.sel},v.id))})})]}):null,f.recent.length?l.jsx(za,{title:"最近任务",more:l.jsx("button",{className:"more",onClick:()=>g0(),children:"全部"}),children:f.recent.map(v=>l.jsx(zb,{job:v,owner:h(v.assistantId),time:ic(v.endedAt??v.createdAt),text:v.summary||v.statusReason||"",size:n,onClick:()=>Mb(v,h(v.assistantId))},v.id))}):null,f.routines.length?l.jsx(za,{title:"定时任务",children:f.routines.map(v=>{const b=v.runs[0];return l.jsxs("button",{className:"list-row home-row",onClick:()=>{or(),Vt(v.assistantId),b0(v.id)},children:[l.jsx(Jf,{owner:h(v.assistantId),size:n}),l.jsxs("div",{className:"main",children:[l.jsxs("div",{className:"l1",children:[l.jsx("span",{className:"nm",children:v.name}),l.jsx("span",{className:"tm",children:Eh(v.schedules[0]??"")})]}),l.jsx("div",{className:"pv",children:b?l.jsxs(l.Fragment,{children:["上次运行 ",ic(b.at)," · ",l.jsx(ks,{meta:Pn[b.status]})]}):"尚未运行"})]})]},v.id)})}):null,f.empty?l.jsxs(l.Fragment,{children:[l.jsx(Ob,{title:"最近任务",text:"分派的任务会显示在这里"}),l.jsx(Ob,{title:"定时任务",text:"定时任务会显示在这里"})]}):null]})}function uE(){const n=je(),a=n.assistants.filter(o=>o.pinned&&!o.hidden&&Fi(o,n.query)),r=vy(a.length);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mhead",children:[l.jsx("button",{className:"me",title:"设置",onClick:jc,children:l.jsx(X,{name:"user",size:17})}),l.jsx("span",{className:"sp"}),n.search?l.jsxs("div",{className:"msearch",children:[l.jsx(X,{name:"search",size:15}),l.jsx("input",{autoFocus:!0,value:n.query,placeholder:"搜索助手",onChange:o=>j0(o.target.value)}),l.jsx("button",{onClick:()=>Gx(!1),title:"关闭搜索",children:l.jsx(X,{name:"close",size:14})})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"hob-icon-btn",title:"知识库",onClick:hh,children:l.jsx(X,{name:"archive",size:19})}),l.jsx("button",{className:"hob-icon-btn",title:"搜索助手",onClick:()=>Gx(!0),children:l.jsx(X,{name:"search",size:19})}),l.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:x0,children:l.jsx(X,{name:"plus",size:21})})]})]}),l.jsx("div",{className:`mpins${r.cls}`,children:a.map(o=>l.jsx(gy,{a:o,size:r.size},o.id))}),l.jsx("div",{className:"mlist",children:l.jsx(xy,{size:36})})]})}function _b({leaving:n,page:a}){return l.jsx("div",{className:`mfull${n?" leaving":""}`,children:l.jsx(Qf,{mobile:!0,page:a})})}const by={smart:[{value:25,label:"一般"},{value:50,label:"较聪明"},{value:75,label:"很聪明"},{value:100,label:"最聪明"}],cost:[{value:0,label:"免费"},{value:20,label:"很低"},{value:50,label:"中等"},{value:75,label:"较高"},{value:100,label:"特别贵"}],speed:[{value:25,label:"较慢"},{value:50,label:"中等"},{value:75,label:"较快"},{value:100,label:"很快"}]};function _h(n){const a=`${n.id} ${n.name}`;return/(?:^|[^a-z])mini|haiku|lite/i.test(a)?{smart:40,cost:10,speed:95}:/flash/i.test(a)?{smart:60,cost:20,speed:85}:/gpt[-\s]?[56](?:\D|$)|opus|pro|sol/i.test(a)?{smart:90,cost:80,speed:40}:n.reasoning?{smart:70,cost:50,speed:50}:{smart:50,cost:50,speed:60}}function Rb(n,a){return by[n].reduce((r,o)=>Math.abs(o.value-a)<Math.abs(r.value-a)?o:r).label}function yy(n){return`聪明 ${n.smart}% · 成本 ${n.cost}% · 速度 ${n.speed}%`}function Rh(n){if(n>=1e6){const a=n/1e6;return`${Number.isInteger(a)?a:a.toFixed(1)}M`}return`${Math.round(n/1e3)}K`}const dE=y.lazy(()=>ur(()=>import("./DesktopView-lixZfbYr.js"),[]).then(n=>({default:n.DesktopView})));function Fe({title:n,desc:a}){return l.jsxs("div",{className:"setintro",children:[l.jsx("div",{className:"h",children:n}),l.jsx("div",{className:"d",children:a})]})}function ys({items:n,value:a,onChange:r,disabled:o}){return l.jsx("div",{className:"seg",role:"radiogroup",style:{"--seg-count":n.length,"--seg-index":Math.max(0,n.findIndex(c=>c.key===a))},children:n.map(c=>l.jsx("button",{role:"radio","aria-checked":a===c.key,className:a===c.key?"on":void 0,onClick:()=>r(c.key),disabled:o,children:c.label},c.key))})}function be({children:n}){return l.jsx("div",{className:"group",children:n})}function ts({saved:n,error:a,children:r}){return l.jsxs("div",{className:"sfoot",children:[n&&!a?l.jsx("span",{className:"okline",children:"已保存"}):null,a?l.jsx("span",{className:"badline",children:a}):null,l.jsx("span",{className:"sp"}),r]})}function $a(){const[n,a]=y.useState(null),[r,o]=y.useState(!1);return y.useEffect(()=>{if(n!=="已保存")return;const f=setTimeout(()=>a(null),3e3);return()=>clearTimeout(f)},[n]),{save:async f=>{o(!0);const h=await lh(f);return o(!1),a(h?"已保存":Fs().notice??"保存失败,请重试。"),h},busy:r,message:n}}function Sn({message:n,toast:a=!1}){return n?l.jsx("span",{className:`${n==="已保存"?"okline":"badline"}${a?" savetoast":""}`,role:"status",children:n}):null}function Ua({value:n,placeholder:a,multiline:r,onSave:o}){const[c,f]=y.useState(n),[h,m]=y.useState(!1);y.useEffect(()=>f(n),[n]);const p=async()=>{if(h||c===n)return;m(!0);const v=await o(c);m(!1),v||f(n)},g={value:c,placeholder:a,disabled:h,onChange:v=>f(v.target.value),onBlur:()=>void p(),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),v.currentTarget.blur())}};return l.jsx("div",{className:"field",children:r?l.jsx("textarea",{...g,rows:3}):l.jsx("input",{...g})})}const Cf=[{id:"general",label:"通用"},{id:"rules",label:"规则"},{id:"providers",label:"服务商"},{id:"models",label:"模型"},{id:"memory",label:"记忆"},{id:"image",label:"图像生成"},{id:"knowledge",label:"知识库"},{id:"search",label:"联网搜索"},{id:"skills",label:"技能"},{id:"mcp",label:"MCP"},{id:"desktop",label:"云桌面"},{id:"work",label:"任务"},{id:"push",label:"通知"},{id:"about",label:"关于"}],fE=[{key:"system",label:"跟随系统"},{key:"light",label:"浅色"},{key:"dark",label:"深色"}];function hE(){return Intl.supportedValuesOf?.("timeZone")??[]}function mE({narrow:n,leaving:a}){const r=je(),o=r.section??(n?null:"general"),c=y.useRef(null);return y.useEffect(()=>{c.current?.scrollTo(0,0)},[o,r.sub]),n&&o===null?l.jsxs("div",{className:`setpage narrow${a?" leaving":""}`,children:[l.jsxs("div",{className:"sethead",children:[l.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:Uf,children:l.jsx(X,{name:"left",size:17})}),l.jsx("span",{className:"t",children:"设置"})]}),l.jsx("div",{className:"setbody",children:Cf.map(f=>l.jsxs("button",{className:"setitem",onClick:()=>zl(f.id),children:[l.jsx("span",{children:f.label}),l.jsx(X,{name:"chev",size:15})]},f.id))})]}):l.jsxs("div",{className:`setpage${n?" narrow":""}${a?" leaving":""}`,children:[n?l.jsxs("div",{className:"sethead",children:[l.jsx("button",{className:"hob-icon-btn",title:"返回",onClick:r.sub?Ht:()=>zl(null),children:l.jsx(X,{name:"left",size:17})}),l.jsx("span",{className:"t",children:r.sub?.title??Cf.find(f=>f.id===o)?.label??"设置"})]}):l.jsxs("div",{className:"setnav",children:[l.jsx("div",{className:"setnavtitle",children:"设置"}),Cf.map(f=>l.jsx("button",{className:`navrow${o===f.id?" sel":""}`,onClick:()=>zl(f.id),children:f.label},f.id)),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"navrow",onClick:Uf,children:"返回 Hob"})]}),l.jsx("div",{className:"setmain",ref:c,children:o==="rules"?l.jsx(pE,{}):o==="providers"?l.jsx(NE,{}):o==="models"?l.jsx(OE,{}):o==="memory"?l.jsx(qE,{}):o==="image"?l.jsx(KE,{}):o==="knowledge"?l.jsx(GE,{}):o==="search"?l.jsx(a3,{}):o==="skills"?l.jsx(ZE,{}):o==="mcp"?l.jsx(WE,{}):o==="desktop"?l.jsx(xE,{}):o==="work"?l.jsx($E,{}):o==="push"?l.jsx(UE,{}):o==="about"?l.jsx(r3,{}):l.jsx(bE,{})})]})}function pE(){const{rules:n,error:a,busy:r}=je().globalRules;y.useEffect(()=>{Of()},[]);const o=c=>Xw(c);return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"全局规则",desc:"所有助手和任务都遵守的规则。「执行前确认」的事项,助手执行前会征求你的确认;「一律照做」是做事的规则。每个助手自己的规则在它的档案里修改。"}),a?l.jsx("div",{className:"badline",role:"status",children:a}):null,n===null?a?l.jsx("button",{className:"hob-btn",onClick:()=>void Of(),children:"重试"}):l.jsx(ze,{children:l.jsx(Fn,{text:"正在读取全局规则…"})}):[{mode:"ask",label:"执行前确认"},{mode:"allow",label:"一律照做"}].map(({mode:c,label:f})=>l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:f}),l.jsxs("div",{className:"group-card settings-card rules-card",children:[n.filter(h=>h.mode===c).map(h=>l.jsx(gE,{rule:h,busy:r,onSave:m=>o(n.map(p=>p.id===h.id?{...p,text:m}:p)),onDelete:()=>void o(n.filter(m=>m.id!==h.id))},h.id)),l.jsx(vE,{label:f,busy:r,onAdd:h=>o([...n,{text:h,mode:c}])})]})]},c))]})}function gE({rule:n,busy:a,onSave:r,onDelete:o}){const[c,f]=y.useState(!1),[h,m]=y.useState(n.text),p=y.useRef(!1),g=()=>{if(p.current){p.current=!1;return}const b=h.trim();if(!b||b===n.text){f(!1);return}r(b).then(j=>{j&&f(!1)})},v=Date.now()-Date.parse(n.changedAt);return l.jsxs("div",{className:"rule",children:[c?l.jsx("input",{className:"rule-input","aria-label":"编辑规则",autoFocus:!0,maxLength:1e3,value:h,disabled:a,onChange:b=>m(b.target.value),onBlur:g,onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur(),b.key==="Escape"&&(p.current=!0,m(n.text),f(!1))}}):l.jsx("button",{className:"rule-text",title:"编辑规则",disabled:a,onClick:()=>{p.current=!1,m(n.text),f(!0)},children:n.text}),l.jsxs("span",{className:"v",children:[v>=0&&v<864e5?l.jsx("span",{className:"rule-recent",children:"最近修改"}):null,l.jsx("button",{className:"del","aria-label":`删除规则:${n.text}`,title:"删除这条规则",disabled:a,onClick:o,children:l.jsx(X,{name:"close",size:13})})]})]})}function vE({label:n,busy:a,onAdd:r}){const[o,c]=y.useState("");return l.jsxs("form",{className:"rule-add-form",onSubmit:f=>{f.preventDefault();const h=o.trim();h&&!a&&r(h).then(m=>{m&&c("")})},children:[l.jsx("input",{className:"rule-input","aria-label":`${n}添加规则`,placeholder:"+ 添加规则",maxLength:1e3,value:o,disabled:a,onChange:f=>c(f.target.value)}),l.jsx("button",{className:"hob-btn",type:"submit",disabled:a||!o.trim(),children:"添加"})]})}function xE(){const[n,a]=y.useState(null),[r,o]=y.useState(""),[c,f]=y.useState(""),[h,m]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(null),[j,E]=y.useState(null),[S,T]=y.useState(!1),[z,A]=y.useState(null),[$,D]=y.useState([]),V=je().assistants;y.useEffect(()=>{iN().then(te=>{a(te),o(te.url),m(te.enabled),g(!te.tokenConfigured),D(te.publicAssistants)}).catch(te=>E({ok:!1,text:`无法读取云桌面配置:${te.message}`}))},[]);const N=n?.deployed??!1,k=n!==null&&h!==n.enabled;async function C(){if(n){T(!0),E(null);try{const te=await rN({revision:n.revision,url:r,enabled:h,...c?{token:c}:{}});a(te),f(""),g(!te.tokenConfigured),E({ok:!0,text:"已保存"})}catch(te){E({ok:!1,text:te instanceof Error?te.message:String(te)})}finally{T(!1)}}}async function M(){if(n){T(!0),E(null);try{const te=await oN(n.revision,$);a(te),D(te.publicAssistants),E({ok:!0,text:"已保存"})}catch(te){E({ok:!1,text:te instanceof Error?te.message:String(te)})}finally{T(!1)}}}async function L(){T(!0),b(null);try{const te=await cN();if(!te.ok){b({ok:!1,text:te.error});return}const ke=te.health.screens.filter(me=>me.browserRunning).map(me=>me.id).join("、");b({ok:!0,text:`已连接 · ${te.health.display.width}×${te.health.display.height} · 浏览器:${ke||"无"}`})}catch(te){b({ok:!1,text:te instanceof Error?te.message:String(te)})}finally{T(!1)}}const J=v?l.jsx("span",{className:v.ok?"okline":"badline",style:v.ok?void 0:{color:"var(--danger)"},role:"status",children:v.text}):null;return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"云桌面",desc:"云桌面需要单独部署。登录 Hob 的人可以观看和接管桌面。"}),N?l.jsxs(be,{children:[l.jsx("div",{className:"note",children:"由部署配置(compose 的 desktop 服务)"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"地址"}),l.jsx("div",{className:"sline mono",children:n?.url||"未配置"}),l.jsx("div",{className:"lbl sub",children:"令牌"}),l.jsx("div",{className:"sline",children:n?.tokenConfigured?"已设置":"未设置"}),l.jsx("div",{className:"lbl sub",children:"启用"}),l.jsx("div",{className:"sline",children:n?.enabled?"已启用":"未启用"}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"hob-btn",disabled:S||!n,onClick:()=>void L(),children:"测试连接"}),l.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>A("hob"),children:"打开桌面"}),J]})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"启用"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`tog${h?"":" off"}`,"aria-label":"启用云桌面","aria-pressed":h,disabled:!n,onClick:()=>m(!h)}),l.jsx("span",{className:"note",children:(h?"已启用。登录 Hob 的人可以观看桌面,接管后可以操作。":"未启用。界面不打开桌面,任务也不能使用桌面。")+(k?"(保存后生效)":"")})]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"连接"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:r,disabled:!n||S,onChange:te=>o(te.target.value),placeholder:"http://127.0.0.1:6080"})}),l.jsx("div",{className:"lbl sub",children:"令牌"}),l.jsx("div",{className:`expand settings-motion${p?" open":""}`,inert:!p,children:l.jsx("div",{children:l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:c,disabled:!n||S,onChange:te=>f(te.target.value),placeholder:n?.tokenConfigured?"已保存,留空则沿用":"云桌面的访问令牌"})})})}),l.jsx("div",{className:`expand settings-motion${p?"":" open"}`,inert:p,children:l.jsx("div",{children:l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:"已设置"}),l.jsx("button",{className:"hob-btn",disabled:S,onClick:()=>g(!0),children:"更换"})]})})}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"hob-btn",disabled:S||!n,onClick:()=>void L(),children:"测试连接"}),J??l.jsx("span",{className:"note",children:"测试地址、令牌和云桌面是否可用。"})]})]}),l.jsxs("div",{className:"note",children:["部署说明见 ",l.jsx("a",{href:"https://github.com/FFatTiger/hob#云桌面",target:"_blank",rel:"noreferrer",children:"云桌面文档"}),"。"]}),l.jsxs("div",{className:"sfoot",children:[j?l.jsx("span",{className:j.ok?"okline":"badline",role:"status",children:j.text}):null,l.jsx("span",{className:"sp"}),l.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>A("hob"),children:"打开桌面"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:S||!n,onClick:()=>void C(),children:"保存"})]})]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"公共屏幕"}),l.jsx("div",{className:"note",children:"用于登录你自己的账号,勾选的助手可以使用。受 Google 限制,目前无法登录 Google 账号。"}),l.jsxs("div",{className:"formcard",children:[V.map(te=>l.jsxs("label",{className:"ctl",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:$.includes(te.id),disabled:S||!n,onChange:ke=>D(me=>ke.target.checked?[...me,te.id]:me.filter(Ne=>Ne!==te.id))}),l.jsx("span",{children:te.name})]},te.id)),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"hob-btn",disabled:!n?.enabled||S,onClick:()=>A("public"),children:"打开公共屏幕"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!n||S,onClick:()=>void M(),children:"保存公共屏幕设置"}),j?l.jsx("span",{className:j.ok?"okline":"badline",role:"status",children:j.text}):null]})]})]}),z?l.jsx(y.Suspense,{fallback:null,children:l.jsx(dE,{initialScreen:z,takeOver:z==="public",onClose:()=>A(null)})}):null]})}function bE(){const n=je(),a=n.settings.settings.general.aboutYou,r=$a(),o=$a(),c=$a(),[f,h]=y.useState(null);return y.useEffect(()=>{if(!f)return;const m=setTimeout(()=>h(null),4e3);return()=>clearTimeout(m)},[f]),l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"通用",desc:"主题、时区、个人信息、登录密码。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"主题"}),l.jsx(ys,{items:fE,value:n.theme,disabled:r.busy,onChange:m=>void r.save({general:{theme:m}})}),l.jsx(Sn,{message:r.message})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"时区"}),l.jsx(yE,{value:n.settings.settings.general.timezone,onSave:m=>o.save({general:{timezone:m}})}),l.jsx(Sn,{message:o.message}),l.jsx("div",{className:"note",children:"助手的「现在时间」和定时任务都按这个时区算。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"展示页面"}),l.jsx("button",{className:`tog${n.settings.settings.general.showPage===!1?" off":""}`,"aria-label":"展示页面","aria-pressed":n.settings.settings.general.showPage!==!1,disabled:r.busy,onClick:()=>void r.save({general:{showPage:n.settings.settings.general.showPage===!1}})}),l.jsx(Sn,{message:r.message}),l.jsx("div",{className:"note",children:"允许助手把适合可视化的内容展示为页面。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"个人信息"}),l.jsx("div",{className:"lbl sub",children:"称呼"}),l.jsx(Ua,{placeholder:"如「王先生」",value:a.name,onSave:m=>c.save({general:{aboutYou:{name:m.trim()}}})}),l.jsx("div",{className:"lbl sub",children:"语言"}),l.jsx(Ua,{placeholder:"如「中文」",value:a.language,onSave:m=>c.save({general:{aboutYou:{language:m.trim()}}})}),l.jsx("div",{className:"lbl sub",children:"其他"}),l.jsx(Ua,{multiline:!0,placeholder:"如「不要看融资新闻」",value:a.notes,onSave:m=>c.save({general:{aboutYou:{notes:m}}})}),l.jsx(Sn,{message:c.message}),l.jsx("div",{className:"note",children:"所有助手都会参考这些信息;未填写的项不使用。"})]}),l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx(kE,{onDone:h}),f?l.jsx("div",{className:"note",children:f}):null]})})]})}function yE({value:n,onSave:a}){const r=hE(),[o,c]=y.useState(n),[f,h]=y.useState(!1),[m,p]=y.useState(null),g=y.useRef(null);y.useEffect(()=>c(n),[n]),y.useEffect(()=>{if(!f)return;const j=E=>{g.current?.contains(E.target)||h(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[f]);const v=r.filter(j=>j.toLowerCase().includes(o.trim().toLowerCase())).slice(0,40),b=j=>{h(!1),p(null),c(j),j!==n&&a(j).then(E=>{E||c(n)})};return l.jsxs("div",{className:"tz",ref:g,children:[l.jsx("label",{className:"field",children:l.jsx("input",{value:o,placeholder:"搜索时区,如 Berlin",onFocus:()=>h(!0),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),j.currentTarget.blur())},onChange:j=>{c(j.target.value),h(!0)},onBlur:()=>{o.trim()!==n&&(r.includes(o.trim())?b(o.trim()):(c(n),p("时区无效,请从列表中选择。")))}})}),m?l.jsx("div",{className:"badline",role:"status",children:m}):null,f&&v.length?l.jsx("div",{className:"tzlist",children:v.map(j=>l.jsx("button",{className:j===n?"sel":"",onMouseDown:()=>b(j),children:j},j))}):null]})}function kE({onDone:n}){const[a,r]=y.useState(""),[o,c]=y.useState(""),[f,h]=y.useState(""),[m,p]=y.useState(!1),g=async()=>{if(m)return;if(!a||!o){n("请填写旧密码和新密码。");return}if(o!==f){n("两次输入的新密码不一致。");return}p(!0);const v=await Kw(a,o);if(p(!1),v){n(`修改失败:${v}`);return}r(""),c(""),h(""),n("密码已修改。")};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"登录密码"}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",placeholder:"旧密码",value:a,onChange:v=>r(v.target.value)})}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",placeholder:"新密码",value:o,onChange:v=>c(v.target.value)})}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",placeholder:"再次输入新密码",value:f,onChange:v=>h(v.target.value)})}),l.jsxs(ts,{saved:!1,error:null,children:[a||o||f?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"hob-btn",disabled:m||!(a||o||f),onClick:()=>{r(""),c(""),h(""),n("")},children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void g(),disabled:m||!a||!o||!f,children:m?"正在验证…":"保存"})]})]})}function ky({value:n,options:a,label:r,icon:o,onChange:c}){return l.jsxs("span",{className:"ctl",children:[o?l.jsx(X,{name:o,size:14}):null,l.jsx("select",{className:"pick","aria-label":r,value:n,onChange:f=>c(f.target.value),children:a.map(f=>l.jsx("option",{value:f.value,children:f.text},f.value))})]})}function jy({value:n,model:a,onChange:r}){const o=fy(a);return o.length===1?null:l.jsx(ky,{value:n,label:"思考强度",icon:"bulb",options:o.map(c=>({value:c,text:sc[c]})),onChange:r})}function Db({modelRef:n,info:a,disabled:r,onSaved:o}){const[c,f]=y.useState(!1),[h,m]=y.useState(null),[p,g]=y.useState(""),[v,b]=y.useState(!1),[j,E]=y.useState(null),[S,T]=y.useState(!1);y.useEffect(()=>{if(!S)return;const k=setTimeout(()=>T(!1),3e3);return()=>clearTimeout(k)},[S]);const z=h??a.levels,A=_a.filter(k=>!z.some(C=>C.level===k)),$=h!==null,D=k=>{m(k.slice().sort((C,M)=>_a.indexOf(C.level)-_a.indexOf(M.level))),E(null),T(!1)},V=async k=>{b(!0),E(null);const C=await Pw(n,k);if(b(!1),!C.ok){m(null),E(C.error);return}m(null),T(!0),o(C.thinking,C.settings)},N=(k=z)=>{const C={};for(const M of _a){const L=k.find(J=>J.level===M);C[M]=L?L.text.trim():null}V(C)};return l.jsxs("div",{className:"think-levels",children:[l.jsxs("button",{className:"thinkhead",onClick:()=>f(k=>!k),disabled:v,children:[l.jsx("span",{className:"lbl sub",children:"思考档"}),l.jsxs("span",{className:"note",children:[z.length," 档",a.custom?" · 有自定义":" · 默认"]}),l.jsx(X,{name:c?"down":"chev",size:14})]}),l.jsx("div",{className:`expand${c?" open":""}`,inert:!c,children:l.jsxs("div",{children:[l.jsx("div",{className:"thinkrows",children:z.map(k=>l.jsxs("div",{className:"thinkrow",children:[l.jsx("span",{className:"tname",children:sc[k.level]}),l.jsx("input",{className:"ttext",value:k.text,placeholder:"默认",title:"留空就按服务商协议的默认值发",onChange:C=>D(z.map(M=>M.level===k.level?{...M,text:C.target.value}:M)),onBlur:()=>{$&&N()},onKeyDown:C=>{C.key==="Enter"&&C.currentTarget.blur()},disabled:v||r}),k.level==="off"?l.jsx("span",{className:"rremove still",title:"关闭这一档不能删","aria-hidden":!0}):l.jsx("button",{className:"rremove",title:`删掉「${sc[k.level]}」`,onClick:()=>N(z.filter(C=>C.level!==k.level)),disabled:v||r,children:l.jsx(X,{name:"close",size:13})})]},k.level))}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[l.jsxs("select",{className:"pick",value:p,onChange:k=>g(k.target.value),disabled:v||r||!A.length,"aria-label":"添加思考档",children:[l.jsx("option",{value:"",children:A.length?"选择档位":"七个档都用上了"}),A.map(k=>l.jsx("option",{value:k,children:sc[k]},k))]}),l.jsx("button",{className:"hob-btn",onClick:()=>{p&&(N([...z,{level:p,text:""}]),g(""))},disabled:v||r||!p,children:"添加思考档"}),l.jsx("span",{className:"sp"}),a.custom?l.jsx("button",{className:"hob-btn",onClick:()=>void V(null),disabled:v||r,children:"恢复默认"}):null]}),l.jsx("div",{className:"note",children:"留空就按服务商协议的默认值发;填了才按你写的发(例如 DeepSeek 的「中」填 high)。 关闭这一档不能删,其余档删掉后不再出现在思考强度里。"}),j?l.jsx("div",{className:"badline",children:j}):null,S?l.jsx("div",{className:"okline",children:"已保存思考档"}):null]})})]})}function wy({info:n}){const a=Rh(n.contextWindow);return l.jsxs("span",{className:"caps",children:[n.input.includes("image")?l.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:l.jsx(X,{name:"image",size:14})}):null,n.reasoning?l.jsx("span",{title:"支持推理","aria-label":"支持推理",children:l.jsx(X,{name:"bulb",size:14})}):null,l.jsx("span",{className:"ctx",title:`上下文 ${a}`,children:a})]})}const Ny=[{key:"openai-completions",label:"OpenAI 兼容"},{key:"openai-responses",label:"OpenAI Responses 兼容"},{key:"anthropic-messages",label:"Anthropic 兼容"},{key:"google-generative-ai",label:"Google 兼容"}],jE=Object.fromEntries(Ny.map(n=>[n.key,n.label])),nc=128e3,Ef=n=>n.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),wE={literal:"包含 Key",env:"包含 Key",command:"需手动填写",none:"无 Key"};function NE(){const a=je().sub,[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),[p,g]=y.useState({}),v=(E,S)=>g(T=>({...T,[E]:S}));if(y.useEffect(()=>{Jw().then(E=>E.ok?o(E.view):f(E.error))},[]),y.useEffect(()=>{a&&m(null)},[a]),y.useEffect(()=>{r&&g(E=>Object.fromEntries(Object.entries(E).filter(([S])=>r.providers.some(T=>T.id===S))))},[r]),c)return l.jsx("div",{className:"note",children:c});if(!r)return l.jsx(ze,{children:"正在读取服务商…"});const b=(E,S)=>{S.startsWith("已导入")&&g({}),o(E),m(S),Ht()},j=(E,S,T)=>{o(z=>z&&{...z,settings:T,models:{...z.models,[E]:(z.models[E]??[]).map(A=>A.ref===S.ref?S:A)}})};return a?.kind==="provider"?l.jsx(CE,{id:a.id,view:r,onView:o,onSaved:b,onThinking:j,onConnection:v}):a?.kind==="addProvider"?l.jsx(EE,{view:r,onSaved:b,onConnection:v}):a?.kind==="importProviders"?l.jsx(AE,{onSaved:b}):l.jsx(SE,{view:r,notice:h,connectionStatus:p})}function SE({view:n,notice:a,connectionStatus:r}){const o=f=>n.builtin.find(h=>h.id===f)?.name??f,c=f=>f.kind==="builtin"?o(f.id):f.name;return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"服务商",desc:"模型服务商与 API Key。内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。API Key 只保存在本机,保存后不再显示。"}),l.jsx(TE,{}),l.jsxs(be,{children:[l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>Tn({kind:"addProvider",title:"添加服务商"}),children:"添加服务商"})}),l.jsx("div",{className:"lbl",children:"已配置的服务商"}),l.jsxs("div",{className:"group-card settings-card",children:[n.providers.map(f=>l.jsxs("button",{className:"list-row setting-row",onClick:()=>Tn({kind:"provider",id:f.id,title:c(f)}),children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname",children:c(f)}),l.jsx("div",{className:"rprov",children:f.kind==="builtin"?"内置服务商":"兼容接口"})]}),l.jsx("span",{className:f.keyConfigured&&r[f.id]!=="failed"?"note":"badline",children:f.keyConfigured?`${r[f.id]==="connected"?"已连接":r[f.id]==="failed"?"连接失败":"未验证"} · ${n.models[f.id]?.length??0} 个模型`:"未填 Key"}),l.jsx(X,{name:"chev",size:15,className:"rgo"})]},f.id)),l.jsxs("button",{className:"maddrow",onClick:()=>Tn({kind:"importProviders",title:"从本机导入"}),children:[l.jsx(X,{name:"doc",size:16}),"从本机导入"]})]}),n.providers.length?null:l.jsx(ze,{children:"尚未添加其他服务商。"}),l.jsx("div",{className:"note",children:"从本机导入会只读本机配置并一次性复制到 Hob,不会修改来源。"}),a?l.jsx("div",{className:"okline",children:a}):null]})]})}function TE(){const[n,a]=y.useState(null),[r,o]=y.useState({enabled:!1,plan:"pro",executable:""}),[c,f]=y.useState(!1),[h,m]=y.useState("");async function p(b=!1){f(!0),m("");try{const j=await Zw();a(j),b&&o(j.settings.settings.claude??{enabled:!1,plan:"pro",executable:""})}catch(j){m(j instanceof Error?j.message:String(j))}finally{f(!1)}}y.useEffect(()=>{p(!0)},[]);async function g(){f(!0),m("");try{a(await Qw(r)),m("已保存")}catch(b){m(b instanceof Error?b.message:String(b))}finally{f(!1)}}const v=n?.status;return l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"Claude 订阅(经本机 Claude Code)"}),l.jsxs("div",{className:"formcard",children:[l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`tog${r.enabled?"":" off"}`,"aria-label":"启用 Claude 订阅","aria-pressed":r.enabled,disabled:!n||c,onClick:()=>o({...r,enabled:!r.enabled})}),l.jsxs("span",{className:"note",children:[r.enabled?"已启用":"未启用",n&&r.enabled!==(n.settings.settings.claude?.enabled??!1)?"(保存后生效)":""]})]}),l.jsx("div",{className:"lbl sub",children:"状态"}),l.jsx("div",{className:v?.loggedIn?"okline":"badline",role:"status",children:v?v.found?v.error?v.error:v.loggedIn?`已登录${v.version?` · ${v.version}`:""}${v.plan?` · ${v.plan}`:""}${v.email?` · ${v.email}`:""}`:`未登录${v.version?` · ${v.version}`:""},当前不可用。`:"未找到 Claude Code,当前不可用。":"正在检测…"}),v?.found&&!v.loggedIn?l.jsxs("div",{className:"note",children:["请在终端执行 ",l.jsx("code",{children:"claude auth login"}),",然后重新检测。"]}):null,l.jsx("div",{className:"lbl sub",children:"套餐"}),l.jsxs("select",{className:"pick",value:r.plan,disabled:c||!n,onChange:b=>o({...r,plan:b.target.value}),children:[l.jsx("option",{value:"pro",children:"Pro"}),l.jsx("option",{value:"max",children:"Max"})]}),l.jsx("div",{className:"lbl sub",children:"Claude Code 程序路径"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:r.executable,disabled:c||!n,onChange:b=>o({...r,executable:b.target.value}),placeholder:v?.executable||"留空时自动查找"})}),l.jsx("div",{className:"note",children:"用量计入你的 Claude 订阅额度,与 Claude Code 共用。Docker 镜像不支持此功能。"}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:12},children:[l.jsx("button",{className:"hob-btn",disabled:c,onClick:()=>void p(),children:"重新检测"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:c||!n,onClick:()=>void g(),children:"保存"}),h?l.jsx("span",{className:"note",role:"status",children:h}):null]})]})]})}function CE({id:n,view:a,onView:r,onSaved:o,onThinking:c,onConnection:f}){const h=a.providers.find(p=>p.id===n);if(y.useEffect(()=>{h||Ht()},[h]),!h)return null;const m=h.kind==="builtin"?{kind:"builtin",isNew:!1,id:h.id,key:""}:{kind:"custom",isNew:!1,id:h.id,name:h.name,api:h.api,baseUrl:h.baseUrl,key:"",models:h.models};return l.jsx(Sy,{view:a,initial:m,onSaved:o,onView:r,onConnection:f,onThinking:(p,g)=>c(n,p,g),extra:l.jsx(ME,{view:a,provider:h,onDeleted:p=>{r(p),Ht()}})})}function EE({view:n,onSaved:a,onConnection:r}){const[o,c]=y.useState(null),[f,h]=y.useState(null),m=n.builtin.filter(g=>!n.providers.some(v=>v.id===g.id));if(o===null)return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"服务商"}),l.jsx(Fe,{title:"添加服务商",desc:"内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。"}),l.jsx(be,{children:l.jsxs("div",{className:"group-card settings-card",children:[l.jsxs("button",{className:"list-row model-row",onClick:()=>c("builtin"),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:"内置服务商"}),l.jsx("span",{className:"sp"}),l.jsx(X,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"提供完整的模型目录,填写 API Key 即可。"})]}),l.jsxs("button",{className:"list-row model-row",onClick:()=>c("custom"),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:"兼容接口"}),l.jsx("span",{className:"sp"}),l.jsx(X,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"填写服务地址、协议与模型;模型列表可从接口获取。"})]})]})})]});if(o==="builtin"&&f===null)return l.jsxs(l.Fragment,{children:[l.jsxs("button",{className:"subback",onClick:()=>c(null),children:[l.jsx(X,{name:"left",size:15}),"添加服务商"]}),l.jsx(Fe,{title:"选择内置服务商",desc:"选择服务商后填写 API Key。"}),l.jsx(be,{children:l.jsx("div",{className:"group-card settings-card",children:m.length?m.map(g=>l.jsxs("button",{className:"list-row model-row",onClick:()=>h(g.id),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:g.name}),l.jsx("span",{className:"sp"}),l.jsx(X,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"内置服务商"})]},g.id)):l.jsx(ze,{children:"所有内置服务商均已添加。"})})})]});const p=o==="builtin"?{kind:"builtin",isNew:!0,id:f??"",key:""}:{kind:"custom",isNew:!0,id:"",name:"",api:"openai-completions",baseUrl:"",key:"",models:[]};return l.jsx(Sy,{view:n,initial:p,onSaved:a,onConnection:r,onThinking:()=>{}})}function AE({onSaved:n}){const[a,r]=y.useState(null),[o,c]=y.useState(new Set),[f,h]=y.useState(!1),[m,p]=y.useState(null);y.useEffect(()=>{eN().then(b=>{if(!b.ok){p(b.error);return}r(b.view),c(new Set(b.view.items.filter(j=>j.selectable&&!j.exists).map(j=>j.id)))})},[]);const g=b=>c(j=>{const E=new Set(j);return E.has(b)?E.delete(b):E.add(b),E}),v=async()=>{if(f||!o.size)return;h(!0),p(null);const b=[...o],j=await tN(b);if(h(!1),!j.ok){p(j.error);return}n(j.view,`已导入 ${b.length} 个服务商`)};return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"服务商"}),l.jsx(Fe,{title:"从本机导入",desc:"读取本机其他客户端保存的服务商配置。来源文件只读,导入后 Key 存入 Hob,不再显示。"}),a===null?m?null:l.jsx(ze,{children:"正在读取…"}):l.jsxs(be,{children:[l.jsxs("div",{className:"sline",children:["来源:",a.source]}),a.items.length?l.jsx("div",{className:"group-card settings-card",style:{marginTop:8},children:a.items.map(b=>l.jsxs("label",{className:`list-row setting-row${b.selectable?"":" gone"}`,children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:o.has(b.id),disabled:!b.selectable||f,onChange:()=>g(b.id)}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[b.id,l.jsxs("span",{className:"rtags",children:[l.jsx("span",{className:"rtag",children:b.kind==="builtin"?"内置服务商":`兼容接口${b.api?` · ${jE[b.api]}`:""}`}),b.models?l.jsxs("span",{className:"rtag",children:[b.models," 个模型"]}):null,b.exists?l.jsx("span",{className:"rtag",children:"将覆盖"}):null]})]}),b.baseUrl?l.jsx("div",{className:"rprov",children:b.baseUrl}):null,l.jsx("div",{className:"rfoot",children:l.jsx("span",{className:b.key==="none"&&!b.note?"rtag bad":"rtag",children:wE[b.key]})}),b.note?l.jsx("div",{className:"note",children:b.note}):null]})]},b.id))}):l.jsx(ze,{children:"未找到可导入的配置。"}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void v(),disabled:f||!o.size,children:f?"正在导入…":"导入所选"}),l.jsx("button",{className:"hob-btn",onClick:Ht,disabled:f,children:"取消"})]})]}),m?l.jsx("div",{className:"badline",children:m}):null]})}function ME({view:n,provider:a,onDeleted:r}){const[o,c]=y.useState(!1),[f,h]=y.useState(null),[m,p]=y.useState(!1),g=["conversation","work"].filter(j=>n.settings.settings.models[j].ref.startsWith(`${a.id}/`)),v=a.kind==="builtin"?n.builtin.find(j=>j.id===a.id)?.name??a.id:a.name,b=async()=>{if(o)return;c(!0),h(null);const j=await Fw(a.id);if(c(!1),!j.ok){h(j.error);return}r(j.view)};return l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"危险操作"}),l.jsx("div",{className:"group-card settings-card",children:m?l.jsxs("div",{className:"ctl",style:{padding:12,gap:8,flexWrap:"wrap"},children:[l.jsxs("span",{children:["删除「",v,"」后,该服务商的模型将不可用。",g.length?`受影响的默认模型:${g.map(j=>j==="conversation"?"对话":"任务执行").join("、")}。`:"当前默认模型不受影响。"]}),l.jsx("button",{className:"hob-btn",onClick:()=>p(!1),disabled:o,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void b(),disabled:o,children:"确认删除"})]}):l.jsx("button",{className:"mline danger",onClick:()=>p(!0),disabled:o,children:"删除服务商"})}),f?l.jsx("div",{className:"badline",children:f}):null]})}function Sy({view:n,initial:a,onSaved:r,onView:o,onConnection:c,onThinking:f,extra:h}){const m=je(),[p,g]=y.useState(a),[v,b]=y.useState(!1),[j,E]=y.useState(null);y.useEffect(()=>{if(!j||j!=="已保存")return;const K=setTimeout(()=>E(null),3e3);return()=>clearTimeout(K)},[j]);const[S,T]=y.useState([]),[z,A]=y.useState(a.isNew||!n.providers.find(K=>K.id===a.id)?.keyConfigured),[$,D]=y.useState(null),[V,N]=y.useState(null),[k,C]=y.useState(null),[M,L]=y.useState(!1),J=new Set(n.providers.map(K=>K.id)),te=K=>n.builtin.find(ie=>ie.id===K)?.name??K,ke=K=>n.models[p.id]?.find(ie=>ie.id===K),me=K=>g(ie=>({...ie,...K})),Ne=p.isNew||JSON.stringify(p)!==JSON.stringify(a),_e=p.kind==="builtin"?{kind:"builtin",id:p.id,...p.key.trim()?{apiKey:p.key.trim()}:{}}:{kind:"custom",...p.id?{id:p.id}:{},api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{}},le=JSON.stringify(_e),ve=async()=>{if(M)return;L(!0),C(null),N(null);const K=await Tx(_e);if(L(!1),!Ne&&p.id&&c(p.id,K?"failed":"connected"),K){D(null),C(K);return}D(le),N("连接成功")},pe=K=>{const ie=`${p.id}/${K.id}`,ae=m.settings.settings.models,ce=ae.roster.some(st=>st.ref===ie),xe=ae.conversation.ref===ie||ae.work.ref===ie;return l.jsxs("label",{className:"ctl",children:[l.jsx("input",{type:"checkbox",checked:ce,disabled:p.isNew||!ke(K.id)||v||M||xe,onChange:()=>{const st=ce?ae.roster.filter(Cn=>Cn.ref!==ie):[...ae.roster,{ref:ie,note:"",scores:_h({id:K.id,name:K.name??K.id,reasoning:!!K.reasoning}),scoresConfirmed:!1}];b(!0),E(null),lh({models:{roster:st}}).then(Cn=>{b(!1),E(Cn?"已保存":"保存失败,请重试。")})}}),l.jsx("span",{children:xe?"默认模型已加入":"加入可用模型"})]})},Oe=async()=>{if(p.kind!=="custom"||M)return;L(!0),C(null);const K=await Ww({api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{},...p.id?{id:p.id}:{}});if(L(!1),!K.ok){C(K.error),T([]);return}T(K.models)},Ae=async K=>{if(p.kind!=="custom")return;if(p.isNew){me({models:K});return}const ie=n.providers.find(Cn=>Cn.id===p.id);if(!ie||ie.kind!=="custom")return;L(!0),C(null);const{id:ae,keyConfigured:ce,...xe}=ie,st=await Sx(ae,{...xe,models:K});if(L(!1),!st.ok){C(st.error);return}me({models:K}),o?.(st.view),E("已保存")},bt=K=>{if(p.kind!=="custom")return;const ie=p.models.some(ae=>ae.id===K.id);Ae(ie?p.models.filter(ae=>ae.id!==K.id):[...p.models,{id:K.id,...K.name?{name:K.name}:{}}])},Ot=K=>{if(p.kind!=="custom")return;const ie=K.trim();!ie||p.models.some(ae=>ae.id===ie)||Ae([...p.models,{id:ie}])},Et=(K,ie)=>{p.kind==="custom"&&Ae(p.models.map(ae=>ae.id===K?{...ae,...ie}:ae))},R=K=>{const ie=n.models[K]??[];return ie.length?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"模型"}),l.jsx("div",{className:"group-card settings-card",children:ie.map(ae=>l.jsx("div",{className:"list-row setting-row",children:l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[ae.name,l.jsx("span",{className:"rtags",children:l.jsx("span",{className:"rtag mono",children:ae.id})})]}),l.jsxs("div",{className:"caps",children:[ae.input?.includes("image")?l.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:l.jsx(X,{name:"image",size:14})}):null,ae.reasoning?l.jsx("span",{title:"支持推理","aria-label":"支持推理",children:l.jsx(X,{name:"bulb",size:14})}):null,ae.contextWindow?l.jsx("span",{className:"ctx",children:Rh(ae.contextWindow)}):null]}),pe(ae),ae.reasoning?l.jsx(Db,{modelRef:ae.ref,info:ae,disabled:M,onSaved:f}):l.jsx("div",{className:"note",children:"不推理,没有思考档。"})]})},ae.id))}),l.jsx("div",{className:"note",children:"模型由服务商提供。会推理的模型可以改每个思考档发给服务商的字符。"})]}):null},F=async()=>{if(M)return;L(!0),C(null);const K=n.providers.find(xe=>xe.id===p.id),ie=p.kind==="builtin"?{kind:"builtin",...p.key.trim()?{key:p.key.trim()}:{}}:{kind:"custom",name:p.name.trim(),api:p.api,baseUrl:p.baseUrl.trim(),models:p.models,...K?.kind==="custom"&&K.extra?{extra:K.extra}:{},...p.key.trim()?{key:p.key.trim()}:{}},ae=p.kind==="custom"&&p.isNew?p.id.trim()||Ef(p.name):p.id;if(!ae){L(!1),C("保存失败:请填写标识。模型引用使用该标识,只能包含小写字母、数字、点和短横线,例如 my-proxy。");return}if(p.isNew&&J.has(ae)){L(!1),C("该服务商标识已存在,请使用其他标识。");return}if($!==le){N("正在验证连接…");const xe=await Tx(_e);if(N(null),xe){L(!1),C(`测试连接失败:${xe}`);return}}const ce=await Sx(ae,ie);if(L(!1),!ce.ok){C(ce.error);return}c(ae,"connected"),r(ce.view,"已保存")},ee=p.kind==="builtin"?p.isNew?"添加内置服务商":te(p.id):p.isNew?"添加兼容接口":p.name||"兼容接口",oe=p.kind==="builtin"?p.id:p.id||Ef(p.name);return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"服务商"}),l.jsx(Fe,{title:ee,desc:oe?l.jsx("span",{className:"mono",children:oe}):null}),p.kind==="builtin"?l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"连接"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"服务商"}),l.jsx("div",{className:"ctl",children:l.jsx("select",{className:"pick grow",value:p.id,onChange:K=>me({id:K.target.value}),disabled:!0,children:n.builtin.filter(K=>!p.isNew||!J.has(K.id)).map(K=>l.jsxs("option",{value:K.id,children:[K.name,J.has(K.id)?"(已配置)":""]},K.id))})}),l.jsx("div",{className:"lbl sub",children:"API Key"}),z?l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(K=>K.id===p.id)?.keyConfigured?"已保存,留空则沿用":"sk-…",onChange:K=>me({key:K.target.value}),disabled:M})}):l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:"已保存"}),l.jsx("button",{className:"hob-btn",onClick:()=>A(!0),children:"更换"})]}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"hob-btn",disabled:M,onClick:()=>void ve(),children:"测试连接"}),l.jsx("span",{className:"note",children:"测试会请求模型,可能产生费用。"}),V&&$===le?l.jsx("span",{className:"okline",children:V}):null]}),l.jsx($b,{busy:M,error:k,dirty:Ne,onCancel:Ht,onSave:()=>void F()})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"连接"}),l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl sub",children:"名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:p.name,placeholder:"如「我的代理」",onChange:K=>me({name:K.target.value}),disabled:M})}),p.isNew?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl sub",children:"标识"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:p.id,placeholder:Ef(p.name)||"my-proxy",onChange:K=>me({id:K.target.value}),disabled:M})}),l.jsx("div",{className:"note",children:"模型引用使用该标识,例如 my-proxy/gpt-x。留空则按名称自动生成。"})]}):l.jsxs("div",{className:"note mono",children:["标识:",p.id]}),l.jsx("div",{className:"lbl sub",children:"协议"}),l.jsx("div",{className:"ctl",children:l.jsx("select",{className:"pick grow",value:p.api,onChange:K=>me({api:K.target.value}),disabled:M,children:Ny.map(K=>l.jsx("option",{value:K.key,children:K.label},K.key))})}),l.jsx("div",{className:"lbl sub",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:p.baseUrl,placeholder:"http://127.0.0.1:8080/v1",onChange:K=>me({baseUrl:K.target.value}),disabled:M})}),l.jsx("div",{className:"lbl sub",children:"API Key"}),z?l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:p.key,placeholder:n.providers.find(K=>K.id===p.id)?.keyConfigured?"已保存,留空则沿用":"sk-…",onChange:K=>me({key:K.target.value}),disabled:M})}):l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:"已保存"}),l.jsx("button",{className:"hob-btn",onClick:()=>A(!0),children:"更换"})]}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap"},children:[l.jsx("button",{className:"hob-btn",disabled:M||!p.baseUrl.trim(),onClick:()=>void ve(),children:"测试连接"}),V&&$===le?l.jsx("span",{className:"okline",children:V}):null,l.jsx("button",{className:"hob-btn",onClick:()=>void Oe(),disabled:M||!p.baseUrl.trim(),children:M?"正在获取…":"获取模型列表"}),l.jsx("span",{className:"note",children:"从接口获取模型列表,选择需要使用的模型。"})]}),l.jsx($b,{busy:M,error:k,dirty:Ne,onCancel:Ht,onSave:()=>void F()})]})]}),S.length?l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"接口上的模型"}),l.jsx("div",{className:"chips",children:S.map(K=>{const ie=p.models.some(ae=>ae.id===K.id);return l.jsx("button",{className:`chip${ie?" on":""}`,onClick:()=>bt(K),disabled:M,children:K.name??K.id},K.id)})}),l.jsx("div",{className:"note",children:"点击添加或移除,添加后可在下方修改模型能力。"})]}):null,l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"模型"}),p.models.length?l.jsx("div",{className:"group-card settings-card",children:p.models.map(K=>l.jsxs("div",{className:"list-row setting-row",children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname mono",children:K.id}),l.jsxs("div",{className:"rfoot",children:[l.jsx("button",{className:`chip${K.input?.includes("image")?" on":""}`,onClick:()=>Et(K.id,{input:K.input?.includes("image")?["text"]:["text","image"]}),disabled:M,children:"支持图片输入"}),l.jsx("button",{className:`chip${K.reasoning?" on":""}`,onClick:()=>Et(K.id,{reasoning:!K.reasoning}),disabled:M,children:"支持推理"}),l.jsx("span",{className:"rtag",children:"上下文"}),l.jsx("input",{className:"pmctx",type:"number",min:1,defaultValue:K.contextWindow??nc,title:"上下文窗口(token)",onBlur:ie=>{const ae=Number(ie.target.value)||nc;ae!==(K.contextWindow??nc)&&Et(K.id,{contextWindow:ae})},onKeyDown:ie=>{ie.key==="Enter"&&ie.currentTarget.blur()},disabled:M},`${K.id}:${K.contextWindow??nc}`)]}),pe(K),K.reasoning?ke(K.id)?l.jsx(Db,{modelRef:`${p.id}/${K.id}`,info:ke(K.id),disabled:M,onSaved:f}):l.jsx("div",{className:"note",children:"保存服务商后可以设置思考档。"}):null]}),l.jsx("button",{className:"rremove",title:"移除该模型",disabled:M,onClick:()=>void Ae(p.models.filter(ie=>ie.id!==K.id)),children:l.jsx(X,{name:"close",size:13})})]},K.id))}):l.jsx(ze,{children:"尚未添加模型。可获取模型列表后勾选,或手动填写模型 ID。"}),l.jsx(zE,{disabled:M,onAdd:Ot})]})]}),p.kind==="builtin"&&!p.isNew?l.jsx(be,{children:R(p.id)}):null,j?l.jsx("div",{className:j==="已保存"?"okline":"badline",role:"status",children:j}):null,h]})}function zE({disabled:n,onAdd:a}){const[r,o]=y.useState(""),c=()=>{r.trim()&&(a(r),o(""))};return l.jsxs("div",{className:"ctl",style:{gap:8,marginTop:10},children:[l.jsx("div",{className:"field",style:{flex:1},children:l.jsx("input",{value:r,placeholder:"手动填写模型 ID,如 gpt-4o-mini",onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&c()},disabled:n})}),l.jsx("button",{className:"hob-btn",onClick:c,disabled:n||!r.trim(),children:"添加"})]})}function $b({busy:n,error:a,dirty:r,onCancel:o,onSave:c}){return l.jsxs(ts,{saved:!1,error:a,children:[!a&&r?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"hob-btn",onClick:o,disabled:n,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:c,disabled:n||!r,children:n?"正在验证…":"保存"})]})}function OE(){const n=je(),[a,r]=y.useState(null);return y.useEffect(()=>{ah().then(r)},[]),a?n.sub?.kind==="model"?l.jsx(RE,{view:a,modelRef:n.sub.ref}):n.sub?.kind==="addModels"?l.jsx(DE,{view:a}):l.jsx(_E,{view:a}):l.jsx(ze,{children:"正在读取模型列表…"})}function Pf(n,a){return{scores:n.scores??_h(a??{id:n.ref.split("/").at(-1)??n.ref,name:"",reasoning:!1}),unconfirmed:!n.scores||n.scoresConfirmed!==!0}}function Ty({entry:n,info:a,update:r,collapsible:o=!1}){const c=Pf(n,a),[f,h]=y.useState(!o||c.unconfirmed),[m,p]=y.useState(c.scores),[g,v]=y.useState(n.note),b=y.useRef(!1),j=y.useRef(m);j.current=m,y.useEffect(()=>{b.current||p(Pf(n,a).scores)},[n.scores,a]),y.useEffect(()=>v(n.note),[n.note]);const E=z=>r({scores:z,scoresConfirmed:!0}),S=()=>{if(!b.current)return;b.current=!1;const z=n.scores,A=j.current;(!z||n.scoresConfirmed!==!0||z.smart!==A.smart||z.cost!==A.cost||z.speed!==A.speed)&&E(A)};if(!f)return l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:yy(n.scores??m)}),l.jsx("button",{className:"hob-btn",onClick:()=>h(!0),children:"修改"})]});const T={smart:"聪明程度",cost:"成本",speed:"速度"};return l.jsxs("div",{className:"group",children:[l.jsxs("div",{className:"note",children:["Hob 按用途选择分派任务的模型。",c.unconfirmed?"数值按模型名称推测,请确认。":""]}),Object.keys(T).map(z=>l.jsxs("div",{className:"score-row",children:[l.jsxs("div",{className:"score-head",children:[l.jsx("label",{htmlFor:`${n.ref}-${z}`,children:T[z]}),l.jsxs("span",{children:[Rb(z,m[z])," · ",m[z],"%"]})]}),l.jsx("input",{id:`${n.ref}-${z}`,className:"score-range",type:"range",min:"0",max:"100",step:"5",value:m[z],onChange:A=>{b.current=!0,p({...j.current,[z]:Number(A.target.value)})},onPointerUp:S,onTouchEnd:S,onKeyUp:S,onBlur:S}),l.jsx("div",{className:"score-ticks",children:by[z].map(A=>l.jsx("button",{style:{left:`${A.value}%`},className:A.value===0?"first":A.value===100?"last":void 0,"aria-pressed":A.label===Rb(z,m[z]),onClick:()=>{const $={...j.current,[z]:A.value};p($),E($)},children:A.label},A.value))})]},z)),l.jsx("div",{className:"field",children:l.jsx("input",{value:g,onChange:z=>v(z.target.value),onBlur:()=>{g!==n.note&&r({note:g})},onKeyDown:z=>{z.key==="Enter"&&z.currentTarget.blur()},placeholder:"补充说明(选填),如「中文写作特别好」"})}),o?l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"收起"})}):null]})}function Dh(){const a=je().settings.settings.models,r=$a(),o=m=>void r.save({models:m});return{models:a,save:o,setRoster:m=>o({roster:m}),update:(m,p)=>void r.save(g=>({models:{roster:g.models.roster.map(v=>v.ref===m?{...v,...p}:v)}})),roles:m=>[a.conversation.ref===m?"对话":null,a.work.ref===m?"任务执行":null].filter(p=>p!==null),feedback:r}}function cn({label:n="模型"}){return l.jsxs("button",{className:"subback",onClick:Ht,children:[l.jsx(X,{name:"left",size:15}),n]})}function _E({view:n}){const{models:a,save:r,roles:o,feedback:c}=Dh(),f=new Map(n.models.map(p=>[p.ref,p])),h=p=>[...a.roster.length?[]:[{value:"",text:"未设置"}],...a.roster.filter(g=>f.has(g.ref)||g.ref===p).map(g=>({value:g.ref,text:f.get(g.ref)?.name??g.ref}))],m=(p,g,v)=>l.jsxs("div",{className:"mline",children:[l.jsx("span",{className:"k",children:g}),l.jsxs("span",{className:"vals",children:[l.jsx(ky,{value:a[p].ref,label:v,options:h(a[p].ref),onChange:b=>r({[p]:{ref:b,thinking:ir(f.get(b),a[p].thinking)}})}),l.jsx(jy,{value:ir(f.get(a[p].ref),a[p].thinking),model:f.get(a[p].ref),onChange:b=>r({[p]:{...a[p],thinking:b}})})]})]});return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"模型",desc:"可用模型来自「服务商」,默认模型从可用模型中选择。"}),l.jsx(Sn,{message:c.message,toast:!0}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"默认模型"}),l.jsxs("div",{className:"group-card settings-card",children:[m("conversation","对话","对话模型"),m("work","任务执行","默认任务模型")]}),l.jsx("div",{className:"note",children:"助手分派任务时未指定模型,使用任务执行的模型。"}),l.jsx("div",{className:"lbl",children:"任务的思考档"}),l.jsx(ys,{items:[{key:"auto",label:"助手按任务选择"},{key:"fixed",label:"固定使用默认档"}],value:a.thinkingChoice??"auto",disabled:c.busy,onChange:p=>r({thinkingChoice:p})}),l.jsx("div",{className:"note",children:"按任务选择时,助手会给简单的活用低档、复杂的活用高档;固定时一律使用上面设置的默认档。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"可用模型"}),l.jsxs("div",{className:"group-card settings-card",children:[a.roster.map(p=>{const g=f.get(p.ref),v=g?.name??p.ref,b=Pf(p,g);return l.jsxs("button",{className:`list-row model-row${g?"":" gone"}`,onClick:()=>Tn({kind:"model",ref:p.ref,title:v}),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:v}),l.jsx("span",{className:"sp"}),g?l.jsx(wy,{info:g}):l.jsx("span",{className:"mbad",children:"不可用"}),l.jsx(X,{name:"chev",size:14})]}),l.jsxs("span",{className:"mprev",children:[o(p.ref).map(j=>l.jsx("span",{className:"mrole",children:j},j)),yy(b.scores),b.unconfirmed?l.jsx("span",{className:"model-use-warning",children:"请确认用途"}):null,g?null:" · 该模型的服务商已删除或未配置 Key"]})]},p.ref)}),l.jsxs("button",{className:"maddrow",onClick:()=>Tn({kind:"addModels",title:"添加模型"}),children:[l.jsx(X,{name:"plus",size:16}),"添加模型"]})]}),l.jsx("div",{className:"note",children:"助手分派任务时,按用途说明在可用模型中选择。"})]})]})}function RE({view:n,modelRef:a}){const{models:r,setRoster:o,update:c,roles:f,feedback:h}=Dh(),[m,p]=y.useState(!1),g=r.roster.find(j=>j.ref===a);if(y.useEffect(()=>{g||Ht()},[g]),!g)return null;const v=n.models.find(j=>j.ref===a),b=f(a);return l.jsxs(l.Fragment,{children:[l.jsx(cn,{}),l.jsx(Fe,{title:v?.name??a,desc:l.jsx("span",{className:"mono",children:a})}),l.jsx(Sn,{message:h.message,toast:!0}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"用途说明"}),l.jsx(Ty,{entry:g,info:v,update:j=>c(a,j)})]}),v?.reasoning?l.jsxs(be,{children:[l.jsx("div",{className:"group-card settings-card",children:l.jsxs("div",{className:"mline",children:[l.jsx("span",{className:"k",children:"分派时的思考强度"}),l.jsx(jy,{value:ir(v,g.thinking??r.work.thinking),model:v,onChange:j=>c(a,{thinking:j})})]})}),l.jsx("div",{className:"note",children:"助手把任务分派给这个模型时使用。作为默认模型时,以「默认模型」中的设置为准。"})]}):null,l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"信息"}),l.jsxs("div",{className:"kvcard",children:[l.jsxs("div",{className:"kvrow",children:[l.jsx("span",{className:"k",children:"服务商"}),l.jsx("span",{className:"v",children:v?.provider??"不可用"})]}),v?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"kvrow",children:[l.jsxs("span",{className:"k kicon",children:[l.jsx(X,{name:"image",size:14}),"图片输入"]}),l.jsx("span",{className:"v",children:v.input.includes("image")?"支持":"不支持"})]}),l.jsxs("div",{className:"kvrow",children:[l.jsxs("span",{className:"k kicon",children:[l.jsx(X,{name:"bulb",size:14}),"推理"]}),l.jsx("span",{className:"v",children:v.reasoning?"支持":"不支持"})]}),l.jsxs("div",{className:"kvrow",children:[l.jsx("span",{className:"k",children:"上下文"}),l.jsx("span",{className:"v",children:Rh(v.contextWindow)})]})]}):null]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"危险操作"}),l.jsx("div",{className:"group-card settings-card",children:m?l.jsxs("div",{className:"ctl",style:{flexWrap:"wrap",padding:12},children:[l.jsx("span",{children:"确定从可用模型中移除?"}),l.jsx("button",{className:"hob-btn",onClick:()=>p(!1),children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>o(r.roster.filter(j=>j.ref!==a)),children:"确认移除"})]}):l.jsx("button",{className:"mline danger",disabled:b.length>0,onClick:()=>p(!0),children:"从可用模型中移除"})}),b.length?l.jsxs("div",{className:"note",children:["这是",b.join("和"),"的默认模型。要移除,请先在「默认模型」中更换。"]}):null]})]})}function DE({view:n}){const{models:a,setRoster:r,roles:o,update:c,feedback:f}=Dh(),[h,m]=y.useState(""),p=new Set(a.roster.map(T=>T.ref)),[g,v]=y.useState(()=>[...new Set(n.models.filter(T=>p.has(T.ref)).map(T=>T.provider))]),b=KC(GC(n.models,h)),j=h.trim().length>0,E=T=>v(z=>z.includes(T)?z.filter(A=>A!==T):[...z,T]),S=T=>r(p.has(T.ref)?a.roster.filter(z=>z.ref!==T.ref):[...a.roster,{ref:T.ref,scores:_h(T),note:"",scoresConfirmed:!1,...T.reasoning?{thinking:ir(T,"medium")}:{}}]);return l.jsxs(l.Fragment,{children:[l.jsx(cn,{}),l.jsx(Fe,{title:"添加模型",desc:"「服务商」提供的全部模型,打勾的已在可用模型中。"}),l.jsx(Sn,{message:f.message,toast:!0}),n.models.length===0?l.jsxs(be,{children:[l.jsx(ze,{children:"尚无可用模型。请先在「服务商」中配置服务商并填写 API Key。"}),l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"hob-btn",onClick:()=>zl("providers"),children:"配置服务商"})})]}):l.jsxs("div",{className:"group-card settings-card",children:[l.jsxs("label",{className:"mfind",children:[l.jsx(X,{name:"search",size:15}),l.jsx("input",{value:h,placeholder:"搜索名称或引用,如 claude",onChange:T=>m(T.target.value)})]}),b.length===0?l.jsx(ze,{children:"没有匹配的模型。"}):b.map(T=>{const z=j||g.includes(T.provider),A=T.models.filter($=>p.has($.ref)).length;return l.jsxs(y.Fragment,{children:[l.jsxs("button",{className:"mgroup","aria-expanded":z,onClick:()=>E(T.provider),children:[l.jsx("span",{className:"n",children:T.provider}),l.jsx("span",{className:"c",children:A?`已加入 ${A} / ${T.models.length}`:T.models.length}),l.jsx(X,{name:z?"down":"chev",size:14})]}),z?T.models.map($=>{const D=p.has($.ref),V=o($.ref).length>0,N=a.roster.find(k=>k.ref===$.ref);return l.jsxs("div",{children:[l.jsxs("button",{className:`madd${D?" on":""}`,disabled:V,title:V?"默认模型不能在这里移除":D?"从可用模型中移除":"加入可用模型",onClick:()=>S($),children:[l.jsx("span",{className:"mname",children:$.name}),l.jsx(wy,{info:$}),l.jsx(X,{name:D?"check":"plus",size:16,className:"mtog"})]}),N?l.jsx("div",{className:"model-use-inline",children:l.jsx(Ty,{entry:N,info:$,collapsible:!0,update:k=>c($.ref,k)})}):null]},$.ref)}):null]},T.provider)})]})]})}function $E(){const a=je().settings.settings.work,r=$a(),o=c=>r.save({work:c});return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"任务",desc:"任务并行数、无响应判定时间,以及全部任务的任务记录。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"最大并行任务数"}),l.jsx("div",{className:"ctl",children:l.jsx("select",{className:"pick",value:a.maxJobs,disabled:r.busy,onChange:c=>void o({maxJobs:Number(c.target.value)}),children:[1,2,3,4,5,6,7,8].map(c=>l.jsx("option",{value:c,children:c},c))})}),l.jsx("div",{className:"note",children:"同时运行的最大任务数,超出后排队。"}),l.jsx(Sn,{message:r.message})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"无响应判定时间"}),l.jsx("div",{className:"lbl sub",children:"任务"}),l.jsxs("div",{className:"ctl",children:[l.jsx(Ua,{value:String(a.jobStallMinutes),onSave:c=>o({jobStallMinutes:Number(c)})}),l.jsx("span",{className:"note",children:"分钟"})]}),l.jsx("div",{className:"lbl sub",children:"助手回复"}),l.jsxs("div",{className:"ctl",children:[l.jsx(Ua,{value:String(a.routerStallMinutes),onSave:c=>o({routerStallMinutes:Number(c)})}),l.jsx("span",{className:"note",children:"分钟"})]}),l.jsx(Sn,{message:r.message}),l.jsx("div",{className:"note",children:"修改后立即生效,无需重启。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"任务记录"}),l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"hob-btn",onClick:()=>g0(),children:"查看全部任务"})}),l.jsx("div",{className:"note",children:"可查看每个任务的完整执行过程。"})]})]})}function UE(){const n=je(),a=$a(),[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),[p,g]=y.useState(null),[v,b]=y.useState(!1),[j,E]=y.useState(null),[S,T]=y.useState(null),z=eh(),A=()=>void th().then(C=>m(C?.endpoint??null));if(y.useEffect(()=>{er().then(C=>C.ok?o(C.view):f(C.error)),A()},[]),c)return l.jsx("div",{className:"note",children:c});if(!r)return l.jsx(ze,{children:"正在读取推送设置…"});const $=typeof Notification<"u"&&Notification.permission==="denied",D=!!(h&&r.devices.some(C=>C.endpoint===h)),V=async()=>{if(!v){b(!0),E(null),T(null);try{const C=D?await EN():await CN();if(!C.ok){E(C.error);return}o(C.view),A(),T(D?"此设备将不再接收推送":"此设备将接收推送")}finally{b(!1)}}},N=async C=>{const M=await a0(C);if(!M.ok){E(M.error);return}o(M.view),g(null),A()},k=async()=>{if(!v){b(!0),E(null),T(null);try{const C=await MN();if(!C.ok){E(C.error);return}C.sent?T("测试通知已发送"):C.removed?(E("这台设备的订阅已失效,已移除;请重新开启本机推送"),er().then(M=>M.ok&&o(M.view))):T("未发送:这台设备尚未订阅")}finally{b(!1)}}};return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"通知",desc:"本机推送与已订阅的设备。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"本机推送"}),z?l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"需要确认或任务受阻时推送给我"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${D?"":" off"}`,title:D?"关闭本机推送":"开启本机推送",onClick:()=>void V(),disabled:v})]}):l.jsx("div",{className:"note",children:"这个浏览器不支持推送:请使用 Chrome、Edge、Safari 16.4+,或在 iPhone 上将 Hob 添加到主屏幕。"}),$?l.jsx("div",{className:"note",children:"浏览器已拒绝通知权限:点击地址栏左侧的图标 → 通知 → 允许,然后刷新本页并重新开启。"}):null,l.jsx("div",{className:"note",children:"页面在前台时不推送,页面不在前台或锁屏时才推送。各助手还需在助手设置中开启「需要确认时通知我」。"}),l.jsx("div",{className:"note",children:"在 iPhone 上需先将 Hob 添加到主屏幕,再从主屏幕打开才能接收推送。"})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"已订阅的设备"}),r.devices.length?r.devices.map(C=>l.jsxs("div",{className:"dev",children:[l.jsx("span",{className:"n",children:C.label}),l.jsx("span",{className:"tm",children:on(C.createdAt)}),l.jsx("span",{className:"sp"}),p===C.endpoint?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"note",children:"确认删除?"}),l.jsx("button",{className:"hob-btn",onClick:()=>g(null),children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void N(C.endpoint),children:"确认删除"})]}):l.jsx("button",{className:"del",title:"删除这台设备",onClick:()=>g(C.endpoint),children:"删除"})]},C.endpoint)):l.jsx(ze,{children:"暂无已订阅的设备"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"hob-btn",onClick:()=>void k(),disabled:v||!r.devices.length,children:"发送测试通知"}),S&&!j?l.jsx("span",{className:"okline",children:S}):null,j?l.jsx("span",{className:"badline",children:j}):null]})]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"推送服务联系邮箱(选填)"}),l.jsx(Ua,{placeholder:"name@example.com",value:n.settings.settings.push.email,onSave:C=>a.save({push:{email:C.trim()}})}),l.jsx(Sn,{message:a.message}),l.jsx("div",{className:"note",children:"推送服务使用此地址联系你;留空使用 Hob 的项目主页。"})]})]})}const Qi="https://api.loremem.com",LE={saas:"https://app.loremem.com/login"},HE=[{key:"saas",label:"Lore 云服务"},{key:"self",label:"自部署"}],BE=[{key:"local",label:"本地记忆"},{key:"lore",label:"Lore"},{key:"off",label:"关闭"}],Ub={invalid_url:"服务地址无效。",insecure_http:"公网地址必须使用 https,明文 http 仅允许本机或局域网地址。",missing_token:"缺少 API Token。",unauthorized:"API Token 被拒绝。",unreachable:"无法连接该地址。"},Ff=n=>n.trim().replace(/\/+$/,"");function Lb(n){return n===null||Ff(n)===Qi?"saas":"self"}function qE(){const[n,a]=y.useState(null),[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState("saas"),[p,g]=y.useState(Qi),[v,b]=y.useState(""),[j,E]=y.useState(!1),[S,T]=y.useState(!1),[z,A]=y.useState(null),[$,D]=y.useState(!1),[V,N]=y.useState(null),[k,C]=y.useState(!1),[M,L]=y.useState(null),[J,te]=y.useState(null),[ke,me]=y.useState(!1);y.useEffect(()=>{if(!k)return;const ee=setTimeout(()=>C(!1),3e3);return()=>clearTimeout(ee)},[k]);const Ne=ee=>{a(ee),o(null),f(null),m(Lb(ee.lore.baseUrl)),g(ee.lore.baseUrl??Qi),b(""),E(!1),T(!1),A(null),N(null),C(!1)};if(y.useEffect(()=>{mf().then(ee=>{ee.ok?Ne(ee.config):o(ee.error)})},[]),r)return l.jsx("div",{className:"note",children:r});if(!n)return l.jsx(ze,{children:"正在读取记忆设置…"});const _e=c??n.provider,le=n.lore.tokenConfigured&&Ff(p)===Ff(n.lore.baseUrl??""),ve=c==="lore"&&!j?n.lore.configured:S,pe=c!==null||j,Oe=async ee=>{if($)return;if(ee===n.provider){f(null);return}if(N(null),C(!1),ee==="lore"&&!n.lore.configured){f("lore");return}D(!0);const oe=await Mx(n.revision,ee);if(D(!1),!oe.ok){N(oe.error);return}Ne(oe.config),C(!0)},Ae=ee=>{$||(ee(),E(!0),T(!1),A(null),N(null),C(!1))},bt=ee=>Ae(()=>{m(ee),g(ee==="saas"?Qi:Lb(n.lore.baseUrl)==="self"?n.lore.baseUrl??"":"")}),Ot=async()=>{if($)return;D(!0),te(null),me(!1);const ee=await SN();if(!ee.ok){D(!1),te(ee.error);return}if(L({source:ee.view.source,found:ee.view.found}),!ee.view.found){D(!1);return}const oe=await TN();if(D(!1),!oe.ok){te(oe.error);return}Ne(oe.config),f("lore"),me(!0)},Et=async()=>{if($)return;D(!0),A(null);const ee={baseUrl:p.trim(),...v?{token:v}:{}},oe=await zx(ee);if(D(!1),!oe.ok){A({ok:!1,text:oe.error});return}oe.result.ok?(T(!0),A({ok:!0,text:"已连接"})):A({ok:!1,text:Ub[oe.result.reason]})},R=async()=>{if($||!pe)return;if(D(!0),N(null),_e==="lore"&&!ve){const K=await zx({baseUrl:p.trim(),...v?{token:v}:{}});if(!K.ok){D(!1),N(K.error);return}if(!K.result.ok){D(!1),N(Ub[K.result.reason]);return}T(!0)}let ee=n;if(_e==="lore"&&j){const K=await NN({baseUrl:p.trim(),...v?{token:v}:{}});if(!K.ok){D(!1),N(K.error);return}ee=K.config}const oe=await Mx(ee.revision,_e);if(D(!1),!oe.ok){N(oe.error),/已刷新/.test(oe.error)&&mf().then(K=>K.ok&&Ne(K.config));return}Ne(oe.config),C(!0)},F=n.provider==="lore"?n.lore.configured?`Lore · 已连接 · 插件 ${n.lorePlugin}`:"Lore · 尚未配置完成:请填写服务地址与 API Token 后保存":n.provider==="local"?"本地记忆 · 已启用":"关闭 · 助手不使用长期记忆";return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"记忆",desc:"所有助手共用同一份长期记忆。各助手特有的做法写在助手设置的「补充说明」中。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"提供者"}),l.jsx(ys,{items:BE,value:_e,onChange:ee=>void Oe(ee),disabled:$}),l.jsx("div",{className:"sline",children:F}),l.jsx(Sn,{message:V??(k?"已保存":null)})]}),_e==="lore"?l.jsxs(l.Fragment,{children:[l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"部署方式"}),l.jsx(ys,{items:HE,value:h,onChange:bt,disabled:$}),l.jsx("div",{className:"lbl",children:"服务地址"}),h==="saas"?l.jsx("div",{className:"field ro",children:Qi}):l.jsx("div",{className:"field",children:l.jsx("input",{value:p,placeholder:"http://192.168.1.10:18901",onChange:ee=>Ae(()=>g(ee.target.value)),disabled:$})}),l.jsxs("div",{className:"lblrow",children:[l.jsx("span",{className:"lbl",children:"Token"}),l.jsx("a",{className:"link",href:LE.saas,target:"_blank",rel:"noreferrer",children:"注册 / 登录 Lore"})]}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:v,placeholder:le?"已保存,留空则沿用":"lm_…",onChange:ee=>Ae(()=>b(ee.target.value)),disabled:$})}),l.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[l.jsx("button",{className:"hob-btn",onClick:()=>void Et(),disabled:$||p.trim()==="",children:"测试连接"}),z?l.jsx("span",{className:z.ok?"okline":"badline",children:z.text}):null]}),l.jsxs(ts,{saved:k&&!pe,error:V,children:[!V&&pe?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"hob-btn",onClick:()=>void mf().then(ee=>ee.ok?Ne(ee.config):o(ee.error)),disabled:$||!pe,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void R(),disabled:$||!pe,children:$?"正在验证…":"保存"})]})]})}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"本机配置"}),l.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[l.jsx("button",{className:"hob-btn",onClick:()=>void Ot(),disabled:$,children:$?"正在导入…":"从本机导入"}),ke?l.jsx("span",{className:"okline",children:"已导入本机的连接"}):null]}),l.jsx("div",{className:"note",children:"读取这台电脑上已保存的 Lore 连接,导入后无需重新填写。"}),M?l.jsxs("div",{className:"sline",children:["来源:",M.source]}):null,M&&!M.found?l.jsx("div",{className:"note",children:"未找到可导入的配置。"}):null,J?l.jsx("div",{className:"badline",children:J}):null]})]}):null]})}const IE=[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],YE=["1024x1024","1536x1024","1024x1536","512x512"],Cy=n=>n.trim().replace(/\/+$/,"");function GE(){const a=je().settings.settings.knowledge?.embedding??{source:"off"},[r,o]=y.useState(a.source),[c,f]=y.useState(a.source==="openai"?a.baseUrl:""),[h,m]=y.useState(a.source==="openai"?a.model:""),[p,g]=y.useState(""),[v,b]=y.useState(!1),[j,E]=y.useState(!1),[S,T]=y.useState(null);y.useEffect(()=>{xN().then($=>b($.keyConfigured)).catch($=>T({ok:!1,text:`读取设置失败:${$ instanceof Error?$.message:String($)}`}))},[]);const z=r==="off"?{source:"off"}:{source:"openai",baseUrl:Cy(c),model:h.trim()},A=async $=>{E(!0),T(null);try{if($){const D=await yN(z,p.trim()||void 0);b(D.keyConfigured),g(""),T({ok:!0,text:"已保存"})}else{const D=await bN({embedding:z,...p.trim()?{apiKey:p.trim()}:{}});T(D.ok?{ok:!0,text:`连接成功 · ${D.dims} 维`}:{ok:!1,text:D.error})}}catch(D){T({ok:!1,text:D instanceof Error?D.message:String(D)})}finally{E(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"知识库",desc:"配置向量模型,关闭时只按关键词查找。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"向量模型"}),l.jsx(ys,{items:[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],value:r,onChange:o,disabled:j})]}),r==="openai"?l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{"aria-label":"服务地址",value:c,onChange:$=>f($.target.value),disabled:j,placeholder:"http://127.0.0.1:8080/v1"})}),l.jsx("div",{className:"lbl",children:"模型名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{"aria-label":"模型名称",value:h,onChange:$=>m($.target.value),disabled:j})}),l.jsx("div",{className:"lbl",children:"API Key"}),l.jsx("div",{className:"field",children:l.jsx("input",{"aria-label":"API Key",type:"password",value:p,onChange:$=>g($.target.value),disabled:j,placeholder:v?"已设置,留空保持不变":"请输入 API Key"})}),l.jsx("button",{className:"hob-btn",disabled:j,onClick:()=>void A(!1),children:"测试连接"})]})}):null,l.jsx(be,{children:l.jsx("div",{className:"dim",children:"建索引和查询时,文件内容和问题会发给这个接口。"})}),l.jsx(ts,{saved:S?.ok===!0,error:S?.ok===!1?S.text:null,children:l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:j,onClick:()=>void A(!0),children:"保存"})}),S?.ok&&S.text!=="已保存"?l.jsx("div",{className:"okline",role:"status",children:S.text}):null]})}function KE(){const a=je().settings.settings.image,[r,o]=y.useState(a.source),[c,f]=y.useState(a.source==="openai"?a.baseUrl:""),[h,m]=y.useState(a.source==="openai"?a.model:""),[p,g]=y.useState(a.source==="openai"?a.size??"":""),[v,b]=y.useState(""),[j,E]=y.useState(!1),[S,T]=y.useState(null),[z,A]=y.useState(null),[$,D]=y.useState(!1),[V,N]=y.useState(null),[k,C]=y.useState(null);y.useEffect(()=>{if(!V)return;const me=setTimeout(()=>N(null),3e3);return()=>clearTimeout(me)},[V]),y.useEffect(()=>{wN().then(me=>{me&&E(me.keyConfigured)})},[]);const M=r==="openai"?{source:"openai",baseUrl:Cy(c),model:h.trim(),...p?{size:p}:{}}:{source:"off"},L=JSON.stringify(M)!==JSON.stringify(a)||v.trim()!=="",J=JSON.stringify({form:M,apiKey:v.trim()});y.useEffect(()=>{T(null),A(null)},[J]);const te=async()=>{if($)return;D(!0),T(null);const me=await Ax({image:M,...v.trim()?{apiKey:v.trim()}:{}});D(!1),me.ok?(A(J),T({ok:!0,text:"生成成功",path:me.path})):(A(null),T({ok:!1,text:me.error}))},ke=async()=>{if($||!L)return;if(D(!0),C(null),N(null),M.source==="openai"&&z!==J){const Ne=await Ax({image:M,...v.trim()?{apiKey:v.trim()}:{}});if(!Ne.ok){D(!1),A(null),C(`测试连接失败:${Ne.error}`);return}A(J),T({ok:!0,text:"生成成功",path:Ne.path})}const me=await Ex(M,v.trim()||void 0);if(D(!1),!me.ok){C(me.error);return}M.source==="openai"&&(f(M.baseUrl),m(M.model)),b(""),E(me.keyConfigured),T(null),N("已保存")};return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"图像生成",desc:"选择图像生成方式:关闭,或使用 OpenAI 兼容接口。配置完成后,开启了图像生成能力的助手可以在任务中生成图片。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"生成方式"}),l.jsx(ys,{items:IE,value:r,onChange:me=>{T(null),C(null),N(null),me==="off"&&a.source!=="off"?(D(!0),Ex({source:"off"}).then(Ne=>{if(D(!1),!Ne.ok){C(Ne.error);return}o("off"),b(""),N("已保存")})):o(me)},disabled:$})]}),r==="openai"?l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:c,placeholder:"http://127.0.0.1:8080/v1",onChange:me=>f(me.target.value),disabled:$})}),l.jsx("div",{className:"lbl",children:"模型名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:h,placeholder:"gpt-image-1",onChange:me=>m(me.target.value),disabled:$})}),l.jsx("div",{className:"lbl",children:"默认尺寸"}),l.jsx("div",{className:"ctl",children:l.jsxs("select",{className:"pick grow",value:p,onChange:me=>g(me.target.value),disabled:$,children:[l.jsx("option",{value:"",children:"不指定,使用接口默认值"}),YE.map(me=>l.jsx("option",{value:me,children:me},me))]})}),l.jsx("div",{className:"lbl",children:"API Key"}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:v,placeholder:j?"已保存,留空则沿用":"sk-…",onChange:me=>b(me.target.value),disabled:$})}),l.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。保存前会生成测试图片,可能产生费用。"}),l.jsx("div",{className:"lbl",children:"测试"}),l.jsxs("div",{className:"testrow",children:[l.jsx("button",{className:"hob-btn",onClick:()=>void te(),disabled:$,children:$?"正在生成…":"生成测试图片"}),S?l.jsxs("div",{className:"testout",children:[l.jsx("span",{className:S.ok?"okline":"badline",children:S.text}),S.ok&&S.path?l.jsx("button",{className:"imgcard testshot",onClick:()=>window.open(Lt(S.path),"_blank","noopener"),title:"查看原图",children:l.jsx("img",{src:Lt(S.path),alt:"生成的图片"})}):null]}):null]}),l.jsxs(ts,{saved:V!==null&&!L,error:k,children:[!k&&L?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"hob-btn",disabled:$||!L,onClick:()=>{o(a.source),f(a.source==="openai"?a.baseUrl:""),m(a.source==="openai"?a.model:""),g(a.source==="openai"?a.size??"":""),b(""),T(null),A(null),C(null)},children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void ke(),disabled:$||!L,children:$?"正在验证…":"保存"})]})]})}):l.jsx(Sn,{message:k??V})]})}const VE={hob:"Hob 的技能",common:"通用技能 · ~/.agents/skills",lore:"Lore 技能"},XE=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"pi",label:"pi"}],Af=n=>`${n.source}:${n.id}`,Xt=n=>n instanceof Error?n.message:String(n);function ZE(){const n=je(),a=n.sub,[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),p=async()=>{try{o(await nN()),f(null)}catch(E){f(Xt(E))}};y.useEffect(()=>{p()},[]),y.useEffect(()=>{a&&m(null)},[a]);const g=async E=>{const S=`${E.source}:${E.name}`,T=n.settings.settings.skills?.disabled??[],z=E.enabled?[...T,S]:T.filter(A=>A!==S);await lh({skills:{disabled:z}})?await p():f(Fs().notice??"保存失败")},v=E=>{p(),m(E),Ht()};if(!r)return c?l.jsx("div",{className:"badline",children:c}):l.jsx(ze,{children:"正在读取技能…"});if(a?.kind==="skill")return l.jsx(QE,{skill:r.skills.find(E=>Af(E)===a.key),onDeleted:v});if(a?.kind==="importSkills")return l.jsx(JE,{onDone:v});const b=(E,S)=>E.length?E.map(T=>l.jsxs("div",{className:`list-row setting-row${T.enabled?"":" gone"}`,children:[l.jsxs("button",{className:"rmain rbtn",onClick:()=>Tn({kind:"skill",key:Af(T),title:T.name}),children:[l.jsxs("div",{className:"rname",children:[T.name,T.overridden?l.jsx("span",{className:"rtag",children:"被同名技能覆盖"}):null]}),l.jsx("div",{className:"rprov rclamp",children:T.description})]}),l.jsx("button",{className:`tog${T.enabled?"":" off"}`,"aria-label":`${T.name}启用`,"aria-pressed":T.enabled,onClick:()=>void g(T)})]},Af(T))):l.jsx(ze,{children:S}),j=r.skills.filter(E=>E.source==="hob");return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"技能",desc:"技能是写好的做法说明,任务按需读取。同名时 Hob 的技能优先,其次是 Lore,最后是通用技能。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"Hob 的技能"}),l.jsxs("div",{className:"group-card settings-card",children:[b(j,"还没有技能,可以从其他工具导入"),l.jsxs("button",{className:"maddrow",onClick:()=>Tn({kind:"importSkills",title:"导入技能"}),children:[l.jsx(X,{name:"plus",size:16}),"从 Claude Code、Codex、pi 导入"]})]}),h?l.jsx("div",{className:"okline",children:h}):null]}),l.jsxs(be,{children:[l.jsxs("div",{className:"lbl",children:["通用技能 ",l.jsx("span",{className:"lbl-aside",children:"~/.agents/skills"})]}),l.jsx("div",{className:"group-card settings-card",children:b(r.skills.filter(E=>E.source==="common"),"目录中没有技能")})]}),l.jsxs(be,{children:[l.jsxs("div",{className:"lbl",children:["Lore 技能",r.loreActive&&r.loreUrl?l.jsx("a",{className:"lbl-aside",href:r.loreUrl,target:"_blank",rel:"noreferrer",children:"在 Lore 控制台管理"}):null]}),r.loreError?l.jsxs("div",{className:"badline",role:"alert",children:[r.loreError," ",l.jsx("button",{onClick:()=>void p(),children:"重试"})]}):r.loreActive?l.jsx("div",{className:"group-card settings-card",children:b(r.skills.filter(E=>E.source==="lore"),"Lore 中没有技能")}):l.jsx("div",{className:"note",children:"在 设置 → 记忆 中连接 Lore 后,这里会列出 Lore 中的技能。"})]}),c?l.jsx("div",{className:"badline",role:"alert",children:c}):null]})}function QE({skill:n,onDeleted:a}){const[r,o]=y.useState(null);if(!n)return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"技能"}),l.jsx("div",{className:"note",children:"技能不存在或已删除。"})]});const c=async()=>{if(window.confirm(`删除技能「${n.name}」?此操作不能撤销。`))try{await aN(n.id),a(`已删除「${n.name}」`)}catch(f){o(Xt(f))}};return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"技能"}),l.jsx(Fe,{title:n.name,desc:n.description}),l.jsxs("div",{className:"sline",children:[VE[n.source],n.overridden?" · 被优先级更高的同名技能覆盖":"",n.enabled?"":" · 已停用"]}),l.jsx(Ya,{className:"skill-doc fp-md markdown-body",text:n.content}),n.source==="hob"?l.jsx(ts,{saved:!1,error:r,children:l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void c(),children:"删除技能"})}):null]})}function JE({onDone:n}){const[a,r]=y.useState("claude"),[o,c]=y.useState(null),[f,h]=y.useState([]),[m,p]=y.useState(!1),[g,v]=y.useState(!1),[b,j]=y.useState(null);y.useEffect(()=>{let S=!0;return c(null),h([]),j(null),sN(a).then(T=>{S&&c(T)}).catch(T=>{S&&j(Xt(T))}),()=>{S=!1}},[a]);const E=async()=>{v(!0),j(null);try{const S=await lN(a,f,m),T=[...S.skipped,...S.errors];T.length?j(T.join(";")):n(`已导入 ${S.imported.length} 个技能`)}catch(S){j(Xt(S))}finally{v(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"技能"}),l.jsx(Fe,{title:"导入技能",desc:"从其他工具的技能目录复制到 Hob,来源只读。"}),l.jsx(be,{children:l.jsx(ys,{items:XE,value:a,onChange:r,disabled:g})}),l.jsxs(be,{children:[o===null?b?null:l.jsx(ze,{children:"正在读取…"}):o.found?l.jsx("div",{className:"group-card settings-card",children:o.skills.length?o.skills.map(S=>l.jsxs("label",{className:"list-row setting-row",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:f.includes(S.id),disabled:g,onChange:T=>h(T.target.checked?[...f,S.id]:f.filter(z=>z!==S.id))}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[S.name,S.exists?l.jsx("span",{className:"rtag",children:"已存在"}):null]}),l.jsx("div",{className:"rprov rclamp",children:S.description})]})]},S.id)):l.jsx(ze,{children:"目录中没有技能"})}):l.jsx(ze,{children:"未找到这个工具的技能目录。"}),o?.skipped.map(S=>l.jsx("div",{className:"note",children:S},S))]}),o?.skills.some(S=>S.exists)?l.jsxs("label",{className:"ctl skill-overwrite",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:m,onChange:S=>p(S.target.checked)}),"覆盖已存在的同名技能"]}):null,l.jsxs(ts,{saved:!1,error:b,children:[l.jsx("button",{className:"hob-btn",onClick:Ht,disabled:g,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:g||!f.length,onClick:()=>void E(),children:g?"正在导入…":f.length?`导入 ${f.length} 个`:"导入所选"})]})]})}const PE={pi:"pi",claude:"Claude Code",cursor:"Cursor"};function FE(n,a){return n.valid?n.enabled?a?a.state==="probing"?"检测中…":a.state==="connected"?a.tools?.length?`已连接 · ${a.tools.length} 个工具`:"已连接 · 没有工具":a.state==="needs_auth"?"需要登录,暂不支持":"连接失败":"未测试":"已停用":"配置无效"}function WE(){const n=je().sub,[a,r]=y.useState(null),[o,c]=y.useState(null),[f,h]=y.useState(null),[m,p]=y.useState({}),g=y.useRef(new Set);y.useEffect(()=>{Cx().then(r).catch(S=>c(Xt(S)))},[]),y.useEffect(()=>{n&&h(null)},[n]);const v=async(S,T=!1)=>{if(S.valid){p(z=>({...z,[S.name]:{state:"probing"}}));try{const z=await fN(S.name,T);p(A=>({...A,[S.name]:z.ok?{state:"connected",tools:z.tools}:{state:z.state,error:z.error,stderrTail:z.stderrTail}}))}catch{p(z=>({...z,[S.name]:{state:"failed",error:"无法测试连接"}}))}}};y.useEffect(()=>{if(a)for(const S of a.servers)!S.valid||!S.enabled||g.current.has(S.name)||(g.current.add(S.name),v(S))},[a]);const b=S=>{Cx().then(r).catch(()=>{}),h(S),Ht()};if(o)return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具。"}),l.jsx("div",{className:"badline",role:"alert",children:o}),l.jsx("div",{className:"note",children:"请修复数据目录 engine/mcp.json 后重试;修复前任务不会加载 MCP 服务。"})]});if(!a)return l.jsx(ze,{children:"正在读取 MCP 服务…"});if(n?.kind==="mcpServer")return l.jsx(s3,{server:a.servers.find(S=>S.name===n.name),setView:r,probe:m[n.name],onProbe:v,onDone:b});if(n?.kind==="addMcp")return l.jsx(n3,{onDone:b});if(n?.kind==="importMcp")return l.jsx(l3,{onDone:b});const j=S=>S.kind==="http"?"远程地址":"本地命令",E=async S=>{try{const T=await l0(S.name,{enabled:!S.enabled});if(r(T),!S.enabled)for(const z of T.servers)z.name===S.name&&z.valid&&v(z,!0)}catch(T){h(Xt(T))}};return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"MCP",desc:"任务可以调用 MCP 服务提供的工具,所有助手派出的任务共用这份配置;对话不直接使用。配置改动对之后新开的任务生效,进行中的任务不受影响。"}),l.jsxs(be,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>Tn({kind:"addMcp",title:"添加 MCP 服务"}),children:"添加服务"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"hob-btn",onClick:()=>Tn({kind:"importMcp",title:"从本机导入 MCP 服务"}),children:"从本机导入"})]}),l.jsx("div",{className:"lbl",children:"已配置的服务"}),l.jsxs("div",{className:"group-card settings-card",children:[a.servers.map(S=>l.jsxs("div",{className:`list-row setting-row${S.enabled&&S.valid?"":" gone"}`,children:[l.jsxs("button",{className:"rmain rbtn",onClick:()=>Tn({kind:"mcpServer",name:S.name,title:S.name}),children:[l.jsxs("div",{className:"rname",children:[S.name,S.valid?null:l.jsx("span",{className:"rtag",children:"配置无效"})]}),l.jsx("div",{className:"rprov rclamp",children:S.valid?S.kind==="http"?S.url:[S.command,...S.args??[]].join(" "):S.invalidReason})]}),l.jsx("span",{className:"note",style:{flex:"none"},children:`${j(S)} · ${FE(S,m[S.name])}`}),S.valid?l.jsx("button",{className:`tog${S.enabled?"":" off"}`,"aria-label":`${S.name}启用`,"aria-pressed":S.enabled,onClick:()=>void E(S)}):null]},S.name)),a.servers.length?null:l.jsx(ze,{children:"还没有配置 MCP 服务"})]}),f?l.jsx("div",{className:f.startsWith("已")?"okline":"badline",role:"status",children:f}):null,l.jsx("div",{className:"note",children:"环境变量和请求头的值只保存在本机,保存后不再显示。远程服务需要 OAuth 登录时这版暂不支持。"})]})]})}function Hb(n){return Object.entries(n??{}).map(([a,r])=>({key:a,value:r.redacted?"":r.value??"",secret:r.redacted}))}function Bb(n,a){const r={},o=new Set(a.filter(c=>c.key.trim()).map(c=>c.key.trim()));for(const c of Object.keys(n??{}))o.has(c)||(r[c]={mode:"remove"});for(const c of a){const f=c.key.trim();f&&(c.value===""&&c.secret?r[f]={mode:"preserve"}:c.value!==""&&(r[f]={mode:"replace",value:c.value}))}return Object.keys(r).length?r:void 0}function qb({rows:n,onChange:a,keyLabel:r,valueLabel:o}){const c=(f,h)=>a(n.map((m,p)=>p===f?{...m,...h}:m));return l.jsxs("div",{className:"pairlist",children:[n.map((f,h)=>l.jsxs("div",{className:"pairrow",children:[l.jsx("label",{className:"field",children:l.jsx("input",{className:"mono",value:f.key,placeholder:r,onChange:m=>c(h,{key:m.target.value})})}),l.jsx("label",{className:"field",children:l.jsx("input",{className:"mono",type:"password",value:f.value,placeholder:f.secret&&f.value===""?"已保存,留空则沿用":o,onChange:m=>c(h,{value:m.target.value})})}),l.jsx("button",{className:"hob-icon-btn",title:"删除这一项",onClick:()=>a(n.filter((m,p)=>p!==h)),children:l.jsx(X,{name:"close",size:15})})]},h)),l.jsx("div",{children:l.jsx("button",{className:"hob-btn",onClick:()=>a([...n,{key:"",value:"",secret:!1}]),children:"添加一项"})})]})}const e3={kind:"stdio",command:"",args:"",env:[],cwd:"",url:"",headers:[],description:""};function t3(n){return{kind:n.kind??"stdio",command:n.command??"",args:(n.args??[]).join(`
|
|
264
|
+
`),env:Hb(n.env),cwd:n.cwd??"",url:n.url??"",headers:Hb(n.headers),description:n.description??""}}function Ey({initial:n,name:a,onName:r,fixedName:o,onSaved:c,saveLabel:f}){const[h,m]=y.useState(n),[p,g]=y.useState(!1),[v,b]=y.useState(null),j=S=>m(T=>({...T,...S})),E=async()=>{b(null);const S=a.trim();if(!/^[A-Za-z0-9_-]{1,64}$/.test(S)){b("名称只能用字母、数字、_ 和 -,最长 64 字符。");return}const T=Object.fromEntries(n.env.map(D=>[D.key,D.secret?{redacted:!0}:{redacted:!1,value:D.value}])),z=Object.fromEntries(n.headers.map(D=>[D.key,D.secret?{redacted:!0}:{redacted:!1,value:D.value}])),A=Bb(n.env.length?T:void 0,h.env),$=Bb(n.headers.length?z:void 0,h.headers);g(!0);try{await uN(S,{kind:h.kind,...h.kind==="stdio"?{command:h.command.trim(),...h.args.trim()?{args:h.args.split(/\r?\n/).map(D=>D.trim()).filter(Boolean)}:{},...h.cwd.trim()?{cwd:h.cwd.trim()}:{},...A?{env:A}:{}}:{url:h.url.trim(),...$?{headers:$}:{}},...h.description.trim()?{description:h.description.trim()}:{}}),c(o?`已保存「${S}」`:`已添加「${S}」`)}catch(D){b(Xt(D))}finally{g(!1)}};return l.jsxs("div",{className:"formcard",children:[l.jsx("div",{className:"lbl",children:"名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:a,readOnly:o,placeholder:"如 filesystem",onChange:S=>r?.(S.target.value)})}),o?null:l.jsx("div",{className:"note",children:"字母、数字、_ 和 -;- 和 _ 视为同名。改名请删除后重新添加。"}),l.jsx("div",{className:"lbl",children:"类型"}),l.jsx(ys,{items:[{key:"stdio",label:"本地命令"},{key:"http",label:"远程地址"}],value:h.kind,onChange:S=>j({kind:S}),disabled:p}),l.jsx("div",{className:`expand settings-motion${h.kind==="stdio"?" open":""}`,inert:h.kind!=="stdio",children:l.jsxs("div",{children:[l.jsx("div",{className:"lbl",children:"命令"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:h.command,placeholder:"如 npx 或 uvx(一个可执行文件,不是整条命令行)",onChange:S=>j({command:S.target.value})})}),l.jsx("div",{className:"lbl",children:"参数"}),l.jsx("div",{className:"field",children:l.jsx("textarea",{className:"mono",rows:3,value:h.args,placeholder:`-y
|
|
265
|
+
@modelcontextprotocol/server-filesystem
|
|
266
|
+
.`,onChange:S=>j({args:S.target.value})})}),l.jsx("div",{className:"note",children:"一行一个参数。"}),l.jsx("div",{className:"lbl",children:"环境变量"}),l.jsx(qb,{rows:h.env,onChange:S=>j({env:S}),keyLabel:"变量名",valueLabel:"值"}),l.jsx("div",{className:"lbl",children:"工作目录"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:h.cwd,placeholder:"可空;相对路径按任务的工作目录解析",onChange:S=>j({cwd:S.target.value})})})]})}),l.jsx("div",{className:`expand settings-motion${h.kind==="http"?" open":""}`,inert:h.kind!=="http",children:l.jsxs("div",{children:[l.jsx("div",{className:"lbl",children:"地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{className:"mono",value:h.url,placeholder:"https://example.com/mcp(streamable HTTP,不支持 /sse 结尾)",onChange:S=>j({url:S.target.value})})}),l.jsx("div",{className:"lbl",children:"请求头"}),l.jsx(qb,{rows:h.headers,onChange:S=>j({headers:S}),keyLabel:"名称",valueLabel:"值"})]})}),l.jsx("div",{className:"lbl",children:"说明"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:h.description,placeholder:"这个服务提供什么,一句话(可空)",onChange:S=>j({description:S.target.value})})}),v?l.jsx("div",{className:"badline",role:"alert",children:v}):null,l.jsx(ts,{saved:!1,error:null,children:l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:p,onClick:()=>void E(),children:p?"正在保存…":f})})]})}function n3({onDone:n}){const[a,r]=y.useState("");return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"MCP"}),l.jsx(Fe,{title:"添加 MCP 服务",desc:"本地命令(stdio)或远程地址(streamable HTTP)。保存后可以在详情里测试连接并开关单个工具。"}),l.jsx(be,{children:l.jsx(Ey,{initial:e3,name:a,onName:r,fixedName:!1,onSaved:n,saveLabel:"添加"})})]})}function s3({server:n,setView:a,probe:r,onProbe:o,onDone:c}){const[f,h]=y.useState(null),[m,p]=y.useState(!1),[g,v]=y.useState(!1),[b,j]=y.useState(null);if(y.useEffect(()=>{n||Ht()},[n]),!n)return null;const E=b??n.hiddenTools??[],S=r?.state==="connected"?r.tools??[]:void 0,T=async D=>{p(!0),h(null);try{const V=await l0(n.name,D);return a(V),V}catch(V){return h(Xt(V)),null}finally{p(!1)}},z=async()=>{v(!0);try{await o(n,!0)}finally{v(!1)}},A=async()=>{if(window.confirm(`删除 MCP 服务「${n.name}」?此操作不能撤销。`))try{a(await dN(n.name)),c(`已删除「${n.name}」`)}catch(D){h(Xt(D))}},$=n.kind==="http"?"远程地址":"本地命令";return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"MCP"}),l.jsx(Fe,{title:n.name,desc:n.description??(n.valid?`${$}的 MCP 服务`:n.invalidReason)}),n.valid?l.jsxs(be,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${n.name}启用`,"aria-pressed":n.enabled,disabled:m,onClick:()=>void T({enabled:!n.enabled})})]}),l.jsx("div",{className:"lbl",children:"提供方式"}),l.jsx(ys,{items:[{key:"direct",label:"直接提供"},{key:"deferred",label:"按需搜索"}],value:n.exposure,disabled:m,onChange:D=>void T({exposure:D})}),l.jsx("div",{className:"note",children:"直接提供:工具和内置工具一样声明给模型,适合工具少的服务。按需搜索:模型先搜索再调用,适合工具多的服务。"})]}):l.jsxs(be,{children:[l.jsxs("div",{className:"badline",role:"alert",children:["配置无效:",n.invalidReason]}),l.jsx("div",{className:"note",children:"删除后重新添加,或在下方按表单保存一次即可修复。"})]}),n.valid?l.jsxs(be,{children:[l.jsxs("div",{className:"testrow",children:[l.jsx("button",{className:"hob-btn",onClick:()=>void z(),disabled:g,children:g?"正在测试…":"测试连接"}),r?l.jsx("span",{className:r.state==="connected"?"okline":"badline",children:r.state==="connected"?`已连接 · ${r.tools?.length??0} 个工具`:r.state==="needs_auth"?"需要登录,暂不支持":r.error??"连接失败"}):l.jsx("span",{className:"note",children:"连接后列出服务提供的工具"})]}),r&&r.state!=="connected"&&r.stderrTail?.length?l.jsx("div",{className:"note mono",children:r.stderrTail.join(`
|
|
267
|
+
`)}):null,S?S.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"lbl",children:["工具(",S.length,")"]}),l.jsx("div",{className:"group-card settings-card",children:S.map(D=>{const V=E.includes(D.name);return l.jsxs("div",{className:`list-row setting-row${V?" gone":""}`,children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname mono",children:D.name}),l.jsx("div",{className:"rprov rclamp",children:D.description||"(没有说明)"})]}),l.jsx("button",{className:`tog${V?" off":""}`,"aria-label":`${D.name}启用`,"aria-pressed":!V,disabled:m,onClick:()=>{const N=V?E.filter(k=>k!==D.name):[...E,D.name];j(N),T({hiddenTools:N})}})]},D.name)})}),l.jsx("div",{className:"note",children:"关掉的工具不声明给模型;改动对之后新开的任务生效。"})]}):l.jsx("div",{className:"note",children:"服务已连接,但没有提供工具。"}):l.jsx("div",{className:"note",children:"先测试连接,取得服务的工具列表后可以单独开关每个工具。"})]}):null,l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:n.valid?"编辑":"重新保存"}),l.jsx(Ey,{initial:t3(n),name:n.name,fixedName:!0,onSaved:c,saveLabel:"保存"})]}),l.jsxs(be,{children:[l.jsx("button",{className:"hob-btn hob-btn-danger",disabled:m,onClick:()=>void A(),children:"删除服务"}),f?l.jsx("div",{className:"badline",role:"alert",children:f}):null]}),l.jsx("div",{className:"note",children:"环境变量和请求头的值不回显;留空表示沿用已保存的值。删除整行表示删掉这个值。"})]})}function l3({onDone:n}){const[a,r]=y.useState(null),[o,c]=y.useState([]),[f,h]=y.useState(!1),[m,p]=y.useState(null);y.useEffect(()=>{let b=!0;return hN().then(j=>{b&&r(j)}).catch(j=>{b&&p(Xt(j))}),()=>{b=!1}},[]);const g=async()=>{h(!0),p(null);try{const b=await mN(o),j=b.skipped.length?`,跳过 ${b.skipped.length} 个(同名)`:"";n(`已导入 ${b.imported.length} 个服务${j}`)}catch(b){p(Xt(b))}finally{h(!1)}},v=a?.items??[];return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"MCP"}),l.jsx(Fe,{title:"从本机导入 MCP 服务",desc:"读取本机 pi、Claude Code、Cursor 里已配置的 MCP 服务,复制到 Hob;来源只读,同名跳过。"}),l.jsxs(be,{children:[a?.sources.length?l.jsxs("div",{className:"note",children:["读取位置:",a.sources.join(";")]}):null,l.jsx("div",{className:"group-card settings-card",children:v.length?v.map(b=>l.jsxs("label",{className:"list-row setting-row",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:o.includes(b.id),disabled:f||!b.selectable,onChange:j=>c(j.target.checked?[...o,b.id]:o.filter(E=>E!==b.id))}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[b.name,l.jsx("span",{className:"rtag",children:PE[b.source]}),b.exists?l.jsx("span",{className:"rtag",children:"同名跳过"}):null]}),l.jsxs("div",{className:"rprov rclamp",children:[b.kind==="http"?"远程地址":"本地命令",b.note?` · ${b.note}`:""]})]})]},b.id)):l.jsx(ze,{children:"没有找到可导入的 MCP 服务"})}),l.jsxs(ts,{saved:!1,error:m,children:[l.jsx("button",{className:"hob-btn",onClick:Ht,disabled:f,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:f||!o.length,onClick:()=>void g(),children:f?"正在导入…":o.length?`导入 ${o.length} 个`:"导入所选"})]})]})]})}const Sl={searxng:{label:"SearXNG",desc:"自建的元搜索服务,填写服务地址即可",url:!0,keyOptional:!0},exa:{label:"Exa",desc:"语义搜索,适合查找技术资料"},tavily:{label:"Tavily",desc:"面向 AI 的搜索接口"},brave:{label:"Brave Search",desc:"Brave 的独立网页索引"},serper:{label:"Serper",desc:"Google 搜索结果"},jina:{label:"Jina",desc:"搜索并读取网页正文"},firecrawl:{label:"Firecrawl",desc:"搜索并抓取网页正文"},perplexity:{label:"Perplexity",desc:"带摘要的搜索结果"},youcom:{label:"You.com",desc:"You.com 搜索接口"},ollama:{label:"Ollama",desc:"Ollama 的网页搜索",url:!0}};function a3(){const n=je(),a=n.sub,r=n.settings.settings.search,[o,c]=y.useState(null),[f,h]=y.useState(null),[m,p]=y.useState(!1),g=async()=>c(await pN());y.useEffect(()=>{g().catch(T=>h(Xt(T)))},[]),y.useEffect(()=>{a&&h(null)},[a]);const v=T=>o?.providers.find(z=>z.name===T)?.keyConfigured??!1,b=async(T,z)=>{p(!0);try{const A=await vN(T,z);return A?(h(A),A):(await g(),null)}catch(A){const $=Xt(A);return h($),$}finally{p(!1)}},j=r.filter(T=>T.enabled),E=(T,z)=>{const A=j.map(V=>V.name),$=A.indexOf(T),D=$+z;D<0||D>=A.length||([A[$],A[D]]=[A[D],A[$]],b([...A.map(V=>r.find(N=>N.name===V)),...r.filter(V=>!V.enabled)]))};if(a?.kind==="searchProvider"){const T=r.find(z=>z.name===a.name);return T?l.jsx(i3,{provider:T,configured:v(T.name),busy:m,save:(z,A)=>b(r.map($=>$.name===z.name?z:$),A===void 0?void 0:{[z.name]:A})}):l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"联网搜索"}),l.jsx("div",{className:"note",children:"没有这个服务商。"})]})}const S=T=>v(T.name)?"已配置 Key":T.baseUrl?"已填服务地址":"未配置";return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"联网搜索",desc:"助手和任务通过这里的服务商搜索网页、读取正文。可以启用多个,按顺序使用,前一个失败时自动换下一个。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"已启用"}),j.length?l.jsx("div",{className:"group-card settings-card",children:j.map((T,z)=>l.jsxs("div",{className:"list-row setting-row",children:[l.jsx("span",{className:"rorder",children:z+1}),l.jsxs("button",{className:"rmain rbtn",onClick:()=>Tn({kind:"searchProvider",name:T.name,title:Sl[T.name].label}),children:[l.jsx("div",{className:"rname",children:Sl[T.name].label}),l.jsx("div",{className:"rprov",children:Sl[T.name].desc})]}),l.jsx("button",{className:"hob-icon-btn rmove",title:"上移",disabled:m||z===0,onClick:()=>E(T.name,-1),children:l.jsx(X,{name:"down",size:15,className:"up"})}),l.jsx("button",{className:"hob-icon-btn rmove",title:"下移",disabled:m||z===j.length-1,onClick:()=>E(T.name,1),children:l.jsx(X,{name:"down",size:15})})]},T.name))}):l.jsx("div",{className:"note",children:"尚未启用服务商,助手和任务暂时不能联网搜索。"}),f?l.jsx("div",{className:"badline",children:f}):null]}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:j.length?"其他服务商":"选择服务商"}),l.jsx("div",{className:"group-card settings-card",children:r.filter(T=>!T.enabled).map(T=>l.jsxs("button",{className:"list-row setting-row",onClick:()=>Tn({kind:"searchProvider",name:T.name,title:Sl[T.name].label}),children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname",children:Sl[T.name].label}),l.jsx("div",{className:"rprov",children:Sl[T.name].desc})]}),l.jsx("span",{className:"note",children:S(T)}),l.jsx(X,{name:"chev",size:15,className:"rgo"})]},T.name))})]})]})}function i3({provider:n,configured:a,busy:r,save:o}){const c=Sl[n.name],[f,h]=y.useState(n.baseUrl??""),[m,p]=y.useState(""),[g,v]=y.useState(null),[b,j]=y.useState(!1),[E,S]=y.useState(null),[T,z]=y.useState(!1);y.useEffect(()=>h(n.baseUrl??""),[n.baseUrl]);const A=f.trim()!==(n.baseUrl??"")||!!m.trim(),$=a||!!m.trim()||c.keyOptional&&!!f.trim(),D=async()=>{j(!0),v(null);try{const k=await gN(n.name,f.trim(),m.trim()||void 0);return v({ok:k.ok,text:k.ok?`搜索成功,返回 ${k.count} 条结果`:k.error??"搜索失败"}),k.ok}catch(k){return v({ok:!1,text:Xt(k)}),!1}finally{j(!1)}},V=async(k,C)=>{S(null),z(!1);const M=await o(k,C);return M?(S(M),!1):(z(!0),!0)},N=async()=>{await D()&&await V({...n,baseUrl:f.trim()||void 0},m.trim()||void 0)&&p("")};return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"联网搜索"}),l.jsx(Fe,{title:c.label,desc:c.desc}),l.jsxs(be,{children:[l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"启用"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${n.enabled?"":" off"}`,"aria-label":`${c.label}启用`,"aria-pressed":n.enabled,disabled:r||!n.enabled&&!$,onClick:()=>void V({...n,enabled:!n.enabled})})]}),!n.enabled&&!$?l.jsxs("div",{className:"note",children:[c.url?"填写服务地址":"填写 API Key","并保存后即可启用。"]}):null]}),l.jsx(be,{children:l.jsxs("div",{className:"formcard",children:[c.url?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"服务地址"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:f,onChange:k=>{h(k.target.value),v(null)},placeholder:"http://127.0.0.1:8888",disabled:r})})]}):null,l.jsxs("div",{className:"lbl",children:["API Key",c.keyOptional?"(可选)":""]}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:m,onChange:k=>{p(k.target.value),v(null)},placeholder:a?"已保存,留空则沿用":"填写 API Key",disabled:r})}),l.jsx("div",{className:"note",children:"API Key 只保存在本机,保存后不再显示。"}),l.jsxs("div",{className:"testrow",children:[l.jsx("button",{className:"hob-btn",onClick:()=>void D(),disabled:r||b,children:b?"正在搜索…":"测试搜索"}),g?l.jsx("span",{className:g.ok?"okline":"badline",children:g.text}):null]}),l.jsxs(ts,{saved:T&&!A,error:E,children:[a?l.jsx("button",{className:"hob-btn",disabled:r,onClick:()=>void V(n,""),children:"删除 Key"}):null,l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:r||b||!A,onClick:()=>void N(),children:"保存"})]})]})})]})}function r3(){const[n,a]=y.useState(null);if(y.useEffect(()=>{Vw().then(a)},[]),!n)return l.jsx(ze,{children:"正在读取版本信息…"});const r=[["Hob 版本",n.version],["数据目录",n.home]];return l.jsxs(l.Fragment,{children:[l.jsx(Fe,{title:"关于",desc:"Hob 的版本与数据目录。"}),l.jsx("div",{className:"kvcard",children:r.map(([o,c])=>l.jsxs("div",{className:"kvrow",children:[l.jsx("span",{className:"k",children:o}),l.jsx("span",{className:"v",children:c})]},o))})]})}const o3=n=>n.id;function c3(){const n=je(),a=n.assistants.filter(c=>c.pinned&&!c.hidden&&Fi(c,n.query)),r=J1(a,o3),o=vy(a.length);return l.jsxs("aside",{className:"side",children:[l.jsxs("div",{className:"side-top",children:[l.jsxs("div",{className:"search",children:[l.jsx(X,{name:"search",size:15}),l.jsx("input",{value:n.query,placeholder:"搜索助手",onChange:c=>j0(c.target.value)})]}),l.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:x0,children:l.jsx(X,{name:"plus",size:18})})]}),l.jsxs("div",{className:"side-scroll",children:[l.jsx("div",{className:`pins${o.cls}`,children:r.map(c=>l.jsx("div",{className:`srow${c.state==="still"?"":` ${c.state}`}`,children:l.jsx("div",{className:"srowclip",children:l.jsx(gy,{a:c.item,sel:c.item.id===n.sel,size:o.size})})},c.key))}),l.jsx(xy,{size:42,markSel:!0})]}),l.jsxs("div",{className:"side-foot",children:[l.jsxs("button",{className:"frow",onClick:hh,children:[l.jsx(X,{name:"archive",size:18}),l.jsx("span",{className:"sp",children:"知识库"})]}),l.jsxs("button",{className:"frow",onClick:jc,children:[l.jsx(X,{name:"gear",size:18}),l.jsx("span",{className:"sp",children:"设置"})]})]})]})}function u3(){"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(n=>{const a=r=>{r&&r.addEventListener("statechange",()=>{r.state==="installed"&&navigator.serviceWorker.controller&&cS()})};a(n.installing),n.addEventListener("updatefound",()=>a(n.installing))}).catch(()=>{})})}async function d3(){if(!("serviceWorker"in navigator)){location.reload();return}let n=!1;const a=()=>{n||(n=!0,location.reload())};navigator.serviceWorker.addEventListener("controllerchange",a,{once:!0}),(await navigator.serviceWorker.getRegistration())?.waiting?.postMessage("skip-waiting"),setTimeout(a,1200)}function f3(n,a){const[r,o]=y.useState({stack:n,owner:a}),[c,f]=y.useState([]);if(r.stack!==n||r.owner!==a){const h=new Set(n.map(Ha));f(r.owner!==a?[]:[...c.filter(m=>!h.has(Ha(m.page))),...$w(r.stack,n)]),o({stack:n,owner:a})}return y.useEffect(()=>{if(!c.length)return;const h=setTimeout(()=>f([]),240);return()=>clearTimeout(h)},[c]),Uw(n,c)}function h3(n){return n.replace(/^无法连接 Hob:/,"")}function m3(){const n=je(),[a,r]=y.useState(()=>window.innerWidth<768),o=wn(n.mobile==="chat"&&!!n.sel,240),c=wn(n.page==="settings",180),f=wn(n.page==="knowledge",180),h=wn(n.sheet,180),m=n.panelStack.at(-1),p=f3(n.panelStack,n.sel),g=p.map(({page:j,leaving:E})=>l.jsx("div",{className:`mlayer${E?" leaving":""}`,children:j.kind==="file"?l.jsx(rc,{page:j}):j.kind==="job"||j.kind==="jobs"?l.jsx(Sf,{page:j}):l.jsx(_b,{page:j,leaving:!1})},Ha(j)));if(y.useLayoutEffect(()=>{Pb(n,a)},[n.phase,n.page,n.mobile,n.sheet,n.panelStack,n.theme,a]),y.useEffect(()=>{zN()},[]),y.useEffect(()=>{if(!n.panelStack.length)return;const j=E=>{E.key==="Escape"&&!E.defaultPrevented&&rr()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[n.panelStack]),y.useEffect(()=>{const j=()=>r(window.innerWidth<768);return window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]),y.useEffect(()=>{const j=setInterval(()=>uS(),3e4);return()=>clearInterval(j)},[]),y.useEffect(()=>{const j=n.assistants.reduce((E,S)=>E+S.unread,0);document.title=j>0?`(${j}) Hob`:"Hob"},[n.assistants]),y.useEffect(()=>{if(!n.notice)return;const j=setTimeout(()=>oS(),6e3);return()=>clearTimeout(j)},[n.notice]),n.phase==="login")return l.jsx(mC,{});if(n.phase==="error")return l.jsx("div",{className:"boot",children:l.jsxs("div",{className:"boot-card",children:[l.jsx("div",{className:"t",children:"无法连接 Hob"}),l.jsx("div",{className:"d",children:"请检查网络,或确认 Hob 服务已启动。"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>location.reload(),children:"重试"}),n.error?l.jsx("div",{className:"raw",children:h3(n.error)}):null]})});if(n.phase==="loading")return l.jsx("div",{className:"boot",children:l.jsxs("div",{className:"boot-loading",children:[l.jsx(rt,{sprite:"hob",size:92,motion:"think"}),l.jsx("span",{className:"activity-shimmer",children:"正在连接 Hob…"})]})});const v=n.notice?l.jsx("div",{className:"toast",children:n.notice}):n.updateReady?l.jsx("button",{className:"upd",onClick:()=>void d3(),children:"有新版本,点击更新"}):null;if(c.mounted)return l.jsxs(l.Fragment,{children:[l.jsx(mE,{narrow:a,leaving:c.leaving}),a?g:l.jsxs(l.Fragment,{children:[l.jsx(Sf,{}),l.jsx(rc,{})]}),v]});if(f.mounted)return l.jsxs(l.Fragment,{children:[l.jsx(TC,{narrow:a,leaving:f.leaving}),a?g:null,v]});const b=m?.kind==="file"?m:null;return a?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mapp",children:[l.jsx("div",{className:`mpane list${n.mobile==="chat"?" back":""}`,children:l.jsx(uE,{})}),o.mounted?l.jsx("div",{className:`mpane chat${o.leaving?" out":""}`,children:l.jsx(DT,{})}):null,h.mounted?l.jsx(_b,{leaving:h.leaving,page:null}):null,g]}),l.jsx(Vx,{}),v]}):l.jsxs("div",{className:`app${b?.full?" preview-full":""}`,children:[l.jsx(c3,{}),l.jsx(RT,{}),l.jsxs("div",{className:`panelwrap${b?.full?" full":n.collapsed?" off":n.nowWide?" wide":""}`,children:[l.jsx(Qf,{page:null}),p.map(({page:j,leaving:E})=>l.jsx("div",{className:`panel-layer${j.kind==="file"||j.kind==="job"||j.kind==="jobs"?" wide":""}${E?" leaving":""}`,children:j.kind==="file"?l.jsx(rc,{embedded:!0,page:j}):j.kind==="job"||j.kind==="jobs"?l.jsx(Sf,{embedded:!0,page:j}):l.jsx(Qf,{page:j})},Ha(j)))]}),l.jsx(Vx,{}),n.offline?l.jsx("div",{className:"toast",children:n.offline}):null,v]})}function Mf(n,a){if(!a)return[];const r=[];n.page==="knowledge"?r.push("knowledge"):n.page==="settings"?(r.push("settings"),n.section&&r.push("section"),n.sub&&r.push("sub")):(n.mobile==="chat"&&n.sel&&r.push("chat"),n.sheet&&r.push("sheet"));for(const o of n.panelStack)r.push("panelPage");return r}const p3={panelPage:rr,sheet:w0,knowledge:()=>{nr(),Lf("list")},chat:()=>Lf("list"),sub:Ht,section:()=>zl(null),settings:Uf};function g3(n=()=>window.innerWidth<768){let a=0,r=0,o=!1;const c=()=>location.pathname+location.search+L1(Fs(),n());history.replaceState({hobDepth:0},"",c());const f=()=>{if(o||r>0)return;const h=Mf(Fs(),n()).length;if(a>h){r++,history.go(h-a),a=h;return}for(;a<h;)history.pushState({hobDepth:++a},"",c());c()!==location.pathname+location.search+location.hash&&history.replaceState(history.state,"",c())};window.addEventListener("popstate",h=>{if(r>0){r--,f();return}const m=Number(h.state?.hobDepth??0);a=m,o=!0;for(let p=0;p<10;p++){const g=Mf(Fs(),n()).at(-1);if(!g||Mf(Fs(),n()).length<=m)break;p3[g]()}o=!1,f()}),s0(f),f()}_1.createRoot(document.getElementById("root")).render(l.jsx(m3,{}));g3();document.addEventListener("gesturestart",n=>n.preventDefault());u3();export{X as I,Ol as M,VC as a,cr as b,cc as d,l as j,y as r,x3 as s,je as u};
|