hob-bot 1.1.0 → 1.2.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.
@@ -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 ef={exports:{}},Hi={};/**
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 Wv;function g1(){if(Wv)return Hi;Wv=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 Hi.Fragment=a,Hi.jsx=r,Hi.jsxs=r,Hi}var ex;function v1(){return ex||(ex=1,ef.exports=g1()),ef.exports}var l=v1(),tf={exports:{}},Bi={},nf={exports:{}},sf={};/**
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 tx;function x1(){return tx||(tx=1,(function(n){function a(se,ve){var me=se.length;se.push(ve);e:for(;0<me;){var ze=me-1>>>1,Ae=se[ze];if(0<c(Ae,ve))se[ze]=ve,se[me]=Ae,me=ze;else break e}}function r(se){return se.length===0?null:se[0]}function o(se){if(se.length===0)return null;var ve=se[0],me=se.pop();if(me!==ve){se[0]=me;e:for(var ze=0,Ae=se.length,bt=Ae>>>1;ze<bt;){var Ot=2*(ze+1)-1,Et=se[Ot],D=Ot+1,J=se[D];if(0>c(Et,me))D<Ae&&0>c(J,Et)?(se[ze]=J,se[D]=me,ze=D):(se[ze]=Et,se[Ot]=me,ze=Ot);else if(D<Ae&&0>c(J,me))se[ze]=J,se[D]=me,ze=D;else break e}}return ve}function c(se,ve){var me=se.sortIndex-ve.sortIndex;return me!==0?me:se.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=[],x=[],v=1,b=null,j=3,T=!1,S=!1,C=!1,M=!1,A=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function k(se){for(var ve=r(x);ve!==null;){if(ve.callback===null)o(x);else if(ve.startTime<=se)o(x),ve.sortIndex=ve.expirationTime,a(p,ve);else break;ve=r(x)}}function N(se){if(C=!1,k(se),!S)if(r(p)!==null)S=!0,E||(E=!0,Ee());else{var ve=r(x);ve!==null&&_e(N,ve.startTime-se)}}var E=!1,_=-1,z=5,V=-1;function ne(){return M?!0:!(n.unstable_now()-V<z)}function ee(){if(M=!1,E){var se=n.unstable_now();V=se;var ve=!0;try{e:{S=!1,C&&(C=!1,U(_),_=-1),T=!0;var me=j;try{t:{for(k(se),b=r(p);b!==null&&!(b.expirationTime>se&&ne());){var ze=b.callback;if(typeof ze=="function"){b.callback=null,j=b.priorityLevel;var Ae=ze(b.expirationTime<=se);if(se=n.unstable_now(),typeof Ae=="function"){b.callback=Ae,k(se),ve=!0;break t}b===r(p)&&o(p),k(se)}else o(p);b=r(p)}if(b!==null)ve=!0;else{var bt=r(x);bt!==null&&_e(N,bt.startTime-se),ve=!1}}break e}finally{b=null,j=me,T=!1}ve=void 0}}finally{ve?Ee():E=!1}}}var Ee;if(typeof $=="function")Ee=function(){$(ee)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,we=he.port2;he.port1.onmessage=ee,Ee=function(){we.postMessage(null)}}else Ee=function(){A(ee,0)};function _e(se,ve){_=A(function(){se(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(se){se.callback=null},n.unstable_forceFrameRate=function(se){0>se||125<se?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<se?Math.floor(1e3/se):5},n.unstable_getCurrentPriorityLevel=function(){return j},n.unstable_next=function(se){switch(j){case 1:case 2:case 3:var ve=3;break;default:ve=j}var me=j;j=ve;try{return se()}finally{j=me}},n.unstable_requestPaint=function(){M=!0},n.unstable_runWithPriority=function(se,ve){switch(se){case 1:case 2:case 3:case 4:case 5:break;default:se=3}var me=j;j=se;try{return ve()}finally{j=me}},n.unstable_scheduleCallback=function(se,ve,me){var ze=n.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?ze+me:ze):me=ze,se){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=me+Ae,se={id:v++,callback:ve,priorityLevel:se,startTime:me,expirationTime:Ae,sortIndex:-1},me>ze?(se.sortIndex=me,a(x,se),r(p)===null&&se===r(x)&&(C?(U(_),_=-1):C=!0,_e(N,me-ze))):(se.sortIndex=Ae,a(p,se),S||T||(S=!0,E||(E=!0,Ee()))),se},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(se){var ve=j;return function(){var me=j;j=ve;try{return se.apply(this,arguments)}finally{j=me}}}})(sf)),sf}var nx;function b1(){return nx||(nx=1,nf.exports=x1()),nf.exports}var lf={exports:{}},Ne={};/**
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 sx;function y1(){if(sx)return Ne;sx=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"),x=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),j=Symbol.for("react.view_transition"),T=Symbol.iterator;function S(D){return D===null||typeof D!="object"?null:(D=T&&D[T]||D["@@iterator"],typeof D=="function"?D:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,A={};function U(D,J,W){this.props=D,this.context=J,this.refs=A,this.updater=W||C}U.prototype.isReactComponent={},U.prototype.setState=function(D,J){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,J,"setState")},U.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function $(){}$.prototype=U.prototype;function k(D,J,W){this.props=D,this.context=J,this.refs=A,this.updater=W||C}var N=k.prototype=new $;N.constructor=k,M(N,U.prototype),N.isPureReactComponent=!0;var E=Array.isArray;function _(){}var z={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function ne(D,J,W){var re=W.ref;return{$$typeof:n,type:D,key:J,ref:re!==void 0?re:null,props:W}}function ee(D,J){return ne(D.type,J,D.props)}function Ee(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function he(D){var J={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(W){return J[W]})}var we=/\/+/g;function _e(D,J){return typeof D=="object"&&D!==null&&D.key!=null?he(""+D.key):J.toString(36)}function se(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(_,_):(D.status="pending",D.then(function(J){D.status==="pending"&&(D.status="fulfilled",D.value=J)},function(J){D.status==="pending"&&(D.status="rejected",D.reason=J)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ve(D,J,W,re,K){var ae=typeof D;(ae==="undefined"||ae==="boolean")&&(D=null);var le=!1;if(D===null)le=!0;else switch(ae){case"bigint":case"string":case"number":le=!0;break;case"object":switch(D.$$typeof){case n:case a:le=!0;break;case v:return le=D._init,ve(le(D._payload),J,W,re,K)}}if(le)return K=K(D),le=re===""?"."+_e(D,0):re,E(K)?(W="",le!=null&&(W=le.replace(we,"$&/")+"/"),ve(K,J,W,"",function(st){return st})):K!=null&&(Ee(K)&&(K=ee(K,W+(K.key==null||D&&D.key===K.key?"":(""+K.key).replace(we,"$&/")+"/")+le)),J.push(K)),1;le=0;var ce=re===""?".":re+":";if(E(D))for(var xe=0;xe<D.length;xe++)re=D[xe],ae=ce+_e(re,xe),le+=ve(re,J,W,ae,K);else if(xe=S(D),typeof xe=="function")for(D=xe.call(D),xe=0;!(re=D.next()).done;)re=re.value,ae=ce+_e(re,xe++),le+=ve(re,J,W,ae,K);else if(ae==="object"){if(typeof D.then=="function")return ve(se(D),J,W,re,K);throw J=String(D),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return le}function me(D,J,W){if(D==null)return D;var re=[],K=0;return ve(D,re,"","",function(ae){return J.call(W,ae,K++)}),re}function ze(D){if(D._status===-1){var J=D._result,W=J();W.then(function(re){(D._status===0||D._status===-1)&&(D._status=1,D._result=re,W.status===void 0&&(W.status="fulfilled",W.value=re))},function(re){(D._status===0||D._status===-1)&&(D._status=2,D._result=re,W.status===void 0&&(W.status="rejected",W.reason=re))}),D._status===-1&&(D._status=0,D._result=W)}if(D._status===1)return D._result.default;throw D._result}var Ae=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function bt(D){var J=z.T,W={};W.types=J!==null?J.types:null,z.T=W;try{var re=D(),K=z.S;K!==null&&K(W,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(_,Ae)}catch(ae){Ae(ae)}finally{J!==null&&W.types!==null&&(J.types=W.types),z.T=J}}function Ot(D){var J=z.T;if(J!==null){var W=J.types;W===null?J.types=[D]:W.indexOf(D)===-1&&W.push(D)}else bt(Ot.bind(null,D))}var Et={map:me,forEach:function(D,J,W){me(D,function(){J.apply(this,arguments)},W)},count:function(D){var J=0;return me(D,function(){J++}),J},toArray:function(D){return me(D,function(J){return J})||[]},only:function(D){if(!Ee(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ne.Activity=b,Ne.Children=Et,Ne.Component=U,Ne.Fragment=r,Ne.Profiler=c,Ne.PureComponent=k,Ne.StrictMode=o,Ne.Suspense=p,Ne.ViewTransition=j,Ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ne.__COMPILER_RUNTIME={__proto__:null,c:function(D){return z.H.useMemoCache(D)}},Ne.addTransitionType=Ot,Ne.cache=function(D){return function(){return D.apply(null,arguments)}},Ne.cacheSignal=function(){return null},Ne.cloneElement=function(D,J,W){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var re=M({},D.props),K=D.key;if(J!=null)for(ae in J.key!==void 0&&(K=""+J.key),J)!V.call(J,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&J.ref===void 0||(re[ae]=J[ae]);var ae=arguments.length-2;if(ae===1)re.children=W;else if(1<ae){for(var le=Array(ae),ce=0;ce<ae;ce++)le[ce]=arguments[ce+2];re.children=le}return ne(D.type,K,re)},Ne.createContext=function(D){return D={$$typeof:h,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:f,_context:D},D},Ne.createElement=function(D,J,W){var re,K={},ae=null;if(J!=null)for(re in J.key!==void 0&&(ae=""+J.key),J)V.call(J,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(K[re]=J[re]);var le=arguments.length-2;if(le===1)K.children=W;else if(1<le){for(var ce=Array(le),xe=0;xe<le;xe++)ce[xe]=arguments[xe+2];K.children=ce}if(D&&D.defaultProps)for(re in le=D.defaultProps,le)K[re]===void 0&&(K[re]=le[re]);return ne(D,ae,K)},Ne.createRef=function(){return{current:null}},Ne.forwardRef=function(D){return{$$typeof:m,render:D}},Ne.isValidElement=Ee,Ne.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:ze}},Ne.memo=function(D,J){return{$$typeof:x,type:D,compare:J===void 0?null:J}},Ne.startTransition=bt,Ne.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ne.use=function(D){return z.H.use(D)},Ne.useActionState=function(D,J,W){return z.H.useActionState(D,J,W)},Ne.useCallback=function(D,J){return z.H.useCallback(D,J)},Ne.useContext=function(D){return z.H.useContext(D)},Ne.useDebugValue=function(){},Ne.useDeferredValue=function(D,J){return z.H.useDeferredValue(D,J)},Ne.useEffect=function(D,J){return z.H.useEffect(D,J)},Ne.useEffectEvent=function(D){return z.H.useEffectEvent(D)},Ne.useId=function(){return z.H.useId()},Ne.useImperativeHandle=function(D,J,W){return z.H.useImperativeHandle(D,J,W)},Ne.useInsertionEffect=function(D,J){return z.H.useInsertionEffect(D,J)},Ne.useLayoutEffect=function(D,J){return z.H.useLayoutEffect(D,J)},Ne.useMemo=function(D,J){return z.H.useMemo(D,J)},Ne.useOptimistic=function(D,J){return z.H.useOptimistic(D,J)},Ne.useReducer=function(D,J,W){return z.H.useReducer(D,J,W)},Ne.useRef=function(D){return z.H.useRef(D)},Ne.useState=function(D){return z.H.useState(D)},Ne.useSyncExternalStore=function(D,J,W){return z.H.useSyncExternalStore(D,J,W)},Ne.useTransition=function(){return z.H.useTransition()},Ne.version="19.3.1",Ne}var lx;function Xf(){return lx||(lx=1,lf.exports=y1()),lf.exports}var af={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 ax;function k1(){if(ax)return Tt;ax=1;var n=Xf();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 T=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:T==null?null:T===h?h:""+T,children:v,containerInfo:b,implementation:j}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function x(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,T=x(j,b.crossOrigin),S=typeof b.integrity=="string"?b.integrity:void 0,C=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;j==="style"?o.d.S(v,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:T,integrity:S,fetchPriority:C}):j==="script"&&o.d.X(v,{crossOrigin:T,integrity:S,fetchPriority:C,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=x(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,T=x(j,b.crossOrigin);o.d.L(v,j,{crossOrigin:T,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=x(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 ix;function Db(){if(ix)return af.exports;ix=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=k1(),af.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 rx;function j1(){if(rx)return Bi;rx=1;var n=b1(),a=Xf(),r=Db();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 x(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 g=!1,w=u.child;w;){if(w===s){g=!0,s=u,i=d;break}if(w===i){g=!0,i=u,s=d;break}w=w.sibling}if(!g){for(w=d.child;w;){if(w===s){g=!0,s=d,i=u;break}if(w===i){g=!0,i=d,s=u;break}w=w.sibling}if(!g)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 T(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||C(t,e,s.child,{foundSelf:!1}),t}function C(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)&&C(e,t,s.child,i))return!0;s=s.sibling}return!1}function M(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,U=null;function $(e,t,s){return e===s?!0:e===t?(A=e,!0):!1}function k(e,t,s){return e===s?(U=e,!1):e===t?(U!==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 E(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 _=Object.assign,z=Symbol.for("react.element"),V=Symbol.for("react.transitional.element"),ne=Symbol.for("react.portal"),ee=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),he=Symbol.for("react.profiler"),we=Symbol.for("react.consumer"),_e=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),me=Symbol.for("react.suspense_list"),ze=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"),D=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),W=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=W&&e[W]||e["@@iterator"],typeof e=="function"?e:null)}var K=Symbol.for("react.client.reference");function ae(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 ee:return"Fragment";case he:return"Profiler";case Ee:return"StrictMode";case ve:return"Suspense";case me:return"SuspenseList";case bt:return"Activity";case D:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case ne:return"Portal";case _e:return e.displayName||"Context";case we:return(e._context.displayName||"Context")+".Consumer";case se:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ze:return t=e.displayName||null,t!==null?t:ae(e.type)||"Memo";case Ae:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var le=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 mr(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)?ov(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ov(t),e=cv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ot(Zt),Ge(Zt,e)}function Ll(){ot(Zt),ot(_t),ot(En)}function yc(e){var t=e.memoizedState;t!==null&&(Sa._currentValue=t.memoizedState,Ge(Ws,e)),t=Zt.current;var s=cv(t,e.type);t!==s&&(Ge(_t,e),Ge(Zt,s))}function pr(e){_t.current===e&&(ot(Zt),ot(_t)),Ws.current===e&&(ot(Ws),Sa._currentValue=st)}var kc,Ah;function ks(e){if(kc===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);kc=t&&t[1]||"",Ah=-1<s.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+kc+e+Ah}var jc=!1;function wc(e,t){if(!e||jc)return"";jc=!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(ie){var L=ie}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(ie){L=ie}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(ie){L=ie}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(ie){if(ie&&L&&typeof ie.stack=="string")return[ie.stack,L.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(),g=d[0],w=d[1];if(g&&w){var O=g.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 Y=`
47
+ `+O[i].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=i&&0<=u);break}}}finally{jc=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?ks(s):""}function yy(e,t){switch(e.tag){case 26:case 27:case 5:return ks(e.type);case 16:return ks("Lazy");case 13:return e.child!==t&&t!==null?ks("Suspense Fallback"):ks("Suspense");case 19:return ks("SuspenseList");case 0:case 15:return wc(e.type,!1);case 11:return wc(e.type.render,!1);case 1:return wc(e.type,!0);case 31:return ks("Activity");case 30:return ks("ViewTransition");default:return""}}function Mh(e){try{var t="",s=null;do t+=yy(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
48
+ Error generating stack: `+i.message+`
49
+ `+i.stack}}var Nc=Object.prototype.hasOwnProperty,Sc=n.unstable_scheduleCallback,Tc=n.unstable_cancelCallback,ky=n.unstable_shouldYield,jy=n.unstable_requestPaint,Qt=n.unstable_now,wy=n.unstable_getCurrentPriorityLevel,zh=n.unstable_ImmediatePriority,Oh=n.unstable_UserBlockingPriority,gr=n.unstable_NormalPriority,Ny=n.unstable_LowPriority,_h=n.unstable_IdlePriority,Sy=n.log,Ty=n.unstable_setDisableYieldValue,Va=null,Jt=null;function js(e){if(typeof Sy=="function"&&Ty(e),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Va,e)}catch{}}var Pt=Math.clz32?Math.clz32:Ay,Cy=Math.log,Ey=Math.LN2;function Ay(e){return e>>>=0,e===0?32:31-(Cy(e)/Ey|0)|0}var vr=256,xr=262144,br=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 yr(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var u=0,d=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var w=i&134217727;return w!==0?(i=w&~d,i!==0?u=el(i):(g&=w,g!==0?u=el(g):s||(s=w&~e,s!==0&&(u=el(s))))):(w=i&~d,w!==0?u=el(w):g!==0?u=el(g):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 Xa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Rh(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 My(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 Dh(){var e=br;return br<<=1,(br&62914560)===0&&(br=4194304),e}function Cc(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Za(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function zy(e,t,s,i,u,d){var g=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=g&~s;0<s;){var Y=31-Pt(s),Q=1<<Y;w[Y]=0,O[Y]=-1;var L=B[Y];if(L!==null)for(B[Y]=null,Y=0;Y<L.length;Y++){var I=L[Y];I!==null&&(I.lane&=-536870913)}s&=~Q}i!==0&&$h(e,i,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(g&~t))}function $h(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 Uh(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 Lh(e,t){var s=t&-t;return s=(s&42)!==0?1:Ec(s),(s&(e.suspendedLanes|t))!==0?0:s}function Ec(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 Ac(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Hh(){var e=xe.p;return e!==0?e:(e=window.event,e===void 0?32:Vv(e.type))}function Bh(e,t){var s=xe.p;try{return xe.p=e,t()}finally{xe.p=s}}var ts=Math.random().toString(36).slice(2),yt="__reactFiber$"+ts,Bt="__reactProps$"+ts,Hl="__reactContainer$"+ts,qh="__reactEvents$"+ts,Oy="__reactListeners$"+ts,_y="__reactHandles$"+ts,Ih="__reactResources$"+ts,Qa="__reactMarker$"+ts,kr="__reactLoad$"+ts;function jr(e){delete e[yt],delete e[Bt],delete e[Oy],delete e[_y]}function tl(e){var t;if(t=e[yt])return t;for(var s=e.parentNode;s;){if(t=s[Hl]||s[yt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=Tv(e);e!==null;){if(s=e[yt])return s;e=Tv(e)}return t}e=s,s=e.parentNode}return null}function Bl(e){if(e=e[yt]||e[Hl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ja(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ql(e){var t=e[Ih];return t||(t=e[Ih]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[Qa]=!0}function Yh(e){e[kr]=void 0}var Gh=new Set,Kh={};function nl(e,t){Il(e,t),Il(e+"Capture",t)}function Il(e,t){for(Kh[e]=t,e=0;e<t.length;e++)Gh.add(t[e])}var Ry=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]*$"),Vh={},Xh={};function Dy(e){return Nc.call(Xh,e)?!0:Nc.call(Vh,e)?!1:Ry.test(e)?Xh[e]=!0:(Vh[e]=!0,!1)}var qe=!1;function Zh(){var e=qe;return qe=!1,e}function wr(e,t,s){if(Dy(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 Nr(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 ns(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 Qh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $y(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(g){s=""+g,d.call(this,g)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(g){s=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mc(e){if(!e._valueTracker){var t=Qh(e)?"checked":"value";e._valueTracker=$y(e,t,""+e[t])}}function Jh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=Qh(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}var Uy=/[\n"\\]/g;function dn(e){return e.replace(Uy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function zc(e,t,s,i,u,d,g,w){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ft(t)):e.value!==""+Ft(t)&&(e.value=""+Ft(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?g==="number"&&e.value==t?Oc(e,Ft(e.value)):Oc(e,Ft(t)):s!=null?Oc(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 Ph(e,t,s,i,u,d,g,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)){Mc(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,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),Mc(e)}function Oc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Yl(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 Fh(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 Wh(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(o(92));if(le(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),Mc(e)}function Gl(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Ly=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 em(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||Ly.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function tm(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&&(em(e,u,i),qe=!0)}else for(var d in t)t.hasOwnProperty(d)&&em(e,d,t[d])}function _c(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 Hy=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"]]),By=/^[\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 Sr(e){return By.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bn(){}var Rc=null;function Dc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kl=null,Vl=null;function nm(e){var t=Bl(e);if(t&&(e=t.stateNode)){var s=e[Bt]||null;e:switch(e=t.stateNode,t.type){case"input":if(zc(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));zc(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&&Jh(i)}break e;case"textarea":Fh(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Yl(e,!!s.multiple,t,!1)}}}var $c=!1;function sm(e,t,s){if($c)return e(t,s);$c=!0;try{var i=e(t);return i}finally{if($c=!1,(Kl!==null||Vl!==null)&&(To(),Kl&&(t=Kl,e=Vl,Vl=Kl=null,nm(t),e)))for(t=0;t<e.length;t++)nm(e[t])}}function Pa(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 ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uc=!1;if(ss)try{var Fa={};Object.defineProperty(Fa,"passive",{get:function(){Uc=!0}}),window.addEventListener("test",Fa,Fa),window.removeEventListener("test",Fa,Fa)}catch{Uc=!1}var ws=null,Lc=null,Tr=null;function lm(){if(Tr)return Tr;var e,t=Lc,s=t.length,i,u="value"in ws?ws.value:ws.textContent,d=u.length;for(e=0;e<s&&t[e]===u[e];e++);var g=s-e;for(i=1;i<=g&&t[s-i]===u[d-i];i++);return Tr=u.slice(e,1<i?1-i:void 0)}function Cr(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 Er(){return!0}function am(){return!1}function Rt(e){function t(s,i,u,d,g){this._reactName=s,this._targetInst=u,this.type=i,this.nativeEvent=d,this.target=g,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)?Er:am,this.isPropagationStopped=am,this}return _(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=Er)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Er)},persist:function(){},isPersistent:Er}),t}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ar=Rt(Ns),Wa=_({},Ns,{view:0,detail:0}),qy=Rt(Wa),Hc,Bc,ei,Mr=_({},Wa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ic,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!==ei&&(ei&&e.type==="mousemove"?(Hc=e.screenX-ei.screenX,Bc=e.screenY-ei.screenY):Bc=Hc=0,ei=e),Hc)},movementY:function(e){return"movementY"in e?e.movementY:Bc}}),im=Rt(Mr),Iy=_({},Mr,{dataTransfer:0}),Yy=Rt(Iy),Gy=_({},Wa,{relatedTarget:0}),qc=Rt(Gy),Ky=_({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),Vy=Rt(Ky),Xy=_({},Ns,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zy=Rt(Xy),Qy=_({},Ns,{data:0}),rm=Rt(Qy),Jy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Py={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"},Fy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Fy[e])?!!t[e]:!1}function Ic(){return Wy}var ek=_({},Wa,{key:function(e){if(e.key){var t=Jy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Cr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Py[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ic,charCode:function(e){return e.type==="keypress"?Cr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Cr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),tk=Rt(ek),nk=_({},Mr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),om=Rt(nk),sk=_({},Ns,{submitter:0}),lk=Rt(sk),ak=_({},Wa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ic}),ik=Rt(ak),rk=_({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),ok=Rt(rk),ck=_({},Mr,{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}),uk=Rt(ck),dk=_({},Ns,{newState:0,oldState:0,source:0}),fk=Rt(dk),hk=[9,13,27,32],Yc=ss&&"CompositionEvent"in window,ti=null;ss&&"documentMode"in document&&(ti=document.documentMode);var mk=ss&&"TextEvent"in window&&!ti,cm=ss&&(!Yc||ti&&8<ti&&11>=ti),um=" ",dm=!1;function fm(e,t){switch(e){case"keyup":return hk.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xl=!1;function pk(e,t){switch(e){case"compositionend":return hm(t);case"keypress":return t.which!==32?null:(dm=!0,um);case"textInput":return e=t.data,e===um&&dm?null:e;default:return null}}function gk(e,t){if(Xl)return e==="compositionend"||!Yc&&fm(e,t)?(e=lm(),Tr=Lc=ws=null,Xl=!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 cm&&t.locale!=="ko"?null:t.data;default:return null}}var vk={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 mm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vk[e.type]:t==="textarea"}function pm(e,t,s,i){Kl?Vl?Vl.push(i):Vl=[i]:Kl=i,t=Oo(t,"onChange"),0<t.length&&(s=new Ar("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var ni=null,si=null;function xk(e){nv(e,0)}function zr(e){var t=Ja(e);if(Jh(t))return e}function gm(e,t){if(e==="change")return t}var vm=!1;if(ss){var Gc;if(ss){var Kc="oninput"in document;if(!Kc){var xm=document.createElement("div");xm.setAttribute("oninput","return;"),Kc=typeof xm.oninput=="function"}Gc=Kc}else Gc=!1;vm=Gc&&(!document.documentMode||9<document.documentMode)}function bm(){ni&&(ni.detachEvent("onpropertychange",ym),si=ni=null)}function ym(e){if(e.propertyName==="value"&&zr(si)){var t=[];pm(t,si,e,Dc(e)),sm(xk,t)}}function bk(e,t,s){e==="focusin"?(bm(),ni=t,si=s,ni.attachEvent("onpropertychange",ym)):e==="focusout"&&bm()}function yk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return zr(si)}function kk(e,t){if(e==="click")return zr(t)}function jk(e,t){if(e==="input"||e==="change")return zr(t)}function wk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wt=typeof Object.is=="function"?Object.is:wk;function li(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(!Nc.call(t,u)||!Wt(e[u],t[u]))return!1}return!0}function Vc(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 km(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jm(e,t){var s=km(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=km(s)}}function wm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Vc(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=Vc(e.document)}return t}function Xc(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 Nk=ss&&"documentMode"in document&&11>=document.documentMode,Zl=null,Zc=null,ai=null,Qc=!1;function Sm(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Qc||Zl==null||Zl!==Vc(i)||(i=Zl,"selectionStart"in i&&Xc(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}),ai&&li(ai,i)||(ai=i,i=Oo(Zc,"onSelect"),0<i.length&&(t=new Ar("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=Zl)))}function sl(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Ql={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")},Jc={},Tm={};ss&&(Tm=document.createElement("div").style,"AnimationEvent"in window||(delete Ql.animationend.animation,delete Ql.animationiteration.animation,delete Ql.animationstart.animation),"TransitionEvent"in window||delete Ql.transitionend.transition);function ll(e){if(Jc[e])return Jc[e];if(!Ql[e])return e;var t=Ql[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Tm)return Jc[e]=t[s];return e}var Cm=ll("animationend"),Em=ll("animationiteration"),Am=ll("animationstart"),Sk=ll("transitionrun"),Tk=ll("transitionstart"),Ck=ll("transitioncancel"),Mm=ll("transitionend"),zm=new Map,Pc="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(" ");Pc.push("scrollEnd");function An(e,t){zm.set(e,t),nl(t,[e])}var Ek=0;function ls(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=_n.identifierPrefix;var s=Ek++;return e="_"+e+"t_"+s.toString(32)+"_",t.autoName=e}function Om(e){if(e==null||typeof e=="string")return e;var t=null,s=pa;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 as(e,t){return e=Om(e),t=Om(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Or=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=[],Jl=0,Fc=0;function _r(){for(var e=Jl,t=Fc=Jl=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 g=i.pending;g===null?u.next=u:(u.next=g.next,g.next=u),i.pending=u}d!==0&&_m(s,u,d)}}function Rr(e,t,s,i){fn[Jl++]=e,fn[Jl++]=t,fn[Jl++]=s,fn[Jl++]=i,Fc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Wc(e,t,s,i){return Rr(e,t,s,i),Dr(e)}function al(e,t){return Rr(e,null,null,t),Dr(e)}function _m(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 Dr(e){if(50<Ci)throw Ci=0,So=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Pl={};function Ak(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 Ak(e,t,s,i)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function is(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 Rm(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 $r(e,t,s,i,u,d){var g=0;if(i=e,typeof i=="function")eu(i)&&(g=1);else if(typeof i=="string")g=s1(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 ee:return il(s.children,u,d,t);case Ee:g=8,u|=24;break;case he:return e=qt(12,s,t,u|2),e.elementType=he,e.lanes=d,e;case ve:return e=qt(13,s,t,u),e.elementType=ve,e.lanes=d,e;case me:return e=qt(19,s,t,u),e.elementType=me,e.lanes=d,e;case Ot:case D:return e=u|32,e=qt(30,s,t,e),e.elementType=D,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:g=10;break e;case we:g=9;break e;case se:g=11;break e;case ze:g=14;break e;case Ae:g=16,i=null;break e}g=29,s=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=qt(g,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 tu(e,t,s){return e=qt(6,e,null,t),e.lanes=s,e}function Dm(e){var t=qt(18,null,null,0);return t.stateNode=e,t}function nu(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 $m=new WeakMap;function hn(e,t){if(typeof e=="object"&&e!==null){var s=$m.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Mh(t)},$m.set(e,t),t)}return{value:e,source:t,stack:Mh(t)}}var Fl=[],Wl=0,Ur=null,ii=0,mn=[],pn=0,Ss=null,qn=1,In="";function rs(e,t){Fl[Wl++]=ii,Fl[Wl++]=Ur,Ur=e,ii=t}function Um(e,t,s){mn[pn++]=qn,mn[pn++]=In,mn[pn++]=Ss,Ss=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 g=u-u%5;d=(i&(1<<g)-1).toString(32),i>>=g,u-=g,qn=1<<32-Pt(t)+u|s<<u|i,In=d+e}else qn=1<<d|s<<u|i,In=e}function Lr(e){e.return!==null&&(rs(e,1),Um(e,1,0))}function su(e){for(;e===Ur;)Ur=Fl[--Wl],Fl[Wl]=null,ii=Fl[--Wl],Fl[Wl]=null;for(;e===Ss;)Ss=mn[--pn],mn[pn]=null,In=mn[--pn],mn[pn]=null,qn=mn[--pn],mn[pn]=null}function Lm(e,t){mn[pn++]=qn,mn[pn++]=In,mn[pn++]=Ss,qn=t.id,In=t.overflow,Ss=e}var gt=null,Fe=null,Me=!1,Ts=null,gn=!1,lu=Error(o(519));function Cs(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ri(hn(t,e)),lu}function Hm(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<Ai.length;s++)De(Ai[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),Ph(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),Wh(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||iv(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||Cs(e,!0)}function Hr(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 ea(e){if(e!==gt)return!1;if(!Me)return Hr(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")||Rd(e.type,e.memoizedProps)),s=!s),s&&Fe&&Cs(e),Hr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Fe=Sv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Fe=Sv(e)}else t===27?(t=Fe,Ys(e.type)?(e=Yd,Yd=null,Fe=e):Fe=t):Fe=gt?xn(e.stateNode.nextSibling):null;return!0}function rl(){Fe=gt=null,Me=!1}function au(){var e=Ts;return e!==null&&(Gt===null?Gt=e:Gt.push.apply(Gt,e),Ts=null),e}function ri(e){Ts===null?Ts=[e]:Ts.push(e)}var iu=un(null),ol=null,os=null;function Es(e,t,s){Ge(iu,t._currentValue),t._currentValue=s}function cs(e){e._currentValue=iu.current,ot(iu)}function Br(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 ru(e,t,s,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var g=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),Br(d.return,s,e),i||(g=null);break e}d=w.next}}else if(u.tag===18){if(g=u.return,g===null)throw Error(o(341));g.lanes|=s,d=g.alternate,d!==null&&(d.lanes|=s),Br(g,s,e),g=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=s,g=u.alternate,g!==null&&(g.lanes|=s),Br(u.return,s,e),g=u.child,g=g!==null?g.sibling:null):g=u.child;if(g!==null)g.return=u;else for(g=u;g!==null;){if(g===e){g=null;break}if(u=g.sibling,u!==null){u.return=g.return,g=u;break}g=g.return}u=g}}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 g=u.alternate;if(g===null)throw Error(o(387));if(g=g.memoizedProps,g!==null){var w=u.type;Wt(u.pendingProps.value,g.value)||(e!==null?e.push(w):e=[w])}}else if(u===Ws.current){if(g=u.alternate,g===null)throw Error(o(387));g.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Sa):e=[Sa])}u=u.return}return e!==null&&ru(t,e,s,i),t.flags|=262144,e!==null}function qr(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,os=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return Bm(ol,e)}function Ir(e,t){return ol===null&&ul(e),Bm(e,t)}function Bm(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},os===null){if(e===null)throw Error(o(308));os=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else os=os.next=t;return s}var Mk=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()})}},zk=n.unstable_scheduleCallback,Ok=n.unstable_NormalPriority,ct={$$typeof:_e,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ou(){return{controller:new Mk,data:new Map,refCount:0}}function oi(e){e.refCount--,e.refCount===0&&zk(Ok,function(){e.controller.abort()})}function qm(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 ci=null;function _k(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var ui=null,cu=0,dl=0,ta=null;function Rk(e,t){if(ui===null){var s=ui=[];cu=0,dl=Sd(),ta={status:"pending",value:void 0,then:function(i){s.push(i)}}}return cu++,t.then(Im,Im),t}function Im(){if(--cu===0&&(ci=null,ui!==null)){ta!==null&&(ta.status="fulfilled");var e=ui;ui=null,dl=0,ta=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Dk(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 Ym=ce.S;ce.S=function(e,t){if(Dg=Qt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Rk(e,t),ci!==null)for(var s=ba;s!==null;)qm(s,ci),s=s.next;if(s=e.types,s!==null){for(var i=ba;i!==null;)qm(i,s),i=i.next;if(dl!==0){i=ci,i===null&&(i=ci=[]);for(var u=0;u<s.length;u++){var d=s[u];i.indexOf(d)===-1&&i.push(d)}}}Ym!==null&&Ym(e,t)};var fl=un(null);function uu(){var e=fl.current;return e!==null?e:Je.pooledCache}function Yr(e,t){t===null?Ge(fl,fl.current):Ge(fl,t.pool)}function Gm(){var e=uu();return e===null?null:{parent:ct._currentValue,pool:e}}var na=Error(o(460)),du=Error(o(474)),Gr=Error(o(542)),Kr={then:function(){}};function Km(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Vm(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,Zm(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,Zm(e),e}throw ml=t,na}}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,na):s}}var ml=null;function Xm(){if(ml===null)throw Error(o(459));var e=ml;return ml=null,e}function Zm(e){if(e===na||e===Gr)throw Error(o(483))}var sa=null,di=0;function Vr(e){var t=di;return di+=1,sa===null&&(sa=[]),Vm(sa,e,t)}function As(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Xr(e,t){throw t.$$typeof===z?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Qm(e){function t(H,R){if(e){var q=H.deletions;q===null?(H.deletions=[R],H.flags|=16):q.push(R)}}function s(H,R){if(!e)return null;for(;R!==null;)t(H,R),R=R.sibling;return null}function i(H){for(var R=new Map;H!==null;)H.key===null?R.set(H.index,H):R.set(H.key,H),H=H.sibling;return R}function u(H,R){return H=is(H,R),H.index=0,H.sibling=null,H}function d(H,R,q){return H.index=q,e?(q=H.alternate,q!==null?(q=q.index,q<R?(H.flags|=2,R):q):(H.flags|=134217730,R)):(H.flags|=1048576,R)}function g(H){return e&&H.alternate===null&&(H.flags|=134217730),H}function w(H,R,q,Z){return R===null||R.tag!==6?(R=tu(q,H.mode,Z),R.return=H,R):(R=u(R,q),R.return=H,R)}function O(H,R,q,Z){var fe=q.type;return fe===ee?(H=Y(H,R,q.props.children,Z,q.key),As(H,q),H):R!==null&&(R.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Ae&&hl(fe)===R.type)?(R=u(R,q.props),As(R,q),R.return=H,R):(R=$r(q.type,q.key,q.props,null,H.mode,Z),As(R,q),R.return=H,R)}function B(H,R,q,Z){return R===null||R.tag!==4||R.stateNode.containerInfo!==q.containerInfo||R.stateNode.implementation!==q.implementation?(R=nu(q,H.mode,Z),R.return=H,R):(R=u(R,q.children||[]),R.return=H,R)}function Y(H,R,q,Z,fe){return R===null||R.tag!==7?(R=il(q,H.mode,Z,fe),R.return=H,R):(R=u(R,q),R.return=H,R)}function Q(H,R,q){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=tu(""+R,H.mode,q),R.return=H,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case V:return q=$r(R.type,R.key,R.props,null,H.mode,q),As(q,R),q.return=H,q;case ne:return R=nu(R,H.mode,q),R.return=H,R;case Ae:return R=hl(R),Q(H,R,q)}if(le(R)||re(R))return R=il(R,H.mode,q,null),R.return=H,R;if(typeof R.then=="function")return Q(H,Vr(R),q);if(R.$$typeof===_e)return Q(H,Ir(H,R),q);Xr(H,R)}return null}function L(H,R,q,Z){var fe=R!==null?R.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return fe!==null?null:w(H,R,""+q,Z);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case V:return q.key===fe?O(H,R,q,Z):null;case ne:return q.key===fe?B(H,R,q,Z):null;case Ae:return q=hl(q),L(H,R,q,Z)}if(le(q)||re(q))return fe!==null?null:Y(H,R,q,Z,null);if(typeof q.then=="function")return L(H,R,Vr(q),Z);if(q.$$typeof===_e)return L(H,R,Ir(H,q),Z);Xr(H,q)}return null}function I(H,R,q,Z,fe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return H=H.get(q)||null,w(R,H,""+Z,fe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case V:return H=H.get(Z.key===null?q:Z.key)||null,O(R,H,Z,fe);case ne:return H=H.get(Z.key===null?q:Z.key)||null,B(R,H,Z,fe);case Ae:return Z=hl(Z),I(H,R,q,Z,fe)}if(le(Z)||re(Z))return H=H.get(q)||null,Y(R,H,Z,fe,null);if(typeof Z.then=="function")return I(H,R,q,Vr(Z),fe);if(Z.$$typeof===_e)return I(H,R,q,Ir(R,Z),fe);Xr(R,Z)}return null}function ie(H,R,q,Z){for(var fe=null,Ue=null,ye=R,ke=R=0,ft=null;ye!==null&&ke<q.length;ke++){ye.index>ke?(ft=ye,ye=null):ft=ye.sibling;var Be=L(H,ye,q[ke],Z);if(Be===null){ye===null&&(ye=ft);break}e&&ye&&Be.alternate===null&&t(H,ye),R=d(Be,R,ke),Ue===null?fe=Be:Ue.sibling=Be,Ue=Be,ye=ft}if(ke===q.length)return s(H,ye),Me&&rs(H,ke),fe;if(ye===null){for(;ke<q.length;ke++)ye=Q(H,q[ke],Z),ye!==null&&(R=d(ye,R,ke),Ue===null?fe=ye:Ue.sibling=ye,Ue=ye);return Me&&rs(H,ke),fe}for(ye=i(ye);ke<q.length;ke++)ft=I(ye,H,ke,q[ke],Z),ft!==null&&(e&&(Be=ft.alternate,Be!==null&&ye.delete(Be.key===null?ke:Be.key)),R=d(ft,R,ke),Ue===null?fe=ft:Ue.sibling=ft,Ue=ft);return e&&ye.forEach(function(Zs){return t(H,Zs)}),Me&&rs(H,ke),fe}function pe(H,R,q,Z){if(q==null)throw Error(o(151));for(var fe=null,Ue=null,ye=R,ke=R=0,ft=null,Be=q.next();ye!==null&&!Be.done;ke++,Be=q.next()){ye.index>ke?(ft=ye,ye=null):ft=ye.sibling;var Zs=L(H,ye,Be.value,Z);if(Zs===null){ye===null&&(ye=ft);break}e&&ye&&Zs.alternate===null&&t(H,ye),R=d(Zs,R,ke),Ue===null?fe=Zs:Ue.sibling=Zs,Ue=Zs,ye=ft}if(Be.done)return s(H,ye),Me&&rs(H,ke),fe;if(ye===null){for(;!Be.done;ke++,Be=q.next())Be=Q(H,Be.value,Z),Be!==null&&(R=d(Be,R,ke),Ue===null?fe=Be:Ue.sibling=Be,Ue=Be);return Me&&rs(H,ke),fe}for(ye=i(ye);!Be.done;ke++,Be=q.next())Be=I(ye,H,ke,Be.value,Z),Be!==null&&(e&&(ft=Be.alternate,ft!==null&&ye.delete(ft.key===null?ke:ft.key)),R=d(Be,R,ke),Ue===null?fe=Be:Ue.sibling=Be,Ue=Be);return e&&ye.forEach(function(p1){return t(H,p1)}),Me&&rs(H,ke),fe}function Ce(H,R,q,Z){if(typeof q=="object"&&q!==null&&q.type===ee&&q.key===null&&q.props.ref===void 0&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case V:e:{for(var fe=q.key;R!==null;){if(R.key===fe){if(fe=q.type,fe===ee){if(R.tag===7){s(H,R.sibling),Z=u(R,q.props.children),As(Z,q),Z.return=H,H=Z;break e}}else if(R.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===Ae&&hl(fe)===R.type){s(H,R.sibling),Z=u(R,q.props),As(Z,q),Z.return=H,H=Z;break e}s(H,R);break}else t(H,R);R=R.sibling}q.type===ee?(Z=il(q.props.children,H.mode,Z,q.key),As(Z,q),Z.return=H,H=Z):(Z=$r(q.type,q.key,q.props,null,H.mode,Z),As(Z,q),Z.return=H,H=Z)}return g(H);case ne:e:{for(fe=q.key;R!==null;){if(R.key===fe)if(R.tag===4&&R.stateNode.containerInfo===q.containerInfo&&R.stateNode.implementation===q.implementation){s(H,R.sibling),Z=u(R,q.children||[]),Z.return=H,H=Z;break e}else{s(H,R);break}else t(H,R);R=R.sibling}Z=nu(q,H.mode,Z),Z.return=H,H=Z}return g(H);case Ae:return q=hl(q),Ce(H,R,q,Z)}if(le(q))return ie(H,R,q,Z);if(re(q)){if(fe=re(q),typeof fe!="function")throw Error(o(150));return q=fe.call(q),pe(H,R,q,Z)}if(typeof q.then=="function")return Ce(H,R,Vr(q),Z);if(q.$$typeof===_e)return Ce(H,R,Ir(H,q),Z);Xr(H,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,R!==null&&R.tag===6?(s(H,R.sibling),Z=u(R,q),Z.return=H,H=Z):(s(H,R),Z=tu(q,H.mode,Z),Z.return=H,H=Z),g(H)):s(H,R)}return function(H,R,q,Z){try{di=0;var fe=Ce(H,R,q,Z);return sa=null,fe}catch(ye){if(ye===na||ye===Gr)throw ye;var Ue=qt(29,ye,null,H.mode);return Ue.lanes=Z,Ue.return=H,Ue}finally{}}}var pl=Qm(!0),Jm=Qm(!1),Ms=!1;function fu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hu(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 zs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Os(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=Dr(e),_m(e,null,s),t}return Rr(e,i,t,s),Dr(e)}function fi(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,Uh(e,s)}}function mu(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 g={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};d===null?u=d=g:d=d.next=g,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 pu=!1;function hi(){if(pu){var e=ta;if(e!==null)throw e}}function mi(e,t,s,i){pu=!1;var u=e.updateQueue;Ms=!1;var d=u.firstBaseUpdate,g=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var O=w,B=O.next;O.next=null,g===null?d=B:g.next=B,g=O;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,w=Y.lastBaseUpdate,w!==g&&(w===null?Y.firstBaseUpdate=B:w.next=B,Y.lastBaseUpdate=O))}if(d!==null){var Q=u.baseState;g=0,Y=B=O=null,w=d;do{var L=w.lane&-536870913,I=L!==w.lane;if(I?($e&L)===L:(i&L)===L){L!==0&&L===dl&&(pu=!0),Y!==null&&(Y=Y.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ie=e,pe=w;L=t;var Ce=s;switch(pe.tag){case 1:if(ie=pe.payload,typeof ie=="function"){Q=ie.call(Ce,Q,L);break e}Q=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=pe.payload,L=typeof ie=="function"?ie.call(Ce,Q,L):ie,L==null)break e;Q=_({},Q,L);break e;case 2:Ms=!0}}L=w.callback,L!==null&&(e.flags|=64,I&&(e.flags|=8192),I=u.callbacks,I===null?u.callbacks=[L]:I.push(L))}else I={lane:L,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Y===null?(B=Y=I,O=Q):Y=Y.next=I,g|=L;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);Y===null&&(O=Q),u.baseState=O,u.firstBaseUpdate=B,u.lastBaseUpdate=Y,d===null&&(u.shared.lanes=0),Hs|=g,e.lanes=g,e.memoizedState=Q}}function Pm(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Fm(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Pm(s[e],t)}var _s=un(null),Zr=un(0);function Wm(e,t){e=ms,Ge(Zr,e),Ge(_s,t),ms=e|t.baseLanes}function gu(){Ge(Zr,ms),Ge(_s,_s.current)}function vu(){ms=Zr.current,ot(_s),ot(Zr)}var jt=un(null),At=null;function Rs(e){var t=e.alternate;Ge(wt,wt.current&1),Ge(jt,e),At===null&&(t===null||_s.current!==null||t.memoizedState!==null)&&(At=e)}function xu(e){Ge(wt,wt.current),Ge(jt,e),At===null&&(At=e)}function ep(e){e.tag===22?(Ge(wt,wt.current),Ge(jt,e),At===null&&(At=e)):Ds()}function Ds(){Ge(wt,wt.current),Ge(jt,jt.current)}function en(e){ot(jt),At===e&&(At=null),ot(wt)}var wt=un(0);function pi(e,t){Ge(jt,jt.current),Ge(wt,t)}function bu(e){ot(wt),ot(jt),At===e&&(At=null)}function Qr(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||qd(s)||Id(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 us=0,Te=null,Qe=null,ut=null,Jr=!1,la=!1,gl=!1,Pr=0,gi=0,aa=null,$k=0;function lt(){throw Error(o(321))}function yu(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 ku(e,t,s,i,u,d){return us=d,Te=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ce.H=e===null||e.memoizedState===null?Up:Lp,gl=!1,d=s(i,u),gl=!1,la&&(d=np(t,s,i,u)),tp(e),d}function tp(e){ce.H=lo;var t=Qe!==null&&Qe.next!==null;if(us=0,ut=Qe=Te=null,Jr=!1,gi=0,aa=null,t)throw Error(o(300));e===null||dt||(e=e.dependencies,e!==null&&qr(e)&&(dt=!0))}function np(e,t,s,i){Te=e;var u=0;do{if(la&&(aa=null),gi=0,la=!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=Gk,d=t(s,i)}while(la);return d}function Uk(){var e=ce.H,t=e.useState()[0];return t=typeof t.then=="function"?vi(t):t,e=e.useState()[0],(Qe!==null?Qe.memoizedState:null)!==e&&(Te.flags|=1024),t}function ju(){var e=Pr!==0;return Pr=0,e}function wu(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Nu(e){if(Jr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Jr=!1}us=0,ut=Qe=Te=null,la=!1,gi=Pr=0,aa=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?Te.memoizedState=ut=e:ut=ut.next=e,ut}function it(){if(Qe===null){var e=Te.alternate;e=e!==null?e.memoizedState:null}else e=Qe.next;var t=ut===null?Te.memoizedState:ut.next;if(t!==null)ut=t,Qe=e;else{if(e===null)throw Te.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?Te.memoizedState=ut=e:ut=ut.next=e}return ut}function Fr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vi(e){var t=gi;return gi+=1,aa===null&&(aa=[]),e=Vm(aa,e,t),t=Te,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,ce.H=t===null||t.memoizedState===null?Up:Lp),e}function Wr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return vi(e);if(e.$$typeof===J)return;if(e.$$typeof===_e)return kt(e)}throw Error(o(438,String(e)))}function Su(e){var t=null,s=Te.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=Te.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=Fr(),Te.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 ds(e,t){return typeof t=="function"?t(e):t}function eo(e){var t=it();return Tu(t,Qe,e)}function Tu(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 g=u.next;u.next=d.next,d.next=g}t.baseQueue=u=d,i.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var w=g=null,O=null,B=t,Y=!1;do{var Q=B.lane&-536870913;if(Q!==B.lane?($e&Q)===Q:(us&Q)===Q){var L=B.revertLane;if(L===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&&(Y=!0);else if((us&L)===L){B=B.next,L===dl&&(Y=!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,g=d):O=O.next=Q,Te.lanes|=L,Hs|=L;Q=B.action,gl&&s(d,Q),d=B.hasEagerState?B.eagerState:s(d,Q)}else L={lane:Q,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},O===null?(w=O=L,g=d):O=O.next=L,Te.lanes|=Q,Hs|=Q;B=B.next}while(B!==null&&B!==t);if(O===null?g=d:O.next=w,!Wt(d,e.memoizedState)&&(dt=!0,Y&&(s=ta,s!==null)))throw s;e.memoizedState=d,e.baseState=g,e.baseQueue=O,i.lastRenderedState=d}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Cu(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 g=u=u.next;do d=e(d,g.action),g=g.next;while(g!==u);Wt(d,t.memoizedState)||(dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),s.lastRenderedState=d}return[d,i]}function sp(e,t,s){var i=Te,u=it(),d=Me;if(d){if(s===void 0)throw Error(o(407));s=s()}else s=t();var g=!Wt((Qe||u).memoizedState,s);if(g&&(u.memoizedState=s,dt=!0),u=u.queue,Mu(ip.bind(null,i,u,e),[e]),e=u.getSnapshot!==t||g||ut!==null&&(ut.memoizedState.tag&1)!==0,ia(e?9:8,{destroy:void 0},ap.bind(null,i,u,s,t),null),e){if(i.flags|=2048,Je===null)throw Error(o(349));d||(us&127)!==0||lp(i,t,s)}return s}function lp(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Te.updateQueue,t===null?(t=Fr(),Te.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function ap(e,t,s,i){t.value=s,t.getSnapshot=i,rp(t)&&op(e)}function ip(e,t,s){return s(function(){rp(t)&&op(e)})}function rp(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Wt(e,s)}catch{return!0}}function op(e){var t=al(e,2);t!==null&&Kt(t,e,2)}function Eu(e){var t=Dt();if(typeof e=="function"){var s=e;if(e=s(),gl){js(!0);try{s()}finally{js(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:e},t}function cp(e,t,s,i){return e.baseState=s,Tu(e,Qe,typeof i=="function"?i:ds)}function Lk(e,t,s,i,u){if(so(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(g){d.listeners.push(g)}};ce.T!==null?s(!0):d.isTransition=!1,i(d),s=t.pending,s===null?(d.next=t.pending=d,up(t,d)):(d.next=s.next,t.pending=s.next=d)}}function up(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var d=ce.T,g={};g.types=d!==null?d.types:null,ce.T=g;try{var w=s(u,i),O=ce.S;O!==null&&O(g,w),dp(e,t,w)}catch(B){Au(e,t,B)}finally{d!==null&&g.types!==null&&(d.types=g.types),ce.T=d}}else try{d=s(u,i),dp(e,t,d)}catch(B){Au(e,t,B)}}function dp(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){fp(e,t,i)},function(i){return Au(e,t,i)}):fp(e,t,s)}function fp(e,t,s){t.status="fulfilled",t.value=s,hp(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,up(e,s)))}function Au(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,hp(t),t=t.next;while(t!==i)}e.action=null}function hp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function mp(e,t){return t}function pp(e,t){if(Me){var s=Je.formState;if(s!==null){e:{var i=Te;if(Me){if(Fe){t:{for(var u=Fe,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){Fe=xn(u.nextSibling),i=u.data==="F!";break e}}Cs(i)}i=!1}i&&(t=s[0])}}return s=Dt(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mp,lastRenderedState:t},s.queue=i,s=Rp.bind(null,Te,i),i.dispatch=s,i=Eu(!1),d=Du.bind(null,Te,!1,i.queue),i=Dt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=Lk.bind(null,Te,u,d,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function gp(e){var t=it();return vp(t,Qe,e)}function vp(e,t,s){if(t=Tu(e,t,mp)[0],e=eo(ds)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=vi(t)}catch(g){throw g===na?Gr:g}else i=t;t=it();var u=t.queue,d=u.dispatch;return s!==t.memoizedState&&(Te.flags|=2048,ia(9,{destroy:void 0},Hk.bind(null,u,s),null)),[i,d,e]}function Hk(e,t){e.action=t}function xp(e){var t=it(),s=Qe;if(s!==null)return vp(t,s,e);it(),t=t.memoizedState,s=it();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function ia(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=Te.updateQueue,t===null&&(t=Fr(),Te.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 bp(){return it().memoizedState}function to(e,t,s,i){var u=Dt();Te.flags|=e,u.memoizedState=ia(1|t,{destroy:void 0},s,i===void 0?null:i)}function no(e,t,s,i){var u=it();i=i===void 0?null:i;var d=u.memoizedState.inst;Qe!==null&&i!==null&&yu(i,Qe.memoizedState.deps)?u.memoizedState=ia(t,d,s,i):(Te.flags|=e,u.memoizedState=ia(1|t,d,s,i))}function yp(e,t){to(8390656,8,e,t)}function Mu(e,t){no(2048,8,e,t)}function Bk(e){Te.flags|=4;var t=Te.updateQueue;if(t===null)t=Fr(),Te.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function kp(e){var t=it().memoizedState;return Bk({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function jp(e,t){return no(4,2,e,t)}function wp(e,t){return no(4,4,e,t)}function Np(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 Sp(e,t,s){s=s!=null?s.concat([e]):null,no(4,4,Np.bind(null,t,e),s)}function zu(){}function Tp(e,t){var s=it();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&yu(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function Cp(e,t){var s=it();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&yu(t,i[1]))return i[0];if(i=e(),gl){js(!0);try{e()}finally{js(!1)}}return s.memoizedState=[i,t],i}function Ou(e,t,s){return s===void 0||(us&1073741824)!==0&&($e&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=Ug(),Te.lanes|=e,Hs|=e,s)}function Ep(e,t,s,i){return Wt(s,t)?s:_s.current!==null?(e=Ou(e,s,i),Wt(e,t)||(dt=!0),e):(us&106)===0||(us&1073741824)!==0&&($e&261930)===0?(dt=!0,e.memoizedState=s):(e=Ug(),Te.lanes|=e,Hs|=e,t)}function Ap(e,t,s,i,u){var d=xe.p;xe.p=d!==0&&8>d?d:8;var g=ce.T,w={};w.types=g!==null?g.types:null,ce.T=w,Du(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 Y=Dk(O,i);xi(e,t,Y,ln(e))}else xi(e,t,i,ln(e))}catch(Q){xi(e,t,{then:function(){},status:"rejected",reason:Q},ln())}finally{xe.p=d,g!==null&&w.types!==null&&(g.types=w.types),ce.T=g}}function qk(){}function _u(e,t,s,i){if(e.tag!==5)throw Error(o(476));var u=Mp(e).queue;Ap(e,u,t,st,s===null?qk:function(){return zp(e),s(i)})}function Mp(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:ds,lastRenderedState:st},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function zp(e){var t=Mp(e);t.next===null&&(t=e.alternate.memoizedState),xi(e,t.next.queue,{},ln())}function Ru(){return kt(Sa)}function Op(){return it().memoizedState}function _p(){return it().memoizedState}function Ik(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=ln();e=zs(s);var i=Os(t,e,s);i!==null&&(Kt(i,t,s),fi(i,t,s)),t={cache:ou()},e.payload=t;return}t=t.return}}function Yk(e,t,s){var i=ln();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},so(e)?Dp(t,s):(s=Wc(e,t,s,i),s!==null&&(Kt(s,e,i),$p(s,t,i)))}function Rp(e,t,s){var i=ln();xi(e,t,s,i)}function xi(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(so(e))Dp(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var g=t.lastRenderedState,w=d(g,s);if(u.hasEagerState=!0,u.eagerState=w,Wt(w,g))return Rr(e,t,u,0),Je===null&&_r(),!1}catch{}finally{}if(s=Wc(e,t,u,i),s!==null)return Kt(s,e,i),$p(s,t,i),!0}return!1}function Du(e,t,s,i){if(i={lane:2,revertLane:Sd(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},so(e)){if(t)throw Error(o(479))}else t=Wc(e,s,i,2),t!==null&&Kt(t,e,2)}function so(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function Dp(e,t){la=Jr=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function $p(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,Uh(e,s)}}var lo={readContext:kt,use:Wr,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},Up={readContext:kt,use:Wr,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:yp,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,to(4194308,4,Np.bind(null,t,e),s)},useLayoutEffect:function(e,t){return to(4194308,4,e,t)},useInsertionEffect:function(e,t){to(4,2,e,t)},useMemo:function(e,t){var s=Dt();t=t===void 0?null:t;var i=e();if(gl){js(!0);try{e()}finally{js(!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){js(!0);try{s(t)}finally{js(!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=Yk.bind(null,Te,e),[i.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Eu(e);var t=e.queue,s=Rp.bind(null,Te,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:zu,useDeferredValue:function(e,t){var s=Dt();return Ou(s,e,t)},useTransition:function(){var e=Eu(!1);return e=Ap.bind(null,Te,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=Te,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||lp(i,t,s)}u.memoizedState=s;var d={value:s,getSnapshot:t};return u.queue=d,yp(ip.bind(null,i,d,e),[e]),i.flags|=2048,ia(9,{destroy:void 0},ap.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=Pr++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=$k++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ru,useFormState:pp,useActionState:pp,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=Du.bind(null,Te,!0,s),s.dispatch=t,[e,t]},useMemoCache:Su,useCacheRefresh:function(){return Dt().memoizedState=Ik.bind(null,Te)},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)}}},Lp={readContext:kt,use:Wr,useCallback:Tp,useContext:kt,useEffect:Mu,useImperativeHandle:Sp,useInsertionEffect:jp,useLayoutEffect:wp,useMemo:Cp,useReducer:eo,useRef:bp,useState:function(){return eo(ds)},useDebugValue:zu,useDeferredValue:function(e,t){var s=it();return Ep(s,Qe.memoizedState,e,t)},useTransition:function(){var e=eo(ds)[0],t=it().memoizedState;return[typeof e=="boolean"?e:vi(e),t]},useSyncExternalStore:sp,useId:Op,useHostTransitionStatus:Ru,useFormState:gp,useActionState:gp,useOptimistic:function(e,t){var s=it();return cp(s,Qe,e,t)},useMemoCache:Su,useCacheRefresh:_p,useEffectEvent:kp},Gk={readContext:kt,use:Wr,useCallback:Tp,useContext:kt,useEffect:Mu,useImperativeHandle:Sp,useInsertionEffect:jp,useLayoutEffect:wp,useMemo:Cp,useReducer:Cu,useRef:bp,useState:function(){return Cu(ds)},useDebugValue:zu,useDeferredValue:function(e,t){var s=it();return Qe===null?Ou(s,e,t):Ep(s,Qe.memoizedState,e,t)},useTransition:function(){var e=Cu(ds)[0],t=it().memoizedState;return[typeof e=="boolean"?e:vi(e),t]},useSyncExternalStore:sp,useId:Op,useHostTransitionStatus:Ru,useFormState:xp,useActionState:xp,useOptimistic:function(e,t){var s=it();return Qe!==null?cp(s,Qe,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Su,useCacheRefresh:_p,useEffectEvent:kp};function $u(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:_({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Uu={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=ln(),u=zs(i);u.payload=t,s!=null&&(u.callback=s),t=Os(e,u,i),t!==null&&(Kt(t,e,i),fi(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=ln(),u=zs(i);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=Os(e,u,i),t!==null&&(Kt(t,e,i),fi(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=ln(),i=zs(s);i.tag=2,t!=null&&(i.callback=t),t=Os(e,i,s),t!==null&&(Kt(t,e,s),fi(t,e,s))}};function Hp(e,t,s,i,u,d,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,d,g):t.prototype&&t.prototype.isPureReactComponent?!li(s,i)||!li(u,d):!0}function Bp(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&&Uu.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=_({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function qp(e){Or(e)}function Ip(e){console.error(e)}function Yp(e){Or(e)}function ao(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Gp(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 Lu(e,t,s){return s=zs(s),s.tag=3,s.payload={element:null},s.callback=function(){ao(e,t)},s}function Kp(e){return e=zs(e),e.tag=3,e}function Vp(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(){Gp(t,s,i)}}var g=s.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Gp(t,s,i),typeof u!="function"&&(Bs===null?Bs=new Set([this]):Bs.add(this));var w=i.stack;this.componentDidCatch(i.value,{componentStack:w!==null?w:""})})}function Kk(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?Co():s.alternate===null&&at===0&&(at=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===Kr?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),jd(e,i,u)),!1;case 22:return s.flags|=65536,i===Kr?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)),jd(e,i,u)),!1}throw Error(o(435,s.tag))}return jd(e,i,u),Co(),!1}if(Me)return t=jt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==lu&&(e=Error(o(422),{cause:i}),ri(hn(e,s)))):(i!==lu&&(t=Error(o(423),{cause:i}),ri(hn(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=hn(i,s),u=Lu(e.stateNode,i,u),mu(e,u),at!==4&&(at=2)),!1;var d=Error(o(520),{cause:i});if(d=hn(d,s),Ti===null?Ti=[d]:Ti.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=Lu(s.stateNode,i,e),mu(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"&&(Bs===null||!Bs.has(d))))return s.flags|=65536,u&=-u,s.lanes|=u,u=Kp(u),Vp(u,e,s,i),mu(s,u),!1;break;case 22:if(s.memoizedState!==null)return s.flags|=65536,!1}s=s.return}while(s!==null);return!1}var Hu=Error(o(461)),dt=!1;function ht(e,t,s,i){t.child=e===null?Jm(t,null,s,i):pl(t,e.child,s,i)}function Xp(e,t,s,i,u){s=s.render;var d=t.ref;if("ref"in i){var g={};for(var w in i)w!=="ref"&&(g[w]=i[w])}else g=i;return ul(t),i=ku(e,t,s,g,d,u),w=ju(),e!==null&&!dt?(wu(e,t,u),fs(e,t,u)):(Me&&w&&Lr(t),t.flags|=1,ht(e,t,i,u),t.child)}function Zp(e,t,s,i,u){if(e===null){var d=s.type;return typeof d=="function"&&!eu(d)&&d.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=d,Qp(e,t,d,i,u)):(e=$r(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Xu(e,u)){var g=d.memoizedProps;if(s=s.compare,s=s!==null?s:li,s(g,i)&&e.ref===t.ref)return fs(e,t,u)}return t.flags|=1,e=is(d,i),e.ref=t.ref,e.return=t,t.child=e}function Qp(e,t,s,i,u){if(e!==null){var d=e.memoizedProps;if(li(d,i)&&e.ref===t.ref)if(dt=!1,t.pendingProps=i=d,Xu(e,u))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,fs(e,t,u)}return Bu(e,t,s,i,u)}function Jp(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 Pp(e,t,d,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Yr(t,d!==null?d.cachePool:null),d!==null?Wm(t,d):gu(),ep(t);else return i=t.lanes=536870912,Pp(e,t,d!==null?d.baseLanes|s:s,s,i)}else d!==null?(Yr(t,d.cachePool),Wm(t,d),Ds(),t.memoizedState=null):(e!==null&&Yr(t,null),gu(),Ds());return ht(e,t,u,s),t.child}function bi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Pp(e,t,s,i,u){var d=uu();return d=d===null?null:{parent:ct._currentValue,pool:d},t.memoizedState={baseLanes:s,cachePool:d},e!==null&&Yr(t,null),gu(),ep(t),e!==null&&cl(e,t,i,!0),t.childLanes=u,null}function io(e,t){return t=ro({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Fp(e,t,s){return pl(t,e.child,null,s),e=io(t,t.pendingProps),e.flags|=2,en(t),t.memoizedState=null,e}function Vk(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=io(t,i),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},bi(null,e);if(xu(t),(e=Fe)?(e=Nv(e,gn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ss!==null?{id:qn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},s=Dm(e),s.return=t,t.child=s,gt=t,Fe=null)):e=null,e===null)throw Cs(t);return t.lanes=536870912,null}return io(t,i)}var d=e.memoizedState;if(d!==null){var g=d.dehydrated;if(xu(t),u)if(t.flags&256)t.flags&=-257,t=Fp(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(_s.current===null){if(i=Je,i!==null&&(g=Lh(i,s),g!==0&&g!==d.retryLane))throw d.retryLane=g,al(e,g),Kt(i,e,g),Hu;Co()}t=Fp(e,t,s)}else e=d.treeContext,Fe=xn(g.nextSibling),gt=t,Me=!0,Ts=null,gn=!1,e!==null&&Lm(t,e),t=io(t,i),t.flags|=134221824;return t}return e=is(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ra(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 Bu(e,t,s,i,u){return ul(t),s=ku(e,t,s,i,void 0,u),i=ju(),e!==null&&!dt?(wu(e,t,u),fs(e,t,u)):(Me&&i&&Lr(t),t.flags|=1,ht(e,t,s,u),t.child)}function Wp(e,t,s,i,u,d){return ul(t),t.updateQueue=null,s=np(t,i,s,u),tp(e),i=ju(),e!==null&&!dt?(wu(e,t,d),fs(e,t,d)):(Me&&i&&Lr(t),t.flags|=1,ht(e,t,s,d),t.child)}function eg(e,t,s,i,u){if(ul(t),t.stateNode===null){var d=Pl,g=s.contextType;typeof g=="object"&&g!==null&&(d=kt(g)),d=new s(i,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Uu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=i,d.state=t.memoizedState,d.refs={},fu(t),g=s.contextType,d.context=typeof g=="object"&&g!==null?kt(g):Pl,d.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&($u(t,s,g,i),d.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(g=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),g!==d.state&&Uu.enqueueReplaceState(d,d.state,null),mi(t,i,d,u),hi(),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,Y=s.contextType;g=Pl,typeof Y=="object"&&Y!==null&&(g=kt(Y));var Q=s.getDerivedStateFromProps;Y=typeof Q=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,Y||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||B!==g)&&Bp(t,d,i,g),Ms=!1;var L=t.memoizedState;d.state=L,mi(t,i,d,u),hi(),B=t.memoizedState,w||L!==B||Ms?(typeof Q=="function"&&($u(t,s,Q,i),B=t.memoizedState),(O=Ms||Hp(t,s,O,i,L,B,g))?(Y||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=g,i=O):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{d=t.stateNode,hu(e,t),g=t.memoizedProps,Y=vl(s,g),d.props=Y,Q=t.pendingProps,L=d.context,B=s.contextType,O=Pl,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"||(g!==Q||L!==O)&&Bp(t,d,i,O),Ms=!1,L=t.memoizedState,d.state=L,mi(t,i,d,u),hi();var I=t.memoizedState;g!==Q||L!==I||Ms||e!==null&&e.dependencies!==null&&qr(e.dependencies)?(typeof w=="function"&&($u(t,s,w,i),I=t.memoizedState),(Y=Ms||Hp(t,s,Y,i,L,I,O)||e!==null&&e.dependencies!==null&&qr(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"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=I),d.props=i,d.state=I,d.context=O,i=Y):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),i=!1)}return d=i,ra(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=fs(e,t,u),e}function tg(e,t,s,i){return rl(),t.flags|=256,ht(e,t,s,i),t.child}var qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Iu(e){return{baseLanes:e,cachePool:Gm()}}function Yu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=sn),e}function ng(e,t,s){var i=t.pendingProps,u=!1,d=(t.flags&128)!==0,g;if((g=d)||(g=e!==null&&e.memoizedState===null?!1:(wt.current&2)!==0),g&&(u=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(u?Rs(t):Ds(),(e=Fe)?(e=Nv(e,gn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ss!==null?{id:qn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},s=Dm(e),s.return=t,t.child=s,gt=t,Fe=null)):e=null,e===null)throw Cs(t);return Id(e)?t.lanes=32:t.lanes=536870912,null}return d=i.children,i=i.fallback,u?(Ds(),u=t.mode,d=ro({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=Iu(s),i.childLanes=Yu(e,g,s),t.memoizedState=qu,bi(null,i)):(Rs(t),Gu(t,d))}var w=e.memoizedState;if(w!==null){var O=w.dehydrated;if(O!==null)return Xk(e,t,d,g,i,O,w,s)}return u?(Ds(),u=i.fallback,d=t.mode,w=e.child,O=w.sibling,i=is(w,{mode:"hidden",children:i.children}),i.subtreeFlags=w.subtreeFlags&1206910976,O!==null?u=is(O,u):(u=il(u,d,s,null),u.flags|=2),u.return=t,i.return=t,i.sibling=u,t.child=i,bi(null,i),i=t.child,u=e.child.memoizedState,u===null?u=Iu(s):(d=u.cachePool,d!==null?(w=ct._currentValue,d=d.parent!==w?{parent:w,pool:w}:d):d=Gm(),u={baseLanes:u.baseLanes|s,cachePool:d}),i.memoizedState=u,i.childLanes=Yu(e,g,s),t.memoizedState=qu,bi(e.child,i)):(Rs(t),s=e.child,e=s.sibling,s=is(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=s,t.memoizedState=null,s)}function Gu(e,t){return t=ro({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ro(e,t){return e=qt(22,e,null,t),e.lanes=0,e}function oo(e,t,s){return pl(t,e.child,null,s),e=Gu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xk(e,t,s,i,u,d,g,w){if(s)return t.flags&256?(Rs(t),t.flags&=-257,oo(e,t,w)):t.memoizedState!==null?(Ds(),t.child=e.child,t.flags|=128,null):(Ds(),d=u.fallback,g=t.mode,u=ro({mode:"visible",children:u.children},g),d=il(d,g,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=Iu(w),u.childLanes=Yu(e,i,w),t.memoizedState=qu,bi(null,u));if(Rs(t),Id(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,ri({value:u,source:null,stack:null})),oo(e,t,w)}if(dt||cl(e,t,w,!1),i=(w&e.childLanes)!==0,dt||i){if(_s.current!==null)return oo(e,t,w);if(i=Je,i!==null&&(u=Lh(i,w),u!==0&&u!==g.retryLane))throw g.retryLane=u,al(e,u),Kt(i,e,u),Hu;return qd(d)||Co(),oo(e,t,w)}return qd(d)?(t.flags|=192,t.child=e.child,null):(e=g.treeContext,Fe=xn(d.nextSibling),gt=t,Me=!0,Ts=null,gn=!1,e!==null&&Lm(t,e),t=Gu(t,u.children),t.flags|=134221824,t)}function sg(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Br(e.return,t,s)}function lg(e){for(var t=null;e!==null;){var s=e.alternate;s!==null&&Qr(s)===null&&(t=e),e=e.sibling}return t}function co(e,t,s,i,u,d){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:u,treeForkCount:d}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=i,g.tail=s,g.tailMode=u,g.treeForkCount=d)}function Ku(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 Vu(e,t,s){var i=t.pendingProps,u=i.revealOrder,d=i.tail;i=i.children;var g=wt.current;if(t.flags&128)return pi(t,g),null;var w=(g&2)!==0;if(w?(g=g&1|2,t.flags|=128):g&=1,pi(t,g),u==="backwards"&&e!==null?(Ku(e),ht(e,t,i,s),Ku(e)):ht(e,t,i,s),i=Me?ii:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sg(e,s,t);else if(e.tag===19)sg(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=lg(t.child),s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null,Ku(t)),co(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&&Qr(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}co(t,!0,s,null,d,i);break;case"together":co(t,!1,null,null,void 0,i);break;case"independent":t.memoizedState=null;break;default:s=lg(t.child),s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),co(t,!1,u,s,d,i)}return t.child}function ag(e,t,s){var i=t.pendingProps;return Es(t,t.type,i.value),ht(e,t,i.children,s),t.child}function fs(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),Hs|=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=is(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=is(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Xu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&qr(e)))}function Zk(e,t,s){switch(t.tag){case 3:mr(t,t.stateNode.containerInfo),Es(t,ct,e.memoizedState.cache),rl();break;case 27:case 5:yc(t);break;case 4:mr(t,t.stateNode.containerInfo);break;case 10:Es(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,xu(t),null;break;case 13:var i=t.memoizedState;if(i!==null){if(i.dehydrated!==null)return Rs(t),t.flags|=128,null;i=cl(e,t,s,!1);var u=t.child.childLanes;return i||(s&u)!==0?ng(e,t,s):(Rs(t),e=fs(e,t,s),e!==null?e.sibling:null)}Rs(t);break;case 19:if(t.flags&128)return Vu(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 Vu(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),pi(t,wt.current),i)break;return null;case 22:return t.lanes=0,Jp(e,t,s,t.pendingProps);case 24:Es(t,ct,e.memoizedState.cache)}return fs(e,t,s)}function ig(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!Xu(e,s)&&(t.flags&128)===0)return dt=!1,Zk(e,t,s);dt=(e.flags&131072)!==0}else dt=!1,Me&&(t.flags&1048576)!==0&&Um(t,ii,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")eu(e)?(i=vl(e,i),t.tag=1,t=eg(null,t,e,i,s)):(t.tag=0,t=Bu(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===se){t.tag=11,t=Xp(null,t,e,i,s);break e}else if(u===ze){t.tag=14,t=Zp(null,t,e,i,s);break e}else if(u===_e){t.tag=10,t.type=e,t=ag(null,t,s);break e}}throw t=ae(e)||e,Error(o(306,t,""))}}return t;case 0:return Bu(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=vl(i,t.pendingProps),eg(e,t,i,u,s);case 3:e:{if(mr(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var d=t.memoizedState;u=d.element,hu(e,t),mi(t,i,null,s);var g=t.memoizedState;if(i=g.cache,Es(t,ct,i),i!==d.cache&&ru(t,[ct],s,!0),hi(),i=g.element,d.isDehydrated)if(d={element:i,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=tg(e,t,i,s);break e}else if(i!==u){u=hn(Error(o(424)),t),ri(u),t=tg(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(Fe=xn(e.firstChild),gt=t,Me=!0,Ts=null,gn=!0,s=Jm(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|134221824,s=s.sibling}else{if(rl(),i===u){t=fs(e,t,s);break e}ht(e,t,i,s)}t=t.child}return t;case 26:return ra(e,t),e===null?(s=zv(t.type,null,t.pendingProps,null))?t.memoizedState=s:Me||(t.stateNode=uv(t.type,t.pendingProps,En.current,t)):t.memoizedState=zv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return yc(t),e===null&&Me&&(i=t.stateNode=Cv(t.type,t.pendingProps,En.current),gt=t,gn=!0,u=Fe,Ys(t.type)?(Yd=u,Fe=xn(i.firstChild)):Fe=u),ht(e,t,t.pendingProps.children,s),ra(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((u=i=Fe)&&(i=Ij(i,t.type,t.pendingProps,gn),i!==null?(t.stateNode=i,gt=t,Fe=xn(i.firstChild),gn=!1,u=!0):u=!1),u||Cs(t)),yc(t),u=t.type,d=t.pendingProps,g=e!==null?e.memoizedProps:null,i=d.children,Rd(u,d)?i=null:g!==null&&Rd(u,g)&&(t.flags|=32),t.memoizedState!==null&&(u=ku(e,t,Uk,null,null,s),Sa._currentValue=u),ra(e,t),ht(e,t,i,s),t.child;case 6:return e===null&&Me&&((e=s=Fe)&&(s=Yj(s,t.pendingProps,gn),s!==null?(t.stateNode=s,gt=t,Fe=null,e=!0):e=!1),e||Cs(t)),null;case 13:return ng(e,t,s);case 4:return mr(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 Xp(e,t,t.type,t.pendingProps,s);case 7:return i=t.pendingProps,ra(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 ag(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 Zp(e,t,t.type,t.pendingProps,s);case 15:return Qp(e,t,t.type,t.pendingProps,s);case 19:return Vu(e,t,s);case 31:return Vk(e,t,s);case 22:return Jp(e,t,s,t.pendingProps);case 24:return ul(t),i=kt(ct),e===null?(u=uu(),u===null&&(u=Je,d=ou(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=s),u=d),t.memoizedState={parent:i,cache:u},fu(t),Es(t,ct,u)):((e.lanes&s)!==0&&(hu(e,t),mi(t,null,null,s),hi()),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),Es(t,ct,i)):(i=d.cache,Es(t,ct,i),i!==u.cache&&ru(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&&Lr(t),e!==null&&e.memoizedProps.name!==i.name?t.flags|=4194816:ra(e,t),ht(e,t,i.children,s),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function hs(e){e.flags|=4}function Zu(e,t,s,i,u){var d;if((d=(e.mode&32)!==0)&&(d=s===null?Dv(t,i):Dv(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(qg())e.flags|=8192;else throw ml=Kr,du}else e.flags&=-16777217}function rg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!$v(t))if(qg())e.flags|=8192;else throw ml=Kr,du}function uo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Dh():536870912,e.lanes|=t,fa|=t)}function yi(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 We(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 Qk(e,t,s){var i=t.pendingProps;switch(su(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return We(t),null;case 1:return We(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),cs(ct),Ll(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ea(t)?hs(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,au())),We(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(hs(t),d!==null?(We(t),rg(t,d)):(We(t),Zu(t,u,null,i,s))):d?d!==e.memoizedState?(hs(t),We(t),rg(t,d)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&hs(t),We(t),Zu(t,u,e,i,s)),null;case 27:if(pr(t),s=En.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&hs(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return We(t),t.subtreeFlags&=-33554433,null}e=Zt.current,ea(t)?Hm(t):(e=Cv(u,i,s),t.stateNode=e,hs(t))}return We(t),t.subtreeFlags&=-33554433,null;case 5:if(pr(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&hs(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return We(t),t.subtreeFlags&=-33554433,null}if(d=Zt.current,ea(t))Hm(t);else{var g=zi(En.current);switch(d){case 1:d=g.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=g.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=g.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof i.is=="string"?g.createElement("select",{is:i.is}):g.createElement("select"),i.multiple?d.multiple=!0:i.size&&(d.size=i.size);break;default:d=typeof i.is=="string"?g.createElement(u,{is:i.is}):g.createElement(u)}}d[yt]=t,d[Bt]=i;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)d.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.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&&hs(t)}}return We(t),t.subtreeFlags&=-33554433,Zu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&hs(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=En.current,ea(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||iv(e.nodeValue,s)),e||Cs(t,!0)}else e=zi(e).createTextNode(i),e[yt]=t,t.stateNode=e}return We(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=ea(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;We(t),e=!1}else s=au(),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 We(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ea(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;We(t),u=!1}else u=au(),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),uo(t,t.updateQueue),We(t),null);case 4:return Ll(),e===null&&Ad(t.stateNode.containerInfo),t.flags|=67108864,We(t),null;case 10:return cs(t.type),We(t),null;case 19:if(bu(t),i=t.memoizedState,i===null)return We(t),null;if(u=(t.flags&128)!==0,d=i.rendering,d===null)if(u)yi(i,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Qr(e),d!==null){for(t.flags|=128,yi(i,!1),e=d.updateQueue,t.updateQueue=e,uo(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Rm(s,e),s=s.sibling;return pi(t,wt.current&1|2),Me&&rs(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Qt()>wo&&(t.flags|=128,u=!0,yi(i,!1),t.lanes=4194304)}else{if(!u)if(e=Qr(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,uo(t,e),yi(i,!0),i.tail===null&&i.tailMode!=="collapsed"&&i.tailMode!=="visible"&&!d.alternate&&!Me)return We(t),null}else 2*Qt()-i.renderingStartTime>wo&&s!==536870912&&(t.flags|=128,u=!0,yi(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?pi(t,d):(s=d,Ge(jt,t),Ge(wt,s),At===null&&(At=t)),Me&&rs(t,i.treeForkCount),e}return We(t),null;case 22:case 23:return en(t),vu(),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&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),s=t.updateQueue,s!==null&&uo(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),cs(ct),We(t),null;case 25:return null;case 30:return t.flags|=33554432,We(t),null}throw Error(o(156,t.tag))}function Jk(e,t){switch(su(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cs(ct),Ll(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pr(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 bu(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 Ll(),null;case 10:return cs(t.type),null;case 22:case 23:return en(t),vu(),e!==null&&ot(fl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return cs(ct),null;case 25:return null;default:return null}}function og(e,t){switch(su(t),t.tag){case 3:cs(ct),Ll();break;case 26:case 27:case 5:pr(t);break;case 4:Ll();break;case 31:t.memoizedState!==null&&en(t);break;case 13:en(t);break;case 19:bu(t);break;case 10:cs(t.type);break;case 22:case 23:en(t),vu(),e!==null&&ot(fl);break;case 24:cs(ct)}}function ki(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,g=s.inst;i=d(),g.destroy=i}s=s.next}while(s!==u)}}catch(w){Ve(t,t.return,w)}}function $s(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 g=i.inst,w=g.destroy;if(w!==void 0){g.destroy=void 0,u=t;var O=s,B=w;try{B()}catch(Y){Ve(u,O,Y)}}}i=i.next}while(i!==d)}}catch(Y){Ve(t,t.return,Y)}}function cg(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Fm(t,s)}catch(i){Ve(e,e.return,i)}}}function ug(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=ls(e.memoizedProps,u);(u.ref===null||u.ref.name!==d)&&(u.ref=vv(d)),i=u.ref;break;case 7:if(e.stateNode===null){var g=new an(e);b(e.child,!1,Bj,g,void 0,void 0),e.stateNode=g}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 fo(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++)wv(e.stateNode,t[s])}function dg(e){for(var t=e.return;t!==null&&(Ju(t)&&wv(e.stateNode,t.stateNode),!Qu(t));)t=t.return}function ji(e){for(var t=e.return;t!==null&&(Ju(t)&&qj(e.stateNode,t.stateNode),!Qu(t));)t=t.return}function Qu(e){return e.tag===5||e.tag===3||e.tag===27}function Ju(e){return e&&e.tag===7&&e.stateNode!==null}function Pu(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 Fu(e,t,s){try{var i=e.stateNode;jj(i,e.type,s,t),i[Bt]=t}catch(u){Ve(e,e.return,u)}}function fg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ys(e.type)||e.tag===4}function Wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fg(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&&Ys(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 ed(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)),fo(e,i),qe=!0;else if(u!==4&&(u===27&&(fo(e,i),i=null,Ys(e.type)&&(s=e.stateNode,t=null)),e=e.child,e!==null))for(ed(e,t,s,i),e=e.sibling;e!==null;)ed(e,t,s,i),e=e.sibling}function ho(e,t,s,i){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?s.insertBefore(u,t):s.appendChild(u),fo(e,i),qe=!0;else if(u!==4&&(u===27&&(fo(e,i),i=null,Ys(e.type)&&(s=e.stateNode)),e=e.child,e!==null))for(ho(e,t,s,i),e=e.sibling;e!==null;)ho(e,t,s,i),e=e.sibling}function hg(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 mo=!1,tn=null;function mg(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(mo=!0)}var Gn=null;function pg(){var e=Gn;return Gn=null,e}var It=0;function oa(e,t,s,i,u){return It=0,gg(e.child,t,s,i,u)}function gg(e,t,s,i,u){for(var d=!1;e!==null;){if(e.tag===5){var g=e.stateNode;if(i!==null){var w=Ud(g);i.push(w),w.view&&(d=!0)}else d||Ud(g).view&&(d=!0);mo=!0,pv(g,It===0?t:t+"_"+It,s),It++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||gg(e.child,t,s,i,u)&&(d=!0));e=e.sibling}return d}function Kn(e,t){for(;e!==null;)e.tag===5?gv(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Kn(e.child,t)),e=e.sibling}function po(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(po(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=as(t.default,t.share),t!=="none"&&(oa(e,s,t,null,!1)||Kn(e.child,!1))}e=e.sibling}}function td(e,t){if(e.tag===30){var s=e.stateNode,i=e.memoizedProps,u=ls(i,s),d=as(i.default,s.paired?i.share:i.enter);d!=="none"?oa(e,u,d,null,!1)?(po(e),s.paired||t||ga(e,i.onEnter)):Kn(e.child,!1):po(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)td(e,t),e=e.sibling;else po(e)}function nd(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=as(s.default,s.share);if(d!=="none"&&(oa(e,i,d,null,!1)?(d=e.stateNode,u.paired=d,d.paired=u,ga(e,s.onShare)):Kn(e.child,!1)),t.delete(i),t.size===0)break}}}nd(e)}e=e.sibling}}}function sd(e){if(e.tag===30){var t=e.memoizedProps,s=ls(t,e.stateNode),i=tn!==null?tn.get(s):void 0,u=as(t.default,i!==void 0?t.share:t.exit);u!=="none"&&(oa(e,s,u,null,!1)?i!==void 0?(u=e.stateNode,i.paired=u,u.paired=i,tn.delete(s),ga(e,t.onShare)):ga(e,t.onExit):Kn(e.child,!1)),tn!==null&&nd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)sd(e),e=e.sibling;else tn!==null&&nd(e)}function vg(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,s=ls(t,e.stateNode);t=as(t.default,t.update),e.flags&=-5,t!=="none"&&oa(e,s,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&vg(e);e=e.sibling}}function ld(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))}ld(e)}e=e.sibling}}function go(e){if(e.tag===30)e.stateNode.paired=null,Kn(e.child,!1),ld(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)go(e),e=e.sibling;else ld(e)}function xg(e){for(e=e.child;e!==null;)e.tag===30?Kn(e.child,!1):(e.subtreeFlags&33554432)!==0&&xg(e),e=e.sibling}function ad(e,t,s,i,u,d,g){for(var w=!1;t!==null;){if(t.tag===5){var O=t.stateNode;if(d!==null&&It<d.length){var B=d[It],Y=Ud(O);(B.view||Y.view)&&(w=!0);var Q;if(Q=(e.flags&4)===0)if(Y.clip)Q=!0;else{Q=B.rect;var L=Y.rect;Q=Q.y!==L.y||Q.x!==L.x||Q.height!==L.height||Q.width!==L.width}Q&&(e.flags|=4),Y.abs?Y=!B.abs:(B=B.rect,Y=Y.rect,Y=B.height!==Y.height||B.width!==Y.width),Y&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&pv(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&&g?e.flags|=t.flags&32:ad(e,t.child,s,i,u,d,g)&&(w=!0));t=t.sibling}return w}function bg(e,t){for(e=e.child;e!==null;){if(e.tag===30){var s=e.memoizedProps,i=e.stateNode,u=ls(s,i),d=as(s.default,s.update),g;g=e.memoizedState,e.memoizedState=null,i=e;var w=e.child;It=0,u=ad(i,w,u,u,d,g,!1),(e.flags&4)!==0&&u&&ga(e,s.onUpdate)}else(e.subtreeFlags&33554432)!==0&&bg(e);e=e.sibling}}var vt=!1,Ye=!1,Vn=!1,id=!1,yg=typeof WeakSet=="function"?WeakSet:Set,xt=null,Xn=!1,wi=!1,vo=!1,rd=!1;function Pk(e,t,s){if(e=e.containerInfo,Od=Ta,e=Nm(e),Xc(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,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,O=-1,B=-1,Y=0,Q=0,L=e,I=null;t:for(;;){for(var ie;L!==i||d!==0&&L.nodeType!==3||(O=w+d),L!==g||u!==0&&L.nodeType!==3||(B=w+u),L.nodeType===3&&(w+=L.nodeValue.length),(ie=L.firstChild)!==null;)I=L,L=ie;for(;;){if(L===e)break t;if(I===i&&++Y===d&&(O=w),I===g&&++Q===u&&(B=w),(ie=L.nextSibling)!==null)break;L=I,I=L.parentNode}L=ie}i=O===-1||B===-1?null:{start:O,end:B}}else i=null}i=i||{start:0,end:0}}else i=null;for(_d={focusedElem:e,selectionRange:i},Ta=!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&&sd(i[d]);if(e.alternate===null&&(e.flags&2)!==0)s&&mg(e),xo(s);else{if(e.tag===22){if(i=e.alternate,e.memoizedState!==null){i!==null&&i.memoizedState===null&&s&&sd(i),xo(s);continue}else if(i!==null&&i.memoizedState!==null){s&&mg(e),xo(s);continue}}i=e.child,(e.subtreeFlags&t)!==0&&i!==null?(i.return=e,xt=i):(s&&vg(e),xo(s))}}tn=null}function xo(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 g=vl(t.type,u);s=d.getSnapshotBeforeUpdate(g,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)Bd(i);else if(s===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Bd(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=ls(i.memoizedProps,i.stateNode),u=t.memoizedProps,u=as(u.default,u.update),u!=="none"&&oa(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 kg(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Zn(e,s),i&4&&ki(5,s);break;case 1:if(Zn(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(g){Ve(s,s.return,g)}else{var u=vl(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){Ve(s,s.return,g)}}i&64&&cg(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{Fm(e,t)}catch(g){Ve(s,s.return,g)}}break;case 27:t===null&&i&4&&hg(s);case 26:case 5:Zn(e,s),t===null&&i&4&&Pu(s),i&512&&Yn(s,s.return);break;case 12:Zn(e,s);break;case 31:Zn(e,s),i&4&&Sg(e,s);break;case 13:Zn(e,s),i&4&&Tg(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=cj.bind(null,s),Gj(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 od(e,t){for(e=e.child;e!==null;)jg(e,t),e=e.sibling}function jg(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,g=d!=null&&d.hasOwnProperty("display")?d.display:null;u.style.display=g==null||typeof g=="boolean"?"":(""+g).trim()}}catch(O){Ve(e,e.return,O)}cd(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?mv(w,!0):mv(e.stateNode,!1)}catch(O){Ve(e,e.return,O)}break;case 22:case 23:e.memoizedState===null&&od(e,t);break;default:od(e,t)}}function cd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var s=e,i=t;switch(s.tag){case 4:jg(s,i);break e;case 22:s.memoizedState===null&&cd(s,i);break e;default:cd(s,i)}}e=e.sibling}}function wg(e){var t=e.alternate;t!==null&&(e.alternate=null,wg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&jr(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;)Ng(e,t,s),s=s.sibling}function Ng(e,t,s){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(Va,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),ji(s);var i=tt,u=Yt;Ys(s.type)&&(tt=s.stateNode,Yt=!1),Mn(e,t,s),Ev(s.stateNode,s.type,s.memoizedProps),tt=i,Yt=u;break;case 5:Ye||Nt(s,t),ji(s);case 6:if(s.tag===6&&ji(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,hv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Ca(e)):hv(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:$s(2,s,t),Ye||$s(4,s,t),Mn(e,t,s);break;case 1:Ye||(Nt(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&ug(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 Sg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ca(e)}catch(s){Ve(t,t.return,s)}}}function Tg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ca(e)}catch(s){Ve(t,t.return,s)}}function Fk(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new yg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new yg),t;default:throw Error(o(435,e.tag))}}function bo(e,t){var s=Fk(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=uj.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],g=e,w=t,O=w;e:for(;O!==null;){switch(O.tag){case 27:if(Ys(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));Ng(g,w,d),tt=null,Yt=!1,g=d.alternate,g!==null&&(g.return=null),d.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cg(t,e,s),t=t.sibling}var zn=null;function Cg(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 g=i[d];g.ref.impl=g.nextImpl}$t(t,e,s),Ut(e),u&4&&($s(3,e,e.return),ki(3,e),$s(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=uv(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[Qa]||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=Rv("link","href",u).get(t+(s.href||""))){for(g=0;g<d.length;g++)if(i=d[g],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(g,1);break t}}i=u.createElement(t),St(i,t,s),u.head.appendChild(i);break;case"meta":if(d=Rv("meta","content",u).get(t+(s.content||""))){for(g=0;g<d.length;g++)if(i=d[g],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(g,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||Xd(d,e.type,e.stateNode);else e.stateNode=_v(d,s,e.memoizedProps);else u!==s?(u===null?(t=i.stateNode,t===null||Ye||t.parentNode.removeChild(t)):u.count--,s===null?vt||Xd(d,e.type,e.stateNode):_v(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Fu(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&&Fu(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{Gl(t,""),qe=!0}catch(Y){Ve(e,e.return,Y)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,Fu(e,t,i!==null?i.memoizedProps:t)),u&1024&&(id=!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(Y){Ve(e,e.return,Y)}}break;case 3:if(qe=!1,Ro=null,d=zn,zn=Oi(t.containerInfo),$t(t,e,s),zn=d,Ut(e),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Ca(t.containerInfo)}catch(Y){Ve(e,e.return,Y)}id&&(id=!1,Eg(e)),qe=!1;break;case 4:u=Vn,Vn=vt,i=Zh(),d=zn,zn=Oi(e.stateNode.containerInfo),$t(t,e,s),Ut(e),zn=d,qe&&wi&&(vo=!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,bo(e,t)));break;case 13:$t(t,e,s),Ut(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(jo=Qt()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bo(e,t)));break;case 22:d=e.memoizedState!==null,g=i!==null&&i.memoizedState!==null;var w=vt,O=Ye,B=Vn;vt=w||d,Vn=B||d,Ye=O||g,$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||g||vt||Ye||(t=g||Ye,s=vt,i=Ye,vt=d||vt,Ye=t,Us(e,2),vt=s,Ye=i),!d&&Vn||od(e,d)),u&4&&(t=e.updateQueue,t!==null&&(s=t.retryQueue,s!==null&&(t.retryQueue=null,bo(e,s))));break;case 19:$t(t,e,s),Ut(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bo(e,t)));break;case 30:u&512&&(Ye||i===null||Nt(i,i.return)),u=Zh(),d=wi,g=(s&335544064)===s,w=e.memoizedProps,wi=g&&as(w.default,w.update)!=="none",$t(t,e,s),Ut(e),g&&i!==null&&qe&&(e.flags|=4),wi=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(fg(i)){s=i;break}i=i.return}i=null;for(var u=e.return;u!==null;){if(Ju(u)){var d=u.stateNode;i===null?i=[d]:i.push(d)}if(Qu(u))break;u=u.return}var g=i;if(s==null)throw Error(o(160));switch(s.tag){case 27:var w=s.stateNode,O=Wu(e);ho(e,O,w,g);break;case 5:var B=s.stateNode;s.flags&32&&(Gl(B,""),s.flags&=-33);var Y=Wu(e);ho(e,Y,B,g);break;case 3:case 4:var Q=s.stateNode.containerInfo,L=Wu(e);ed(e,L,Q,g);break;default:throw Error(o(161))}}catch(I){Ve(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Eg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Eg(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Ta=!0,t.reset(),Ta=!1),e=e.sibling}}function ca(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ag(t,e),t=t.sibling;else bg(t)}function Ag(e,t){var s=e.alternate;if(s===null)td(e,!1);else switch(e.tag){case 3:if(rd=Xn=!1,pg(),ca(t,e),!Xn&&!vo){if(e=Gn,e!==null)for(var i=0;i<e.length;i+=3){s=e[i];var u=e[i+1];gv(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"})),rd=!0}Gn=null;break;case 5:ca(t,e);break;case 4:i=Xn,Xn=!1,ca(t,e),Xn&&(vo=!0),Xn=i;break;case 22:e.memoizedState===null&&(s.memoizedState!==null?td(e,!1):ca(t,e));break;case 30:i=Xn,u=pg(),Xn=!1,ca(t,e),Xn&&(e.flags|=4);var d=e.memoizedProps,g=e.stateNode;t=ls(d,g),g=ls(s.memoizedProps,g);var w=as(d.default,d.update);w==="none"?t=!1:(d=s.memoizedState,s.memoizedState=null,s=e.child,It=0,t=ad(e,s,t,g,w,d,!0),It!==(d===null?0:d.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(ga(e,e.memoizedProps.onUpdate),Gn=u):u!==null&&(u.push.apply(u,Gn),Gn=u),Xn=(e.flags&32)!==0?!0:i;break;default:ca(t,e)}}function Zn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)kg(e,t.alternate,t),t=t.sibling}function Us(e,t){for(e=e.child;e!==null;){var s=e,i=t;switch(s.tag){case 0:case 11:case 14:case 15:$s(4,s,s.return),Us(s,i);break;case 1:Nt(s,s.return);var u=s.stateNode;typeof u.componentWillUnmount=="function"&&ug(s,s.return,u),Us(s,i);break;case 27:(i&2)!==0&&Ev(s.stateNode,s.type,s.memoizedProps);case 5:Nt(s,s.return),s.tag!==5&&s.tag!==27||ji(s),Us(s,i);break;case 6:ji(s);break;case 26:Nt(s,s.return),u=s.stateNode,s.memoizedState!==null||u===null||Ye||u.parentNode.removeChild(u),Us(s,i);break;case 22:s.memoizedState===null&&Us(s,i);break;case 30:Nt(s,s.return),Us(s,i);break;case 7:Nt(s,s.return);default:Us(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,g=d.flags,w=(s&1)!==0;switch(d.tag){case 0:case 11:case 15:On(u,d,s),ki(4,d);break;case 1:if(On(u,d,s),i=d,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(Y){Ve(i,i.return,Y)}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++)Pm(B[u],O)}catch(Y){Ve(i,i.return,Y)}}w&&g&64&&cg(d),Yn(d,d.return);break;case 27:(s&2)!==0&&hg(d);case 5:d.tag!==5&&d.tag!==27||dg(d),On(u,d,s),w&&i===null&&g&4&&Pu(d),Yn(d,d.return);break;case 6:dg(d);break;case 26:O=d.stateNode,d.memoizedState!==null||O===null||vt||Xd(Oi(O.ownerDocument),d.type,O),On(u,d,s),w&&i===null&&g&4&&Pu(d),Yn(d,d.return);break;case 12:On(u,d,s);break;case 31:On(u,d,s),w&&g&4&&Sg(u,d);break;case 13:On(u,d,s),w&&g&4&&Tg(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 ud(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&&oi(s))}function dd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oi(e))}function vn(e,t,s,i){var u=(s&335544064)===s;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)Mg(e,t,s,i),t=t.sibling;else u&&xg(t)}function Mg(e,t,s,i){var u=(s&335544064)===s;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&go(t);var d=t.flags;switch(t.tag){case 0:case 11:case 15:vn(e,t,s,i),d&2048&&ki(9,t);break;case 1:vn(e,t,s,i);break;case 3:vn(e,t,s,i),u&&rd&&(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&&oi(d)));break;case 12:if(d&2048){vn(e,t,s,i),d=t.stateNode;try{var g=t.memoizedProps,w=g.id,O=g.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:g=t.stateNode,w=t.alternate,t.memoizedState!==null?(u&&w!==null&&w.memoizedState===null&&go(w),g._visibility&2?vn(e,t,s,i):Ni(e,t)):(u&&w!==null&&w.memoizedState!==null&&go(t),g._visibility&2?vn(e,t,s,i):(g._visibility|=2,ua(e,t,s,i,(t.subtreeFlags&10256)!==0||!1))),d&2048&&ud(w,t);break;case 24:vn(e,t,s,i),d&2048&&dd(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 ua(e,t,s,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,g=t,w=s,O=i,B=g.flags;switch(g.tag){case 0:case 11:case 15:ua(d,g,w,O,u),ki(8,g);break;case 23:break;case 22:var Y=g.stateNode;g.memoizedState!==null?Y._visibility&2?ua(d,g,w,O,u):Ni(d,g):(Y._visibility|=2,ua(d,g,w,O,u)),u&&B&2048&&ud(g.alternate,g);break;case 24:ua(d,g,w,O,u),u&&B&2048&&dd(g.alternate,g);break;default:ua(d,g,w,O,u)}t=t.sibling}}function Ni(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:Ni(s,i),u&2048&&ud(i.alternate,i);break;case 24:Ni(s,i),u&2048&&dd(i.alternate,i);break;default:Ni(s,i)}t=t.sibling}}var xl=8192;function bl(e,t,s){if(e.subtreeFlags&xl)for(e=e.child;e!==null;)zg(e,t,s),e=e.sibling}function zg(e,t,s){switch(e.tag){case 26:bl(e,t,s),e.flags&xl&&(e.memoizedState!==null?l1(s,zn,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&Lv(s,e)));break;case 5:bl(e,t,s),e.flags&xl&&(e=e.stateNode,(t&335544128)===t&&Lv(s,e));break;case 3:case 4:var i=zn;zn=Oi(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 Og(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 Si(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,Rg(i,e)}Og(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)_g(e),e=e.sibling}function _g(e){switch(e.tag){case 0:case 11:case 15:Si(e),e.flags&2048&&$s(9,e,e.return);break;case 3:Si(e);break;case 12:Si(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,yo(e)):Si(e);break;default:Si(e)}}function yo(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,Rg(i,e)}Og(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$s(8,t,t.return),yo(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,yo(t));break;default:yo(t)}e=e.sibling}}function Rg(e,t){for(;xt!==null;){var s=xt;switch(s.tag){case 0:case 11:case 15:$s(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:oi(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(wg(i),i===s){xt=null;break e}if(u!==null){u.return=d,xt=u;break e}xt=d}}}var Wk={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}},ej=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Je=null,Re=null,$e=0,Ke=0,nn=null,Ls=!1,da=!1,fd=!1,ms=0,at=0,Hs=0,yl=0,ko=0,sn=0,fa=0,Ti=null,Gt=null,hd=!1,jo=0,Dg=0,wo=1/0,No=null,Bs=null,nt=0,_n=null,kl=null,Qn=0,md=0,pd=null,$g=null,ha=null,ma=null,pa=null,Ci=0,So=null;function ln(){return(Ie&2)!==0&&$e!==0?$e&-$e:ce.T!==null?Sd():Hh()}function Ug(){if(sn===0)if(($e&536870912)===0||Me){var e=xr;xr<<=1,(xr&3932160)===0&&(xr=262144),sn=e}else sn=536870912;return e=jt.current,e!==null&&(e.flags|=32),sn}function ga(e,t){if(t!=null){var s=e.stateNode,i=s.ref;i===null&&(i=s.ref=vv(ls(e.memoizedProps,s))),ma===null&&(ma=[]),ma.push(t.bind(null,i))}}function Kt(e,t,s){(e===Je&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(va(e,0),qs(e,$e,sn,!1)),Za(e,s),((Ie&2)===0||e!==Je)&&(e===Je&&((Ie&2)===0&&(yl|=s),at===4&&qs(e,$e,sn,!1)),Jn(e))}function Lg(e,t,s){if((Ie&6)!==0)throw Error(o(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Xa(e,t),u=i?sj(e,t):vd(e,t,!0),d=i;do{if(u===0){da&&!i&&qs(e,t,0,!1);break}else{if(s=e.current.alternate,d&&!tj(s)){u=vd(e,t,!1),d=!1;continue}if(u===2){if(d=t,e.errorRecoveryDisabledLanes&d)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var w=e;u=Ti;var O=w.current.memoizedState.isDehydrated;if(O&&(va(w,g).flags|=256),g=vd(w,g,!1),g!==2&&g!==6){if(fd&&!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=g}if(d=!1,u!==2)continue}}if(u===1){va(e,0),qs(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:qs(i,t,sn,!Ls);break e;case 2:Gt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=jo+300-Qt(),10<u)){if(qs(i,t,sn,!Ls),yr(i,0,!0)!==0)break e;Qn=t,i.timeoutHandle=$d(Hg.bind(null,i,s,Gt,No,hd,t,sn,yl,fa,Ls,d,"Throttled",-0,0),u);break e}Hg(i,s,Gt,No,hd,t,sn,yl,fa,Ls,d,null,-0,0)}}break}while(!0);Jn(e)}function Hg(e,t,s,i,u,d,g,w,O,B,Y,Q,L,I){e.timeoutHandle=-1;var ie=t.subtreeFlags,pe=(d&335544064)===d;if(Q=null,(pe||ie&8192||(ie&16785408)===16785408)&&(Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bn},tn=null,zg(t,d,Q),pe&&(ie=Q,pe=e.containerInfo,pe=(pe.nodeType===9?pe:pe.ownerDocument).__reactViewTransition,pe!=null&&(ie.count++,ie.waitingForViewTransition=!0,ie=Di.bind(ie),pe.finished.then(ie,ie))),ie=(d&62914560)===d?jo-Qt():(d&4194048)===d?Dg-Qt():0,ie=a1(Q,ie),ie!==null)){Qn=d,e.cancelPendingCommit=ie(Xg.bind(null,e,t,d,s,i,u,g,w,O,B,Y,Q,null,L,I)),qs(e,d,g,!B);return}Xg(e,t,d,s,i,u,g,w,O,B,Y,Q)}function tj(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 qs(e,t,s,i){t=Rh(e,t),t&=~ko,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),g=1<<d;i[d]=-1,u&=~g}s!==0&&$h(e,s,t)}function To(){return(Ie&6)===0?(Ei(0),!1):!0}function gd(){if(Re!==null){if(Ke===0)var e=Re.return;else e=Re,os=ol=null,Nu(e),sa=null,di=0,e=Re;for(;e!==null;)og(e.alternate,e),e=e.return;Re=null}}function va(e,t){var s=e.timeoutHandle;return s!==-1&&(e.timeoutHandle=-1,Sj(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Qn=0,gd(),Je=e,Re=s=is(e.current,null),$e=t,Ke=0,nn=null,Ls=!1,da=Xa(e,t),fd=!1,fa=sn=ko=yl=Hs=at=0,Gt=Ti=null,hd=!1,ms=Rh(e,t),_r(),s}function Bg(e,t){Te=null,ce.H=lo,t===na||t===Gr?(t=Xm(),Ke=3):t===du?(t=Xm(),Ke=4):Ke=t===Hu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,nn=t,Re===null&&(at=1,ao(e,hn(t,e.current)))}function qg(){var e=jt.current;return e===null?!0:($e&4194048)===$e?At===null:($e&62914560)===$e||($e&536870912)!==0?e===At:!1}function Ig(){var e=ce.H;return ce.H=lo,e===null?lo:e}function Yg(){var e=ce.A;return ce.A=Wk,e}function Co(){at=4,Ls||($e&4194048)!==$e&&jt.current!==null||(da=!0),(Hs&134217727)===0&&(yl&134217727)===0||Je===null||qs(Je,$e,sn,!1)}function vd(e,t,s){var i=Ie;Ie|=2;var u=Ig(),d=Yg();(Je!==e||$e!==t)&&(No=null,va(e,t)),t=!1;var g=at;e:do try{if(Ke!==0&&Re!==null){var w=Re,O=nn;switch(Ke){case 8:gd(),g=6;break e;case 3:case 2:case 9:case 6:jt.current===null&&(t=!0);var B=Ke;if(Ke=0,nn=null,xa(e,w,O,B),s&&da){g=0;break e}break;default:B=Ke,Ke=0,nn=null,xa(e,w,O,B)}}nj(),g=at;break}catch(Y){Bg(e,Y)}while(!0);return t&&e.shellSuspendCounter++,os=ol=null,Ie=i,ce.H=u,ce.A=d,Re===null&&(Je=null,$e=0,_r()),g}function nj(){for(;Re!==null;)Gg(Re)}function sj(e,t){var s=Ie;Ie|=2;var i=Ig(),u=Yg();Je!==e||$e!==t?(No=null,wo=Qt()+500,va(e,t)):da=Xa(e,t);e:do try{if(Ke!==0&&Re!==null){t=Re;var d=nn;t:switch(Ke){case 1:Ke=0,nn=null,xa(e,t,d,1);break;case 2:case 9:if(Km(d)){Ke=0,nn=null,Kg(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:Km(d)?(Ke=0,nn=null,Kg(t)):(Ke=0,nn=null,xa(e,t,d,7));break;case 5:var g=null;switch(Re.tag){case 26:g=Re.memoizedState;case 5:case 27:var w=Re;if(g?$v(g):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,Eo(B)):Re=null}break t}}Ke=0,nn=null,xa(e,t,d,5);break;case 6:Ke=0,nn=null,xa(e,t,d,6);break;case 8:gd(),at=6;break e;default:throw Error(o(462))}}lj();break}catch(Y){Bg(e,Y)}while(!0);return os=ol=null,ce.H=i,ce.A=u,Ie=s,Re!==null?0:(Je=null,$e=0,_r(),at)}function lj(){for(;Re!==null&&!ky();)Gg(Re)}function Gg(e){var t=ig(e.alternate,e,ms);e.memoizedProps=e.pendingProps,t===null?Eo(e):Re=t}function Kg(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Wp(s,t,t.pendingProps,t.type,void 0,$e);break;case 11:t=Wp(s,t,t.pendingProps,t.type.render,t.ref,$e);break;case 5:Nu(t);var i=t;i===gt&&(Me?(Hr(i),i.tag===5&&i.stateNode!=null&&(Fe=i.stateNode)):(Hr(i),Me=!0));default:og(s,t),t=Re=Rm(t,ms),t=ig(s,t,ms)}e.memoizedProps=e.pendingProps,t===null?Eo(e):Re=t}function xa(e,t,s,i){os=ol=null,Nu(t),sa=null,di=0;var u=t.return;try{if(Kk(e,u,t,s,$e)){at=1,ao(e,hn(s,e.current)),Re=null;return}}catch(d){if(u!==null)throw Re=u,d;at=1,ao(e,hn(s,e.current)),Re=null;return}t.flags&32768?(Me||i===1?e=!0:da||($e&536870912)!==0?e=!1:(Ls=e=!0,(i===2||i===9||i===3||i===6)&&(i=jt.current,i!==null&&i.tag===13&&(i.flags|=16384))),Vg(t,e)):Eo(t)}function Eo(e){var t=e;do{if((t.flags&32768)!==0){Vg(t,Ls);return}e=t.return;var s=Qk(t.alternate,t,ms);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 Vg(e,t){do{var s=Jk(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 Xg(e,t,s,i,u,d,g,w,O,B,Y,Q){e.cancelPendingCommit=null;do Ao();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,pd=u,$g=i,aj(e,t,s,g,w,O,Q)}}function aj(e,t,s,i,u,d,g){var w=t.lanes|t.childLanes;if(md=w,w|=Fc,zy(e,s,w,i,u,d),ma=null,(s&335544064)===s?(pa=_k(e),i=10262):(pa=null,i=10256),(t.subtreeFlags&i)!==0||(t.flags&i)!==0?(e.callbackNode=null,e.callbackPriority=0,dj(gr,function(){return kd(),null})):(e.callbackNode=null,e.callbackPriority=0),mo=!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{Pk(e,t,s)}finally{Ie=d,xe.p=u,ce.T=i}}nt=1,mo?ha=zj(g,e.containerInfo,pa,xd,bd,rj,yd,kd,ij):(xd(),bd(),yd())}function ij(e){if(nt!==0){var t=_n.onRecoverableError;t(e,{componentStack:null})}}function rj(){nt===3&&(nt=0,Ag(kl,_n),nt=4)}function xd(){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{wi=vo=!1,Cg(t,e,s),s=_d;var g=Nm(e.containerInfo),w=s.focusedElem,O=s.selectionRange;if(g!==w&&w&&w.ownerDocument&&wm(w.ownerDocument.documentElement,w)){if(O!==null&&Xc(w)){var B=O.start,Y=O.end;if(Y===void 0&&(Y=B),"selectionStart"in w)w.selectionStart=B,w.selectionEnd=Math.min(Y,w.value.length);else{var Q=w.ownerDocument||document,L=Q&&Q.defaultView||window;if(L.getSelection){var I=L.getSelection(),ie=w.textContent.length,pe=Math.min(O.start,ie),Ce=O.end===void 0?pe:Math.min(O.end,ie);!I.extend&&pe>Ce&&(g=Ce,Ce=pe,pe=g);var H=jm(w,pe),R=jm(w,Ce);if(H&&R&&(I.rangeCount!==1||I.anchorNode!==H.node||I.anchorOffset!==H.offset||I.focusNode!==R.node||I.focusOffset!==R.offset)){var q=Q.createRange();q.setStart(H.node,H.offset),I.removeAllRanges(),pe>Ce?(I.addRange(q),I.extend(R.node,R.offset)):(q.setEnd(R.node,R.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}}Ta=!!Od,_d=Od=null}finally{Ie=d,xe.p=u,ce.T=i}}e.current=t,nt=2}}function bd(){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{kg(e,t.alternate,t)}finally{Ie=u,xe.p=i,ce.T=s}}nt=3}}function yd(){if(nt===4||nt===3){nt=0;var e=ha;ha=null,jy();var t=_n,s=kl,i=Qn,u=$g,d=(i&335544064)===i?10262:10256;if((s.subtreeFlags&d)!==0||(s.flags&d)!==0?nt=5:(nt=0,kl=_n=null,Zg(t,t.pendingLanes)),d=t.pendingLanes,d===0&&(Bs=null),Ac(i),s=s.stateNode,Jt&&typeof Jt.onCommitFiberRoot=="function")try{Jt.onCommitFiberRoot(Va,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 g=t.onRecoverableError,w=0;w<u.length;w++){var O=u[w];g(O.value,{componentStack:O.stack})}}finally{ce.T=s,xe.p=d}}if(u=ma,g=pa,pa=null,u!==null&&(ma=null,g===null&&(g=[]),e!==null))for(O=0;O<u.length;O++)s=(0,u[O])(g),s!==void 0&&e.finished.finally(s);(Qn&3)!==0&&Ao(),Jn(t),d=t.pendingLanes,(i&261930)!==0&&(d&42)!==0?t===So?Ci++:(Ci=0,So=t):(Ci=0,So=null),Ei(0)}}function Zg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oi(t)))}function Ao(){return ha!==null&&(ha.skipTransition(),ha=null),xd(),bd(),yd(),kd()}function kd(){if(nt!==5)return!1;var e=_n,t=md;md=0;var s=Ac(Qn),i=ce.T,u=xe.p;try{xe.p=32>s?32:s,ce.T=null,s=pd,pd=null;var d=_n,g=Qn;if(nt=0,kl=_n=null,Qn=0,(Ie&6)!==0)throw Error(o(331));var w=Ie;if(Ie|=4,_g(d.current),Mg(d,d.current,g,s),Ie=w,Ei(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Va,d)}catch{}return!0}finally{xe.p=u,ce.T=i,Zg(e,t)}}function Qg(e,t,s){t=hn(s,t),t=Lu(e.stateNode,t,2),e=Os(e,t,2),e!==null&&(Za(e,2),Jn(e))}function Ve(e,t,s){if(e.tag===3)Qg(e,e,s);else for(;t!==null;){if(t.tag===3){Qg(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Bs===null||!Bs.has(i))){e=hn(s,e),s=Kp(2),i=Os(t,s,2),i!==null&&(Vp(s,i,t,e),Za(i,2),Jn(i));break}}t=t.return}}function jd(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new ej;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)||(fd=!0,u.add(s),e=oj.bind(null,e,t,s),t.then(e,e))}function oj(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()-jo)&&(Ie&2)===0?va(e,0):ko|=s,fa===$e&&(fa=0)),Jn(e)}function Jg(e,t){t===0&&(t=Dh()),e=al(e,t),e!==null&&(Za(e,t),Jn(e))}function cj(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Jg(e,s)}function uj(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),Jg(e,s)}function dj(e,t){return Sc(e,t)}var ba=null,ya=null,wd=!1,Mo=!1,Nd=!1,Is=0;function Jn(e){e!==ya&&e.next===null&&(ya===null?ba=ya=e:ya=ya.next=e),Mo=!0,wd||(wd=!0,hj())}function Ei(e,t){if(!Nd&&Mo){Nd=!0;do for(var s=!1,i=ba;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var d=0;else{var g=i.suspendedLanes,w=i.pingedLanes;d=(1<<31-Pt(42|e)+1)-1,d&=u&~(g&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(s=!0,ev(i,d))}else d=$e,d=yr(i,i===Je?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(d&3)===0||Xa(i,d)||(s=!0,ev(i,d));i=i.next}while(s);Nd=!1}}function fj(){Pg()}function Pg(){Mo=wd=!1;var e=0;Is!==0&&Nj()&&(e=Is);for(var t=Qt(),s=null,i=ba;i!==null;){var u=i.next,d=Fg(i,t);d===0?(i.next=null,s===null?ba=u:s.next=u,u===null&&(ya=s)):(s=i,(e!==0||(d&3)!==0)&&(Mo=!0)),i=u}nt!==0&&nt!==5||Ei(e),Is!==0&&(Is=0)}function Fg(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var g=31-Pt(d),w=1<<g,O=u[g];O===-1?((w&s)===0||(w&i)!==0)&&(u[g]=My(w,t)):O<=t&&(e.expiredLanes|=w),d&=~w}if(t=Je,s=$e,s=yr(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&&Tc(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Xa(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&Tc(i),Ac(s)){case 2:case 8:s=Oh;break;case 32:s=gr;break;case 268435456:s=_h;break;default:s=gr}return i=Wg.bind(null,e),s=Sc(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&Tc(i),e.callbackPriority=2,e.callbackNode=null,2}function Wg(e,t){if(nt!==0&&nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Ao()&&e.callbackNode!==s)return null;var i=$e;return i=yr(e,e===Je?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Lg(e,i,t),Fg(e,Qt()),e.callbackNode!=null&&e.callbackNode===s?Wg.bind(null,e):null)}function ev(e,t){if(Ao())return null;Lg(e,t,!0)}function hj(){Tj(function(){(Ie&6)!==0?Sc(zh,fj):Pg()})}function Sd(){if(Is===0){var e=dl;e===0&&(e=vr,vr<<=1,(vr&261888)===0&&(vr=256)),Is=e}return Is}function tv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Sr(e)}function mj(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var d=tv((u[Bt]||null).action),g=i.submitter;g&&(t=(t=g[Bt]||null)?tv(t.formAction):g.getAttribute("formAction"),t!==null&&(d=t,g=null));var w=new Ar("action","action",null,i,u);e.push({event:w,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Is!==0){var O=new FormData(u,g);_u(s,{pending:!0,data:O,method:u.method,action:d},null,O)}}else typeof d=="function"&&(w.preventDefault(),O=new FormData(u,g),_u(s,{pending:!0,data:O,method:u.method,action:d},d,O))},currentTarget:u}]})}}for(var Td=0;Td<Pc.length;Td++){var Cd=Pc[Td],pj=Cd.toLowerCase(),gj=Cd[0].toUpperCase()+Cd.slice(1);An(pj,"on"+gj)}An(Cm,"onAnimationEnd"),An(Em,"onAnimationIteration"),An(Am,"onAnimationStart"),An("dblclick","onDoubleClick"),An("focusin","onFocus"),An("focusout","onBlur"),An(Sk,"onTransitionRun"),An(Tk,"onTransitionStart"),An(Ck,"onTransitionCancel"),An(Mm,"onTransitionEnd"),Il("onMouseEnter",["mouseout","mouseover"]),Il("onMouseLeave",["mouseout","mouseover"]),Il("onPointerEnter",["pointerout","pointerover"]),Il("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 Ai="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(" "),vj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ai));function nv(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 g=i.length-1;0<=g;g--){var w=i[g],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(Y){Or(Y)}u.currentTarget=null,d=O}else for(g=0;g<i.length;g++){if(w=i[g],O=w.instance,B=w.currentTarget,w=w.listener,O!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=B;try{d(u)}catch(Y){Or(Y)}u.currentTarget=null,d=O}}}}function De(e,t){var s=t[qh];s===void 0&&(s=t[qh]=new Set);var i=e+"__bubble";s.has(i)||(sv(t,e,2,!1),s.add(i))}function Ed(e,t,s){var i=0;t&&(i|=4),sv(s,e,i,t)}var zo="_reactListening"+Math.random().toString(36).slice(2);function Ad(e){if(!e[zo]){e[zo]=!0,Gh.forEach(function(s){s!=="selectionchange"&&(vj.has(s)||Ed(s,!1,e),Ed(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zo]||(t[zo]=!0,Ed("selectionchange",!1,t))}}function sv(e,t,s,i){switch(Vv(t)){case 2:var u=c1;break;case 8:u=u1;break;default:u=Qd}s=u.bind(null,t,s,e),u=void 0,!Uc||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 Md(e,t,s,i,u){var d=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var g=i.tag;if(g===3||g===4){var w=i.stateNode.containerInfo;if(w===u)break;if(g===4)for(g=i.return;g!==null;){var O=g.tag;if((O===3||O===4)&&g.stateNode.containerInfo===u)return;g=g.return}for(;w!==null;){if(g=tl(w),g===null)return;if(O=g.tag,O===5||O===6||O===26||O===27){i=d=g;continue e}w=w.parentNode}}i=i.return}sm(function(){var B=d,Y=Dc(s),Q=[];e:{var L=zm.get(e);if(L!==void 0){var I=Ar,ie=e;switch(e){case"keypress":if(Cr(s)===0)break e;case"keydown":case"keyup":I=tk;break;case"focusin":ie="focus",I=qc;break;case"focusout":ie="blur",I=qc;break;case"beforeblur":case"afterblur":I=qc;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=im;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":I=Yy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":I=ik;break;case Cm:case Em:case Am:I=Vy;break;case Mm:I=ok;break;case"scroll":case"scrollend":I=qy;break;case"wheel":I=uk;break;case"copy":case"cut":case"paste":I=Zy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":I=om;break;case"submit":I=lk;break;case"toggle":case"beforetoggle":I=fk}var pe=(t&4)!==0,Ce=!pe&&(e==="scroll"||e==="scrollend"),H=pe?L!==null?L+"Capture":null:L;pe=[];for(var R=B,q;R!==null;){var Z=R;if(q=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||q===null||H===null||(Z=Pa(R,H),Z!=null&&pe.push(Mi(R,Z,q))),Ce)break;R=R.return}0<pe.length&&(L=new I(L,ie,null,s,Y),Q.push({event:L,listeners:pe}))}}if((t&7)===0){e:{if(I=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",I&&s!==Rc&&(ie=s.relatedTarget||s.fromElement)&&(tl(ie)||ie[Hl]))break e;(L||I)&&(ie=Y.window===Y?Y:(I=Y.ownerDocument)?I.defaultView||I.parentWindow:window,L?(I=s.relatedTarget||s.toElement,L=B,I=I?tl(I):null,I!==null&&(Ce=f(I),pe=I.tag,I!==Ce||pe!==5&&pe!==27&&pe!==6)&&(I=null)):(L=null,I=B),L!==I&&(pe=im,Z="onMouseLeave",H="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(pe=om,Z="onPointerLeave",H="onPointerEnter",R="pointer"),Ce=L==null?ie:Ja(L),q=I==null?ie:Ja(I),ie=new pe(Z,R+"leave",L,s,Y),ie.target=Ce,ie.relatedTarget=q,Z=null,tl(Y)===B&&(pe=new pe(H,R+"enter",I,s,Y),pe.target=q,pe.relatedTarget=Ce,Z=pe),Ce=Z,pe=L&&I?E(L,I,xj):null,L!==null&&lv(Q,ie,L,pe,!1),I!==null&&Ce!==null&&lv(Q,Ce,I,pe,!0)))}e:{if(L=B?Ja(B):window,I=L.nodeName&&L.nodeName.toLowerCase(),I==="select"||I==="input"&&L.type==="file")var fe=gm;else if(mm(L))if(vm)fe=jk;else{fe=yk;var Ue=bk}else I=L.nodeName,!I||I.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?B&&_c(B.elementType)&&(fe=gm):fe=kk;if(fe&&(fe=fe(e,B))){pm(Q,fe,s,Y);break e}Ue&&Ue(e,L,B)}switch(Ue=B?Ja(B):window,e){case"focusin":(mm(Ue)||Ue.contentEditable==="true")&&(Zl=Ue,Zc=B,ai=null);break;case"focusout":ai=Zc=Zl=null;break;case"mousedown":Qc=!0;break;case"contextmenu":case"mouseup":case"dragend":Qc=!1,Sm(Q,s,Y);break;case"selectionchange":if(Nk)break;case"keydown":case"keyup":Sm(Q,s,Y)}var ye;if(Yc)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Xl?fm(e,s)&&(ke="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(ke="onCompositionStart");ke&&(cm&&s.locale!=="ko"&&(Xl||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Xl&&(ye=lm()):(ws=Y,Lc="value"in ws?ws.value:ws.textContent,Xl=!0)),Ue=Oo(B,ke),0<Ue.length&&(ke=new rm(ke,e,null,s,Y),Q.push({event:ke,listeners:Ue}),ye?ke.data=ye:(ye=hm(s),ye!==null&&(ke.data=ye)))),(ye=mk?pk(e,s):gk(e,s))&&(ke=Oo(B,"onBeforeInput"),0<ke.length&&(Ue=new rm("onBeforeInput","beforeinput",null,s,Y),Q.push({event:Ue,listeners:ke}),Ue.data=ye)),mj(Q,e,B,s,Y)}nv(Q,t)})}function Mi(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Oo(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=Pa(e,s),u!=null&&i.unshift(Mi(e,u,d)),u=Pa(e,t),u!=null&&i.push(Mi(e,u,d))),e.tag===3)return i;e=e.return}return[]}function xj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function lv(e,t,s,i,u){for(var d=t._reactName,g=[];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=Pa(s,d),B!=null&&g.unshift(Mi(s,B,O))):u||(B=Pa(s,d),B!=null&&g.push(Mi(s,B,O)))),s=s.return}g.length!==0&&e.push({event:t,listeners:g})}var bj=/\r\n?/g,yj=/\u0000|\uFFFD/g;function av(e){return(typeof e=="string"?e:""+e).replace(bj,`
50
+ `).replace(yj,"")}function iv(e,t){return t=av(t),av(e)===t}function Xe(e,t,s,i,u,d){switch(s){case"children":if(typeof i=="string")t==="body"||t==="textarea"&&i===""||Gl(e,i);else if(typeof i=="number"||typeof i=="bigint")t!=="body"&&Gl(e,""+i);else return;break;case"className":Nr(e,"class",i);break;case"tabIndex":Nr(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Nr(e,s,i);break;case"style":tm(e,i,d);return;case"data":if(t!=="object"){Nr(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=Sr(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=Sr(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=Sr(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),wr(e,"popover",i);break;case"xlinkActuate":ns(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ns(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ns(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ns(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ns(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ns(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ns(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ns(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ns(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":wr(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=Hy.get(s)||s,wr(e,s,i);else return}qe=!0}function zd(e,t,s,i,u,d){switch(s){case"style":tm(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")Gl(e,i);else if(typeof i=="number"||typeof i=="bigint")Gl(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(!Kh.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,""):wr(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 g=s[d];if(g!=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,g,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=g=u=null,O=null,B=null;for(i in s)if(s.hasOwnProperty(i)){var Y=s[i];if(Y!=null)switch(i){case"name":u=Y;break;case"type":g=Y;break;case"checked":O=Y;break;case"defaultChecked":B=Y;break;case"value":d=Y;break;case"defaultValue":w=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Xe(e,t,i,Y,s,null)}}Ph(e,d,w,O,B,g,u,!1);return;case"select":De("invalid",e),i=g=d=null;for(u in s)if(s.hasOwnProperty(u)&&(w=s[u],w!=null))switch(u){case"value":d=w;break;case"defaultValue":g=w;break;case"multiple":i=w;default:Xe(e,t,u,w,s,null)}t=d,s=g,e.multiple=!!i,t!=null?Yl(e,!!i,t,!1):s!=null&&Yl(e,!!i,s,!0);return;case"textarea":De("invalid",e),d=u=i=null;for(g in s)if(s.hasOwnProperty(g)&&(w=s[g],w!=null))switch(g){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,g,w,s,null)}Wh(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<Ai.length;i++)De(Ai[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(_c(t)){for(Y in s)s.hasOwnProperty(Y)&&(i=s[Y],i!==void 0&&zd(e,t,Y,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 kj={};function jj(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,g=null,w=null,O=null,B=null,Y=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 L in i){var I=i[L];if(Q=s[L],i.hasOwnProperty(L)&&(I!=null||Q!=null))switch(L){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),Y=I;break;case"value":I!==Q&&(qe=!0),g=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,L,I,i,Q)}}zc(e,g,w,O,B,Y,d,u);return;case"select":I=g=w=L=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),L=d;break;case"defaultValue":d!==O&&(qe=!0),w=d;break;case"multiple":d!==O&&(qe=!0),g=d;default:d!==O&&Xe(e,t,u,d,i,O)}t=w,s=g,i=I,L!=null?Yl(e,!!s,L,!1):!!i!=!!s&&(t!=null?Yl(e,!!s,t,!0):Yl(e,!!s,s?[]:"",!1));return;case"textarea":I=L=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(g in i)if(u=i[g],d=s[g],i.hasOwnProperty(g)&&(u!=null||d!=null))switch(g){case"value":u!==d&&(qe=!0),L=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,g,u,i,d)}Fh(e,L,I);return;case"option":for(var ie in s)if(L=s[ie],s.hasOwnProperty(ie)&&L!=null&&!i.hasOwnProperty(ie))switch(ie){case"selected":e.selected=!1;break;default:Xe(e,t,ie,null,i,L)}for(O in i)if(L=i[O],I=s[O],i.hasOwnProperty(O)&&L!==I&&(L!=null||I!=null))switch(O){case"selected":L!==I&&(qe=!0),e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:Xe(e,t,O,L,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 pe in s)L=s[pe],s.hasOwnProperty(pe)&&L!=null&&!i.hasOwnProperty(pe)&&Xe(e,t,pe,null,i,L);for(B in i)if(L=i[B],I=s[B],i.hasOwnProperty(B)&&L!==I&&(L!=null||I!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(o(137,t));break;default:Xe(e,t,B,L,i,I)}return;default:if(_c(t)){for(var Ce in s)L=s[Ce],s.hasOwnProperty(Ce)&&L!==void 0&&!i.hasOwnProperty(Ce)&&zd(e,t,Ce,void 0,i,L);for(Y in i)L=i[Y],I=s[Y],!i.hasOwnProperty(Y)||L===I||L===void 0&&I===void 0||zd(e,t,Y,L,i,I);return}}for(var H in s)L=s[H],s.hasOwnProperty(H)&&L!=null&&!i.hasOwnProperty(H)&&Xe(e,t,H,null,i,L);for(Q in i)L=i[Q],I=s[Q],!i.hasOwnProperty(Q)||L===I||L==null&&I==null||Xe(e,t,Q,L,i,I)}function rv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wj(){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,g=u.initiatorType,w=u.duration;if(d&&w&&rv(g)){for(g=0,w=u.responseEnd,i+=1;i<s.length;i++){var O=s[i],B=O.startTime;if(B>w)break;var Y=O.transferSize,Q=O.initiatorType;Y&&rv(Q)&&(O=O.responseEnd,g+=Y*(O<w?1:(w-B)/(O-B)))}if(--i,t+=8*(d+g)/(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 Od=null,_d=null;function zi(e){return e.nodeType===9?e:e.ownerDocument}function ov(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 cv(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 uv(e,t,s,i){return s=zi(s).createElement(e),s[yt]=i,s[Bt]=t,St(s,e,t),pt(s),s}function Rd(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 Dd=null;function Nj(){var e=window.event;return e&&e.type==="popstate"?e===Dd?!1:(Dd=e,!0):(Dd=null,!1)}var $d=typeof setTimeout=="function"?setTimeout:void 0,Sj=typeof clearTimeout=="function"?clearTimeout:void 0,dv=typeof Promise=="function"?Promise:void 0,fv=typeof requestAnimationFrame=="function"?requestAnimationFrame:$d,Tj=typeof queueMicrotask=="function"?queueMicrotask:typeof dv<"u"?function(e){return dv.resolve(null).then(e).catch(Cj)}:$d;function Cj(e){setTimeout(function(){throw e})}function Ys(e){return e==="head"}function hv(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),Ca(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")Gd(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Gd(s);for(var d=s.firstChild;d;){var g=d.nextSibling,w=d.nodeName;d[Qa]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||s.removeChild(d),d=g}}else s==="body"&&Gd(e.ownerDocument.body);s=u}while(s);Ca(t)}function mv(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 pv(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 gv(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 Ej(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 Ud(e){var t=e.getBoundingClientRect(),s=getComputedStyle(e);return Ej(t,s,e)}function Aj(e){return e.documentElement.clientHeight}function Mj(e){this.addEventListener("load",e),this.addEventListener("error",e)}function zj(e,t,s,i,u,d,g,w,O){var B=t.nodeType===9?t:t.ownerDocument;try{var Y=B.startViewTransition({update:function(){var L=B.defaultView,I=L.navigation&&L.navigation.transition,ie=B.fonts.status;i();var pe=[];if(ie==="loaded"&&(Aj(B),B.fonts.status==="loading"&&pe.push(B.fonts.ready)),ie=pe.length,e!==null)for(var Ce=e.suspenseyImages,H=0,R=0;R<Ce.length;R++){var q=Ce[R];if(!q.complete){var Z=q.getBoundingClientRect();if(0<Z.bottom&&0<Z.right&&Z.top<L.innerHeight&&Z.left<L.innerWidth){if(H+=Uv(q),H>Do){pe.length=ie;break}q=new Promise(Mj.bind(q)),pe.push(q)}}}if(0<pe.length)return L=Promise.race([Promise.all(pe),new Promise(function(fe){return setTimeout(fe,500)})]).then(u,u),(I?Promise.allSettled([I.finished,L]):L).then(d,d);if(u(),I)return I.finished.then(d,d);d()},types:s});B.__reactViewTransition=Y;var Q=[];return Y.ready.then(function(){for(var L=B.documentElement.getAnimations({subtree:!0}),I=0;I<L.length;I++){var ie=L[I],pe=ie.effect,Ce=pe.pseudoElement;if(Ce!=null&&Ce.startsWith("::view-transition")){Q.push(ie),ie=pe.getKeyframes();for(var H=Ce=void 0,R=!0,q=0;q<ie.length;q++){var Z=ie[q],fe=Z.width;if(Ce===void 0)Ce=fe;else if(Ce!==fe){R=!1;break}if(fe=Z.height,H===void 0)H=fe;else if(H!==fe){R=!1;break}delete Z.width,delete Z.height,Z.transform==="none"&&delete Z.transform}R&&Ce!==void 0&&H!==void 0&&(pe.setKeyframes(ie),R=getComputedStyle(pe.target,pe.pseudoElement),R.width!==Ce||R.height!==H)&&(R=ie[0],R.width=Ce,R.height=H,R=ie[ie.length-1],R.width=Ce,R.height=H,pe.setKeyframes(ie))}}g()},function(L){B.__reactViewTransition===Y&&(B.__reactViewTransition=null);try{if(typeof L=="object"&&L!==null)switch(L.name){case"InvalidStateError":(L.message==="View transition was skipped because document visibility state is hidden."||L.message==="Skipping view transition because document visibility state has become hidden."||L.message==="Skipping view transition because viewport size changed."||L.message==="Transition was aborted because of invalid state")&&(L=null)}L!==null&&O(L)}finally{i(),u(),g()}}),Y.finished.finally(function(){for(var L=0;L<Q.length;L++)Q[L].cancel();B.__reactViewTransition===Y&&(B.__reactViewTransition=null),w()}),Y}catch{return i(),u(),g(),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}:_({},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 vv(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(bv(d,e,t,s)===-1){var g=this,w=t;s!=null&&typeof s!="boolean"&&s.once===!0&&(w=function(O){g.removeEventListener(e,t,s),typeof t=="function"?t.call(this,O):t.handleEvent(O)}),i!==null&&(u=g.removeEventListener.bind(g,e,t,s),i.addEventListener("abort",u,{once:!0}),u=i.removeEventListener.bind(i,"abort",u)),i=ka(s),d.push({type:e,listener:t,optionsOrUseCapture:s,attachedListener:w,cleanup:u}),b(this._fragmentFiber.child,!1,Oj,e,w,i)}this._eventListeners=d}};function Oj(e,t,s,i){return M(e).addEventListener(t,s,i),!1}an.prototype.removeEventListener=function(e,t,s){var i=this._eventListeners;if(i!==null&&(t=bv(i,e,t,s),t!==-1)){var u=i[t];s=u.attachedListener;var d=u.cleanup;u=ka(u.optionsOrUseCapture),b(this._fragmentFiber.child,!1,_j,e,s,u),i.splice(t,1),d!==null&&d()}};function _j(e,t,s,i){return M(e).removeEventListener(t,s,i),!1}function ka(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function xv(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function bv(e,t,s,i){if(e.length===0)return-1;i=xv(i);for(var u=0;u<e.length;u++){var d=e[u];if(d.type===t&&d.listener===s&&xv(d.optionsOrUseCapture)===i)return u}return-1}an.prototype.dispatchEvent=function(e){var t=j(this._fragmentFiber);if(t===null)return!0;t=M(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,ka(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,ka(d.optionsOrUseCapture));return t.removeChild(i),e}return t.dispatchEvent(e)},an.prototype.focus=function(e){b(this._fragmentFiber.child,!0,yv,e,void 0,void 0)};function yv(e,t){return e.tag===6?!1:(e=M(e),Kj(e,t))}an.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,Ld,t,void 0,void 0);for(var s=t.length-1;0<=s&&!yv(t[s],e);s--);};function Ld(e,t){return t.push(e),!1}an.prototype.blur=function(){var e=j(this._fragmentFiber);e!==null&&(e=M(e),e=zi(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Rj,e,void 0,void 0))};function Rj(e,t){return e.tag===6?!1:(e=M(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,Dj,e,void 0,void 0)};function Dj(e,t){return e.tag===6||(e=M(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,$j,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 $j(e,t){return e.tag===6||(e=M(e),t.unobserve(e)),!1}var Rn=[],Hd=!1;function Uj(e,t,s){Rn.push({fragmentInstance:e,observer:t,instance:s}),Hd||(Hd=!0,Vj(function(){Hd=!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,Lj,e,void 0,void 0),e};function Lj(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=M(e),t.push.apply(t,e.getClientRects());return!1}an.prototype.getRootNode=function(e){var t=j(this._fragmentFiber);return t===null?this:M(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,Ld,s,void 0,void 0);var i=M(t);if(s.length===0){if(s=i,T(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=M(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=M(s[0]),u=M(s[s.length-1]);var d=T(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 g=t.compareDocumentPosition(e),w=u.compareDocumentPosition(e),O=g&Node.DOCUMENT_POSITION_CONTAINED_BY||w&Node.DOCUMENT_POSITION_CONTAINED_BY;return w=i&&d&&g&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:g,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Hj(t,this._fragmentFiber,s[0],s[s.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Hj(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=E(s,d,N),t===null?t=!1:(b(t,!0,$,d,s),d=A,A=null,t=d!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!d)&&!(t=d===i)&&(t=E(i,d,N),t===null?t=!1:(b(t,!0,k,d,i),d=A,U=A=null,t=d!==null)),t):!1}function kv(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,Ld,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=M(i),kv(e,s);return}if(i=M(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=M(u),kv(u,s)):M(u).scrollIntoView(e),i+=s?-1:1}};function Bj(e,t){return e=M(e),jv(e,t),!1}function jv(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function wv(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,ka(u.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(d){for(var g=0,w=0;w<Rn.length;w++){var O=Rn[w];(O.fragmentInstance!==t||O.observer!==d||O.instance!==e)&&(Rn[g++]=O)}Rn.length=g,d.observe(e)}),jv(e,t))}function qj(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,ka(u.optionsOrUseCapture))}e.nodeType!==3&&(s=t._observers,s!==null&&s.forEach(function(d){typeof d.rootMargin=="string"?Uj(t,d,e):d.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Bd(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":Bd(s),jr(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Ij(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[Qa])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 Yj(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 Nv(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 qd(e){return e.data==="$?"||e.data==="$~"}function Id(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Gj(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 Yd=null;function Sv(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 Tv(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 Kj(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 Vj(e){fv(function(){fv(function(t){return e(t)})})}function Cv(e,t,s){switch(t=zi(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 Ev(e,t,s){for(var i in s){var u=s[i];s.hasOwnProperty(i)&&u!=null&&Xe(e,t,i,null,kj,u)}s.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Bn&&(e.onclick=null),jr(e)}function Gd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);jr(e)}var bn=new Map,Av=new Set;function Oi(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 ps=xe.d;xe.d={f:Xj,r:Zj,D:Qj,C:Jj,L:Pj,m:Fj,X:e1,S:Wj,M:t1};function Xj(){var e=ps.f(),t=To();return e||t}function Zj(e){var t=Bl(e);t!==null&&t.tag===5&&t.type==="form"?zp(t):ps.r(e)}var ja=typeof document>"u"?null:document;function Mv(e,t,s){var i=ja;if(i&&typeof t=="string"&&t){var u=dn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),Av.has(u)||(Av.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 Qj(e){ps.D(e),Mv("dns-prefetch",e,null)}function Jj(e,t){ps.C(e,t),Mv("preconnect",e,t)}function Pj(e,t,s){ps.L(e,t,s);var i=ja;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=wa(e);break;case"script":d=Na(e)}if(!(bn.has(d)||(e=_({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(_i(d))||t==="script"&&i.querySelector(Ri(d))))){var g=i.createElement("link");St(g,"link",e),t==="style"&&(g[kr]=!0,g.onload=g.onerror=function(){Yh(g)}),pt(g),i.head.appendChild(g)}}}function Fj(e,t){ps.m(e,t);var s=ja;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=Na(e)}if(!bn.has(d)&&(e=_({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(Ri(d)))return}i=s.createElement("link"),St(i,"link",e),pt(i),s.head.appendChild(i)}}}function Wj(e,t,s){ps.S(e,t,s);var i=ja;if(i&&e){var u=ql(i).hoistableStyles,d=wa(e);t=t||"default";var g=u.get(d);if(!g){var w={loading:0,preload:null};if(g=i.querySelector(_i(d)))w.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":t},s),(s=bn.get(d))&&Kd(e,s);var O=g=i.createElement("link");pt(O),St(O,"link",e),O._p=new Promise(function(B,Y){O.onload=B,O.onerror=Y}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,_o(g,t,i)}g={type:"stylesheet",instance:g,count:1,state:w},u.set(d,g)}}}function e1(e,t){ps.X(e,t);var s=ja;if(s&&e){var i=ql(s).hoistableScripts,u=Na(e),d=i.get(u);d||(d=s.querySelector(Ri(u)),d||(e=_({src:e,async:!0},t),(t=bn.get(u))&&Vd(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 t1(e,t){ps.M(e,t);var s=ja;if(s&&e){var i=ql(s).hoistableScripts,u=Na(e),d=i.get(u);d||(d=s.querySelector(Ri(u)),d||(e=_({src:e,async:!0,type:"module"},t),(t=bn.get(u))&&Vd(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 zv(e,t,s,i){var u=(u=En.current)?Oi(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=wa(s.href),t=ql(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=wa(s.href);var d=ql(u).hoistableStyles,g=d.get(e);if(g||(u=u.ownerDocument||u,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,g),(d=u.querySelector(_i(e)))?d._p||(g.instance=d,g.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)),n1(u,e,d,g.state))),t&&i===null)throw Error(o(528,""));return g}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=Na(s),t=ql(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 wa(e){return'href="'+dn(e)+'"'}function _i(e){return'link[rel="stylesheet"]['+e+"]"}function Ov(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function n1(e,t,s,i){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[kr]!==!0){i.loading=1;return}}else t=e.createElement("link"),t[kr]=!0,t.onload=t.onerror=Yh.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 Na(e){return'[src="'+dn(e)+'"]'}function Ri(e){return"script[async]"+e}function _v(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=_({},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=wa(s.href);var d=e.querySelector(_i(u));if(d)return t.state.loading|=4,t.instance=d,pt(d),d;i=Ov(s),(u=bn.get(u))&&Kd(i,u),d=(e.ownerDocument||e).createElement("link"),pt(d);var g=d;return g._p=new Promise(function(w,O){g.onload=w,g.onerror=O}),St(d,"link",i),t.state.loading|=4,_o(d,s.precedence,e),t.instance=d;case"script":return d=Na(s.src),(u=e.querySelector(Ri(d)))?(t.instance=u,pt(u),u):(i=s,(u=bn.get(d))&&(i=_({},s),Vd(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,g=0;g<i.length;g++){var w=i[g];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 Kd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Vd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ro=null;function Rv(e,t,s){if(Ro===null){var i=new Map,u=Ro=new Map;u.set(s,i)}else u=Ro,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[Qa]||d[yt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var g=d.getAttribute(t)||"";g=e+g;var w=i.get(g);w?w.push(d):i.set(g,[d])}}return i}function Xd(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function s1(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 Dv(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function $v(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Uv(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Lv(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Uv(t),e.suspenseyImages.push(t)),e=i1.bind(e),t.decode().then(e,e))}function l1(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=wa(i.href),d=t.querySelector(_i(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Di.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=d,pt(d);return}d=t.ownerDocument||t,i=Ov(i),(u=bn.get(u))&&Kd(i,u),d=d.createElement("link"),pt(d);var g=d;g._p=new Promise(function(w,O){g.onload=w,g.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=Di.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var Do=0;function a1(e,t){return e.stylesheets&&e.count===0&&Uo(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&Uo(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Do===0&&(Do=62500*wj());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Uo(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Do?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Hv(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Uo(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Di(){this.count--,Hv(this)}function i1(){this.imgCount--,Hv(this)}var $o=null;function Uo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$o=new Map,t.forEach(r1,e),$o=null,Di.call(e))}function r1(e,t){if(!(t.state.loading&4)){var s=$o.get(e);if(s)var i=s.get(null);else{s=new Map,$o.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var g=u[d];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(s.set(g.dataset.precedence,g),i=g)}i&&s.set(null,i)}u=t.instance,g=u.getAttribute("data-precedence"),d=s.get(g)||i,d===i&&s.set(null,u),s.set(g,u),this.count++,i=Di.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 Sa={$$typeof:_e,Provider:null,Consumer:null,_currentValue:st,_currentValue2:st,_threadCount:0};function o1(e,t,s,i,u,d,g,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=Cc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cc(0),this.hiddenUpdates=Cc(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.transitionTypes=null,this.incompleteTransitions=new Map}function Bv(e,t,s,i,u,d,g,w,O,B,Y,Q){return e=new o1(e,t,s,g,O,B,Y,Q,w),t=1,d===!0&&(t|=24),d=qt(3,null,null,t),e.current=d,d.stateNode=e,t=ou(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:i,isDehydrated:s,cache:t},fu(d),e}function qv(e){return e?(e=Pl,e):Pl}function Iv(e,t,s,i,u,d){u=qv(u),i.context===null?i.context=u:i.pendingContext=u,i=zs(t),i.payload={element:s},d=d===void 0?null:d,d!==null&&(i.callback=d),s=Os(e,i,t),s!==null&&(Kt(s,e,t),fi(s,e,t))}function Yv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function Zd(e,t){Yv(e,t),(e=e.alternate)&&Yv(e,t)}function Gv(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&Kt(t,e,67108864),Zd(e,67108864)}}function Kv(e){if(e.tag===13||e.tag===31){var t=ln();t=Ec(t);var s=al(e,t);s!==null&&Kt(s,e,t),Zd(e,t)}}var Ta=!0;function c1(e,t,s,i){var u=ce.T;ce.T=null;var d=xe.p;try{xe.p=2,Qd(e,t,s,i)}finally{xe.p=d,ce.T=u}}function u1(e,t,s,i){var u=ce.T;ce.T=null;var d=xe.p;try{xe.p=8,Qd(e,t,s,i)}finally{xe.p=d,ce.T=u}}function Qd(e,t,s,i){if(Ta){var u=Jd(i);if(u===null)Md(e,t,i,Lo,s),Xv(e,i);else if(f1(u,e,t,s,i))i.stopPropagation();else if(Xv(e,i),t&4&&-1<d1.indexOf(e)){for(;u!==null;){var d=Bl(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var g=el(d.pendingLanes);if(g!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;g;){var O=1<<31-Pt(g);w.entanglements[1]|=O,g&=~O}Jn(d),(Ie&6)===0&&(wo=Qt()+500,Ei(0))}}break;case 31:case 13:w=al(d,2),w!==null&&Kt(w,d,2),To(),Zd(d,2)}if(d=Jd(i),d===null&&Md(e,t,i,Lo,s),d===u)break;u=d}u!==null&&i.stopPropagation()}else Md(e,t,i,null,s)}}function Jd(e){return e=Dc(e),Pd(e)}var Lo=null;function Pd(e){if(Lo=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 Lo=e,null}function Vv(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(wy()){case zh:return 2;case Oh:return 8;case gr:case Ny:return 32;case _h:return 268435456;default:return 32}default:return 32}}var Fd=!1,Gs=null,Ks=null,Vs=null,$i=new Map,Ui=new Map,Xs=[],d1="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 Xv(e,t){switch(e){case"focusin":case"focusout":Gs=null;break;case"dragenter":case"dragleave":Ks=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":$i.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ui.delete(t.pointerId)}}function Li(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=Bl(t),t!==null&&Gv(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function f1(e,t,s,i,u){switch(t){case"focusin":return Gs=Li(Gs,e,t,s,i,u),!0;case"dragenter":return Ks=Li(Ks,e,t,s,i,u),!0;case"mouseover":return Vs=Li(Vs,e,t,s,i,u),!0;case"pointerover":var d=u.pointerId;return $i.set(d,Li($i.get(d)||null,e,t,s,i,u)),!0;case"gotpointercapture":return d=u.pointerId,Ui.set(d,Li(Ui.get(d)||null,e,t,s,i,u)),!0}return!1}function Zv(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,Bh(e.priority,function(){Kv(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,Bh(e.priority,function(){Kv(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 Ho(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=Jd(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);Rc=i,s.target.dispatchEvent(i),Rc=null}else return t=Bl(s),t!==null&&Gv(t),e.blockedOn=s,!1;t.shift()}return!0}function Qv(e,t,s){Ho(e)&&s.delete(t)}function h1(){Fd=!1,Gs!==null&&Ho(Gs)&&(Gs=null),Ks!==null&&Ho(Ks)&&(Ks=null),Vs!==null&&Ho(Vs)&&(Vs=null),$i.forEach(Qv),Ui.forEach(Qv)}function Bo(e,t){e.blockedOn===t&&(e.blockedOn=null,Fd||(Fd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,h1)))}var qo=null;function Jv(e){qo!==e&&(qo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){qo===e&&(qo=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(Pd(i||s)===null)continue;break}var d=Bl(s);d!==null&&(e.splice(t,3),t-=3,_u(d,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function Ca(e){function t(O){return Bo(O,e)}Gs!==null&&Bo(Gs,e),Ks!==null&&Bo(Ks,e),Vs!==null&&Bo(Vs,e),$i.forEach(t),Ui.forEach(t);for(var s=0;s<Xs.length;s++){var i=Xs[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Xs.length&&(s=Xs[0],s.blockedOn===null);)Zv(s),s.blockedOn===null&&Xs.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],g=u[Bt]||null;if(typeof d=="function")g||Jv(s);else if(g){var w=null;if(d&&d.hasAttribute("formAction")){if(u=d,g=d[Bt]||null)w=g.formAction;else if(Pd(u)!==null)continue}else w=g.action;typeof w=="function"?s[i+1]=w:(s.splice(i,3),i-=3),Jv(s)}}}function Pv(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(g){return u=g})},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 Wd(e){this._internalRoot=e}Io.prototype.render=Wd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var s=t.current,i=ln();Iv(s,i,e,t,null,null)},Io.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Iv(e.current,2,null,e,null,null),To(),t[Hl]=null}};function Io(e){this._internalRoot=e}Io.prototype.unstable_scheduleHydration=function(e){if(e){var t=Hh();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Xs.length&&t!==0&&t<Xs[s].priority;s++);Xs.splice(s,0,e),s===0&&Zv(e)}};var Fv=a.version;if(Fv!=="19.3.1")throw Error(o(527,Fv,"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=x(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var m1={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:ce,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{Va=Yo.inject(m1),Jt=Yo}catch{}}return Bi.createRoot=function(e,t){if(!c(e))throw Error(o(299));var s=!1,i="",u=qp,d=Ip,g=Yp;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&&(g=t.onRecoverableError)),t=Bv(e,1,!1,null,null,s,i,null,u,d,g,Pv),e[Hl]=t.current,Ad(e),new Wd(t)},Bi.hydrateRoot=function(e,t,s){if(!c(e))throw Error(o(299));var i=!1,u="",d=qp,g=Ip,w=Yp,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&&(g=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError),s.formState!==void 0&&(O=s.formState)),t=Bv(e,1,!0,t,s??null,i,u,O,d,g,w,Pv),t.context=qv(null),s=t.current,i=ln(),i=Ec(i),u=zs(i),u.callback=null,Os(s,u,i),s=i,t.current.lanes=s,Za(t,s),Jn(t),e[Hl]=t.current,Ad(e),new Io(t)},Bi.version="19.3.1",Bi}var ox;function w1(){if(ox)return tf.exports;ox=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(),tf.exports=j1(),tf.exports}var N1=w1(),y=Xf();const S1=["general","providers","models","memory","image","knowledge","search","skills","mcp","desktop","work","push","about"];function cx(n){try{return n?decodeURIComponent(n):null}catch{return null}}function T1(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 C1(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 E1(n){const[a,r,o,c]=n.replace(/^#\/?/,"").split("/"),f=cx(r);return a==="knowledge"?{sel:null,settings:!1,section:null,knowledge:!0}:a==="chat"&&f?{sel:f,settings:!1,section:null,panel:T1(o,cx(c))}:a==="settings"?{sel:null,settings:!0,section:S1.find(m=>m===f)??null}:{sel:null,settings:!1,section:null}}function A1(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?C1(r):""}`}const M1=["searxng","exa","tavily","brave","serper","jina","firecrawl","perplexity","youcom","ollama"];function $b(){return M1.map(n=>({name:n,enabled:!1}))}class Le extends Error{status;constructor(a,r){super(r),this.status=a}}async function te(n,a){let r;try{r=await fetch(n,{credentials:"same-origin",...a})}catch(c){throw new Le(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 Le(r.status,c)}if(r.status===204)return;const o=await r.text();return o?JSON.parse(o):void 0}function He(n,a="POST"){return{method:a,headers:{"content-type":"application/json"},body:JSON.stringify(n)}}const z1=["assistant","assistant_removed","item","delta","job","delegation","job_step","activity","approval","draft","routine","routine_removed","profile","knowledge","skills"],O1={knowledge:(n={})=>{const a=new URLSearchParams;for(const[r,o]of Object.entries(n))o!==void 0&&o!==""&&a.set(r,String(o));return te(`/api/knowledge?${a}`)},knowledgeEntry:(n,a)=>te(`/api/knowledge/entries/${encodeURIComponent(n)}${a!==void 0?`?chunk=${a}`:""}`),reindexKnowledge:n=>te(`/api/knowledge/collections/${encodeURIComponent(n)}/reindex`,{method:"POST"}),embeddingKey:()=>te("/api/knowledge/embedding"),putEmbedding:(n,a,r)=>te("/api/knowledge/embedding",He({revision:n,embedding:a,...r?{apiKey:r}:{}},"PUT")),embeddingTest:n=>te("/api/knowledge/embedding/test",He(n)),createKnowledgeCollection:n=>te("/api/knowledge/collections",He({name:n})).then(a=>a.collection),renameKnowledgeCollection:(n,a)=>te(`/api/knowledge/collections/${encodeURIComponent(n)}`,He({name:a},"PATCH")).then(r=>r.collection),deleteKnowledgeCollection:n=>te(`/api/knowledge/collections/${encodeURIComponent(n)}`,{method:"DELETE"}),patchKnowledgeEntry:(n,a)=>te(`/api/knowledge/entries/${encodeURIComponent(n)}`,He(a,"PATCH")).then(r=>r.entry),deleteKnowledgeEntry:n=>te(`/api/knowledge/entries/${encodeURIComponent(n)}`,{method:"DELETE"}),uploadKnowledge:(n,a)=>{const r=new FormData;for(const o of a)r.append("files",o);return te(`/api/knowledge/upload?collection=${encodeURIComponent(n)}`,{method:"POST",body:r})},me:()=>te("/api/me"),login:n=>te("/api/login",He({password:n})),logout:()=>te("/api/logout",{method:"POST"}),bootstrap:()=>te("/api/bootstrap"),settings:()=>te("/api/settings"),models:()=>te("/api/models"),putSettings:(n,a)=>te("/api/settings",He({revision:n,patch:a},"PUT")),providers:()=>te("/api/providers"),claude:()=>te("/api/claude"),saveClaude:(n,a)=>te("/api/claude",He({revision:n,claude:a},"PUT")),putProvider:(n,a)=>te(`/api/providers/${encodeURIComponent(n)}`,He(a,"PUT")),putThinking:n=>te("/api/models/thinking",He(n,"PUT")),deleteProvider:n=>te(`/api/providers/${encodeURIComponent(n)}`,{method:"DELETE"}),testProvider:n=>te("/api/providers/test",He(n)),discoverProvider:n=>te("/api/providers/discover",He(n)),providersImport:()=>te("/api/providers/import"),importProviders:n=>te("/api/providers/import",He({ids:n})),assistantSkills:n=>te(`/api/assistants/${encodeURIComponent(n)}/skills`),patchAssistantSkill:(n,a,r)=>te(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:r})}),rollbackAssistantSkill:(n,a)=>te(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}/rollback`,{method:"POST"}),deleteAssistantSkill:(n,a)=>te(`/api/assistants/${encodeURIComponent(n)}/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),sedimentJob:n=>te(`/api/jobs/${encodeURIComponent(n)}/sediment`,{method:"POST"}),skills:()=>te("/api/skills"),skillsImport:n=>te(`/api/skills/import/${n}`),importSkills:(n,a,r)=>te(`/api/skills/import/${n}`,He({ids:a,overwrite:r})),deleteSkill:n=>te(`/api/skills/${encodeURIComponent(n)}`,{method:"DELETE"}),desktop:()=>te("/api/desktop"),saveDesktop:n=>te("/api/desktop",He(n,"PUT")),saveDesktopPublic:(n,a)=>te("/api/desktop/public",He({revision:n,assistants:a},"PUT")),testDesktop:()=>te("/api/desktop/test",He({})),mcp:()=>te("/api/mcp"),putMcp:(n,a)=>te(`/api/mcp/${encodeURIComponent(n)}`,He(a,"PUT")),patchMcp:(n,a)=>te(`/api/mcp/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteMcp:n=>te(`/api/mcp/${encodeURIComponent(n)}`,{method:"DELETE"}),testMcp:(n,a)=>te(`/api/mcp/${encodeURIComponent(n)}/test`,He({refresh:a})),mcpImports:()=>te("/api/mcp/import"),importMcp:n=>te("/api/mcp/import",He({ids:n})),search:()=>te("/api/search"),putSearch:(n,a,r)=>te("/api/search",He({revision:n,providers:a,keys:r},"PUT")),testSearch:(n,a,r)=>te("/api/search/test",He({name:n,baseUrl:a,apiKey:r})),imageKey:()=>te("/api/image"),putImage:(n,a,r)=>te("/api/image",He({revision:n,image:a,...r?{apiKey:r}:{}},"PUT")),imageTest:n=>te("/api/image/test",He(n)),changePassword:(n,a)=>te("/api/password",He({old:n,new:a})),about:()=>te("/api/about"),memory:()=>te("/api/memory"),putMemory:(n,a)=>te("/api/memory",He({revision:n,provider:a},"PUT")),putLore:n=>te("/api/memory/lore",He(n,"PUT")),loreTest:n=>te("/api/memory/lore-test",He(n)),loreImport:()=>te("/api/memory/lore/import"),importLore:()=>te("/api/memory/lore/import",{method:"POST"}),items:(n,a)=>te(`/api/assistants/${encodeURIComponent(n)}/items?limit=60${a?`&before=${encodeURIComponent(a)}`:""}`),profile:n=>te(`/api/assistants/${encodeURIComponent(n)}/profile`),sendMessage:(n,a)=>te(`/api/assistants/${encodeURIComponent(n)}/messages`,He(a)),stopAssistant:n=>te(`/api/assistants/${encodeURIComponent(n)}/stop`,{method:"POST"}),markRead:n=>te(`/api/assistants/${encodeURIComponent(n)}/read`,{method:"POST"}),patchAssistant:(n,a)=>te(`/api/assistants/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),archiveAssistant:n=>te(`/api/assistants/${encodeURIComponent(n)}/archive`,{method:"POST"}),deleteRule:(n,a)=>te(`/api/assistants/${encodeURIComponent(n)}/rules/${encodeURIComponent(a)}`,{method:"DELETE"}),retryDelegation:n=>te(`/api/delegations/${encodeURIComponent(n)}/retry`,{method:"POST"}),answerApproval:(n,a)=>te(`/api/approvals/${encodeURIComponent(n)}`,He(a)),createDraft:n=>te(`/api/drafts/${encodeURIComponent(n)}/create`,{method:"POST"}),dismissDraft:n=>te(`/api/drafts/${encodeURIComponent(n)}/dismiss`,{method:"POST"}),createRoutine:n=>te("/api/routines",He(n)),patchRoutine:(n,a)=>te(`/api/routines/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),deleteRoutine:n=>te(`/api/routines/${encodeURIComponent(n)}`,{method:"DELETE"}),runRoutine:n=>te(`/api/routines/${encodeURIComponent(n)}/run`,{method:"POST"}),replyJob:(n,a)=>te(`/api/jobs/${encodeURIComponent(n)}/reply`,He({text:a})),stopJob:n=>te(`/api/jobs/${encodeURIComponent(n)}/stop`,{method:"POST"}),transcript:n=>te(`/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 te(`/api/jobs${r?`?${r}`:""}`)},upload:async n=>{const a=new FormData;a.append("file",n);const r=await te("/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=>te(`/api/files/meta?path=${encodeURIComponent(n)}`),jobFiles:(n,a)=>te(`/api/jobs/${encodeURIComponent(n)}/files${a?`?path=${encodeURIComponent(a)}`:""}`),push:()=>te("/api/push"),subscribePush:(n,a)=>te("/api/push/subscribe",He({subscription:n,label:a})).then(r=>r.push),unsubscribePush:n=>te("/api/push/subscribe",{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})}),testPush:n=>te("/api/push/test",He(n?{endpoint:n}:{})),visibility:(n,a)=>te("/api/visibility",He({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 z1)c.addEventListener(m,h);return c.onerror=()=>{f=!0,r(c.readyState===EventSource.CLOSED?"实时连接已断开":"实时连接中断,正在重连")},c.onopen=()=>{f&&(f=!1,a())},()=>c.close()}},_1=60;function R1(n,a){return n.at===a.at?0:n.at<a.at?-1:1}function Ub(n,a,r=_1){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(R1),c.length>r?c.slice(-r):c}function D1(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 Lb(n){const a=n[n.length-1];return a?.kind==="assistant"&&!!a.streaming}function $1(n,a){return n.state==="writing"&&!a.seen&&!a.closed&&a.inChat&&n.assistantId===a.assistantId}function U1(n,a){return n.filter(r=>r.assistantId===a&&r.state==="writing")}const L1=900,_a=new Map;function Hb(n){for(const a of n)_a.has(a)||_a.set(a,window.setTimeout(()=>_a.delete(a),L1))}function H1(n){return _a.has(n)}function B1(){for(const n of _a.values())window.clearTimeout(n);_a.clear()}function Bb(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 q1(n,a,r="",o=200){const[c,f]=y.useState([]),[h,m]=y.useState([]),p=y.useRef(null),x=y.useRef(r),v=y.useRef([]),b=y.useRef([]);return y.useEffect(()=>{const T=n.map(a);if(p.current===null||x.current!==r){p.current=new Set(T),x.current=r,v.current=n;return}const S=T.filter(M=>!p.current.has(M)),C=v.current.filter(M=>!T.includes(a(M)));if(p.current=new Set(T),v.current=n,S.length&&(f(M=>[...M,...S]),b.current.push(window.setTimeout(()=>f(M=>M.filter(A=>!S.includes(A))),1e3))),C.length){const M=C.map(A=>({item:A,key:a(A),state:"leave"}));m(A=>[...A,...M]),b.current.push(window.setTimeout(()=>m(A=>A.filter(U=>!M.some($=>$.key===U.key))),o))}},[n,a,r,o]),y.useEffect(()=>{const T=b.current;return()=>{for(const S of T)window.clearTimeout(S)}},[]),[...n.map(T=>{const S=a(T);return{item:T,key:S,state:c.includes(S)?"enter":"still"}}),...h]}function gc(n){return`pending/${n.id}/${n.name}`}function I1(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??gc(a))}:{}}}function Y1(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 G1={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"};function Xi(n){const a=n.lastIndexOf(".");return a===-1?!1:n.slice(a).toLowerCase()in G1}function qi(n){return(n.split("/").pop()??n).replace(/^u-[a-z0-9]{6}-/,"")}function qb(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 Ib(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 lc=["off","minimal","low","medium","high","xhigh","max"],ec={off:"关闭",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},K1=40;function V1(n,a){return a?/gpt/i.test(n)?lc.slice(0,6):[...lc]:["off"]}function X1(n,a){return a==="google-generative-ai"||a==="google-vertex"?"high":n}function Z1(n,a,r,o){if(!a)return{levels:["off"],chars:{},map:{}};const c=V1(n,a),f=[],h={},m={};for(const p of lc){const x=r?.[p];if(!(x!==void 0?x!==null:c.includes(p))){m[p]=null;continue}f.push(p);const b=typeof x=="string"?x.trim():"";h[p]=b,b?m[p]=b:(p==="xhigh"||p==="max")&&(m[p]=X1(p,o))}return{levels:f,chars:h,map:m}}function Q1(n){if(!n||typeof n!="object"||Array.isArray(n))return;const a=n,r={};let o=!1;for(const c of lc){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<=K1?h:""}if(o)return r.off===null&&(r.off=""),r}const Yb={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 F(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 ac(){const n=new URLSearchParams(globalThis.location?.search??"").get("desktop");return n==="ready"||n==="deployed"||n==="failed"?n:"none"}const J1={version:"1.7.0",display:{width:1280,height:800},screens:[{id:"hob",running:!0,browserRunning:!0,viewers:0,lastActiveAt:null}]},P1={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:[]}},F1=[{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 W1(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:F(30,9,0),last:{text:"已交给任务处理,完成后通知你。",at:F(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:F(30,9,0),last:{text:"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。",at:F(0,10,20)},unread:2,busy:!1},{id:"server",name:"服务器",duty:"线上和机器",sprite:"server",primary:!1,pinned:!0,hidden:!1,notify:!0,instructions:"清理日志前先查看保留天数的规则。",createdAt:F(28,9,0),last:{text:"凌晨 3 点清理 2.1GB 旧日志",at:F(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:F(7,9,0),splitFrom:{from:"hob",at:F(7,9,0),conversations:8},last:{text:"今天 6 条,挑选了 2 条重点",at:F(0,9,0)},unread:0,busy:!1},{id:"house",name:"家里 NAS",duty:"相册和备份",sprite:"house",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:F(25,9,0),last:{text:"相册备份完成,新增 312 张",at:F(0,7,30)},unread:0,busy:!1},{id:"coin",name:"记账",duty:"账单和预算",sprite:"coin",primary:!1,pinned:!1,hidden:!1,notify:!1,instructions:"",createdAt:F(24,9,0),last:{text:"10 月账单已整理完成,比上月减少 12%",at:F(1,21,10)},unread:0,busy:!1},{id:"book",name:"读书",duty:"读书笔记",sprite:"book",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:F(20,9,0),last:{text:"本周读书笔记已整理完成",at:F(3,20,0)},unread:0,busy:!1},{id:"leaf",name:"健身",duty:"每周训练",sprite:"leaf",primary:!1,pinned:!1,hidden:!0,notify:!1,instructions:"",createdAt:F(18,9,0),last:{text:"本周三次训练已记录",at:F(2,19,0)},unread:0,busy:!1}],h=(V,ne,ee,Ee,he,we,_e,se,ve)=>({id:V,assistantId:ne,title:ee,detail:Ee,options:he,status:we?"answered":"pending",chosen:we?_e:void 0,source:"router",ruleText:ve,createdAt:se,answeredAt:we?se: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",F(0,7,42),"发公众号"),"ap-split":h("ap-split","hob","是否创建一个专属助手「行业动态」?",a?"这两周你让我查询了 8 次模型和 agent 产品的动态。创建后它会记住你关注的内容,每天早上 9 点提供一份简报。":"这两周你让我查询了 8 次模型和 agent 产品的动态。",[{key:"A",label:"创建专属助手"},{key:"B",label:"暂不创建"}],!o,"A",F(0,10,15))},x={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:F(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(F1)},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:F(1,3,0),startedAt:F(1,3,0),endedAt:F(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:F(1,3,0),verb:"$",text:"du -sh /var/log/*"},{at:F(1,3,1),verb:"读",text:"/var/log/nginx"},{at:F(1,3,3),verb:"跑",text:"find /var/log -mtime +3 -delete"},...Array.from({length:9},(V,ne)=>({at:F(1,3,4),verb:"读",text:`/srv/example/reports/src/check-${ne}.ts`})),{at:F(1,3,5),verb:"说",text:"已清理 2.1GB,服务均正常运行。"}]},T={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:F(20,21,0),runs:[{jobId:"t-0901",at:F(0,8,0),status:"done"}]},{id:"r-weekly-reminder",assistantId:"hob",name:"周报提醒",instruction:"周五下午提醒查看本周周报。",schedules:["0 17 * * 5"],active:!0,createdAt:F(20,21,2),runs:[]},{id:"r-reconcile",assistantId:"hob",name:"月底对账",instruction:"月末核对账单,列出不一致的项目。",schedules:["0 9 28 * *"],active:!1,createdAt:F(19,10,0),runs:[{jobId:"t-0820",at:F(4,9,0),status:"done"}]},{id:"r-daily",skill:"daily-brief",assistantId:"bird",name:"每日简报",instruction:"挑模型发布、agent 产品和开源项目里最值得看的几条,每条一句话说清为什么重要。最多 6 条,不看融资新闻。",schedules:["0 9 * * *"],active:!0,createdAt:F(7,9,0),runs:[{jobId:"t-0926",at:F(0,9,0),status:"done",durationMs:372e3,tools:95,tokens:198e3},{jobId:"t-0925",at:F(1,9,0),status:"done"},{jobId:"t-0924",at:F(2,9,1),status:"done"},{jobId:"t-0923",at:F(3,9,0),status:"done"}]},{id:"r-weekly-draft",assistantId:"page",name:"周报初稿",instruction:"每周五 17:00 撰写周报初稿,存入草稿箱,完成后通知我。",schedules:["0 17 * * 5"],active:!0,createdAt:F(0,10,21),runs:[]}],C=(V,ne,ee,Ee)=>({kind:"assistant",id:V,at:ne,text:ee,routine:Ee}),A=[C("i-h1",F(0,8,0),`早上好。昨晚交代的两件事均已完成:
51
+
52
+ - 写作已将周报初稿存入草稿箱
53
+ - 服务器凌晨 3 点清理了 2.1GB 旧日志`),{kind:"user",id:"i-h3",at:F(0,10,5),text:"页面为什么这么卡?排查一下原因,不要修改代码。"},C("i-h4",F(0,10,5),"已交给任务处理,完成后通知你。"),{kind:"job",id:"i-h5",at:F(0,10,5),jobId:"t-0931"},{kind:"question",id:"i-h6",at:F(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:F(0,10,16),text:"创建专属助手吧。最多 6 条即可,不要包含融资新闻。"},C("i-h8",F(0,10,17),"草稿如下,需要修改请直接说明:"),{kind:"draft",id:"i-h9",at:F(0,10,17),draftId:"d-bird"});const U=r?A.filter(V=>!["i-h2","i-h3","i-h4","i-h5"].includes(V.id)):A,$=[C("i-p1",F(1,17,5),"周报初稿已完成,存放在草稿箱。"),{kind:"user",id:"i-p2",at:F(1,17,6),text:n==="mchat"?"好,周一发布。":"标题再短一些。"},C("i-p3",F(1,17,8),n==="mchat"?"好的,周一发布时我会再提醒你。":"已改为《这周:Hob 立项》。"),C("i-p4",F(0,7,40),"《Grok Bot 能借鉴什么》已完成,3200 字,包含 4 张配图。"),{kind:"file",id:"i-p5",at:F(0,7,41),path:"/srv/example/notes/Grok Bot 能借鉴什么.md",name:"Grok Bot 能借鉴什么.md",meta:"3200 字 · 4 张图"},{kind:"question",id:"i-p6",at:F(0,7,42),approvalId:"ap-publish"}];n!=="mchat"&&$.push({kind:"note",id:"i-p7",at:F(0,7,43),icon:"rule",text:"已记入写作的规则 · 发布公众号无需确认"},C("i-p8",F(0,7,44),"已发布。[查看文章](https://mp.weixin.qq.com/)"),{kind:"user",id:"i-p9",at:F(0,10,20),text:"以后周报也由你负责,周五下午提供初稿。"},C("i-p10",F(0,10,20),"好的。每周五 17:00 撰写初稿,存入草稿箱,完成后通知你。"),{kind:"note",id:"i-p11",at:F(0,10,21),icon:"routine",text:"新增定时任务 · 周报初稿 · 每周五 17:00"});const k=[{kind:"note",id:"i-b0",at:F(7,9,0),icon:"split",text:`${new Date(F(7,9,0)).getMonth()+1}月${new Date(F(7,9,0)).getDate()}日 由 Hob 创建 · 迁移 8 段对话、14 条记忆`},C("i-b1",F(1,9,0),"昨天 5 条,没有特别要紧的。[看全部 5 条](https://example.com/)",{id:"r-daily",name:"每日简报"}),{kind:"job",id:"i-b-job",at:F(0,9,0),jobId:"t-0926"},C("i-b2",F(0,9,0),"今天 6 条,挑选 2 条重点:",{id:"r-daily",name:"每日简报",jobId:"t-0926"}),C("i-b3",F(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:F(0,9,12),text:"这个和 Hob 相比,差异在哪里?",quote:{itemId:"i-b3",text:"xAI 的 Grok Bot:常驻 Bot 加定时任务…"}},C("i-b5",F(0,9,12),"它的 Bot 有一台云电脑,能直接操作网页;Bot 之间也能互相发消息。定时任务、审批、助手创建,我们均已具备。"),{kind:"user",id:"i-b6",at:F(0,9,14),text:"以后不需要包含融资新闻。"},C("i-b7",F(0,9,14),"好的,已记录。"),{kind:"note",id:"i-b8",at:F(0,9,14),icon:"memory",text:"记忆已更新 · 不包含融资新闻,优先关注人工智能产品和模型的重要更新与实际应用"},{kind:"note",id:"i-b8-en",at:F(0,9,14),icon:"memory",text:"记忆已更新 · Follow important AI product and model updates, focusing on practical applications."},{kind:"note",id:"i-b9",at:F(0,9,15),icon:"skill",text:"已沉淀技能「每日行业简报」,以后定时执行按它做",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md"}],N=(V,ne,ee,Ee)=>[C(`${V}-1`,F(1,20,0),ne),{kind:"user",id:`${V}-2`,at:F(1,20,2),text:ee},C(`${V}-3`,F(1,20,3),Ee)],E={hob:U,page:$,bird:k,server:[...N("i-s","凌晨清理日志的任务已完成,清理 2.1GB,服务均正常运行。","好的,以后每月清理一次。","已记录:每月 1 号凌晨 3 点清理一次。"),{kind:"job",id:"i-s4",at:F(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"&&(E.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")&&(E.hob=[{kind:"user",id:"bubble-user",at:ue(3),text:"给我看看公式、代码和媒体。"},C("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。"),C("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 字"},C("bubble-after-file",ue(2),"《火星日落示意图.md》已发给你。直接打开能看 Markdown 源码,用支持 Mermaid 的预览器可以看到光路图。"),{kind:"file",id:"bubble-page",at:ue(2),path:"/mock/sunset.html",name:"如果在地球和火星同时看日落",meta:"两幅同视角示意图:看太阳周围,再看远离太阳的天空。"},C("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:"画个简单的表格给我,有几种方式?"},C("bubble-table",ue(0),`主要有四种:
70
+
71
+ | 方式 | 适合什么情况 | 能不能改 |
72
+ | --- | --- | --- |
73
+ | 聊天里直接画 | 简单的表,看一眼就行 | 让我重画 |
74
+ | 发 Excel 或 CSV 文件 | 要下载、自己改或者算 | 能 |
75
+ | 做成页面 | 能排序、筛选,以后还要更新 | 能 |
76
+ | 做成图片 | 要转发给别人或者发朋友圈 | 不能 |
77
+
78
+ 想要哪种?告诉我放什么内容。`)]);const _={},z={"t-0931":v,"t-rounds":b,"t-0927":j,"t-0929":T,"t-0926":{id:"t-0926",assistantId:"bird",title:"每日简报",instruction:"整理每日简报",status:"done",createdAt:F(0,8,54),startedAt:F(0,8,54),endedAt:F(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")&&(_["dg-sidebar-running"]={id:"dg-sidebar-running",from:"hob",to:"page",text:"整理文章。",createdAt:ue(6),status:"running",jobIds:[]},_["dg-sidebar-waiting"]={id:"dg-sidebar-waiting",from:"hob",to:"server",text:"检查服务器。",createdAt:ue(5),status:"waiting",jobIds:[]},E.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 V=n==="d-waiting"||n==="d-mobile"?"waiting":n==="d-done"?"done":"running",ne={id:"dg-demo",from:"hob",to:"server",text:"检查服务器磁盘和服务状态,清理前先确认,不要影响正在运行的服务。",createdAt:ue(6),status:V,jobIds:["t-delegated"],approvalIds:[]};_[ne.id]=ne,z["t-delegated"]={...v,id:"t-delegated",assistantId:"server",delegationId:ne.id,title:"检查服务器状态",status:V==="waiting"?"waiting":V},V==="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)}),E.hob=[{kind:"user",id:"d-user",at:ue(7),text:"检查一下服务器的磁盘和服务状态。"},{kind:"delegation",id:"d-card",at:ue(6),delegationId:ne.id}],E.server=[{kind:"user",id:"d-forward",at:ue(6),text:ne.text,from:{assistantId:"hob",name:"Hob",delegationId:ne.id}},{kind:"job",id:"d-job",at:ue(5),jobId:"t-delegated"},...V==="waiting"?[{kind:"question",id:"d-question",at:ue(2),approvalId:"ap-delegation"}]:[]]}if(n.startsWith("h-")){const V=f.find(ne=>ne.id==="server");V&&(V.dutyLong="维护服务器、监控服务状态和磁盘空间;代理配置由其他助手负责。"),_["dg-returned"]={id:"dg-returned",from:"hob",to:"server",text:"检查代理节点为什么无法连接。",createdAt:ue(4),status:"returned",reply:"退回:代理配置不属于服务器维护职责。",jobIds:[]},E.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"}],E.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 V=f.find(ne=>ne.id==="hob");V.busy=!0,V.activity=n==="act-think"||n==="act-demo"?{state:"thinking",label:"正在想…"}:{state:"tool",label:"搜索:最新 AI 动态"},E.hob=[{kind:"user",id:"act-user",at:ue(1),text:"帮我搜索最新 AI 动态。"}],n==="act-home"&&(f.find(ne=>ne.id==="page").busy=!0)}return{assistants:f,items:E,jobs:z,delegations:_,approvals:p,drafts:{"d-bird":x},routines:S,assistantSkills:{bird:[{name:"daily-brief",title:"每日行业简报",description:"整理值得关注的行业动态。",path:"/mock/assistants/bird/skills/daily-brief/SKILL.md",version:2,createdAt:F(7,9),updatedAt:F(1,9),uses:3,lastUsedAt:F(0,9),enabled:!0},{name:"release-watch",title:"重要发布追踪",description:"追踪模型和产品的重要发布。",path:"/mock/assistants/bird/skills/release-watch/SKILL.md",version:1,createdAt:F(2,9),updatedAt:F(2,9),uses:0,enabled:!0}]},rules:{hob:[{id:"rule-1",text:"花钱",mode:"ask",changedAt:F(10,9,0)},{id:"rule-2",text:"改线上服务",mode:"ask",changedAt:F(10,9,0)},{id:"rule-3",text:"清理我的文件",mode:"ask",changedAt:F(3,9,0)}],page:[{id:"rule-4",text:"删除草稿",mode:"ask",changedAt:F(9,9,0)},{id:"rule-5",text:"花钱",mode:"ask",changedAt:F(9,9,0)},{id:"rule-6",text:"发公众号",mode:"allow",changedAt:ue(120)}],bird:[{id:"rule-7",text:"花钱订阅",mode:"ask",changedAt:F(7,9,0)}]},worklog:{hob:[{at:F(0,10,5),text:"任务已完成:排查页面卡顿",jobId:"t-0931"},{at:F(0,8,2),text:"转述写作的审批:发布公众号"},{at:F(0,8,0),text:"早报:两件事均已完成"}],page:[{at:F(0,10,21),text:"新增定时任务:周报初稿",jobId:"r-weekly-draft"},{at:F(0,7,44),text:"发布的文章:Grok Bot 能借鉴什么"},{at:F(0,7,40),text:"完成《Grok Bot 能借鉴什么》,3200 字"},{at:F(1,17,8),text:"周报初稿修改标题"}],bird:[{at:F(0,9,0),text:"每日简报:今天 6 条",jobId:"t-0926"},{at:F(1,9,0),text:"每日简报:昨天 5 条",jobId:"t-0925"}],server:[{at:F(1,3,5),text:"任务已完成:清理旧日志",jobId:"t-0927"}],house:[{at:F(0,7,30),text:"相册备份:新增 312 张"}],coin:[{at:F(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},...$b().filter(V=>V.name!=="searxng"&&V.name!=="exa")],work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}}}}}const ew={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:[]},ux={keyConfigured:!0},tw=[{id:"anthropic",name:"Anthropic"},{id:"openai",name:"OpenAI"},{id:"google",name:"Google"},{id:"deepseek",name:"DeepSeek"},{id:"openrouter",name:"OpenRouter"}],nw={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 rf(n,a){return(n.kind==="custom"?n.models.map(o=>({id:o.id,name:o.name?.trim()||o.id,reasoning:o.reasoning===!0})):nw[n.id]??[]).map(o=>{const c=`${n.id}/${o.id}`,f=a?.[c],h=Z1(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 sw="/Users/me/.pi/agent",lw="/Users/me/.lore",aw=[{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:"登录授权类凭据无法导入。"}],iw={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"}]}},dx=new Map,of={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 rw(n="s1"){const a=W1(n);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 r=[{id:"kc-1",name:"工作资料",createdAt:ue(1e3),count:0},{id:"kc-2",name:"灵感收藏",createdAt:ue(900),count:0}],o=["项目封面.png","产品设计页面.html","工作记录.md","数据汇总.csv","参考文档.pdf","插画.png","会议纪要.md","网站方案.html","预算表.csv","资料.txt","附件.json","录音.mp3"].map((k,N)=>({id:`k-${N}`,origin:N%3===0?"chat":N%3===1?"output":"upload",name:k,description:`项目资料 · ${k},记录设计与工作进展。`,kind:k.endsWith(".png")?"image":k.endsWith(".html")?"html":k.endsWith(".csv")?"csv":k.endsWith(".pdf")?"pdf":k.endsWith(".json")?"json":k.endsWith(".mp3")?"audio":"markdown",path:`/mock/knowledge/${k}`,hash:`hash-${N}`,size:2048+N*1e3,createdAt:ue(N<6?N*60:336*60+N),updatedAt:ue(N<6?N*60:336*60+N),source:{assistantId:"hob",itemId:n==="bubbles"||n==="bubbles-dark"?["bubble-file","bubble-page","bubble-audio","bubble-video","bubble-job"][N%5]:n==="image"?"image-done":a.items.hob?.[0]?.id},collections:N%2?["kc-1"]:["kc-2"]}));const c=["queued","indexing","ready","failed","unsupported"];o.forEach((k,N)=>{k.index={state:c[N%c.length],...N%c.length===3?{error:"无法读取文件"}:{}}});const f=a.assistants.find(k=>k.id==="hob");f&&(f.knowledge=["kc-1"]);let h=!1;const m=new Set,p=k=>m.forEach(N=>N(k)),x=k=>a.assistants.find(N=>N.id===k),v=new Set(["anthropic","my-proxy"]);let b=de(P1[ac()]);const j=()=>({providers:a.settings.settings.providers.map(k=>({...k,keyConfigured:v.has(k.id)})),builtin:de(tw),settings:de(a.settings),models:Object.fromEntries(a.settings.settings.providers.map(k=>[k.id,rf(k,a.settings.settings.models.thinking)]))}),T={revision:a.settings.revision,provider:"local",providerExplicit:!1,lorePlugin:"1.12.5",lore:{configured:!1,baseUrl:null,source:"none",tokenConfigured:!1}},S=[{endpoint:"https://push.example/mock-iphone",label:"iPhone",createdAt:new Date(Date.now()-3*864e5).toISOString()}],C=()=>({publicKey:"BOmockVapidPublicKeyForPreviewOnly",email:a.settings.settings.push.email,devices:de(S)}),M=k=>{const N=[];return k.activity.forEach((E,_)=>{if(E.verb==="$")return;const z=E.text.match(/^浏览器 打开 (\S+)$/),V=z?"browser_open":E.verb==="读"?"read":E.verb==="跑"?"bash":E.verb==="改"?"edit":E.verb==="说"?"report":"ls";N.push({id:`mock-${k.id}-${_}`,kind:"tool",at:E.at,name:V,title:V==="report"?"提交结果":`${E.verb} ${E.text}`,args:z?{url:z[1]}:V==="bash"?{command:E.text}:V==="report"?{outcome:"done",summary:E.text}:{path:E.text},output:V==="report"?"结果已记录。":z?"已打开页面。":`${E.text}
79
+ `,durationMs:120})}),k.id==="t-0931"&&N.push({id:"mock-search",kind:"tool",at:k.createdAt,name:"web_search",title:"联网搜索:浏览器页面性能优化",args:{query:"浏览器页面性能优化"},output:"演示结果:网页性能优化指南。",durationMs:120}),N};function A(k,N){const E=x(k);E&&(Object.assign(E,N),p({type:"assistant",assistant:de(E)}))}function U(k,N){const E=a.items[k]??=[],_=E.findIndex(z=>z.id===N.id);_>=0?E[_]=N:E.push(N),p({type:"item",assistantId:k,item:N})}function $(k,N){A(k,{last:{text:N,at:new Date().toISOString()}})}return{knowledge:async(k={})=>{const N=k.q?.toLowerCase(),E=o.filter(z=>(!k.origin||z.origin===k.origin)&&(!k.collection||z.collections.includes(k.collection))&&(!k.kind||Ib(z.kind)===k.kind)&&(!k.assistantId||z.source?.assistantId===k.assistantId)&&(!k.before||z.updatedAt<k.before)&&(!N||`${z.name} ${z.description}`.toLowerCase().includes(N))),_=k.limit??50;return{entries:de(E.slice(0,_).map(z=>N?{...z,snippet:z.description??z.name}:z)),hasMore:E.length>_,collections:de(r.map(z=>({...z,count:o.filter(V=>V.collections.includes(z.id)).length,indexed:o.filter(V=>V.collections.includes(z.id)&&V.index?.state==="ready").length,failed:o.filter(V=>V.collections.includes(z.id)&&V.index?.state==="failed").length,unsupported:o.filter(V=>V.collections.includes(z.id)&&V.index?.state==="unsupported").length})))}},knowledgeEntry:async(k,N)=>{const E=o.find(_=>_.id===k);if(!E)throw new Le(404,"文件不存在");return{entry:de(E),...N!==void 0?{chunk:{index:N,heading:E.name,text:"模拟模式中的项目资料。"}}:{}}},reindexKnowledge:async k=>{if(!r.some(N=>N.id===k))throw new Le(404,"知识库不存在");return o.filter(N=>N.collections.includes(k)&&N.index?.state==="failed").forEach(N=>{N.index={state:"queued"}}),p({type:"knowledge"}),{ok:!0}},embeddingKey:async()=>({keyConfigured:h}),putEmbedding:async(k,N,E)=>{if(k!==a.settings.revision)throw new Le(409,"设置已在别处修改");return a.settings={revision:k+1,settings:{...a.settings.settings,knowledge:{embedding:N}}},E&&(h=!0),{settings:de(a.settings),keyConfigured:h}},embeddingTest:async()=>({ok:!0,dims:1024}),createKnowledgeCollection:async k=>{const N={id:`kc-${Date.now()}`,name:k,createdAt:new Date().toISOString(),count:0};return r.push(N),p({type:"knowledge"}),de(N)},renameKnowledgeCollection:async(k,N)=>{const E=r.find(_=>_.id===k);if(!E)throw new Le(404,"知识库不存在");return E.name=N,p({type:"knowledge"}),de(E)},deleteKnowledgeCollection:async k=>{r=r.filter(E=>E.id!==k);const N=o.length;return o=o.filter(E=>!(E.origin==="upload"&&E.collections.length===1&&E.collections[0]===k)).map(E=>({...E,collections:E.collections.filter(_=>_!==k)})),p({type:"knowledge"}),{deleted:N-o.length}},patchKnowledgeEntry:async(k,N)=>{const E=o.find(_=>_.id===k);if(!E)throw new Le(404,"文件不存在");return Object.assign(E,N),p({type:"knowledge"}),de(E)},deleteKnowledgeEntry:async k=>(o=o.filter(N=>N.id!==k),p({type:"knowledge"}),{ok:!0}),uploadKnowledge:async(k,N)=>{const E=N.map((_,z)=>({id:`k-${Date.now()}-${z}`,origin:"upload",name:_.name,kind:"other",path:URL.createObjectURL(_),hash:`mock-${Date.now()}-${z}`,size:_.size,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),collections:[k]}));return o.unshift(...E),p({type:"knowledge"}),{entries:de(E)}},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(k=>k.status==="pending")),settings:de(a.settings)}),settings:async()=>de(a.settings),models:async()=>({...de(ew),roster:de(a.settings.settings.models.roster)}),providers:async()=>j(),claude:async()=>({settings:de(a.settings),status:{found:!1,loggedIn:!1}}),saveClaude:async(k,N)=>{if(k!==a.settings.revision)throw new Le(409,"设置已更改,请刷新后重试。");return a.settings={revision:k+1,settings:{...a.settings.settings,claude:N}},{settings:de(a.settings),status:{found:!1,loggedIn:!1}}},putThinking:async k=>{const N=a.settings.settings.providers.find(ne=>k.ref.startsWith(`${ne.id}/`)),E=N?rf(N,a.settings.settings.models.thinking).find(ne=>ne.ref===k.ref):void 0;if(!N||!E)throw new Le(400,`模型 ${k.ref} 不在已配置的服务商里。`);const _={...a.settings.settings.models.thinking??{}},z=k.levels===null?void 0:Q1(k.levels);z?_[k.ref]=z:delete _[k.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(_).length?{thinking:_}:{}}}};const V=rf(N,a.settings.settings.models.thinking).find(ne=>ne.ref===k.ref);return{settings:de(a.settings),thinking:V}},putProvider:async(k,N)=>{const E=N,_={...E,id:k};delete _.key;const z=a.settings.settings.providers.filter(V=>V.id!==k);return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...z,_]}},E.key&&v.add(k),j()},deleteProvider:async k=>(a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:a.settings.settings.providers.filter(N=>N.id!==k)}},v.delete(k),j()),discoverProvider:async()=>({models:[{id:"gpt-x",name:"GPT X"},{id:"gpt-x-mini",name:"GPT X mini"},{id:"gpt-x-vision"}]}),providersImport:async()=>({source:sw,items:aw.map(k=>({...k,exists:k.exists||a.settings.settings.providers.some(N=>N.id===k.id)}))}),importProviders:async k=>{const N=k.map(_=>iw[_]).filter(_=>_!==void 0);if(!N.length)throw new Le(400,"没有可导入的服务商:请选择状态为可导入的项目。");const E=a.settings.settings.providers.filter(_=>!N.some(z=>z.id===_.id));a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,providers:[...E,...N]}};for(const _ of N)v.add(_.id);return j()},testProvider:async()=>{},imageKey:async()=>de(ux),putImage:async(k,N,E)=>{if(k!==a.settings.revision)throw new Le(409,"设置已在别处修改,已刷新");return a.settings={revision:a.settings.revision+1,settings:{...a.settings.settings,image:N}},{settings:de(a.settings),keyConfigured:!!E||ux.keyConfigured}},assistantSkills:async k=>de(a.assistantSkills[k]??[]),patchAssistantSkill:async(k,N,E)=>{const _=a.assistantSkills[k]?.find(z=>z.name===N);if(!_)throw new Error("技能不存在");return _.enabled=E,p({type:"skills",assistantId:k}),de(_)},rollbackAssistantSkill:async(k,N)=>{const E=a.assistantSkills[k]?.find(_=>_.name===N);if(!E||E.version<=1)throw new Error("没有上一版");return E.version--,p({type:"skills",assistantId:k}),de(E)},deleteAssistantSkill:async(k,N)=>(a.assistantSkills[k]=(a.assistantSkills[k]??[]).filter(E=>E.name!==N),p({type:"skills",assistantId:k}),{ok:!0}),sedimentJob:async k=>{if(!a.jobs[k])throw new Error("任务不存在");if(a.jobs[k].status!=="done")throw new Error("任务尚未完成");return setTimeout(()=>p({type:"sediment-finished",jobId:k}),0),{ok:!0}},skills:async()=>{const k=a.settings.settings.skills?.disabled??[],N=(E,_,z,V,ne=!1)=>({id:E,name:E,description:z,source:_,content:V,enabled:!k.includes(`${_}:${E}`),overridden:ne});return{skills:[N("weekly-report","hob","按固定结构整理本周进展、风险和下周计划,生成可直接发出的周报。",`# 周报
80
+
81
+ 1. 汇总本周完成的事项
82
+ 2. 列出风险和需要的支持
83
+ 3. 写下周计划`),N("research","hob","查阅可靠来源,交叉核对后整理结论,并为每条结论注明出处。",`# 研究
84
+
85
+ 查阅可靠来源,整理结论并注明出处。`),N("server-checkup","hob","检查主机的磁盘、内存、服务状态和最近的错误日志,给出处理建议。",`# 主机巡检
86
+
87
+ 逐台检查磁盘、内存、服务与日志。`),N("browser","common","在浏览器中打开页面、操作并截图,验证改动是否生效。",`# 浏览器
88
+
89
+ 通过浏览器检查和验证页面。`),N("pdf","common","读取、拆分、合并 PDF,提取其中的表格和文字。",`# PDF
90
+
91
+ 处理 PDF 文件。`),N("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(k,N)=>({imported:N,skipped:[],errors:[]}),deleteSkill:async()=>{},desktop:async()=>de(b),saveDesktop:async k=>(b={...b,revision:b.revision+1,url:k.url,enabled:k.enabled,tokenConfigured:b.tokenConfigured||!!k.token},de(b)),saveDesktopPublic:async(k,N)=>{if(k!==b.revision)throw new Le(409,"设置已在别处修改,已刷新");return b={...b,revision:b.revision+1,publicAssistants:[...N]},de(b)},testDesktop:async()=>ac()==="failed"?{ok:!1,error:`无法连接 ${b.url},请确认云桌面已部署并启动。`}:b.url?{ok:!0,health:de(J1)}:{ok:!1,error:"请先填写云桌面地址。"},mcp:async()=>({servers:of.servers.map(k=>({...k}))}),putMcp:async()=>({servers:of.servers.map(k=>({...k}))}),patchMcp:async()=>({servers:of.servers.map(k=>({...k}))}),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 k=>({imported:k,skipped:[]}),search:async()=>({providers:a.settings.settings.search.map(k=>({...k,keyConfigured:k.name==="exa"||k.name==="tavily"}))}),putSearch:async(k,N)=>{if(k!==a.settings.revision)throw new Le(409,"设置已在别处修改,已刷新");return a.settings={revision:k+1,settings:{...a.settings.settings,search:N}},de(a.settings)},testSearch:async()=>({ok:!1,error:"演示模式不连接搜索服务商。"}),imageTest:async()=>({ok:!1,error:"演示模式不连接图像生成接口;正式运行时会实际生成图片。"}),putSettings:async(k,N)=>{if(k!==a.settings.revision)throw new Le(409,"设置已在别处修改,已刷新");const E=N.models??{};return a.settings={revision:a.settings.revision+1,settings:{general:{...a.settings.settings.general,...N.general??{},aboutYou:{...a.settings.settings.general.aboutYou,...N.general?.aboutYou??{}}},models:{roster:E.roster??a.settings.settings.models.roster,conversation:E.conversation??a.settings.settings.models.conversation,work:E.work??a.settings.settings.models.work,thinkingChoice:E.thinkingChoice??a.settings.settings.models.thinkingChoice,...E.thinking??a.settings.settings.models.thinking?{thinking:E.thinking??a.settings.settings.models.thinking}:{}},providers:a.settings.settings.providers,image:a.settings.settings.image,search:a.settings.settings.search,skills:N.skills??a.settings.settings.skills,work:{...a.settings.settings.work,...N.work??{}},push:{...a.settings.settings.push,...N.push??{}}}},de(a.settings)},changePassword:async k=>{if(k!=="test")throw new Le(403,"旧密码不正确")},about:async()=>({version:"0.1.0",home:"/var/lib/hob"}),memory:async()=>de({...T,revision:a.settings.revision}),putMemory:async(k,N)=>{if(k!==a.settings.revision)throw new Le(409,"设置已在别处修改,已刷新");if(N==="lore"&&!T.lore.configured)throw new Le(400,"Lore 尚未配置:请先填写服务地址和 Token 并测试连接");return T.provider=N,T.providerExplicit=!0,a.settings.revision+=1,T.revision=a.settings.revision,de(T)},putLore:async k=>{const N=k.baseUrl.trim().replace(/\/+$/,"");if(!N)throw new Le(400,"Lore 服务地址不能为空");const E=T.lore.baseUrl===N;return T.lore={configured:E?T.lore.tokenConfigured:!!k.token,baseUrl:N,source:"config",tokenConfigured:E?T.lore.tokenConfigured:!!k.token},de({...T,revision:a.settings.revision})},loreTest:async k=>{const N=(k.baseUrl??T.lore.baseUrl??"").trim().replace(/\/+$/,"");return N?N.startsWith("http://")&&!/^http:\/\/(localhost|127\.0\.0\.1|192\.168\.|10\.)/.test(N)?{ok:!1,reason:"insecure_http"}:!k.token&&!T.lore.tokenConfigured?{ok:!1,reason:"missing_token"}:{ok:!0,baseUrl:N}:{ok:!1,reason:"invalid_url"}},loreImport:async()=>({source:lw,found:!0,baseUrl:"https://api.loremem.com",tokenPresent:!0}),importLore:async()=>(T.lore={configured:!0,baseUrl:"https://api.loremem.com",source:"config",tokenConfigured:!0},de({...T,revision:a.settings.revision})),items:async k=>({items:de(a.items[k]??[]),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 k=>{const N=x(k);if(!N)throw new Error(`没有这个助手:${k}`);return{assistant:de(N),rules:de(a.rules[k]??[]),routines:de(a.routines.filter(_=>_.assistantId===k)),worklog:de(a.worklog[k]??[])}},sendMessage:async(k,N)=>{if(N.text==="模拟发送失败")throw new Error("网络连接已断开");const E=new Date().toISOString();for(const z of Object.values(a.delegations))z.to!==k||z.reportedAt||z.status==="interrupted"||(Object.assign(z,{status:"takenOver",endedAt:E,reportedAt:E}),p({type:"delegation",delegation:de(z)}));for(const z of Object.values(a.approvals))z.assistantId!==k||z.source!=="router"||z.status!=="pending"||(z.status="expired",p({type:"approval",approval:de(z)}));const _={kind:"user",id:yn("mock-u"),at:E,text:N.text,quote:N.quote,files:N.files&&N.files.length?N.files:void 0};return U(k,_),$(k,N.text),A(k,{busy:!0}),setTimeout(()=>{U(k,{kind:"assistant",id:yn("mock-a"),at:new Date().toISOString(),text:"收到。"}),$(k,"收到。"),A(k,{busy:!1})},320),{item:_}},stopAssistant:async k=>A(k,{busy:!1}),markRead:async k=>A(k,{unread:0}),patchAssistant:async(k,N)=>{if(!x(k))throw new Le(404,"助手不存在。");if(N.rule){const E=a.rules[k]??=[],_=N.rule.id===void 0?void 0:E.find(ee=>ee.id===N.rule.id);if(N.rule.id!==void 0&&!_)throw new Le(404,"规则不存在。");const z=N.rule.text===void 0?_?.text??"":N.rule.text.trim();if(!z||z.length>1e3)throw new Le(400,"规则内容不能为空或超过 1000 字。");if(E.some(ee=>ee.id!==N.rule.id&&ee.text===z))throw new Le(400,"规则内容已存在。");const V=N.rule.mode??_?.mode;if(V!=="ask"&&V!=="allow")throw new Le(400,"规则模式无效。");const ne={id:_?.id??yn("r-"),text:z,mode:V,changedAt:new Date().toISOString()};return _?Object.assign(_,ne):E.push(ne),p({type:"profile",assistantId:k}),{rule:de(ne)}}A(k,N)},archiveAssistant:async k=>{const N=x(k);if(!N)throw new Le(404,"助手不存在");if(N.primary)throw new Le(400,"主助手不能归档");if(Object.values(a.jobs).filter(_=>_.assistantId===k&&(_.status==="running"||_.status==="queued"||_.status==="waiting")).length)throw new Le(409,"请等任务结束后再归档");for(const _ of a.routines.filter(z=>z.assistantId===k))p({type:"routine_removed",id:_.id});a.routines=a.routines.filter(_=>_.assistantId!==k),a.assistants=a.assistants.filter(_=>_.id!==k),p({type:"assistant_removed",id:k})},deleteRule:async(k,N)=>{a.rules[k]=(a.rules[k]??[]).filter(E=>E.id!==N),p({type:"profile",assistantId:k})},answerApproval:async(k,N)=>{const E=a.approvals[k];if(!E||E.status!=="pending")return;E.status="answered",N.key?E.chosen=N.key:E.answerText=(N.text??"").trim(),E.answeredAt=new Date().toISOString(),E.options.find(z=>z.key===N.key)?.always&&E.ruleText&&((a.rules[E.assistantId]??=[]).push({id:yn("rule"),text:E.ruleText,mode:"allow",changedAt:E.answeredAt}),U(E.assistantId,{kind:"note",id:yn("mock-n"),at:E.answeredAt,icon:"rule",text:`已记入${x(E.assistantId)?.name??""}的规则 · ${E.ruleText}无需确认`}),p({type:"profile",assistantId:E.assistantId})),p({type:"approval",approval:de(E)});for(const z of Object.values(a.delegations))!z.reportedAt&&((z.approvalIds??[]).includes(E.id)||E.jobId&&z.jobIds.includes(E.jobId))&&(z.status="running",E.jobId&&a.jobs[E.jobId]?.status==="waiting"&&(a.jobs[E.jobId].status="running",p({type:"job",job:de(a.jobs[E.jobId])})),p({type:"delegation",delegation:de(z)}))},retryDelegation:async k=>{const N=a.delegations[k];if(!N||N.status!=="interrupted")throw new Le(400,"只有已中断的委派可以重新转交");const E={...N,id:yn("dg-"),status:"running",createdAt:new Date().toISOString(),jobIds:[],approvalIds:[],reportedAt:void 0,endedAt:void 0};a.delegations[E.id]=E,p({type:"delegation",delegation:de(E)}),U("hob",{kind:"delegation",id:yn("item-"),at:E.createdAt,delegationId:E.id}),U(E.to,{kind:"user",id:yn("item-"),at:E.createdAt,text:E.text,from:{assistantId:"hob",name:"Hob",delegationId:E.id}})},createDraft:async k=>{const N=a.drafts[k];N&&(N.status="created",N.createdAssistantId="bird",p({type:"draft",draft:de(N)}),U(N.assistantId,{kind:"note",id:yn("mock-n"),at:new Date().toISOString(),icon:"split",text:`专属助手已创建 · ${N.name}`}))},dismissDraft:async k=>{const N=a.drafts[k];N&&(N.status="dismissed",p({type:"draft",draft:de(N)}))},createRoutine:async k=>{const N={...k,id:yn("r"),createdAt:new Date().toISOString(),runs:[]};return a.routines.push(N),p({type:"routine",routine:de(N)}),de(N)},patchRoutine:async(k,N)=>{const E=a.routines.find(V=>V.id===k);if(!E)return;const{skill:_,...z}=N;Object.assign(E,z),_===null?delete E.skill:_!==void 0&&(E.skill=_),p({type:"routine",routine:de(E)})},deleteRoutine:async k=>{a.routines=a.routines.filter(N=>N.id!==k),p({type:"routine_removed",id:k})},runRoutine:async k=>{const N=a.routines.find(V=>V.id===k);if(!N)return;const E=new Date().toISOString(),_={id:yn("t-"),assistantId:N.assistantId,title:`${N.name}(立即运行)`,instruction:N.instruction,status:"running",createdAt:E,startedAt:E,stats:{reads:0,commands:0,edits:0},routineId:N.id,activity:[{at:E,verb:"$",text:`立即运行 ${N.name}`}]};a.jobs[_.id]=_;const z={jobId:_.id,at:E,status:"running"};N.runs=[z,...N.runs].slice(0,20),U(N.assistantId,{kind:"job",id:yn("mock-j"),at:E,jobId:_.id}),p({type:"job",job:de(_)}),p({type:"routine",routine:de(N)}),$(N.assistantId,`运行定时任务:${N.name}`)},replyJob:async(k,N)=>{const E=a.jobs[k];if(!E)return;E.activity=[...E.activity,{at:new Date().toISOString(),verb:"说",text:N}],p({type:"activity",jobId:k,line:E.activity[E.activity.length-1],stats:de(E.stats)});const _=new Date().toISOString();p({type:"job_step",jobId:k,step:{id:`q${Date.now()}`,kind:"text",at:_,from:"user",text:N,queued:!0}}),setTimeout(()=>p({type:"job_step",jobId:k,step:{id:`u${Date.now()}`,kind:"text",at:new Date().toISOString(),from:"user",text:N}}),4e3)},transcript:async k=>{const N=a.jobs[k];if(!N)throw new Error(`没有这个任务:${k}`);return{job:de(N),steps:M(N)}},jobs:async(k={})=>{let N=Object.values(a.jobs).sort((z,V)=>V.createdAt.localeCompare(z.createdAt));if(k.assistantId&&(N=N.filter(z=>z.assistantId===k.assistantId)),k.status&&(N=N.filter(z=>z.status===k.status)),k.before){const z=N.findIndex(V=>V.id===k.before);z!==-1&&(N=N.slice(z+1))}const E=k.limit??30;return{jobs:de(N.slice(0,E)),hasMore:N.length>E}},stopJob:async k=>{const N=a.jobs[k];N&&(N.status="stopped",N.endedAt=new Date().toISOString(),p({type:"job",job:de(N)}))},upload:async k=>{await new Promise(E=>setTimeout(E,1200));const N=`/mock/uploads/u-${Math.random().toString(36).slice(2,8).padEnd(6,"0")}-${k.name}`;return dx.set(N,URL.createObjectURL(k)),N},fileUrl:(k,N)=>dx.get(k)??(k==="/srv/example/reports/stats.csv"?`data:text/plain;charset=utf-8,${encodeURIComponent(`项目,大小
92
+ 旧日志,2.1GB
93
+ 服务,正常`)}`:k==="/srv/example/reports/log-cleanup-1031.md"?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 清理报告
94
+
95
+ 已清理旧日志,服务运行正常。`)}`:k.startsWith("/mock/assistants/")?`data:text/plain;charset=utf-8,${encodeURIComponent(`# 每日行业简报
96
+
97
+ 整理值得关注的行业动态。`)}`:k.startsWith("blob:")?k:k.startsWith("/mock/knowledge/")?k.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>')}`:k.endsWith(".html")?`data:text/html;charset=utf-8,${encodeURIComponent("<h1>产品设计页面</h1><p>这是模拟模式中的项目资料。</p>")}`:`data:text/plain;charset=utf-8,${encodeURIComponent("模拟模式中的项目资料。")}`:k.startsWith("/mock/")?k:`data:text/plain;charset=utf-8,${encodeURIComponent(`mock 模式没有真实文件。
98
+
99
+ ${k}`)}`),fileMeta:async k=>{const N=k.split("/").pop()??k,E=N.lastIndexOf("."),_=E>0?N.slice(E).toLowerCase():"",z=[".png",".jpg",".jpeg",".webp",".gif"].includes(_)?"image":_===".md"?"markdown":_===".csv"?"csv":_===".html"?"html":_===".json"?"json":"text";return{path:k,name:N,size:2048,modifiedAt:new Date().toISOString(),mime:z==="image"?`image/${_===".jpg"?"jpeg":_.slice(1)}`:"text/plain; charset=utf-8",kind:z,text:z!=="image"}},jobFiles:async(k,N)=>{const E=a.jobs[k];if(!E)throw new Le(404,"任务不存在");const _="/srv/example/reports",z=ee=>({type:"file",path:`${_}/${ee}`,rel:ee,name:ee.split("/").pop(),size:2048,modifiedAt:E.createdAt,kind:ee.endsWith(".md")?"markdown":ee.endsWith(".csv")?"csv":"code"}),V=k!=="t-0927"?[]:N?N==="src"?[{type:"directory",path:`${_}/src/checks`,rel:"src/checks",name:"checks",count:1},z("src/main.ts")]:N==="src/checks"?[z("src/checks/logs.ts")]:[]:[{type:"directory",path:`${_}/src`,rel:"src",name:"src",count:2},z("log-cleanup-1031.md"),z("stats.csv"),z("notes.txt")],ne=V.filter(ee=>ee.type==="directory").length;return{files:V,total:V.length,directoryCount:ne,fileCount:V.length-ne}},push:async()=>C(),subscribePush:async(k,N)=>{const E=S.filter(_=>_.endpoint!==k.endpoint);return S.splice(0,S.length,...E,{endpoint:k.endpoint,label:N.trim()||"本机",createdAt:new Date().toISOString()}),C()},unsubscribePush:async k=>{const N=S.findIndex(E=>E.endpoint===k);return N>=0&&S.splice(N,1),C()},testPush:async()=>({sent:1,removed:0}),visibility:async()=>{},events:k=>{m.add(k.onEvent);const N=[];return n==="act-demo"&&(N.push(setTimeout(()=>p({type:"router-activity",assistantId:"hob",activity:{state:"tool",label:"搜索:最新 AI 动态"}}),2500)),N.push(setTimeout(()=>{p({type:"router-activity",assistantId:"hob",activity:null}),p({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"正在整理搜索结果…",streaming:!0}})},5500)),N.push(setTimeout(()=>{p({type:"item",assistantId:"hob",item:{kind:"assistant",id:"act-answer",at:new Date().toISOString(),text:"已整理好最新动态。"}}),p({type:"assistant",assistant:{...a.assistants.find(E=>E.id==="hob"),busy:!1,activity:null}})},7500))),()=>{N.forEach(clearTimeout),m.delete(k.onEvent)}}}}function ow(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 cw(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 Zf(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&"Notification"in window}function uw(n,a){return!n||n.byteLength!==a.length?!1:new Uint8Array(n).every((o,c)=>o===a[c])}function dw(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 Qf(){return Zf()?await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription()??null:null}async function fw(n){if(!Zf())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=cw(n);let c=await r.pushManager.getSubscription();if(c&&!uw(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=dw(c);return f?{subscription:f}:{error:"浏览器返回的订阅信息不完整"}}function Ua(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 hw(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 mw(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 pw(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 Go(n,a,r){const o=a&&!r?n.slice(0,8):n;return{rows:o,remaining:n.length-o.length}}const fx=400,gw=2e5,hx=3;function vw(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,hx),p=Math.min(r.length-f,hx),x=r.slice(c-m,c).map(v=>({sign:" ",text:v}));return x.push(...xw(r.slice(c,f),o.slice(c,h))),x.push(...r.slice(f,f+p).map(v=>({sign:" ",text:v}))),x.length<=fx?x:[...x.slice(0,fx),{sign:" ",text:"…"}]}function xw(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>gw)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 bw(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(x=>(!h||x.at>=h)&&(!m||x.at<=m)&&(!p||x.at<p))}})}const yw=new Set(["排队中","进行中","待确认","等你确认","已完成","受阻","失败","已停止"]);function kw(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 Jf(n){const a=n.statusReason?Ua(n.statusReason):"";if(!(!a||yw.has(a)))return a}function jw(n){return n.split(/`/).map((a,r)=>({text:a,mono:r%2===1})).filter(a=>a.text.length>0)}function ww(n,a){const r=n==="dark"||n==="system"&&a;return{dark:r,color:r?"#1b1b1d":"#f6f6f4"}}function Nw(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 Gb(n,a){const r=document.documentElement;r.style.setProperty("--status-background",`var(--${Nw(n,a)})`);const o=getComputedStyle(r).backgroundColor;document.querySelector('meta[name="theme-color"]')?.setAttribute("content",o)}function Sw(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 Fn(n,a){const r=n.findIndex(o=>Sw(o,a));return[...r<0?n:n.slice(0,r),a]}function Tw(n,a,r,o){return a!==r&&!o?[]:n}function Kb(n){return n.slice(0,-1)}function Vb(n,a){return Fn(Kb(n),a)}function La(n){return`${n.kind}:${"id"in n?n.id:"path"in n?n.liveId??n.path:""}`}function Cw(n,a){const r=new Set(a.map(La)),o=a.length<n.length;return n.flatMap((c,f)=>r.has(La(c))?[]:[{page:c,index:f,leaving:o}])}function Ew(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 Aw(n,a){return n.filter(r=>r.kind!=="file"||!r.liveId||!!a[r.liveId])}const Mw={general:{theme:"system",timezone:"UTC",aboutYou:{name:"",language:"",notes:""}},providers:[],models:{roster:[],conversation:{ref:"",thinking:"low"},work:{ref:"",thinking:"high"}},image:{source:"off"},search:$b(),work:{maxJobs:2,jobStallMinutes:15,routerStallMinutes:6},push:{email:""}},El=new URLSearchParams(location.search),zl=El.get("mock")==="1",zw=["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"],cf=El.get("scene"),vc=cf&&zw.includes(cf)?cf:"s1",P=zl?rw(vc):O1,Pf="hob.theme",Xb=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;let mx=!1;function px(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 Zb(){const n=localStorage.getItem(Pf);return n==="light"||n==="dark"||n==="system"?n:null}const Qb=El.get("dark")==="1",Js=E1(location.hash);function Ow(){const n=Yb[zl?vc:"s1"],a={phase:"loading",error:null,notice:null,offline:null,assistants:[],jobs:{},sedimenting:{},delegations:{},routines:[],approvals:{},drafts:{},settings:{revision:0,settings:Mw},page:"main",knowledge:{category:"all",q:"",kind:"",assistantId:"",entries:[],collections:[],collectionsLoaded:!1,hasMore:!1,loading:!1,error:null},section:null,sub:null,items:{},itemGen:{},profiles:{},assistantSkills:{},sidebarJobs:{},sidebarFiles:{},sel:"hob",panelStack:[],livePages:{},steps:{},worklog:null,collapsed:!1,nowWide:!1,theme:Zb()??"system",query:"",quote:null,text:"",attachments:[],pending:{},nonce:0,mobile:"list",sheet:!1,search:!1,menu:null,tick:0,updateReady:!1,loggingIn:!1};if(zl){a.sel=n.sel;const c=px(n.panel);a.panelStack=c.kind==="now"?[]:[c],a.collapsed=n.collapsed,a.mobile=n.mobile,a.theme=n.dark?"dark":"light"}const r=El.get("a");r&&(a.sel=r),Js.sel&&(a.sel=Js.sel),Js.panel&&(a.panelStack=[Js.panel]),Js.knowledge&&(a.page="knowledge"),Js.settings&&(a.page="settings",a.section=Js.section);const o=El.get("panel");if(o){const c=px(o);a.panelStack=c.kind==="now"?[]:[c]}return El.get("collapsed")==="1"&&(a.collapsed=!0),Qb&&(a.theme="dark"),a}let oe=Ow();function _w(){return Js.sel?!0:zl?Yb[vc].mobile==="chat":!!El.get("a")||window.innerWidth>=768}zl||Qb||Zb();const Cf=new Set;function G(n){oe={...oe,...typeof n=="function"?n(oe):n},Cf.forEach(a=>a())}function Jb(n){return Cf.add(n),()=>Cf.delete(n)}const Ps=()=>oe;function je(){return y.useSyncExternalStore(Jb,Ps,Ps)}function ge(n){return n instanceof Le||n instanceof Error?n.message:String(n)}function Nn(n){const a={};for(const r of n)a[r.id]=r;return a}function gx(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 Rw(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 vx=Promise.resolve();function Ff(n){const a=vx.then(()=>Dw(typeof n=="function"?n(oe.settings.settings):n));return vx=a.then(()=>{},()=>{}),a}async function Dw(n){const a=oe.settings,r={revision:a.revision,settings:Rw(a.settings,n)};G({settings:r,theme:r.settings.general.theme}),n.general?.theme&&Cl(n.general.theme);try{const o=await P.putSettings(a.revision,n);return G({settings:o,theme:o.settings.general.theme}),Cl(o.settings.general.theme),localStorage.setItem(Pf,o.settings.general.theme),!0}catch(o){if(o instanceof Le&&o.status===409){try{const c=await P.settings();G({settings:c,theme:c.settings.general.theme}),Cl(c.settings.general.theme)}catch{G({settings:a})}return G({notice:"设置已在别处修改,已刷新"}),!1}return G({settings:a,theme:a.settings.general.theme,notice:`保存失败:${ge(o)}`}),Cl(a.settings.general.theme),!1}}async function $w(n,a){try{return await P.changePassword(n,a),null}catch(r){return ge(r)}}async function Uw(){try{return await P.about()}catch(n){return G({notice:`无法读取版本信息:${ge(n)}`}),null}}async function Wf(){try{return await P.models()}catch(n){return G({notice:`无法读取模型列表:${ge(n)}`}),null}}async function Lw(){const n=await P.claude();return G({settings:n.settings}),n}async function Hw(n){const a=await P.saveClaude(oe.settings.revision,n);return G({settings:a.settings}),a}async function eh(n){return G({settings:n.settings}),n}async function Bw(){try{return{ok:!0,view:await P.providers()}}catch(n){return{ok:!1,error:ge(n)}}}async function xx(n,a){try{return{ok:!0,view:await eh(await P.putProvider(n,a))}}catch(r){return{ok:!1,error:ge(r)}}}async function qw(n,a){try{const r=await P.putThinking({ref:n,levels:a});return G({settings:r.settings}),{ok:!0,settings:r.settings,thinking:r.thinking}}catch(r){return{ok:!1,error:ge(r)}}}async function Iw(n){try{return{ok:!0,view:await eh(await P.deleteProvider(n))}}catch(a){return{ok:!1,error:ge(a)}}}async function bx(n){try{return await P.testProvider(n),null}catch(a){return ge(a)}}async function Yw(n){try{return{ok:!0,models:(await P.discoverProvider(n)).models}}catch(a){return{ok:!1,error:ge(a)}}}async function Gw(){try{return{ok:!0,view:await P.providersImport()}}catch(n){return{ok:!1,error:ge(n)}}}async function Kw(n){try{return{ok:!0,view:await eh(await P.importProviders(n))}}catch(a){return{ok:!1,error:ge(a)}}}const Vw=()=>P.skills(),Xw=n=>P.skillsImport(n),Zw=(n,a,r)=>P.importSkills(n,a,r),Qw=n=>P.deleteSkill(n),Jw=()=>P.desktop();async function Pw(n){const a=await P.saveDesktop(n);return G({settings:await P.settings()}),a}async function Fw(n,a){const r=await P.saveDesktopPublic(n,a);return G({settings:await P.settings()}),r}const Ww=()=>P.testDesktop(),yx=()=>P.mcp(),eN=(n,a)=>P.putMcp(n,a),Pb=(n,a)=>P.patchMcp(n,a),tN=n=>P.deleteMcp(n),nN=(n,a=!0)=>P.testMcp(n,a),sN=()=>P.mcpImports(),lN=n=>P.importMcp(n),aN=()=>P.search(),iN=(n,a,r)=>P.testSearch(n,a,r);async function rN(n,a){try{const r=await P.putSearch(oe.settings.revision,n,a);return G({settings:r}),null}catch(r){return r instanceof Le&&r.status===409&&G({settings:await P.settings()}),ge(r)}}const oN=()=>P.embeddingKey(),cN=n=>P.embeddingTest(n);async function uN(n,a){try{const r=await P.putEmbedding(oe.settings.revision,n,a);return G({settings:r.settings}),r}catch(r){throw r instanceof Le&&r.status===409&&G({settings:await P.settings()}),r}}const dN=(n,a)=>P.knowledgeEntry(n,a),fN=n=>P.reindexKnowledge(n);async function hN(){try{return await P.imageKey()}catch(n){return G({notice:`无法读取图像生成设置:${ge(n)}`}),null}}async function kx(n,a){try{const r=await P.putImage(oe.settings.revision,n,a);return G({settings:r.settings}),{ok:!0,keyConfigured:r.keyConfigured}}catch(r){if(r instanceof Le&&r.status===409){try{G({settings:await P.settings()})}catch{}return{ok:!1,error:"设置已在别处修改,已刷新,请重新保存",conflict:!0}}return{ok:!1,error:ge(r),conflict:!1}}}async function jx(n){try{return await P.imageTest(n)}catch(a){return{ok:!1,error:`生成测试图片的请求失败:${ge(a)}`}}}async function uf(){try{return{ok:!0,config:await P.memory()}}catch(n){return{ok:!1,error:`无法读取记忆设置:${ge(n)}`}}}async function wx(n,a){try{const r=await P.putMemory(n,a);return G(o=>({settings:{...o.settings,revision:Math.max(o.settings.revision,r.revision)}})),{ok:!0,config:r}}catch(r){return{ok:!1,error:ge(r)}}}async function mN(n){try{return{ok:!0,config:await P.putLore(n)}}catch(a){return{ok:!1,error:ge(a)}}}async function Nx(n){try{return{ok:!0,result:await P.loreTest(n)}}catch(a){return{ok:!1,error:`测试请求失败:${ge(a)}`}}}async function pN(){try{return{ok:!0,view:await P.loreImport()}}catch(n){return{ok:!1,error:ge(n)}}}async function gN(){try{return{ok:!0,config:await P.importLore()}}catch(n){return{ok:!1,error:ge(n)}}}async function Pi(){try{return{ok:!0,view:await P.push()}}catch(n){return{ok:!1,error:`无法读取推送设置:${ge(n)}`}}}async function vN(){const n=await Pi();if(!n.ok)return n;try{const a=await fw(n.view.publicKey);return"error"in a?{ok:!1,error:a.error}:{ok:!0,view:await P.subscribePush(a.subscription,ow(navigator.userAgent))}}catch(a){return{ok:!1,error:`订阅推送失败:${ge(a)}`}}}async function xN(){try{const n=await Qf();if(n)try{await n.unsubscribe()}catch{}return Fb(n?.endpoint??await bN())}catch(n){return{ok:!1,error:`关闭推送失败:${ge(n)}`}}}async function bN(){const n=await Pi();return n.ok?n.view.devices[0]?.endpoint??"":""}async function Fb(n){if(!n)return Pi();try{return{ok:!0,view:await P.unsubscribePush(n)}}catch(a){return{ok:!1,error:`删除设备失败:${ge(a)}`}}}async function yN(){const n=await Qf();try{const a=await P.testPush(n?.endpoint);return{ok:!0,sent:a.sent,removed:a.removed}}catch(a){return{ok:!1,error:ge(a)}}}const Wb=window.matchMedia("(prefers-color-scheme: dark)");function Cl(n){const{dark:a}=ww(n,Wb.matches);document.documentElement.classList.toggle("dark",a),document.documentElement.style.colorScheme=a?"dark":"light",Gb(oe,window.innerWidth<768)}Wb.addEventListener("change",()=>Cl(oe.theme));let Sx=!1,Tx=null;async function kN(){if(!Sx){if(Sx=!0,Cl(oe.theme),zl){if(vc==="boot")return;await ic();return}try{await P.me()}catch(n){if(n instanceof Le&&n.status===401){G({phase:"login"});return}G({phase:"error",error:ge(n)});return}await ic()}}async function jN(n){if(!oe.loggingIn){G({loggingIn:!0,error:null});try{await P.login(n)}catch(a){G({loggingIn:!1,error:a instanceof Le&&a.status===401?"密码不正确":`登录失败:${ge(a)}`});return}G({loggingIn:!1,phase:"loading"}),await ic()}}async function ic(){try{const n=await P.bootstrap();G({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(Pf,n.settings.settings.general.theme),Tx||(Tx=P.events({onEvent:e0,onReconnect:()=>{G({offline:null,sedimenting:{}}),ic()},onDown:o=>G({offline:o})},Xb),NN());const a=oe.sel&&n.assistants.some(o=>o.id===oe.sel)?oe.sel:n.assistants.find(o=>o.primary)?.id??n.assistants[0]?.id??null;a&&await Vt(a,_w()),oe.page==="knowledge"&&zt();const r=oe.panelStack.at(-1);r?.kind==="job"&&lh(r.id),r?.kind==="jobs"&&!oe.worklog&&uc()}catch(n){G({phase:"error",error:ge(n)})}}const th=new Set;function e0(n){switch(n.type){case"sediment-finished":G(a=>({sedimenting:{...a.sedimenting,[n.jobId]:!1}}));break;case"page-live":{const a=!oe.livePages[n.callId];G(r=>({livePages:{...r.livePages,[n.callId]:n},...$1(n,{seen:!a,closed:th.has(n.callId),assistantId:r.sel,inChat:r.page==="main"&&(r.mobile==="chat"||!window.matchMedia("(max-width: 767px)").matches)})?{panelStack:Fn(r.panelStack,{kind:"file",path:"",full:!1,liveId:n.callId})}:{}}));break}case"assistant":{const a=n.assistant;G(r=>({assistants:gx(r.assistants,a),profiles:r.profiles[a.id]?{...r.profiles,[a.id]:{...r.profiles[a.id],assistant:a}}:r.profiles}));break}case"router-activity":G(a=>({assistants:a.assistants.map(r=>r.id===n.assistantId?{...r,activity:n.activity}:r)}));break;case"assistant_removed":G(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=oe.items[n.assistantId];if(!a)break;const r=oe.pending[n.assistantId]??[],o=r.find(c=>Y1(c,n.item));!o&&!a.some(c=>c.id===n.item.id)&&Hb([n.item.id]),G(c=>({items:{...c.items,[n.assistantId]:Ub(a,n.item)},...o?{pending:{...c.pending,[n.assistantId]:r.filter(f=>f!==o)}}:{}}));break}case"delta":{const a=oe.items[n.assistantId];if(!a)break;const r=D1(a,n.itemId,n.text);r!==a&&G(o=>({items:{...o.items,[n.assistantId]:r}}));break}case"job":G(a=>({jobs:{...a.jobs,[n.job.id]:n.job}})),wN(n.job.status)&&oe.panelStack.some(a=>a.kind==="job"&&a.id===n.job.id)&&oe.steps[n.job.id]&&lh(n.job.id);break;case"delegation":G(a=>({delegations:{...a.delegations,[n.delegation.id]:n.delegation}}));break;case"job_step":{const a=oe.steps[n.jobId];if(!a)break;G(r=>({steps:{...r.steps,[n.jobId]:hw(a,n.step)}}));break}case"activity":{const a=oe.jobs[n.jobId];if(!a)break;G(r=>({jobs:{...r.jobs,[n.jobId]:{...a,stats:n.stats,activity:[...a.activity,n.line].slice(-200)}}}));break}case"approval":G(a=>({approvals:{...a.approvals,[n.approval.id]:n.approval}}));break;case"draft":G(a=>({drafts:{...a.drafts,[n.draft.id]:n.draft}}));break;case"routine":G(a=>({routines:gx(a.routines,n.routine)}));break;case"routine_removed":G(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":xs(n.assistantId);break;case"knowledge":oe.page==="knowledge"&&zt(!1,!0);break;case"profile":t0(n.assistantId);break}}function wN(n){return n==="done"||n==="stuck"||n==="failed"||n==="stopped"}function Cx(){P.visibility(Xb,document.visibilityState==="visible").catch(()=>{})}function NN(){mx||(mx=!0,document.addEventListener("visibilitychange",Cx),Cx())}async function Vt(n,a=!0,r=!1){G(c=>({sel:n,panelStack:Tw(c.panelStack,c.sel,n,r),...c.sel!==n&&!r?{worklog:null}:{},...a?{mobile:"chat",...r?{}:{sheet:!1},search:!1}:{},quote:null}));const o=oe.assistants.find(c=>c.id===n);o&&o.unread>0&&(G(c=>({assistants:c.assistants.map(f=>f.id===n?{...f,unread:0}:f)})),P.markRead(n).catch(()=>{})),await Promise.all([SN(n),t0(n)])}async function SN(n){const a=new Set(Object.keys(oe.livePages));try{const r=await P.items(n);B1();const o=new Set((r.pageLive??[]).map(c=>c.callId));G(c=>{const f=Object.fromEntries(Object.entries(c.livePages).filter(([h,m])=>m.assistantId!==n||m.state==="done"||!a.has(h)||o.has(h)));return{livePages:f,panelStack:Aw(c.panelStack,f)}});for(const c of r.pageLive??[])e0({type:"page-live",...c});G(c=>({items:{...c.items,[n]:r.items},itemGen:{...c.itemGen,[n]:(c.itemGen[n]??0)+1},jobs:{...c.jobs,...Nn(r.jobs)},approvals:{...c.approvals,...Nn(r.approvals)},drafts:{...c.drafts,...Nn(r.drafts)},delegations:{...c.delegations,...Nn(r.delegations??[])}}))}catch(r){G({notice:`无法加载对话:${ge(r)}`})}}async function t0(n){try{const a=await P.profile(n);G(r=>({profiles:{...r.profiles,[n]:a}}))}catch(a){G({notice:`无法加载档案:${ge(a)}`})}}function nh(n){G({text:n})}function rc(n){G({quote:n,nonce:oe.nonce+1})}const n0=new Map,Ef=new Map,oc=new Map;function Rl(n){return oc.get(n)??P.fileUrl(n,{thumb:!0})}function Ex(n,a){const r=o=>o.some(c=>c.id===n)?o.map(c=>c.id===n?{...c,...a}:c):o;G(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 s0(n){const a=n0.get(n.id),r=P.upload(a).then(o=>{const c=oc.get(gc(n));return c&&oc.set(o,c),Ex(n.id,{status:"done",path:o}),o},o=>{throw Ef.delete(n.id),Ex(n.id,{status:"failed"}),o});return r.catch(()=>{}),Ef.set(n.id,r),r}function TN(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 n0.set(o.id,r),Xi(r.name)&&oc.set(gc(o),URL.createObjectURL(r)),o});G(r=>({attachments:[...r.attachments,...a]})),a.forEach(r=>void s0(r))}function Ax(n){G(a=>({attachments:a.attachments.filter(r=>r.id!==n)}))}async function CN(n){return Promise.all(n.attachments.map(a=>Ef.get(a.id)??s0(a)))}function Af(n,a,r){G(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 l0(n){Af(n.assistantId,n.localId,{status:"sending",error:void 0});try{const a=await CN(n),r=await P.sendMessage(n.assistantId,{text:n.text,quote:n.quote,files:a.length?a:void 0});G(o=>({pending:{...o.pending,[n.assistantId]:(o.pending[n.assistantId]??[]).filter(c=>c.localId!==n.localId)},...r?.item?{items:{...o.items,[n.assistantId]:Ub(o.items[n.assistantId]??[],r.item)}}:{}}))}catch(a){Af(n.assistantId,n.localId,{status:"failed",error:ge(a)})}}async function Mx(){const n=oe.sel,a=oe.text.trim();if(!n||!a&&!oe.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,...oe.quote?{quote:oe.quote}:{},attachments:oe.attachments,status:"sending"};Hb([r.localId]),G(o=>({text:"",quote:null,attachments:[],nonce:o.nonce+1,pending:{...o.pending,[n]:[...o.pending[n]??[],r]}})),await l0(r)}function zx(n,a){const r=oe.pending[n]?.find(o=>o.localId===a);r&&l0(r)}function EN(n,a){Af(n,a,null)}function a0(n,a){if(!a)return[];const r=n.pending[a]??[],o=n.items[a]??[];return r.length?[...o,...r.map(I1)]:o}function AN(n,a,r){return a?n.pending[a]?.find(o=>o.localId===r):void 0}async function MN(n){try{await P.stopAssistant(n)}catch(a){G({notice:`停止失败:${ge(a)}`})}}async function Ox(n,a){const r=oe.approvals[n];if(r){G(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){G({approvals:{...oe.approvals,[n]:r},notice:`提交失败:${ge(o)}`})}}}async function zN(n){try{await P.createDraft(n)}catch(a){G({notice:`创建助手失败:${ge(a)}`})}}async function ON(n){try{await P.archiveAssistant(n);const a=oe.assistants.find(r=>r.primary);oe.sel===n&&a&&await Vt(a.id)}catch(a){G({notice:`归档失败:${ge(a)}`})}}async function _N(n){try{await P.retryDelegation(n)}catch(a){G({notice:`重新转交失败:${ge(a)}`})}}async function _x(n,a,r){await r0(n,a,r?"forward":"handback")}async function sh(n,a,r){await r0(n,a,r?"forward":"delegation")}async function i0(n,a){let r=oe.items[n]??[];for(;!r.some(a)&&r.length;){const o=await P.items(n,r[0].id);if(!o.items.length||(r=[...o.items,...r],G(c=>({items:{...c.items,[n]:r},jobs:{...c.jobs,...Nn(o.jobs)},approvals:{...c.approvals,...Nn(o.approvals)},drafts:{...c.drafts,...Nn(o.drafts)},delegations:{...c.delegations,...Nn(o.delegations??[])}})),!o.hasMore))break}return r.some(a)}async function r0(n,a,r){(oe.sel!==n||!oe.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 i0(n,o)){G({notice:"未找到对应的转交消息"});return}requestAnimationFrame(()=>requestAnimationFrame(()=>document.getElementById(`${r}-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})))}catch(c){G({notice:`无法定位转交消息:${ge(c)}`})}}async function Mf(n,a){try{return await P.replyJob(n,a),!0}catch(r){return G({notice:`发送失败:${ge(r)}`}),!1}}async function o0(n){try{await P.stopJob(n)}catch(a){G({notice:`停止失败:${ge(a)}`})}}const Ko={};async function xs(n){const a=Ko[n]=(Ko[n]??0)+1;G(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);Ko[n]===a&&G(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:r,loaded:!0,loading:!1,error:null}}}))}catch(r){Ko[n]===a&&G(o=>({assistantSkills:{...o.assistantSkills,[n]:{skills:o.assistantSkills[n]?.skills??[],loaded:o.assistantSkills[n]?.loaded??!1,loading:!1,error:ge(r)}}}))}}async function df(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 xs(n)}catch(o){G({notice:`操作失败:${ge(o)}`})}}async function RN(n){G(a=>({sedimenting:{...a.sedimenting,[n]:!0}}));try{return await P.sedimentJob(n),!0}catch(a){return G(r=>({notice:`沉淀失败:${ge(a)}`,sedimenting:{...r.sedimenting,[n]:!1}})),!1}}async function wl(n,a){const r=oe.routines.find(f=>f.id===n);if(!r)return;const{skill:o,...c}=a;G(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){G({routines:oe.routines.map(h=>h.id===n?r:h),notice:`保存失败:${ge(f)}`})}}async function DN(n){const a=new Set(oe.routines.map(c=>c.id));let r;try{r=await P.createRoutine(n)}catch(c){G({notice:`创建失败:${ge(c)}`});return}const o=r?.id?r:oe.routines.find(c=>!a.has(c.id));o&&G(c=>({panelStack:Vb(c.panelStack,{kind:"routine",id:o.id})}))}async function $N(n){try{await P.deleteRoutine(n)}catch(a){G({notice:`删除失败:${ge(a)}`})}}async function UN(n){try{await P.runRoutine(n)}catch(a){G({notice:`运行失败:${ge(a)}`})}}async function cc(n,a){const r=oe.assistants.find(c=>c.id===n),o=oe.profiles[n];if(!r)return"助手不存在。";G(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=`保存失败:${ge(c)}`;return G(h=>({assistants:h.assistants.map(m=>m.id===n?r:m),profiles:o?{...h.profiles,[n]:o}:h.profiles,notice:f})),f}}async function LN(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 G(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`保存失败:${ge(o)}`}}async function HN(n,a){try{return await P.patchAssistant(n,{rule:a}),G(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`保存失败:${ge(r)}`}}async function BN(n,a){const r=oe.profiles[n];if(r){G(o=>({profiles:{...o.profiles,[n]:{...r,rules:r.rules.filter(c=>c.id!==a)}}}));try{await P.deleteRule(n,a)}catch(o){G({profiles:{...oe.profiles,[n]:r},notice:`删除失败:${ge(o)}`})}}}async function lh(n){try{const{job:a,steps:r}=await P.transcript(n);G(o=>({jobs:{...o.jobs,[a.id]:a},steps:{...o.steps,[a.id]:o.steps[a.id]?mw(o.steps[a.id],r):r}}))}catch(a){G({notice:`无法加载任务过程:${ge(a)}`})}}function Un(n,a){G(r=>({panelStack:Fn(r.panelStack,{kind:"job",id:n,round:a})})),lh(n)}function c0(n=null){G(a=>({panelStack:Fn(a.panelStack,{kind:"jobs"})})),uc({assistantId:n,status:null})}function lr(){const n=oe.panelStack.at(-1);n?.kind==="file"&&n.liveId&&th.add(n.liveId),G(a=>({panelStack:Kb(a.panelStack)}))}function ar(){for(const n of oe.panelStack)n.kind==="file"&&n.liveId&&th.add(n.liveId);G({panelStack:[]})}async function uc(n={}){const a=n.assistantId??null,r=n.status??null;G({worklog:{jobs:[],assistantId:a,status:r,hasMore:!1,loading:!0}});try{const o=await P.jobs({...a?{assistantId:a}:{},...r?{status:r}:{},limit:30});u0(o,a,r)}catch(o){G({worklog:null,notice:`无法加载任务记录:${ge(o)}`})}}async function Rx(){const n=oe.worklog;if(!n||!n.hasMore||n.loading)return;const a=n.jobs[n.jobs.length-1];G({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});u0(r,n.assistantId,n.status)}catch(r){G(o=>({worklog:o.worklog?{...o.worklog,loading:!1}:null,notice:`无法加载更多:${ge(r)}`}))}}function u0(n,a,r){G(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 Fi(){G({nonce:oe.nonce+1,mobile:"chat",sheet:!1})}function d0(){const n=oe.assistants.find(a=>a.primary);n&&(Vt(n.id),G({text:"我想创建一个专属助手,负责:",nonce:oe.nonce+1,mobile:"chat",sheet:!1}))}async function qN(n,a){(oe.sel!==n||!oe.items[n])&&await Vt(n),requestAnimationFrame(()=>{document.getElementById(`job-${a}`)?.scrollIntoView({block:"center",behavior:"smooth"})})}function f0(n){G(a=>({panelStack:Fn(a.panelStack,{kind:"routine",id:n})}))}function IN(){G(n=>({panelStack:Fn(n.panelStack,{kind:"newRoutine"})}))}function ah(){G(n=>({panelStack:Fn(n.panelStack,{kind:"assistant"})}))}function Vo(n){G(a=>({panelStack:Fn(a.panelStack,{kind:n})}))}async function h0(n,a,r){const o={items:[],loaded:!1,loading:!1,loadingMore:!1,hasMore:!1,error:null},c=oe[n][a]??o;if(!(c.loading||r&&(!c.loaded||!c.hasMore))){G(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(T=>({items:T.jobs,hasMore:T.hasMore})):await P.knowledge({origin:"output",assistantId:a,before:f,limit:30}).then(T=>({items:T.entries,hasMore:T.hasMore})),m=r?[...c.items,...h.items]:[...h.items,...c.items],p=new Set,x=m.filter(T=>!p.has(T.id)&&!!p.add(T.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;G(T=>({[n]:{...T[n],[a]:{items:x,loaded:!0,loading:!1,loadingMore:!1,hasMore:j,error:null,cursor:b}}}))}catch(f){G(h=>({[n]:{...h[n],[a]:{...c,loading:!1,loadingMore:!1,failedMore:r,error:ge(f)}}}))}}}function ff(n,a=!1){return h0("sidebarJobs",n,a)}function hf(n,a=!1){return h0("sidebarFiles",n,a)}let Dx=!1;async function YN(){if(Dx)return;const n=await P.knowledge({limit:1});Dx=!0,G(a=>({knowledge:{...a.knowledge,collections:n.collections,collectionsLoaded:!0}}))}function $x(n,a,r){G({menu:{id:n,x:a,y:r}})}function mf(){oe.menu&&G({menu:null})}let pf=0;async function zt(n=!1,a=!1){if(n&&(oe.knowledge.loading||!oe.knowledge.hasMore))return;const r=oe.knowledge,o=++pf;G({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!==pf)return;G({knowledge:{...oe.knowledge,entries:n?[...r.entries,...c.entries]:c.entries,collections:c.collections,collectionsLoaded:!0,hasMore:c.hasMore,loading:!1}})}catch(c){o===pf&&G({knowledge:{...oe.knowledge,loading:!1,error:ge(c)}})}}function Al(n){G({knowledge:{...oe.knowledge,...n,hasMore:!1}}),zt()}async function m0(n,a=!0){try{const r=await P.createKnowledgeCollection(n.trim());return a?Al({category:r.id}):await zt(!1,!0),r}catch(r){return G({notice:`新建失败:${ge(r)}`}),null}}async function GN(n,a){try{return await P.renameKnowledgeCollection(n,a.trim()),await zt(!1,!0),!0}catch(r){return G({notice:`改名失败:${ge(r)}`}),!1}}async function KN(n){try{const{deleted:a}=await P.deleteKnowledgeCollection(n);oe.knowledge.category===n?Al({category:"all"}):await zt(!1,!0),G({notice:a?`已删除知识库,一起删掉 ${a} 个文件`:"已删除知识库"})}catch(a){G({notice:`删除失败:${ge(a)}`})}}async function tc(n,a){try{return await P.patchKnowledgeEntry(n,a),await zt(!1,!0),!0}catch(r){return G({notice:`保存失败:${ge(r)}`}),!1}}async function VN(n){try{await P.deleteKnowledgeEntry(n),await zt(!1,!0)}catch(a){G({notice:`删除失败:${ge(a)}`})}}async function XN(n,a){try{await P.uploadKnowledge(n,a),await zt(!1,!0)}catch(r){G({notice:`上传失败:${ge(r)}`})}}function ih(){G({page:"knowledge",panelStack:[],sheet:!1}),zt()}function Wi(){G({page:"main",panelStack:[]})}async function ZN(n,a){G({page:"main",panelStack:[]}),await Vt(n);try{if(!await i0(n,c=>c.id===a)){G({notice:"未找到对应的对话消息"});return}const r=performance.now()+1500,o=()=>{if(oe.page!=="main"||oe.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):G({notice:"没能定位到这条消息"});return}Bb(c)};requestAnimationFrame(o)}catch(r){G({notice:`无法定位对话消息:${ge(r)}`})}}function xc(){G({page:"settings",section:null,sub:null,sheet:!1,search:!1,panelStack:[]})}function zf(){G({page:"main",panelStack:[]})}function Ml(n){G({section:n,sub:null})}function Tn(n){G({sub:n})}function Ht(){G({sub:null})}function gf(){G(n=>({nowWide:!n.nowWide}))}function QN(){G({collapsed:!0,sheet:!1})}function JN(){G({collapsed:!1,panelStack:[]})}function p0(n){G({query:n})}function Of(n){G({mobile:n,sheet:!1,search:!1})}function PN(){G({sheet:!0})}function g0(){G({sheet:!1})}function Ux(n){G({search:n,query:n?oe.query:""})}function FN(){G({notice:null})}function Ya(n){G({notice:n})}function WN(){G({updateReady:!0})}function eS(){G({tick:oe.tick+1})}function Lt(n,a){return P.fileUrl(n,a)}function rh(n){return P.fileMeta(n)}function v0(n,a){return P.jobFiles(n,a)}function Ct(n,a,r){G(o=>({panelStack:Fn(o.panelStack,{kind:"file",path:n,full:!1,...a?{title:a}:{},...r})}))}function tS(n){G(a=>({panelStack:Fn(a.panelStack,{kind:"file",path:"",full:!1,liveId:n})}))}function nS(){G(n=>{const a=n.panelStack.at(-1);return a?.kind==="file"?{panelStack:Vb(n.panelStack,{...a,full:!a.full})}:{}})}const sS=500,Lx=10;function x0(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(),$x(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),$x(n.id,m.x,m.y))},sS))},onPointerMove(h){const m=r.current;m&&(Math.abs(h.clientX-m.x)>Lx||Math.abs(h.clientY-m.y)>Lx)&&c()},onPointerUp:c,onPointerCancel:c},takeHeld(){return o.current?(o.current=!1,!0):!1}}}function Hx(){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)&&mf()},x=v=>{v.key==="Escape"&&mf()};return document.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",x)}},[a]),!a)return null;const o=n.assistants.find(p=>p.id===a.id);if(!o)return null;const c=p=>{mf(),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 cc(o.id,{pinned:!o.pinned})),children:o.pinned?"取消置顶":"放在顶部"}),o.primary?null:l.jsx("button",{onClick:()=>c(()=>void cc(o.id,{hidden:!o.hidden})),children:o.hidden?"放回列表":"收起这个助手"}),l.jsx("button",{onClick:()=>c(()=>{Vt(o.id,!1),ah()}),children:"助手设置"})]})}const b0={};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(" "))b0[r]=n;function Dl(n){const a=n.split(/[\\/]/).pop()??"",r=a.lastIndexOf(".");return r>0?b0[a.slice(r+1).toLowerCase()]??"file":"file"}const y0={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 dc(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">${y0[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:y0[n]}})}const za=["......k.....",".....kok....",".....kook...","..k.koook...",".kokoooook..",".kooooooook.","kooyyyyyyook","koyyeyyeyyok","koyyeyyeyyok","koyyyyyyyyok",".kooyyyyook.","..kkkkkkkk.."],jn=16,Bx="#40261a",Ha={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],Ol={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...."])}},lS=Object.keys(Ol),aS=Object.keys(Ha);function k0(n){if(n==="custom")return{prop:"custom",color:"orange"};if(n.startsWith("custom:")){const f=n.slice(7);return Object.hasOwn(Ha,f)?{prop:"custom",color:f}:void 0}const[a,r,...o]=n.split(":");if(o.length||!Object.hasOwn(Ol,a))return;const c=a;return r===void 0?{prop:c,color:Ol[c].color}:Object.hasOwn(Ha,r)?{prop:c,color:r}:void 0}function vf(n){return n==="orange"?"custom":`custom:${n}`}const iS=/^#[0-9a-f]{6}$/;function rS(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,x]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 x!="string"||!iS.test(x))return{ok:!1,error:`pal[${p}] 要是 #rrggbb 格式的颜色,收到「${String(x)}」`}}const f=a.join("");for(const p of new Set([...f].filter(x=>x!==".")))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-za.length;for(let p=0;p<za.length;p++)for(let x=0;x<za[p].length;x++){if(za[p][x]!=="e")continue;const b=a[m+p]?.[o+x];if(b&&b!==".")return{ok:!1,error:`art 第 ${m+p+1} 行第 ${o+x+1} 列会盖住火苗的眼睛,把图案挪开(或调小 dx)`}}return{ok:!0,prop:{art:a,pal:r,dx:o}}}function xf(n,a){return a===Ol[n].color?n:`${n}:${a}`}function oS(n,a){const r=k0(n)??{prop:"hob",color:"slate"},o=r.prop==="custom"&&a?rS(a):void 0,c=r.prop==="custom"?o?.ok?o.prop:Ol.hob:Ol[r.prop],f=Ha[r.color],h=[...Array(jn-za.length).fill(""),...za].map((b,j)=>{const T=b?`${".".repeat(c.dx)}${b}`.padEnd(jn,"."):".".repeat(jn),S=c.art[j]??"";return[...T].map((C,M)=>S[M]&&S[M]!=="."?S[M]:C).join("")});let[m,p,x,v]=[jn,jn,0,0];return h.forEach((b,j)=>[...b].forEach((T,S)=>{T!=="."&&([m,p,x,v]=[Math.min(m,S),Math.min(p,j),Math.max(x,S+1),Math.max(v,j+1)])})),{rows:h,pal:{k:Bx,e:Bx,o:f.o,y:f.y,...c.pal},bg:f.bg,offset:[(m+x-jn)/2,(p+v-jn)/2]}}function cS(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 qx({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 uS={busy:"正在工作",ask:"等你确认",stuck:"受阻",done:"已完成,未读"},dS=4,fS=7;function rt({sprite:n,prop:a,size:r,title:o,onClick:c,motion:f,mark:h,free:m,slot:p}){const x=y.useRef(h);h&&(x.current=h);const v=h??x.current,b=oS(n,a),j=f?cS(b):void 0,T=f==="peek"?`${(p??0)%fS*dS}s`:f?`${-([...n].reduce((S,C)=>(S*31+C.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:T?{"--eye-delay":T}:void 0,children:j?l.jsxs(l.Fragment,{children:[l.jsx(qx,{art:{...b,rows:j.body}}),l.jsx("g",{className:"av-eyes",children:l.jsx("g",{className:"av-blink",children:j.eyes.map(([S,C])=>l.jsx("rect",{x:S,y:C,width:1.02,height:1.02,fill:b.pal.e},`${S}-${C}`))})})]}):l.jsx(qx,{art:b})}),l.jsx("span",{className:`av-mark${h?" present":""}${v?` ${v}`:""}`,"aria-label":h?uS[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 ir=Db();async function oh(n){try{const a=navigator.clipboard;return a?.writeText?(await a.writeText(n),!0):!1}catch{return!1}}const hS="modulepreload",mS=function(n){return"/"+n},Ix={},rr=function(a,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(x){return Promise.all(x.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(x=>{if(x=mS(x),x in Ix)return;Ix[x]=!0;const v=x.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${b}`))return;const j=document.createElement("link");if(j.rel=v?"stylesheet":hS,v||(j.as="script"),j.crossOrigin="",j.href=x,p&&j.setAttribute("nonce",p),document.head.appendChild(j),v)return new Promise((T,S)=>{j.addEventListener("load",T),j.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${x}`)))})}))}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 ch(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $l=ch();function j0(n){$l=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 Se(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 w0=((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}}(?:</?(?:${cr})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:Nl(n=>new RegExp(`^ {0,${n}}>`))},pS=/^(?:[ \t]*(?:\n|$))+/,gS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,vS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,or=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xS=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,uh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,N0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,S0=Se(N0).replace(/bull/g,uh).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(),bS=Se(N0).replace(/bull/g,uh).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(),dh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,yS=/^[^\n]+/,fh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,kS=Se(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",fh).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),jS=Se(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,uh).getRegex(),cr="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",hh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,wS=Se("^ {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",hh).replace("tag",cr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),T0=n=>Se(dh).replace("hr",or).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",cr).getRegex(),NS=T0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),SS=T0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),TS=Se(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",SS).getRegex(),mh={blockquote:TS,code:gS,def:kS,fences:vS,heading:xS,hr:or,html:wS,lheading:S0,list:jS,newline:pS,paragraph:NS,table:Tl,text:yS},Yx=Se("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",or).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",cr).getRegex(),CS={...mh,lheading:bS,table:Yx,paragraph:Se(dh).replace("hr",or).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Yx).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",cr).getRegex()},ES={...mh,html:Se(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",hh).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:Se(dh).replace("hr",or).replace("heading",` *#{1,6} *[^
104
+ ]`).replace("lheading",S0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},AS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,MS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,C0=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,zS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Wn=/[\p{P}\p{S}]/u,Ga=/[\s\p{P}\p{S}]/u,ur=/[^\s\p{P}\p{S}]/u,OS=Se(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ga).getRegex(),_S=/[\p{Pi}\p{Ps}"']/u,E0=/(?!~)[\p{P}\p{S}]/u,RS=/(?!~)[\s\p{P}\p{S}]/u,DS=/(?:[^\s\p{P}\p{S}]|~)/u,$S=Se(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",w0?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),A0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,US=Se(A0,"u").replace(/punct/g,Wn).getRegex(),LS=Se(A0,"u").replace(/punct/g,E0).getRegex(),HS=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,BS=Se(HS,"u").replace(/openQuote/g,_S).replace(/punct/g,Wn).getRegex(),M0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qS=Se(M0,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Ga).replace(/punct/g,Wn).getRegex(),IS=Se(M0,"gu").replace(/notPunctSpace/g,DS).replace(/punctSpace/g,RS).replace(/punct/g,E0).getRegex(),YS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",GS=Se(YS,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Ga).replace(/punct/g,Wn).getRegex(),KS=Se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Ga).replace(/punct/g,Wn).getRegex(),VS="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",XS=Se(VS,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Ga).replace(/punct/g,Wn).getRegex(),ZS=Se(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Wn).getRegex(),QS="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",JS=Se(QS,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Ga).replace(/punct/g,Wn).getRegex(),PS=Se(/\\(punct)/,"gu").replace(/punct/g,Wn).getRegex(),FS=Se(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,Wn).getRegex(),WS=Se(/^<(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(),e2=Se(hh).replace("(?:-->|$)","-->").getRegex(),t2=Se("^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",e2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),z0=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,fc=Se(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",z0).getRegex(),n2=Se(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",fc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),s2=Se(/^!?\[(label)\]\[(ref)\]/).replace("label",fc).replace("ref",fh).getRegex(),l2=Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",fh).getRegex(),Gx=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,a2=Se(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",z0).getRegex(),i2=Se("reflink|nolink(?!\\()","g").replace("reflink",Se(/^!?\[(label)\]\[(ref)\]/).replace("label",a2).replace("ref",Gx).getRegex()).replace("nolink",Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",Gx).getRegex()).getRegex(),Kx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,r2=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,o2=Se(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,r2).getRegex(),ph={_backpedal:Tl,anyPunctuation:PS,anyPunctuationOutsideCode:FS,autolink:WS,blockSkip:$S,br:C0,code:MS,del:Tl,delLDelim:Tl,delRDelim:Tl,emStrongLDelim:US,emStrongRDelimAst:qS,emStrongRDelimUnd:KS,escape:AS,link:n2,nolink:l2,punctuation:OS,reflink:s2,reflinkSearch:i2,tag:t2,text:zS,url:Tl},c2={...ph,emStrongLDelim:BS,emStrongRDelimAst:GS,emStrongRDelimUnd:XS,link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",fc).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fc).getRegex()},_f={...ph,emStrongRDelimAst:IS,emStrongLDelim:LS,delLDelim:ZS,delRDelim:JS,url:Se(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",o2).replace("protocol",Kx).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:Se(/^(?:[^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",Kx).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",w0?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},u2={..._f,br:Se(C0).replace("{2,}","*").getRegex(),text:Se(_f.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Xo={normal:mh,gfm:CS,pedantic:ES},Ii={normal:ph,gfm:_f,breaks:u2,pedantic:c2},d2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Vx=n=>d2[n];function rn(n,a){if(a){if(mt.escapeTest.test(n))return n.replace(mt.escapeReplace,Vx)}else if(mt.escapeTestNoEncode.test(n))return n.replace(mt.escapeReplaceNoEncode,Vx);return n}function f2(n){return mt.numericCharacterReference.test(n)?n.replace(mt.numericCharacterReferenceOrAmpersand,(a,r,o)=>{if(r===void 0&&o===void 0)return"&amp;";let c=r===void 0?Number.parseInt(o,16):Number.parseInt(r,10);return c===0||c>1114111||c>=55296&&c<=57343?"�":c===38?"&amp;":String.fromCodePoint(c)}):n}function Xx(n){try{n=encodeURI(n).replace(mt.percentDecode,"%")}catch{return null}return n}function Zx(n,a){let r=n.replace(mt.findPipe,(f,h,m)=>{let p=!1,x=h;for(;--x>=0&&m[x]==="\\";)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 gs(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 Qx(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 hc(n){return n.trim().replace(mt.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function Jx(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 Ba=new WeakMap;function gh(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 h2(n,a){let r=gh(a),o=Ba.get(n);o?o.push(r):Ba.set(n,[r])}function m2(n){let a=Ba.get(n);a&&(a.pop(),a.length===0&&Ba.delete(n))}function p2(n,a,r){let o=Ba.get(n)?.at(-1);return o&&o.maskedSrc===a?o.lastPossibleEmStrongCloserIndex[r]:gh(a).lastPossibleEmStrongCloserIndex[r]}function g2(n,a){let r=Ba.get(n)?.at(-1);return r&&r.maskedSrc===a?r.lastPossibleDelCloserIndex:gh(a).lastPossibleDelCloserIndex}function Zo(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 Px(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)==="!",x=o.state.inLink,v=o.state.linkEmitted,b=o.state.inRawBlock;o.state.inLink=!0,o.state.linkEmitted=!1;let j=o.inlineTokens(m),T=o.state.linkEmitted;if(o.state.linkEmitted=v,o.state.inLink=x,!p){if(T){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 v2(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 Fx(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 Ra=class{options;rules;lexer;constructor(a){this.options=a||$l}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]:Qx(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=v2(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=gs(o,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceTabChar.test(c))&&(o=c.trim())}return{type:"heading",raw:gs(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:gs(r[0],`
112
+ `)}}blockquote(a){let r=this.rules.block.blockquote.exec(a);if(r){let o=gs(r[0],`
113
+ `).split(`
114
+ `),c="",f="",h=[];for(;o.length>0;){let m=!1,p=[],x;for(x=0;x<o.length;x++)if(this.rules.other.blockquoteStart.test(o[x]))p.push(o[x]),m=!0;else if(!m)p.push(o[x]);else break;o=o.slice(x);let v=p.join(`
115
+ `),b=v.replace(this.rules.other.blockquoteMarkerWhitespace,(S,C,M)=>C+Zo(M,C.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 T=h.at(-1);if(T?.type==="code"||T?.type==="heading"||T?.type==="hr"||T?.type==="html"||T?.type==="table")break;if(T?.type==="blockquote"){let S=T,C=o.join(`
119
+ `),M=S.raw+`
120
+ `+C.replace(this.rules.other.blockquoteSetextReplace2,""),A=this.blockquote(M);h[h.length-1]=A;let U=M.substring(A.raw.length).replace(/^\n/,""),$=U?U.split(`
121
+ `).length:0,k=$?o.slice(0,-$):o;if(k.length>0&&(c=`${c}
122
+ ${k.join(`
123
+ `)}`),f=f.substring(0,f.length-S.text.length)+A.text,o=o.slice(k.length),o.length>0&&this.rules.other.blockquoteStart.test(o[0]))continue;break}else if(T?.type==="list"){let S=T,C=S.raw+`
124
+ `+o.join(`
125
+ `),M=this.list(C);h[h.length-1]=M;let A=M.raw.length>S.raw.length?C.slice(S.raw.length+1,M.raw.length).split(`
126
+ `).length:0;if(A>0){let U=o.slice(0,A).join(`
127
+ `);c=`${c}
128
+ ${U}`,f=`${f}
129
+ ${U}`}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),x=!1;for(;a;){let b=!1,j="";if(!(r=p.exec(a))||this.rules.block.hr.test(a))break;let T=c();a=a.substring(r[0].length);let S=r[2].split(`
130
+ `,1)[0],C=r[1].length,M=this.options.pedantic?Zo(S,C):S.replace(this.rules.other.leadingSpaceTab,N=>Zo(N,C)),A=a.split(`
131
+ `,1)[0],U=!M.trim(),$=0;if(this.options.pedantic?($=2,j=M.trimStart()):U?$=C+1:($=M.search(this.rules.other.nonSpaceChar),$=$>4?1:$,j=M.slice($),$+=C),U&&this.rules.other.blankLine.test(A)&&(a=a.substring(A.length+1),b=!0),!b){let N=this.rules.other.nextBulletRegex($),E=this.rules.other.hrRegex($),_=this.rules.other.fencesBeginRegex($),z=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex($):this.rules.other.headingBeginRegex($),V=this.rules.other.htmlBeginRegex($),ne=this.rules.other.blockquoteBeginRegex($);for(;a;){let ee=a.split(`
132
+ `,1)[0],Ee;if(A=ee,this.options.pedantic?(A=A.replace(this.rules.other.listReplaceNesting," "),Ee=A):Ee=A.replace(this.rules.other.leadingSpaceTab,he=>Zo(he)),_.test(A)||z.test(A)||V.test(A)||ne.test(A)||N.test(A)||E.test(A))break;if(Ee.search(this.rules.other.nonSpaceChar)>=$||!A.trim())j+=`
133
+ `+Ee.slice($);else{if(U||M.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(M)||z.test(M)||V.test(M)||E.test(M))break;let he=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(A)&&this.rules.block.lheading.test(`${M}
134
+ ${A}`)?` ${Ee.replace(/^ {0,3}/,"")}`:A;j+=`
135
+ `+he}U=!A.trim(),a=a.substring(ee.length+1),M=Ee.slice($)}}let k=o.slice(T,c());m.loose||(x?m.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(x=!0)),m.items.push({type:"list_item",raw:k,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"),T=j.length>0&&j.some(S=>this.rules.other.anyLine.test(S.raw));m.loose=T}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 T=this.rules.other.listTaskCheckbox.exec(b.raw);if(T){let S={type:"checkbox",raw:T[0]+" ",checked:T[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=Qx(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])&&Jx(r[2],"()")!==-1)return;let o=hc(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:gs(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=Zx(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:gs(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(Zx(m,h.header.length).map((p,x)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:h.align[x]})));return h}}lheading(a){let r=this.rules.block.lheading.exec(a);if(r){let o=r[1].trim();return{type:"heading",raw:gs(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&&Fx(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=gs(c.slice(0,-1),"\\");if((c.length-p.length)%2===0)return}else{let p=Jx(r[2],"()");if(p===-2)return;if(p>-1){let x=(r[0].indexOf("!")===0?5:4)+r[1].length+p;r[2]=r[2].substring(0,p),r[0]=r[0].substring(0,x).trim(),r[3]=""}}let f=gs(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)),Px(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&&Fx(a,o[1],c,this.rules))return;let f=r[hc(o[2]||o[1])];if(!f){let h=o[0].charAt(0);return{type:"text",raw:h,text:h}}return Px(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 x=[...r.slice(Math.max(0,p-2),p)].at(-1)??"",v=x==="*"||x==="_"||!!this.rules.inline.punctuation.exec(x);p<m&&(o=x);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 T=[...c[0]].length-1,S,C,M=T,A=0,U=m-p+T,$=!this.options.pedantic&&!!x.trim()&&(!!j||f==="*"&&!v);if(f!=="*"&&f!=="_")return;let k=f==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,N=p2(this,r,f),E=r.length-a.length+T;if(N<E)return;r=r.slice(-1*a.length+T);let _=N-E;for(k.lastIndex=0;(c=k.exec(r))!==null&&!(c.index>_);){if(S=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!S)continue;if(C=[...S].length,c[3]||c[4]){M+=C;continue}else if(c[5]||c[6]||$){if(h&&(c[5]||c[6]))break;if(U%3&&!((U+C)%3)){A+=C;continue}}if(M-=C,M>0)continue;C=Math.min(C,C+M+A);let z=[...c[0]][0].length,V=a.slice(0,T+c.index+z+C);if(Math.min(T,C)%2){let ee=V.slice(1,-1);return{type:"em",raw:V,text:ee,tokens:this.lexer.inlineTokens(ee)}}let ne=V.slice(2,-2);return{type:"strong",raw:V,text:ne,tokens:this.lexer.inlineTokens(ne)}}}}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,x=this.rules.inline.delRDelim,v=g2(this,r),b=r.length-a.length+f;if(v<b)return;r=r.slice(-1*a.length+f);let j=v-b;for(x.lastIndex=0;(c=x.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 T=[...c[0]][0].length,S=a.slice(0,f+c.index+T+m),C=S.slice(f,-f);return{type:"del",raw:S,text:C,tokens:this.lexer.inlineTokens(C)}}}}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]:f2(r[0]),escaped:o}}}},Dn=class Rf{tokens;options;state;inlineQueue;tokenizer;constructor(a){this.tokens=[],this.tokens.links=Object.create(null),this.options=a||$l,this.options.tokenizer=this.options.tokenizer||new Ra,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:Xo.normal,inline:Ii.normal};this.options.pedantic?(r.block=Xo.pedantic,r.inline=Ii.pedantic):this.options.gfm&&(r.block=Xo.gfm,this.options.breaks?r.inline=Ii.breaks:r.inline=Ii.gfm),this.tokenizer.rules=r}static get rules(){return{block:Xo,inline:Ii}}static lex(a,r){return new Rf(r).lex(a)}static lexInline(a,r){return new Rf(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),x;this.options.extensions.startBlock.forEach(v=>{x=v.call({lexer:this},p),typeof x=="number"&&x>=0&&(m=Math.min(m,x))}),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,hc(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!==Ra.prototype.emStrong||this.tokenizer.del!==Ra.prototype.del?this.#n(a):a;h2(this.tokenizer,o);try{return this.#t(a,o,r)}finally{m2(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(x=>(m=x.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 x=o.at(-1);m.type==="text"&&x?.type==="text"?(x.raw+=m.raw,x.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 x=1/0,v=a.slice(1),b;this.options.extensions.startInline.forEach(j=>{b=j.call({lexer:this},v),typeof b=="number"&&b>=0&&(x=Math.min(x,b))}),x<1/0&&x>=0&&(p=a.substring(0,x+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 x=o.at(-1);x?.type==="text"?(x.raw+=m.raw,x.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,hc(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)}},mc=class{options;parser;constructor(n){this.options=n||$l}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=Xx(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=Xx(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)}},vh=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 Df{options;renderer;textRenderer;constructor(a){this.options=a||$l,this.options.renderer=this.options.renderer||new mc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new vh,this.textRenderer.parser=this}static parse(a,r){return new Df(r).parse(a)}static parseInline(a,r){return new Df(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}},Yi=class{options;block;constructor(n){this.options=n||$l}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 Qs(n,a){if(Array.isArray(a))for(let r=0;r<a.length;r++)n.push(a[r]);else n.push(a)}var O0=class{defaults=ch();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$n;Renderer=mc;TextRenderer=vh;Lexer=Dn;Tokenizer=Ra;Hooks=Yi;constructor(...n){this.use(...n)}walkTokens(n,a){let r=[];for(let o of n)switch(Qs(r,a.call(this,o)),o.type){case"table":{let c=o;for(let f of c.header)Qs(r,this.walkTokens(f.tokens,a));for(let f of c.rows)for(let h of f)Qs(r,this.walkTokens(h.tokens,a));break}case"list":{let c=o;Qs(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);Qs(r,this.walkTokens(h,a))}):c.tokens&&Qs(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 mc(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]=(...x)=>{let v=m.apply(c,x);return v===!1&&(v=p.apply(c,x)),v===!1?"":v??""}}o.renderer=c}if(r.tokenizer){let c=this.defaults.tokenizer||new Ra(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]=(...x)=>{let v=m.apply(c,x);return v===!1&&(v=p.apply(c,x)),v}}o.tokenizer=c}if(r.hooks){let c=this.defaults.hooks||new Yi;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];Yi.passThroughHooks.has(f)?c[h]=x=>{if(c.options.async&&Yi.passThroughHooksRespectAsync.has(f))return(async()=>{let b=await m.call(c,x);return p.call(c,b)})();let v=m.call(c,x);return p.call(c,v)}:c[h]=(...x)=>{if(c.options.async)return(async()=>{let b=await m.apply(c,x);return b===!1&&(b=await p.apply(c,x)),b})();let v=m.apply(c,x);return v===!1&&(v=p.apply(c,x)),v}}o.hooks=c}if(r.walkTokens){let c=this.defaults.walkTokens,f=r.walkTokens;o.walkTokens=function(h){let m=[];return Qs(m,f.call(this,h)),c&&Qs(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 x=await(c.hooks?await c.hooks.provideParser(n):n?$n.parse:$n.parseInline)(p,c);return c.hooks?await c.hooks.postprocess(x):x})().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}}},_l=new O0;function Pe(n,a){return _l.parse(n,a)}Pe.options=Pe.setOptions=function(n){return _l.setOptions(n),Pe.defaults=_l.defaults,j0(Pe.defaults),Pe};Pe.getDefaults=ch;Pe.defaults=$l;function x2(...n){return _l.use(...n),Pe.defaults=_l.defaults,j0(Pe.defaults),Pe}Pe.use=x2;Pe.walkTokens=function(n,a){return _l.walkTokens(n,a)};Pe.parseInline=_l.parseInline;Pe.Parser=$n;Pe.parser=$n.parse;Pe.Renderer=mc;Pe.TextRenderer=vh;Pe.Lexer=Dn;Pe.lexer=Dn.lex;Pe.Tokenizer=Ra;Pe.Hooks=Yi;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}",qa=new RegExp(`[${Ln}]`,"u"),b2=new RegExp(`^((?![*_])[\\s\\p{P}\\p{S}${Ln}])`,"u");function _0(n,a,r){return new RegExp(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)${n}(\\*+)(?=[\\s]|$)|${r}(\\*+)(?!\\*)(?=${a}|$)|(?!\\*)${a}(\\*+)(?=${r})|[\\s](\\*+)(?!\\*)(?=${n})|(?!\\*)${n}(\\*+)(?!\\*)(?=${n})|${r}(\\*+)(?=${r})`,"gu")}function y2(n,a,r){return new RegExp(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)${n}(_+)(?=[\\s]|$)|${r}(_+)(?!_)(?=${a}|$)|(?!_)${a}(_+)(?=${r})|[\\s](_+)(?!_)(?=${n})|(?!_)${n}(_+)(?!_)(?=${n})`,"gu")}function k2(n,a,r){return new RegExp(`^[^~]+(?=[^~])|(?!~)${n}(~~?)(?=[\\s]|$)|${r}(~~?)(?!~)(?=${a}|$)|(?!~)${a}(~~?)(?=${r})|[\\s](~~?)(?!~)(?=${n})|(?!~)${n}(~~?)(?!~)(?=${n})|${r}(~~?)(?=${r})`,"gu")}const R0=`[\\p{P}\\p{S}${Ln}]`,D0=`[\\s\\p{P}\\p{S}${Ln}]`,$0=`[^\\s\\p{P}\\p{S}${Ln}]`,j2=`(?![*_])[\\p{P}\\p{S}${Ln}]`,w2=`(?![*_])[\\s\\p{P}\\p{S}${Ln}]`,N2=`(?:[^\\s\\p{P}\\p{S}${Ln}]|[*_])`,S2=`(?!~)[\\p{P}\\p{S}${Ln}]`,T2=`(?!~)[\\s\\p{P}\\p{S}${Ln}]`,C2=`(?:[^\\s\\p{P}\\p{S}${Ln}]|~)`,E2=_0(R0,D0,$0),A2=_0(S2,T2,C2),M2=y2(R0,D0,$0),Wx=k2(j2,w2,N2);function eb(n,a,r){let o=b2.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=qa.test(String.fromCodePoint(m)))}else o=qa.test(String.fromCharCode(h))}}return o}function tb(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 qa.test(r)||qa.test(c)}function xh(n){return n.length>=5}function z2(n){return!!(n[1]||n[2]||n[3]||n[4])}function O2(n){return xh(n)?!!n[4]:!!n[3]}function _2(n){return xh(n)?n[1]||n[3]||"":n[1]||n[2]||""}function Qo(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 R2(){return{tokenizer:{emStrong(n,a,r=""){const{rules:o}=this,c=o.inline.emStrongLDelim.exec(n);if(!c)return!1;const f=xh(c);if(f&&!z2(c))return;if(O2(c)&&r.match(o.other.unicodeAlphaNumeric))return!1;const h=_2(c),m=eb(r,a,n);if(!h||!r||o.inline.punctuation.exec(r)||m||qa.test(h)){const p=Qo(c[0])-1;let x,v,b=p,j=0;const T=f&&r===c[0][0],S=o.inline.emStrongRDelimAst.source.includes("(?!~)");let C;c[0][0]==="*"?C=S?A2:E2:C=M2,C.lastIndex=0;const M=a.slice(-1*n.length+p);let A;for(;(A=C.exec(M))!=null;){if(x=A[1]||A[2]||A[3]||A[4]||A[5]||A[6],!x)continue;v=Qo(x);const U=tb(A,M),$=!!(A[3]||A[4]),k=!!(A[5]||A[6]);if($&&!U){b+=v;continue}if(k||U){if(p%3&&!((p+v)%3)){j+=v;continue}if(T&&k)break}if(b-=v,b>0)continue;v=Math.min(v,v+b+j);const N=A[0].codePointAt(0)>65535?2:1,E=n.slice(0,p+A.index+N+v);if(Math.min(p,v)%2){const z=E.slice(1,-1);return{type:"em",raw:E,text:z,tokens:this.lexer.inlineTokens(z)}}const _=E.slice(2,-2);return{type:"strong",raw:E,text:_,tokens:this.lexer.inlineTokens(_)}}}},del(n,a,r=""){const{rules:o}=this,c=o.inline.delLDelim.exec(n);if(!c)return!1;const f=c[1]||"",h=eb(r,a,n);if(!f||!r||o.inline.punctuation.exec(r)||h||qa.test(f)){const m=Qo(c[0])-1;let p,x,v=m;Wx.lastIndex=0;const b=a.slice(-1*n.length+m);let j;for(;(j=Wx.exec(b))!=null;){if(p=j[1]||j[2]||j[3]||j[4]||j[5]||j[6],!p||(x=Qo(p),x!==m))continue;const T=tb(j,b);if((j[3]||j[4])&&!T){v+=x;continue}if(v-=x,v>0)continue;x=Math.min(x,x+v);const S=j[0].codePointAt(0)>65535?2:1,C=n.slice(0,m+j.index+S+x),M=C.slice(m,-m);return{type:"del",raw:C,text:M,tokens:this.lexer.inlineTokens(M)}}}}}}}function Zi(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let $f,D2;function $2(){return D2??=rr(()=>import("./math-weKGDUmL.js"),__vite__mapDeps([0,1])).then(n=>{$f=n.default})}function U2(n){let a=!1;return er.walkTokens(er.lexer(n),r=>{(r.type==="inlineMath"||r.type==="displayMath")&&(a=!0)}),a}function nb(n,a,r){if(!$f)return Zi(r);try{return $f.renderToString(n,{displayMode:a,throwOnError:!0,trust:!1})}catch{return Zi(r)}}const er=new O0({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">${nb(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 nb(String(n.text),!1,n.raw)}}],renderer:{html(n){return Zi(n.text??"")},code(n){const a=n.lang?.trim().split(/\s+/)[0]??"";return`<div class="code-block">${a?`<div class="code-head">${Zi(a)}</div>`:""}<button type="button" class="code-copy" aria-label="复制代码" title="复制代码">${dc("copy",15)}</button><pre><code>${Zi(n.text)}
174
+ </code></pre></div>`}}});er.use(R2());const L2=/^(https?:|mailto:|\/|#|\.)/i;function H2(n){return er.parse(n,{async:!1,gfm:!0,breaks:!0}).replace(/<a href="([^"]*)"/g,(r,o)=>qb(o)?`<a class="knowledge-citation" href="${o}"`:L2.test(o.trim())?`<a target="_blank" rel="noreferrer" href="${o}"`:"<a").replace(/(<a class="knowledge-citation"[^>]*>)/g,`$1${dc("doc",13)}`).replace(/[((]\s*(<a class="knowledge-citation"[^>]*>[\s\S]*?<\/a>)\s*[))]/g,"$1")}function B2(n){const a=[];for(const o of er.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 Uf=/[\p{L}\p{N}]/u;function q2(n){const a=n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s*[#>\-*]+\s*/gm,"");return Array.from(a).filter(r=>Uf.test(r)).join("")}function I2(n,a){const r=[];let o="";for(const x of n)for(let v=0;v<x.data.length;){const b=String.fromCodePoint(x.data.codePointAt(v));if(Uf.test(b)){o+=b;for(let j=0;j<b.length;j++)r.push({node:x,offset:v,end:v+b.length})}v+=b.length}const c=Array.from(a).filter(x=>Uf.test(x)).join("");if(!c)return null;let f=o.indexOf(c),h=f+c.length;if(f<0){const x=Array.from(c),v=x.slice(0,40).join(""),b=x.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 Y2(n,a){try{const r=await dN(n,a);Ct(r.entry.path,r.entry.name,{find:r.chunk?q2(r.chunk.text):void 0,page:r.chunk?.page})}catch(r){Ya(r instanceof Le&&r.status===404?"这份资料已经删除":`无法打开资料:${r instanceof Error?r.message:String(r)}`)}}function Ia({text:n,className:a,streaming:r,onMathRendered:o}){const[c,f]=y.useState(0);return y.useEffect(()=>{let h=!0;return U2(n)&&$2().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&&qb(m.getAttribute("href")??"");if(p){h.preventDefault(),h.stopPropagation(),Y2(p.entryId,p.chunk);return}const x=h.target.closest(".code-copy");if(!x)return;h.stopPropagation();const v=x.closest(".code-block")?.querySelector("code")?.textContent??"";oh(v.endsWith(`
175
+ `)?v.slice(0,-1):v).then(b=>{if(!b){Ya("复制失败:浏览器不允许写入剪贴板");return}x.innerHTML=dc("check",15),x.setAttribute("aria-label","已复制"),window.setTimeout(()=>{x.innerHTML=dc("copy",15),x.setAttribute("aria-label","复制代码")},1500)})},dangerouslySetInnerHTML:{__html:H2(n)+(r?'<span class="cur"></span>':"")}})}const G2={".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 K2(n){const a=n.lastIndexOf(".");return a>0?n.slice(a).toLowerCase():""}function V2(n){return G2[K2(n)]}function X2(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 Ea=null;function Z2({path:n,name:a,fallback:r,itemId:o}){const c=y.useRef(null),[f,h]=y.useState(null),[m,p]=y.useState(0),[x,v]=y.useState(0),[b,j]=y.useState(!0),[T,S]=y.useState(1);y.useEffect(()=>{const A=new AbortController;let U;return(async()=>{try{const $=await fetch(Lt(n),{signal:A.signal});if(!$.ok||Number($.headers.get("content-length"))>20*1024*1024)return;const k=$.body?.getReader();if(!k)return;const N=[];let E=0;for(;;){const{done:ne,value:ee}=await k.read();if(ne)break;if(E+=ee.byteLength,E>20*1024*1024){await k.cancel();return}N.push(ee)}const _=new Uint8Array(E);let z=0;for(const ne of N)_.set(ne,z),z+=ne.byteLength;U=new AudioContext;const V=await U.decodeAudioData(_.buffer);A.signal.aborted||h(X2(V.getChannelData(0),50))}catch{}finally{U&&U.close()}})(),()=>{A.abort(),Ea===c.current&&(Ea=null)}},[n]);const C=x?Math.min(1,m/x):0,M=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=>{Ea&&Ea!==A.currentTarget&&Ea.pause(),Ea=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,U)=>l.jsx("i",{className:U/f.length<C?"played":"",style:{height:`${Math.max(12,A*100)}%`}},U))}):l.jsx("div",{className:"audio-line",children:l.jsx("i",{style:{width:`${C*100}%`}})}),l.jsx("input",{type:"range","aria-label":"播放进度",min:0,max:x||0,step:"0.01",value:Math.min(m,x||0),onChange:A=>{c.current&&(c.current.currentTime=Number(A.target.value))}})]})]}),l.jsx("span",{className:"audio-time",children:M(x||0)}),l.jsxs("button",{className:"audio-rate",onClick:()=>{const A=T===1?1.5:T===1.5?2:1;S(A),c.current&&(c.current.playbackRate=A)},children:[T,"×"]})]})}function sb({path:n,name:a,fallback:r,itemId:o}){const[c,f]=y.useState(!1);if(c)return r;const h=V2(n);return h==="audio"?l.jsx(Z2,{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 Aa=13,Q2=2.7,lb=700;function J2(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 P2(n){return Math.min(.96,1-Math.exp(-n/30))}function F2(n){return n<.2?"正在构思":n<.55?"正在勾勒草图":n<.85?"正在上色":"正在润色细节"}function W2(){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 eT(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 bf=[3500,7500];function tT(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 nT({status:n,prompt:a,size:r,path:o,error:c,startedAt:f,fresh:h,itemId:m}){const p=y.useRef(null),[x,v]=y.useState(n==="done"?"shown":"live"),[b,j]=y.useState(()=>Date.now()),T=Date.parse(f)||Date.now(),S=y.useRef(x);S.current=x,y.useEffect(()=>{if(n!=="pending")return;const A=setInterval(()=>j(Date.now()),1e3);return()=>clearInterval(A)},[n]),y.useEffect(()=>{if(x!=="reveal")return;const A=setTimeout(()=>v("shown"),lb+200);return()=>clearTimeout(A)},[x]),y.useEffect(()=>{const A=p.current;if(!A||x==="shown")return;const U=A.getContext("2d");if(!U)return;const $=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let k=0,N=!0,E=0,_=[];const z=W2();let V=[],ne=0,ee=0;const Ee=new IntersectionObserver(([we])=>{N=we.isIntersecting,N&&!k&&(k=requestAnimationFrame(he))});Ee.observe(A);function he(we){k=0;const _e=Math.min(2,window.devicePixelRatio||1),{width:se,height:ve}=A.getBoundingClientRect();(A.width!==Math.round(se*_e)||A.height!==Math.round(ve*_e))&&(A.width=Math.round(se*_e),A.height=Math.round(ve*_e)),U.setTransform(_e,0,0,_e,0,0),U.clearRect(0,0,se,ve);const me=Math.max(1,Math.floor(se/Aa)),ze=Math.max(1,Math.floor(ve/Aa)),Ae=(se-(me-1)*Aa)/2,bt=(ve-(ze-1)*Aa)/2;_.length!==me*ze&&(_=Array.from({length:me*ze},()=>Math.random()));const Ot=document.documentElement.classList.contains("dark");S.current==="reveal"&&!E&&(E=we);const Et=E?Math.min(1,(we-E)/lb):0,D=n==="pending"&&!$,J=ee?Math.min(.1,(we-ee)/1e3):0;if(ee=we,D){if(ne||(ne=we+1200+Math.random()*1500),we>ne){const ae=Math.random()<.5;V.push({kind:ae?"ring":"swell",x:.2+Math.random()*.6,y:.2+Math.random()*.6,at:we,dur:ae?2600:1800}),ne=we+bf[0]+Math.random()*(bf[1]-bf[0])}V=V.filter(ae=>we-ae.at<ae.dur);for(const[ae,le]of z.entries()){we>le.next&&(eT(le,z[1-ae]),le.next=we+3e3+Math.random()*2500);const ce=1-Math.exp(-J*.7);le.x+=(le.tx-le.x)*ce,le.y+=(le.ty-le.y)*ce}}U.fillStyle=Ot?"rgb(232,232,230)":"rgb(38,38,36)";const W=se/ve,re=we/1e3;for(let ae=0;ae<ze;ae++)for(let le=0;le<me;le++){const ce=_[ae*me+le],xe=me>1?le/(me-1):.5,st=ze>1?ae/(ze-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 z){const En=(xe-_t.x)*W,Ws=st-_t.y;Hn+=_t.gain*Math.exp(-(En*En+Ws*Ws)/(_t.r*_t.r))}for(const _t of V)Hn+=tT(_t,we,(xe-_t.x)*W,st-_t.y)}const un=D?Math.sin(re*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+(Q2-.45)*ot)*(1-Ge);Zt<.3||(U.globalAlpha=(.16+.84*ot)*(1-Ge),U.beginPath(),U.arc(Ae+le*Aa,bt+ae*Aa,Zt,0,Math.PI*2),U.fill())}U.globalAlpha=1,(S.current==="reveal"?Et<1:D)&&N&&(k=requestAnimationFrame(he))}return k=requestAnimationFrame(he),()=>{cancelAnimationFrame(k),Ee.disconnect()}},[x,n,T]);const C=Math.max(0,Math.floor((b-T)/1e3)),M=P2(C);return l.jsxs("div",{className:`igen ${x}${n==="failed"?" failed":""}${h?" enter":""}`,"data-item-id":m,children:[x==="live"&&n!=="failed"?l.jsx("div",{className:"igen-stage",role:"status",title:a,children:F2(M)}):null,l.jsxs("div",{className:"igen-frame",style:{aspectRatio:String(J2(r))},children:[o?l.jsx("button",{className:"igen-img",onClick:()=>Ct(o),title:a,tabIndex:x==="live"?-1:0,children:l.jsx("img",{src:Rl(o),alt:a,onLoad:()=>{S.current==="live"&&v("reveal")}})}):null,x==="shown"?null:l.jsx("canvas",{ref:p,"aria-hidden":"true"}),x==="live"&&n==="pending"?l.jsxs("span",{className:"igen-pct",children:[Math.floor(M*100),"%"]}):null]}),n==="failed"&&x==="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 sT=50,lT=110;function aT({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)/lT),x=v=>{const b=h.current;h.current=null,b&&(b.moved?Math.abs(c)>sT&&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:()=>x(!0),onPointerCancel:()=>x(!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:Rl(v),alt:"",draggable:!1,style:S},v)})})}const U0=["日","一","二","三","四","五","六"];function Gi(n){return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function bh(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=bh(n,a);return o===0?`今天 ${Gi(r)}`:o===1?`昨天 ${Gi(r)}`:o===-1?`明天 ${Gi(r)}`:`${r.getMonth()+1}月${r.getDate()}日 ${Gi(r)}`}function nc(n,a=new Date){if(!n)return"";const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const o=bh(n,a);return o===0?Gi(r):o===1?"昨天":`${r.getMonth()+1}月${r.getDate()}日`}function dr(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 Ul(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 Lf(n){if(n<1e3)return String(n);const a=n/1e3;return`${a<10?a.toFixed(1):Math.round(a)}k`}function iT(n){return[n.durationMs!==void 0?Ul(n.durationMs):void 0,n.tools!==void 0?`${n.tools} 次操作`:void 0,n.tokens!==void 0?`${Lf(n.tokens)} token`:void 0].filter(Boolean).join(" · ")}function Ka(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 rT(n,a=new Date){return bh(n,a)===0}function oT(n,a){return n?new Date(a).getTime()-new Date(n).getTime()>300*1e3:!1}function yh(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),x=Number(c);return p>59||x>23?a:f==="*"&&m==="*"?{...a,kind:"daily",hour:x,minute:p}:f==="*"&&/^\d$/.test(m)?{...a,kind:"weekly",hour:x,minute:p,weekday:Number(m)}:/^\d{1,2}$/.test(f)&&m==="*"?{...a,kind:"monthly",hour:x,minute:p,day:Number(f)}:a}function cT(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 kh(n){const a=yh(n),r=`${String(a.hour).padStart(2,"0")}:${String(a.minute).padStart(2,"0")}`;return a.kind==="daily"?`每天 ${r}`:a.kind==="weekly"?`每周${U0[a.weekday]??"?"} ${r}`:a.kind==="monthly"?`每月${a.day}日 ${r}`:n}function uT(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 ab(n){return n.direction==="horizontal"&&n.distance>48}function dT(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 fT(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}},L0={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 jh(n,a,r){const o=Pn[n];return l.jsx(X,{name:o.icon,size:a,w:r,className:o.spin?"spin":""})}function ys({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 hT={memory:"mem",skill:"bulb",rule:"rule",routine:"clock",split:"split",info:"info"};function mT(){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 Hf({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 oh(n)){Ya("复制失败:浏览器不允许写入剪贴板");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:()=>{rc({itemId:a,text:Ua(n).slice(0,60)}),Fi(),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 ib({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,x=dT(m,p);return ir.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:x,children:l.jsx(Hf,{text:a,itemId:r,menu:!0,close:o})})]}),document.body)}function pT(n,a){const o=[...n.currentTarget.closest(".col")?.querySelectorAll(".message-row[data-item-id]")??[]].find(c=>c.dataset.itemId===a);o&&Bb(o)}function rb(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:Ul(a)}function gT({job:n,round:a,fresh:r,itemId:o}){const c=je(),f=kw(n,a),h=f!==n,[m,p]=y.useState(!1),[x,v]=y.useState(""),[b,j]=y.useState(!1),T=wn(m,200),S=f.status==="running",C=!h&&(S||f.status==="waiting"),M=f.status==="stuck"||f.status==="failed",A=Jf(f),U=c.assistants.find(k=>k.id===f.assistantId),$=y.useRef(f.status);return y.useEffect(()=>{if($.current===f.status)return;$.current=f.status,j(!0);const k=window.setTimeout(()=>j(!1),400);return()=>window.clearTimeout(k)},[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:k=>{k.key==="Enter"&&Un(f.id,a??0)},children:[l.jsxs("div",{className:"tt",children:[U?l.jsx("span",{className:"jav",children:l.jsx(rt,{sprite:U.sprite,prop:U.prop,size:40})}):null,l.jsxs("span",{className:"jt",children:[f.routineId?l.jsx(X,{name:"clock",size:14}):null,f.title]}),l.jsx(ys,{meta:Pn[f.status],card:!0,animated:!0,swapped:b,children:S?` · ${dr(f.startedAt??f.createdAt)}`:rb(f)?` · 用时 ${rb(f)}`:null})]}),A?l.jsx("div",{className:`meta${M?" bad":""}`,children:A}):null,C||S?l.jsxs("div",{className:"acts",children:[C?l.jsxs("button",{className:`hob-btn job-reply${m?" selected":""}`,"aria-pressed":m,onClick:k=>{k.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:k=>{k.stopPropagation(),o0(f.id)},children:[l.jsx(X,{name:"stop",size:14}),"停止"]}):null]}):null,T.mounted?l.jsx("div",{className:`replywrap${T.leaving?" leaving":""}`,onClick:k=>k.stopPropagation(),children:l.jsx("div",{className:"replyclip",children:l.jsxs("div",{className:"replybox",children:[l.jsx("input",{autoFocus:!0,value:x,placeholder:"补充说明或更正方向",onChange:k=>v(k.target.value),onKeyDown:k=>{k.key==="Enter"&&x.trim()&&(Mf(f.id,x.trim()),v(""),p(!1)),k.key==="Escape"&&p(!1)}}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{x.trim()&&Mf(f.id,x.trim()),v(""),p(!1)},children:"发送"})]})})}):null]})})}function ob({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 zN(n.id),children:"创建"}),l.jsx("button",{className:"hob-btn",onClick:()=>{nh("请修改草稿:"),Fi()},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 vT({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,x=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(ys,{meta:L0[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:[jh(b.status,14,2),l.jsx("span",{children:b.title}),l.jsx(X,{name:"chev",size:14,className:"go"})]},v):null}),x.map(v=>l.jsx(H0,{approval:v,fresh:!1},v.id)),l.jsxs("div",{className:"delegation-actions",children:[l.jsxs("button",{onClick:()=>void sh(n.to,n.id,!0),children:["去「",p,"」看看 →"]}),n.status==="interrupted"?l.jsx("button",{onClick:()=>void _N(n.id),children:"重新转交"}):null]})]})})}function H0({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(C=>C.key===n.chosen),f=n.status==="answered"&&c?n.chosen:void 0,[h,m]=y.useState(null),[p,x]=y.useState(""),v=h??f,b=h!==null,j=n.status==="answered"?n.answerText:void 0,T=p.trim(),S=()=>{T&&Ox(n.id,{text:T})};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(C=>C.key===v)?.label,l.jsx("span",{className:"ck",children:l.jsx(X,{name:"check",size:16})})]}):n.options.map(C=>{const M=C.key===v;return l.jsx("div",{className:`optrow${b&&!M?" away":""}`,children:l.jsx("div",{className:"optclip",children:l.jsxs("button",{className:`opt${M?" chosen":""}`,disabled:b,onClick:()=>{m(C.key),Ox(n.id,{key:C.key})},children:[l.jsx("span",{className:"key",children:C.key}),C.label,M&&b?l.jsx("span",{className:"ck",children:l.jsx(X,{name:"check",size:16})}):null]})})},C.key)}),n.status==="expired"||j||b||v?null:l.jsxs("div",{className:"other",children:[l.jsx("input",{value:p,placeholder:"其他想法…",onChange:C=>x(C.target.value),onKeyDown:C=>{C.key==="Enter"&&!C.nativeEvent.isComposing&&S()}}),T?l.jsx("button",{className:"hob-icon-btn other-send",title:"发送",onClick:S,children:l.jsx(X,{name:"send",size:16})}):null]})]})]})}function xT({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:Dl(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 bT({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:Rl(a),alt:n,loading:"lazy"})})}function yT(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 x=Math.ceil(h-f.left+parseFloat(getComputedStyle(r).paddingRight));x>=f.width-1||(r.style.maxWidth=`${x}px`,r.getBoundingClientRect().height>f.height+.5&&(r.style.maxWidth=""))};return c(),document.fonts.ready.then(c),()=>{o=!1}},[n]),a}function kT({item:n,inlineDraft:a,fresh:r,tools:o}){const c=je(),f=r?" enter":"",[h,m]=y.useState(!1),p=yT(n.kind==="user"&&!n.files?.length?n.text:void 0),x=o.touch?T=>T.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 T=n.files?.filter(Xi)??[],S=n.files?.filter(E=>!Xi(E))??[],C=T.length===1,M=T.length>1,A=!!(n.from||n.quote||n.text||S.length),U=AN(c,c.sel,n.id),$=E=>{E.startsWith("pending/")||Ct(E,qi(E))},k=(E,_)=>l.jsx("button",{className:_,onClick:()=>$(E),title:qi(E),children:l.jsx("img",{src:Rl(E),alt:qi(E),loading:"lazy"})},E),N=E=>l.jsxs("button",{className:"ufile",onClick:()=>$(E),children:[l.jsx("span",{className:"fi",children:l.jsx(X,{name:Dl(E),size:16})}),l.jsx("span",{className:"fn",children:qi(E)})]});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:x,children:[j,U?.status==="failed"?l.jsx("button",{className:"send-failed",title:"重试","aria-label":"未送达,重试",onClick:()=>zx(U.assistantId,U.localId),children:"!"}):U&&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":""}${U?" pending":""}`,children:[M?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?"收起":`展开 ${T.length}`}),h?l.jsx("div",{className:"album-list",children:T.map(E=>k(E,"u-photo album-item"))}):l.jsx(aT,{photos:T,onOpen:$})]}):null,C?l.jsx("div",{className:"u-solo",ref:A?void 0:p,style:A?void 0:v,children:k(T[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"?sh(n.from.assistantId,n.from.delegationId,!1):_x(n.from.assistantId,n.from.delegationId,!1)),children:[(()=>{const E=c.assistants.find(_=>_.id===n.from.assistantId);return E?l.jsx(rt,{sprite:E.sprite,prop:E.prop,size:16}):null})(),"转自 ",n.from.assistantId==="hob"?n.from.name:`「${n.from.name}」`]}):null,n.quote?l.jsx("button",{className:"quote",onClick:E=>pT(E,n.quote.itemId),children:n.quote.text}):null,n.text?l.jsx("span",{className:"u-text",children:n.text}):null,S.map(E=>E.startsWith("pending/")?l.jsx(y.Fragment,{children:N(E)},E):l.jsx(sb,{path:E,name:qi(E),fallback:N(E)},E))]}):null,U?.status==="failed"?l.jsxs("div",{className:"send-status",children:["未送达",l.jsx("button",{onClick:()=>zx(U.assistantId,U.localId),children:"重试"}),l.jsx("button",{onClick:()=>EN(U.assistantId,U.localId),children:"删除"})]}):null,U?null:l.jsx(Hf,{text:n.text,itemId:n.id})]}),o.open?l.jsx(ib,{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:x,children:[j,l.jsxs("div",{className:`hov msg${f}`,children:[B2(n.text).map((T,S,C)=>T.table?l.jsx("div",{className:"tablecard",ref:S===0?p:void 0,style:S===0?v:void 0,children:l.jsx(Ia,{text:T.md})},S):l.jsxs("div",{className:`b${a&&S===C.length-1?" wide":""}`,ref:S===0?p:void 0,style:S===0?v:void 0,children:[l.jsx(Ia,{text:T.md,streaming:n.streaming&&S===C.length-1}),a&&S===C.length-1?l.jsx(ob,{draft:a}):null]},S)),l.jsx(Hf,{text:n.text,itemId:n.id})]}),o.open?l.jsx(ib,{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:hT[n.icon],size:14}):null,n.handbackId?l.jsx("button",{onClick:()=>void _x("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 T=c.approvals[n.approvalId];return T?l.jsx(H0,{approval:T,fresh:r}):null}if(n.kind==="job"){const T=c.jobs[n.jobId];return T?l.jsx(gT,{job:T,round:n.round,fresh:r,itemId:n.id}):null}if(n.kind==="draft"){const T=c.drafts[n.draftId];return T?l.jsx("div",{className:`b wide${f}`,children:l.jsx(ob,{draft:T})}):null}if(n.kind==="delegation"){const T=c.delegations[n.delegationId];return T?l.jsx(vT,{delegation:T,fresh:r}):null}return n.kind==="image"?l.jsx(nT,{...n,fresh:r,itemId:n.id}):Xi(n.path)?l.jsx(bT,{path:n.path,name:n.name,fresh:r,itemId:n.id}):l.jsx(sb,{path:n.path,name:n.name,itemId:n.id,fallback:l.jsx(xT,{path:n.path,name:n.name,meta:n.meta,fresh:r,itemId:n.id})})}function jT(n,a){return n?n.kind==="user"!=(a.kind==="user")||!!a.lead:!1}function B0({items:n}){const a=je(),r=mT(),[o,c]=y.useReducer(fT,null),f=y.useRef(null),[h,m]=y.useState(null);y.useEffect(()=>{const x=()=>{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 C=f.current;if(!C||C.pointerId!==S.pointerId)return;if(C.swipe=uT(C.swipe,S.clientX,S.clientY),Math.hypot(S.clientX-C.swipe.x,S.clientY-C.swipe.y)>10&&window.clearTimeout(C.timer),C.swipe.direction==="vertical"){x();return}if(C.swipe.direction!=="horizontal")return;window.clearTimeout(C.timer);const M=ab(C.swipe);if(M&&!C.ready&&navigator.vibrate?.(10),C.ready=M,window.matchMedia("(prefers-reduced-motion: reduce)").matches){M&&(rc({itemId:C.id,text:Ua(C.text).slice(0,60)}),Fi(),x());return}m({id:C.id,distance:C.swipe.distance,ready:M})},j=S=>{const C=f.current;!C||C.pointerId!==S.pointerId||(ab(C.swipe)&&(rc({itemId:C.id,text:Ua(C.text).slice(0,60)}),Fi()),x())},T=()=>{x(),c({type:"close"})};return document.addEventListener("pointerdown",v,!0),document.addEventListener("pointermove",b,!0),document.addEventListener("pointerup",j,!0),document.addEventListener("pointercancel",x,!0),document.addEventListener("scroll",T,!0),()=>{x(),document.removeEventListener("pointerdown",v,!0),document.removeEventListener("pointermove",b,!0),document.removeEventListener("pointerup",j,!0),document.removeEventListener("pointercancel",x,!0),document.removeEventListener("scroll",T,!0)}},[]);const p=[];n.length&&!rT(n[0].at)&&n[0].kind!=="note"&&p.push(l.jsx("div",{className:"div",children:on(n[0].at)},"first-div"));for(let x=0;x<n.length;x++){const v=n[x],b=n[x-1],j=n[x+1],T=H1(v.id),S=v.kind==="assistant"&&j?.kind==="draft"?a.drafts[j.draftId]:void 0,C={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?M=>{if(M.pointerType!=="touch"||v.kind!=="user"&&v.kind!=="assistant"||M.target.closest("a,button,input,textarea,select,[contenteditable],.draft,.album-stack"))return;f.current&&window.clearTimeout(f.current.timer);const{clientX:A,clientY:U,pointerId:$}=M,k=window.setTimeout(()=>{f.current=null,c({type:"open",id:v.id})},500);f.current={timer:k,pointerId:$,id:v.id,text:v.text,swipe:{x:A,y:U,direction:"pending",distance:0},ready:!1}}:void 0};S&&x++,p.push(l.jsxs(y.Fragment,{children:[oT(b?.at,v.at)?l.jsx("div",{className:`div${T?" enter-fade":""}`,children:on(v.at)}):jT(b,v)?l.jsx("div",{className:"g"}):null,l.jsx(kT,{item:v,inlineDraft:S,fresh:T,tools:C})]},v.id))}for(const x of U1(Object.values(a.livePages),a.sel))p.push(l.jsxs("button",{className:`att filecard${x.state==="failed"?" bad":""}`,onClick:()=>tS(x.callId),children:[l.jsx("span",{className:"ico",children:l.jsx(X,{name:x.state==="writing"?"spin":"close",className:x.state==="writing"?"spin":"",size:18})}),l.jsxs("span",{children:[l.jsx("span",{className:"n",style:{display:"block"},children:x.title||"正在写页面…"}),l.jsx("span",{className:"m",children:x.state==="failed"?`生成失败:${x.error}`:"生成中"})]})]},x.callId));return l.jsx(l.Fragment,{children:p})}function q0({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 I0(n,a,r,o){const c=y.useRef(!0),f=y.useRef({key:"",len:0});y.useEffect(()=>{const h=n.current;if(!h)return;let m=h.scrollTop;const p=()=>{h.scrollHeight-h.scrollTop-h.clientHeight<80?c.current=!0:h.scrollTop<m-2&&(c.current=!1),m=h.scrollTop},x=new ResizeObserver(()=>{c.current&&(h.scrollTop=h.scrollHeight,m=h.scrollTop)});h.addEventListener("scroll",p,{passive:!0}),x.observe(h);for(const v of Array.from(h.children))x.observe(v);return()=>{h.removeEventListener("scroll",p),x.disconnect()}},[n]),y.useLayoutEffect(()=>{const h=n.current;if(!h)return;const m=f.current;f.current={key:a,len:r},m.key!==a||r<m.len?(c.current=!0,h.scrollTop=h.scrollHeight):r>m.len&&(c.current||o)&&(c.current=!0,h.scrollTo({top:h.scrollHeight,behavior:"smooth"}))},[n,a,r,o])}function Y0(n){return n?.kind==="user"&&!n.from}const wT=["查看这台电脑的磁盘和内存占用","每天早上 9 点给我一份科技新闻简报","把附件里的会议记录整理成要点"];function G0({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:`我是${K0(n.name,!1)}${n.primary?",你的主助手":""}`}),l.jsx("div",{className:"d",children:n.primary?"交给我的事,我会分派给后台任务执行,完成、受阻或需要你确认时再告诉你;也可以让我定时执行。同类工作多了,我会建议创建专属助手。":`负责${n.duty}。`}),o?n.primary?l.jsx("div",{className:"ex",children:wT.map(c=>l.jsx("button",{className:"hob-btn",onClick:()=>{nh(c),Fi()},children:c},c))}):null:l.jsxs("div",{className:"setup",children:[l.jsx("div",{children:"开始使用前,请先添加模型服务商并选择模型。"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>{xc(),Ml("providers")},children:"前往设置"})]})]})}function K0(n,a=!0){const r=o=>!!(o&&/[A-Za-z0-9]/.test(o));return`${r(n[0])?" ":""}${n}${a&&r(n.at(-1))?" ":""}`}function V0(n,a){return`${n??""}|${a??0}`}function NT(){const n=je(),a=n.assistants.find(p=>p.id===n.sel),r=a0(n,n.sel),o=!!(a&&n.sel&&r.length===0&&n.items[n.sel]!==void 0&&!a.busy),c=y.useRef(null),f=V0(n.sel,n.sel?n.itemGen[n.sel]:0),h=!!a?.busy&&!Lb(r),m=wn(h,180);return I0(c,f,r.length,Y0(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:JN,children:l.jsx(X,{name:"panel",size:18})}):null]}),l.jsx("div",{className:"msgs",ref:c,children:l.jsxs("div",{className:`col${o?" mid":""}`,children:[o&&a?l.jsx(G0,{a}):l.jsx(B0,{items:r}),m.mounted&&a?l.jsx(q0,{a,leaving:m.leaving,gap:r.at(-1)?.kind==="user"}):null]})}),l.jsx(X0,{})]})}function X0({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 x=n==="mobile"?120:180;p.style.height=`${Math.min(p.scrollHeight,x)}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,x=p?.closest(".chat");if(!p||!x)return;const v=new ResizeObserver(()=>x.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:()=>rc(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 x=p.path??gc(p),v=p.status==="uploading"?" uploading":p.status==="failed"?" failed":"";return Xi(p.name)?l.jsxs("span",{className:`comp-thumb${v}`,children:[l.jsx("img",{src:Rl(x),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:()=>Ax(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:Dl(p.name),size:16})}),l.jsx("span",{className:"fn",children:p.name}),l.jsx("button",{onClick:()=>Ax(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 x=Array.from(p.target.files??[]);p.target.value="",x.length&&TN(x)}})]}),l.jsx("textarea",{ref:o,className:"ta",rows:1,value:a.text,placeholder:`给${K0(r?.name??"")}发消息`,onChange:p=>nh(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),Mx())}}),r?.busy&&!c?l.jsx("button",{className:"sendbtn stop",title:"停止",onClick:()=>void MN(r.id),children:l.jsx(X,{name:"stop",size:18})}):l.jsx("button",{className:"sendbtn",title:"发送",disabled:!c,onClick:()=>void Mx(),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 ST(){const n=je(),a=n.assistants.find(p=>p.id===n.sel),r=a0(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&&!Lb(r),h=wn(f,180),m=V0(n.sel,n.sel?n.itemGen[n.sel]:0);return I0(c,m,r.length,Y0(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:()=>Of("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:PN,children:l.jsx(X,{name:"more",size:20})})]}),l.jsx("div",{className:"mmsgs",ref:c,children:l.jsxs("div",{className:`col${o?" mid":""}`,children:[o&&a?l.jsx(G0,{a}):l.jsx(B0,{items:r}),h.mounted&&a?l.jsx(q0,{a,leaving:h.leaving,gap:r.at(-1)?.kind==="user"}):null]})}),l.jsx(X0,{variant:"mobile"})]})}const TT="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')});",CT="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'})});",ET="(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)})();",AT="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data: https:; media-src data: https:; font-src data:",MT=`: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}}`,yf=n=>n.replace(/[&<>"]/g,a=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[a]);function zT(){return OT("","","").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 OT(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="${AT}">
255
+ <title>${yf(n)}</title><script>${ET}${CT}<\/script><style>${MT}</style></head>
256
+ <body><div class="page"><header class="hd"><h1>${yf(n)}</h1><p>${yf(a)}</p></header>
257
+ <main>
258
+ ${r}
259
+ </main></div><script>${TT}<\/script></body></html>
260
+ `}function _T(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 tr({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?g0:lr,children:l.jsx(X,{name:"left",size:18})}),n,a,o?l.jsx("button",{className:"hob-icon-btn panel-close",title:"关闭",onClick:ar,children:l.jsx(X,{name:"close",size:17})}):null]})}function Oe({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 Fs({text:n}){const[a,r]=y.useState(!1);return y.useEffect(()=>{const o=setTimeout(()=>r(!0),300);return()=>clearTimeout(o)},[]),a?n:null}const RT=1024*1024;function sc({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:ar,children:l.jsx("div",{className:`fp${m.full?" full":""}`,onClick:p=>p.stopPropagation(),children:m.liveId&&r.livePages[m.liveId]?l.jsx(DT,{page:r.livePages[m.liveId]}):l.jsx($T,{path:m.path,title:m.title,find:m.find,page:m.page})})})}function DT({page:n}){const a=y.useRef(null),r=y.useRef(n);r.current=n;const[o,c]=y.useState(null),f=y.useMemo(()=>zT(),[]),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 x=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",x),()=>{p.disconnect(),window.removeEventListener("message",x)}},[]),y.useEffect(()=>{let p=!0;return n.path&&rh(n.path).then(x=>{p&&c(x)}).catch(x=>Ya(`无法加载文件信息:${x instanceof Error?x.message:String(x)}`)),()=>{p=!1}},[n.path]);const m=n.state!=="done";return l.jsxs(l.Fragment,{children:[l.jsx(Z0,{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(Q0,{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 $T({path:n,title:a,find:r,page:o}){const[c,f]=y.useState({state:"loading"});y.useEffect(()=>{let p=!0;return f({state:"loading"}),rh(n).then(x=>{p&&f({state:"ok",meta:x})}).catch(x=>{if(!p)return;const v=x instanceof Error?x.message:String(x),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(Z0,{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(Fs,{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 oh(n).then(p=>Ya(p?"路径已复制":"复制失败:浏览器不允许写入剪贴板")),children:"复制路径"})]})}):l.jsx(UT,{meta:c.meta,find:r,page:o})})]})}function Z0({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(tr,{className:"fphead",close:!0,children:[l.jsx(X,{name:Dl(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:[Ka(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:nS,children:l.jsx(X,{name:h?"shrink":"expand",size:17})})]})}function Q0({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 UT({meta:n,find:a,page:r}){switch(n.kind){case"image":return l.jsx(cb,{path:n.path,name:n.name,svg:!1});case"svg":return l.jsx(cb,{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(Q0,{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(LT,{meta:n,find:a})}}function cb({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=x=>{x.key==="Escape"&&(x.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:Rl(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 LT({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(Fs,{text:"正在读取内容…"})});const x=n.size>RT?l.jsxs("div",{className:"fp-note",children:["文件有 ",Ka(n.size),",只显示前 1 MB,完整内容请下载。"]}):null;if(n.kind==="markdown")return l.jsxs(l.Fragment,{children:[x,l.jsx(Jo,{find:a,text:r,mathVersion:h,children:l.jsx(Ia,{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:[x,l.jsx(Jo,{find:a,text:r,children:l.jsx(ub,{text:v})})]})}return n.kind==="csv"?l.jsxs(l.Fragment,{children:[x,l.jsx(Jo,{find:a,text:r,children:l.jsx(HT,{text:r,tsv:n.mime.includes("tab-separated")})})]}):l.jsxs(l.Fragment,{children:[x,l.jsx(Jo,{find:a,text:r,children:l.jsx(ub,{text:r})})]})}function Jo({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=I2(m,n);if(!p)return;const{start:x,end:v}=p,b=document.createRange();return b.setStart(x.node,x.offset),b.setEnd(v.node,v.offset),f.set("knowledge-source",new Highlight(b)),x.node.parentElement?.scrollIntoView({block:"center"}),()=>{f.delete("knowledge-source")}},[n,a,r]),l.jsx("div",{ref:c,children:o})}function ub({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 HT({text:n,tsv:a}){const r=y.useMemo(()=>BT(n,a?" ":","),[n,a]),o=y.useMemo(()=>_T(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((x,v)=>l.jsx("td",{className:o[v]?"numeric":void 0,children:x},v))},p))})]})})]})}function BT(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 qT=y.lazy(()=>rr(()=>import("./DesktopView-CEBJFAIN.js"),[]).then(n=>({default:n.DesktopView}))),IT={off:"关",minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"很高",max:"最高"},YT=["running","waiting","queued","done","stuck","failed","stopped"],GT={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 nr(n){return n.status==="running"||n.status==="queued"||n.status==="waiting"}function kf({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:ar,children:l.jsx("div",{className:"jd",onClick:p=>p.stopPropagation(),children:m.kind==="jobs"?l.jsxs(l.Fragment,{children:[l.jsx(tr,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务记录"}),close:!0}),l.jsx(sC,{})]}):l.jsx(KT,{id:m.id,round:m.round},`${m.id}-${m.round??"default"}`)})})}function KT({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?nr(o):!0)),[m,p]=y.useState(null),[x,v]=y.useState(!1),[b,j]=y.useState(a);if(y.useEffect(()=>{Wf().then($=>p($?.models??null))},[]),y.useEffect(()=>{const $=f.current;if(!$)return;const k=()=>{h.current=$.scrollHeight-$.scrollTop-$.clientHeight<80};return $.addEventListener("scroll",k),()=>$.removeEventListener("scroll",k)},[]),y.useEffect(()=>{const $=f.current,k=c?.[c.length-1]?.queued;$&&(h.current||k)&&($.scrollTop=$.scrollHeight,h.current=!0)},[c?.length,c?.[c.length-1]?.id]),!o)return l.jsxs("div",{className:"jdbody",children:[l.jsx(tr,{className:"jdhead",title:l.jsx("span",{className:"t",children:"任务"}),close:!0}),l.jsx(Oe,{children:"无法读取这个任务。"})]});const T=r.assistants.find($=>$.id===o.assistantId),S=o.model?m?.find($=>$.ref===o.model)?.name??o.model:"",C=o.startedAt??o.createdAt,M=o.durationMs??(nr(o)?Date.now()-new Date(C).getTime():void 0),A=o.usage,U=Jf(o);return l.jsxs(l.Fragment,{children:[l.jsxs(tr,{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:()=>{RN(o.id)},children:[l.jsx(X,{name:"mem",size:14}),r.sedimenting[o.id]?"正在沉淀…":"沉淀成技能"]}):null,c?.some($=>$.name?.startsWith("browser_")||$.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(ys,{meta:Pn[o.status]}),T||o.assistantName?l.jsxs("span",{className:"jd-owner",children:[T?l.jsx(rt,{sprite:T.sprite,prop:T.prop,size:16}):null,T?.name??o.assistantName]}):null,l.jsx("span",{children:on(C)}),M!==void 0?l.jsxs("span",{children:["用时 ",Ul(M)]}):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:["思考 ",IT[o.thinking]??o.thinking]}):null,o.modelReason?l.jsx("span",{children:o.modelReason}):null,A?l.jsxs("span",{children:["输入 ",Lf(A.input)," · 输出 ",Lf(A.output),A.cost>0?` · $${A.cost.toFixed(4)}`:""]}):null]}):null,U?l.jsx("div",{className:"jd-reason",children:U}):null,o.rounds?.length?(()=>{const $=bw(o,c),k=Math.min(b??$.length-1,$.length-1);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"seg jd-rounds",role:"tablist",style:{"--seg-count":$.length,"--seg-index":k},children:$.map((N,E)=>l.jsxs("button",{role:"tab","aria-selected":E===k,className:E===k?"on":void 0,onClick:()=>j(E),children:["第 ",E+1," 轮"]},E))}),l.jsx("div",{className:b!==a?"jd-round-content":void 0,children:l.jsx(db,{part:$[k],last:k===$.length-1,index:k})},k)]})})():l.jsx(l.Fragment,{children:l.jsx(db,{part:{job:o,instruction:o.instruction,steps:c},last:!0,index:0})})]}),l.jsx(VT,{job:o}),x?l.jsx(y.Suspense,{fallback:l.jsx("div",{children:"正在打开云桌面…"}),children:l.jsx(qT,{onClose:()=>v(!1)})}):null]})}function db({part:n,last:a,index:r}){const[o,c]=y.useState(!1),f=n.steps===void 0?void 0:pw(n.steps),h=Jf(n.job),m=!nr(n.job),p=new Set(f?Go(f.rows,m,!1).rows.map(x=>x.id):[]);return l.jsxs(l.Fragment,{children:[a?null:l.jsxs("div",{className:"jd-meta",children:[l.jsx(ys,{meta:Pn[n.job.status]}),n.job.durationMs!==void 0?l.jsxs("span",{children:["用时 ",Ul(n.job.durationMs)]}):null]}),h&&!a?l.jsx("div",{className:"jd-reason",children:h}):null,m?l.jsxs(l.Fragment,{children:[l.jsx(FT,{job:n.job}),l.jsx(WT,{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(Oe,{children:l.jsx(Fs,{text:"正在读取执行过程…"})}):f.rows.length||f.thinking?l.jsxs(l.Fragment,{children:[Go(f.rows,m,o).rows.map(x=>o&&!p.has(x.id)?l.jsx("div",{className:"jd-unfold",children:l.jsx("div",{children:l.jsx(fb,{step:x,cwd:n.job.cwd})})},x.id):l.jsx(fb,{step:x,cwd:n.job.cwd},x.id)),Go(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:["还有 ",Go(f.rows,m,o).remaining," 步"]})]})}):null,f.thinking?l.jsx(XT,{text:f.thinking}):null]}):l.jsx(Oe,{children:"还没有执行步骤。"})}),a?l.jsx(tC,{jobId:n.job.id}):null]})}function VT({job:n}){const[a,r]=y.useState(""),o=a.trim().length>0,c=()=>{if(!o)return;const f=a.trim();r(""),Mf(n.id,f).then(h=>{h||r(m=>m||f)})};return l.jsxs("div",{className:"jd-foot",children:[l.jsx("input",{value:a,placeholder:nr(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 o0(n.id),children:"停止"}):null]})}function fb({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(J0,{text:n.thinking,open:!1}):null,l.jsx(Ia,{className:"jd-text",text:n.text??""})]});const f=n.title??n.name??"",h=jw(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:GT[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?Ul(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(QT,{step:n,cwd:a}):null})})]})}function J0({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 XT({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 ZT(n){const a=n.args?.edits;return Array.isArray(a)?a.map(r=>({oldText:String(r?.oldText??""),newText:String(r?.newText??"")})):[]}function Bf({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 QT({step:n,cwd:a}){const r=n.args??{},o=ZT(n);return l.jsxs("div",{className:"jd-tool-body",children:[n.thinking?l.jsx(J0,{text:n.thinking,open:!0}):null,o.length?l.jsxs(l.Fragment,{children:[l.jsx(Bf,{path:String(r.path??""),cwd:a}),o.map((c,f)=>l.jsx(PT,{before:c.oldText,after:c.newText},f))]}):l.jsx(JT,{step:n,args:r,cwd:a}),n.output?l.jsx(qf,{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 JT({step:n,args:a,cwd:r}){if(n.name==="bash")return l.jsx(qf,{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(Bf,{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(Bf,{path:String(a.path??""),cwd:r});const o=JSON.stringify(a,null,2);return o==="{}"?null:l.jsx(qf,{text:o,className:"jd-arg mono",lines:6})}function PT({before:n,after:a}){const[r,o]=y.useState(!1),c=vw(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 qf({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 FT({job:n}){return n.summary?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"报告"}),l.jsx(Ia,{className:"jd-report",text:n.summary})]}):null}function WT({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(eC,{path:r},r))})]}):null}function eC({path:n}){const[a,r]=y.useState(),[o,c]=y.useState("");return y.useEffect(()=>{let f=!0;return rh(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:Dl(n),size:18}),l.jsx("span",{children:n.split("/").pop()}),o?l.jsx("small",{title:o,children:"大小读取失败"}):a!==void 0?l.jsx("small",{children:Ka(a)}):null]})}function tC({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 x=!0;return h(""),v0(n).then(v=>{x&&c(v)}).catch(v=>{x&&h(v instanceof Error?v.message:String(v))}),()=>{x=!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(P0,{jobId:n,view:o}):null]})}function P0({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:Dl(r.name),size:18}),l.jsx("span",{children:r.name}),l.jsx("small",{children:Ka(r.size)})]},r.rel):l.jsx(nC,{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 nC({jobId:n,entry:a}){const[r,o]=y.useState(!1),[c,f]=y.useState(),[h,m]=y.useState(""),[p,x]=y.useState(0);return y.useEffect(()=>{if(!r||c)return;let v=!0;return m(""),v0(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:()=>x(p+1),children:"重试"})]}):c?l.jsx(P0,{jobId:n,view:c}):l.jsx("div",{className:"jd-dir-more",children:"正在读取…"})}):null]})}function sC(){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&&Rx()},children:[l.jsxs("div",{className:"jd-filters",children:[l.jsxs("select",{className:"pick",value:r??"",onChange:c=>void uc({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 uc({assistantId:r,status:c.target.value||null}),children:[l.jsx("option",{value:"",children:"全部状态"}),YT.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(Oe,{children:l.jsx(Fs,{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?` · ${Ul(f.durationMs)}`:nr(f)?` · ${dr(f.startedAt??f.createdAt)}`:""]})]}),l.jsx(ys,{meta:Pn[f.status]})]},f.id)})}):l.jsx(Oe,{children:"没有符合条件的任务。"}),a?.hasMore?l.jsx("button",{className:"hob-btn jd-morebtn",onClick:()=>void Rx(),children:a.loading?"正在读取…":"加载更多"}):null]})}function lC(){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&&jN(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 aC=[["","全部类型"],["image","图片"],["document","文档"],["table","表格"],["page","网页"],["other","其他"]],iC=n=>`删除知识库「${n}」?直接上传到这里、又不在别的知识库里的文件会一起删除,其余文件只是移出。`;function bc(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 pc({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(x=>{x?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 rC({collections:n,selected:a,narrow:r}){const[o,c]=y.useState(!1),[f,h]=y.useState(null),m=bc(),p=n.find(x=>x.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(([x,v])=>l.jsx("div",{children:l.jsx("button",{className:`navrow${a===x?" sel":""}`,onClick:()=>Al({category:x}),children:v})},x)),!r&&l.jsx("div",{className:"knowledge-label",children:"我的知识库"}),n.map(x=>l.jsxs("div",{className:`knowledge-category${m.menu?.id===x.id?" menu-open":""}${a===x.id?" selected":""}`,onContextMenu:v=>{v.preventDefault();const b=v.currentTarget.querySelector(".category-dots");b&&m.toggle(x.id,b)},children:[f===x.id?l.jsx(pc,{initial:x.name,label:"知识库名称",save:v=>GN(x.id,v),cancel:()=>h(null)}):l.jsxs("button",{className:`navrow${a===x.id?" sel":""}`,onClick:()=>Al({category:x.id}),children:[l.jsx("span",{children:x.name}),l.jsx("span",{className:"knowledge-count",children:x.count})]}),l.jsx("button",{className:"knowledge-dots category-dots","aria-label":`${x.name}的操作`,onClick:v=>m.toggle(x.id,v.currentTarget),children:l.jsx(X,{name:"more",size:18})})]},x.id)),l.jsx("div",{children:o?l.jsx(pc,{label:"新知识库名称",save:async x=>!!await m0(x),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:Wi,children:"返回 Hob"})]}),p&&ir.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(iC(p.name))&&KN(p.id)},children:"删除"})]}),document.body)]})}function oC({knowledge:n,assistants:a,uploading:r,upload:o}){const[c,f]=y.useState(n.q),[h,m]=y.useState(!1),p=y.useRef(null),x=n.collections.some(v=>v.id===n.category);return y.useEffect(()=>{if(h||c===n.q)return;const v=window.setTimeout(()=>Al({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=>Al({kind:v.target.value}),children:aC.map(([v,b])=>l.jsx("option",{value:v,children:b},v))}),l.jsxs("select",{"aria-label":"助手",value:n.assistantId,onChange:v=>Al({assistantId:v.target.value}),children:[l.jsx("option",{value:"",children:"全部助手"}),a.map(v=>l.jsx("option",{value:v.id,children:v.name},v.id))]}),x&&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 cC({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);tc(n.id,{collections:c})}}),r.name]},r.id))})}function uC({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 dC({entry:n,collections:a,assistants:r,selected:o,category:c}){const f=bc(),[h,m]=y.useState(!1),[p,x]=y.useState(!1),[v,b]=y.useState(!1),j=Ib(n.kind),T=r.find(A=>A.id===n.source?.assistantId),S=n.source,C=n.index?.state==="queued"||n.index?.state==="indexing"?"正在建索引…":n.index?.state==="failed"?`未能建索引:${n.index.error||"未知原因"}`:n.index?.state==="unsupported"?"这类文件还不能建索引":"",M=[n.origin==="upload"?"上传":T?.name,on(n.updatedAt),Ka(n.size),n.versions?.length?`第 ${n.versions.length+1} 版`:"",C].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:Rl(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(pc,{initial:n.name,label:"文件名称",save:A=>tc(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:M}),l.jsx("span",{className:"knowledge-tags",children:n.collections.map(A=>{const U=a.find($=>$.id===A);return U?l.jsx("span",{children:U.name},A):null})})]})]})]}),S&&(S.itemId||S.jobId)?l.jsx("button",{className:"knowledge-source",onClick:()=>{S.itemId?ZN(S.assistantId,S.itemId):S.jobId&&(Wi(),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&&ir.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(cC,{entry:n,collections:a}),p?l.jsx(pc,{label:"新知识库名称",save:async A=>{const U=await m0(A,!1);return!!U&&await tc(n.id,{collections:[...n.collections,U.id]})},cancel:()=>x(!1)}):l.jsx("button",{onClick:()=>x(!0),children:"+ 新建知识库"})]}):l.jsx(uC,{entry:n,collections:a,category:c,join:()=>m(!0),rename:()=>{f.close(),b(!0)},remove:()=>{f.close(),tc(n.id,{collections:n.collections.filter(A=>A!==c)})},confirm:()=>{f.close(),window.confirm(`删除「${n.name}」?会从所有知识库里移除,不能恢复。`)&&VN(n.id)}})}),document.body)]})}function fC({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(Oe,{large:!0,action:{label:"重试",onClick:()=>void zt()},children:["加载失败:",n.error]}):!n.entries.length&&!n.loading?l.jsx(Oe,{large:!0,children:f}):null,n.entries.map(h=>l.jsx(dC,{entry:h,collections:n.collections,assistants:a,selected:h.path===r,category:n.category},h.id)),n.loading?l.jsx(Oe,{large:!0,children:"正在加载…"}):null,n.hasMore&&!n.loading?l.jsx("button",{className:"knowledge-more",onClick:()=>void zt(!0),children:"加载更多"}):null]})}function hC({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),cc(f.id,{knowledge:h.includes(n)?h.filter(m=>m!==n):[...h,n]}).finally(()=>c(!1))}}),f.name]},f.id))})}function mC({id:n,busy:a,setBusy:r}){return l.jsx("button",{disabled:a,onClick:()=>{r(!0),fN(n).then(()=>zt(!1,!0)).catch(o=>Ya(`重试失败:${o instanceof Error?o.message:String(o)}`)).finally(()=>r(!1))},children:"重试"})}function pC({collection:n,collections:a,assistants:r,embedding:o}){const c=bc("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&&ir.createPortal(l.jsx("div",{className:"amenu knowledge-popup",ref:c.box,children:l.jsx(hC,{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(mC,{id:n.id,busy:h,setBusy:m})]}):null,o?null:l.jsxs(l.Fragment,{children:[" · 只按关键词查 · ",l.jsx("button",{onClick:()=>{xc(),Ml("knowledge")},children:"去设置向量模型"})]})]})]})}function gC({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=x=>{!x.length||h||(m(!0),XN(o.category,x).finally(()=>m(!1)))};return y.useEffect(()=>{if(r.page!=="knowledge"||f)return;const x=v=>{v.key==="Escape"&&Wi()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[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:Wi,children:l.jsx(X,{name:"left",size:17})}),l.jsx("span",{className:"t",children:"知识库"})]}):null,l.jsx(rC,{collections:o.collections,selected:o.category,narrow:n}),l.jsxs("section",{className:"knowledge-main",children:[l.jsx(oC,{knowledge:o,assistants:r.assistants,uploading:h,upload:p}),o.collections.find(x=>x.id===o.category)?l.jsx(pC,{collection:o.collections.find(x=>x.id===o.category),collections:o.collections,assistants:r.assistants,embedding:r.settings.settings.knowledge?.embedding.source==="openai"}):null,l.jsx(fC,{knowledge:o,assistants:r.assistants,previewPath:f?.path,upload:p})]}),!n&&f?l.jsx("aside",{className:"knowledge-preview",children:l.jsx(sc,{embedded:!0})}):null]})}const vC=5,xC=24*3600*1e3;function Qi(n,a){const r=a.trim();return r?n.name.includes(r)||n.duty.includes(r)||(n.last?.text??"").includes(r):!0}function hb(n,a){return(a.last?.at??"").localeCompare(n.last?.at??"")}const mb=n=>n.status==="running"||n.status==="queued"||n.status==="waiting";function bC(n,a){return(a.startedAt??a.createdAt).localeCompare(n.startedAt??n.createdAt)}function yC(n,a){return(a.endedAt??a.createdAt).localeCompare(n.endedAt??n.createdAt)}function pb(n){const a=yh(n.schedules[0]??"");return a.kind==="raw"?1440:a.hour*60+a.minute}function kC(n,a=Date.now()){const r=n.query.trim().length>0,o=new Date(a-xC).toISOString(),c=Object.values(n.jobs),f=n.assistants.filter(T=>T.pinned&&!T.hidden&&Qi(T,n.query)),h=n.assistants.filter(T=>!T.pinned&&!T.hidden&&Qi(T,n.query)).sort(hb),m=n.assistants.filter(T=>T.hidden&&Qi(T,n.query)).sort(hb),p=r?[]:Object.values(n.approvals).filter(T=>T.status==="pending").sort((T,S)=>S.createdAt.localeCompare(T.createdAt)),x=r?[]:c.filter(mb).sort(bC),v=r?[]:c.filter(T=>!mb(T)&&(T.endedAt??T.createdAt)>o).sort(yC).slice(0,vC),b=r?[]:n.routines.filter(T=>T.active).sort((T,S)=>pb(T)-pb(S)),j=!r&&!p.length&&!x.length&&!h.length&&!m.length&&!v.length&&!b.length;return{searching:r,pins:f,rows:h,hidden:m,asks:p,live:x,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(jC(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=jf(n.tz,r),c=new Date(r.getTime()-o),f=jf(n.tz,c);if(f-o===0)return c;{let h=new Date(r.getTime()-f),m=jf(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 jf(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 jC(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 wh=32,Ji=31|wh,F0=[1,2,4,8,16],gb=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,Ji),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,x=parseInt(h,10)+r,v=parseInt(m,10)+r,b=parseInt(p,10);if(isNaN(x))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(x>v)throw new TypeError("CronPattern: From value is larger than to value: '"+n+"'");for(let j=x;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]|wh;else if(a===Ji)this.dayOfWeek[n]=Ji;else if(a<6&&a>0)this.dayOfWeek[n]=this.dayOfWeek[n]|F0[a-1];else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${a}, Type: ${typeof a}`)}},vb=[31,28,31,30,31,30,31,31,30,31,30,31],vs=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],kn=class W0{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 W0)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&Ji&&F0[h-1]&c)return!0;if(c&wh){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>vb[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=vb[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 x=o[r][p];if(r==="day"&&o.lastDayOfMonth&&p-c==h&&(x=1),r==="day"&&!o.starDOW){let v=o.dayOfWeek[(m+(p-c-1))%7];if(v&&v&Ji)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?x=x||v:x=x&&v}if(x)return this[r]=p-c,f!==this[r]?2:1}return 3}recurse(a,r,o){let c=this.findNext(r,vs[o][0],a,vs[o][2]);if(c>1){let f=o+1;for(;f<vs.length;)this[vs[f][0]]=-vs[f][2],f++;if(c===3)return this[vs[o][1]]++,this[vs[o][0]]=-vs[o][2],this.apply(),this.recurse(a,r,0);if(this.apply())return this.recurse(a,r,o-1)}return o+=1,o>=vs.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 wC(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 Ki(n){return Object.prototype.toString.call(n)==="[object Function]"||typeof n=="function"||n instanceof Function}function NC(n){return Ki(n)}function SC(n){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer(n):n&&typeof n.unref<"u"&&n.unref()}var xb=30*1e3,Po=[],TC=class{name;options;_states;fn;constructor(n,a,r){let o,c;if(Ki(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(Ki(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=wC(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 gb("* * * * *")},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 gb(n,this.options.timezone),this.name){if(Po.find(f=>f.name===this.name))throw new Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");Po.push(this)}return c!==void 0&&NC(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=Po.indexOf(this);n>=0&&Po.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>xb&&(a=xb),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(r),a),this._states.currentTimeout&&this.options.unref&&SC(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){Ki(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&&Ki(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 ey(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 TC(f,{timezone:a}).nextRun(r);h&&(!o||h<o.at)&&(o={routine:c,at:h})}catch{}return o}function Nh(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 CC(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 ty(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),x=new Intl.DateTimeFormat("zh-CN",{timeZone:a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(n);return c===o(r)?`今天 ${x}`:c===p?`明天 ${x}`:`${new Intl.DateTimeFormat("zh-CN",{timeZone:a,month:"numeric",day:"numeric"}).format(n)} ${x}`}function EC(n,a,r=new Date){if(!n.length)return"没有";const o=ey(n,a,r);return o?`${n.length} 个 · ${ty(o.at,a,r)}`:`${n.length} 个 · ${n.some(c=>c.active)?"无下次执行时间":"已暂停"}`}function AC(n,a,r){return{skills:n?`${n} 个`:"没有",knowledge:a.length?a.join("、"):"未开启",rules:r?`${r} 条`:"没有"}}function MC(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 bb(n,a=new Date){return`${n.uses?`用过 ${n.uses} 次${n.lastUsedAt?` · 上次${on(n.lastUsedAt,a)}`:""}`:"还没用过"} · 第 ${n.version} 版`}function ny(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=zC.exec(a);if(r){let o=r[2];const c=yb(o);if(c){let[f,h]=c;const m=/^(?:ba)?sh\s+-l?c\s+/.exec(f),p=m?yb(f.slice(m[0].length)):void 0;p&&(f=p[0]+p[1]),o=f+h}a=`${r[1]}: ${ny(o)}`}return a||n.trim()}const zC=/^ssh\s+(?:-[BbcDEeFIiJLlmOoPpQRSWw]\s*\S+\s+|-[46AaCfGgKkMNnqsTtVvXxYy]+\s+)*([^\s'"-]\S*)\s+(.+)$/s;function yb(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 OC(){return l.jsx("div",{className:"sidebar-loading",role:"status",children:l.jsx(Fs,{text:"正在读取…"})})}function _C(){const n=je(),a=n.sel??"hob",r=n.profiles[a],o=r?.assistant??n.assistants.find(z=>z.id===a),c=n.routines.filter(z=>z.assistantId===a),f=n.assistantSkills[a],[h,m]=y.useState("任务"),[p,x]=y.useState(""),[v,b]=y.useState(!n.knowledge.collectionsLoaded),j=n.sidebarJobs?.[a],T=n.sidebarFiles?.[a],S=T?.items??[],C=Object.values({...Object.fromEntries((j?.items??[]).map(z=>[z.id,z])),...n.jobs}).filter(z=>z.assistantId===a).sort((z,V)=>V.createdAt.localeCompare(z.createdAt)),M=y.useRef(null),A=y.useRef(!1);(!M.current||M.current.aid!==a)&&(M.current={aid:a,ids:new Set},A.current=!1);const U=j?.loaded?new Set(C.filter(z=>!M.current.ids.has(z.id)).map(z=>z.id)):new Set;y.useEffect(()=>{if(!j?.loaded){A.current=!1;return}C.forEach(z=>M.current?.ids.add(z.id)),A.current=!0}),y.useEffect(()=>{m("任务"),xs(a),ff(a)},[a]),y.useEffect(()=>{YN().catch(z=>x(z instanceof Error?z.message:String(z))).finally(()=>b(!1))},[]),y.useEffect(()=>{h==="文件"&&hf(a)},[a,h]);const $=h==="任务"?j:T,k=y.useRef(null);y.useEffect(()=>{const z=k.current;if(!z||!$?.hasMore||$.loading||$.error)return;const V=new IntersectionObserver(ne=>{ne.some(ee=>ee.isIntersecting)&&(h==="任务"?ff(a,!0):hf(a,!0))},{root:z.closest(".panel")});return V.observe(z),()=>V.disconnect()},[a,h,$?.hasMore,$?.loading,$?.error,$?.cursor]);const N=(o?.knowledge??[]).map(z=>n.knowledge.collections.find(V=>V.id===z)?.name).filter(z=>!!z),E=AC(f?.skills.length??0,N,r?.rules.length??0),_=MC(S);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"group-card sidebar-info",children:[l.jsxs("button",{className:"sidebar-instructions",onClick:ah,children:[l.jsx("small",{children:"补充说明"}),l.jsx("span",{className:o?.instructions?"":"muted",children:o?.instructions||"添加这个助手特有的做法"}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Vo("routines"),children:[l.jsx(X,{name:"clock",size:15}),l.jsx("span",{children:"定时任务"}),l.jsx("small",{children:EC(c,n.settings.settings.general.timezone)}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Vo("skills"),children:[l.jsx(X,{name:"mem",size:15}),l.jsx("span",{children:"技能"}),l.jsx("small",{children:f?.error?"加载失败":f?.loaded?E.skills:l.jsx(Fs,{text:"正在加载…"},a)}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Vo("knowledge"),children:[l.jsx(X,{name:"archive",size:15}),l.jsx("span",{children:"知识库"}),l.jsx("small",{children:p?"加载失败":v?l.jsx(Fs,{text:"正在加载…"}):E.knowledge}),l.jsx("b",{children:"›"})]}),l.jsxs("button",{onClick:()=>Vo("rules"),children:[l.jsx(X,{name:"rule",size:15}),l.jsx("span",{children:"执行前确认"}),l.jsx("small",{children:E.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(z=>l.jsx("button",{className:h===z?"on":"",onClick:()=>m(z),children:z},z))})}),l.jsx("div",{className:"sidebar-tab-content",children:l.jsxs("div",{className:"group-card sidebar-list",children:[h==="任务"?C.map(z=>l.jsx("div",{className:`srow${A.current&&U.has(z.id)?" enter":""}`,children:l.jsx("div",{className:"srowclip",children:l.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Un(z.id),children:[jh(z.status,16),l.jsxs("span",{children:[l.jsxs("strong",{children:[z.routineId?"⏱ ":"",z.title]}),l.jsxs("small",{children:[on(z.startedAt??z.createdAt),z.status==="running"||z.status==="waiting"?` · 已进行 ${dr(z.startedAt??z.createdAt)}`:z.durationMs!==void 0?` · 用时 ${Ul(z.durationMs)}`:""]})]}),l.jsx("b",{children:"›"})]})})},z.id)):[["本周",_.week],["更早",_.older]].map(([z,V])=>V.length?l.jsxs("div",{children:[l.jsx("div",{className:"sidebar-group-label",children:z}),V.map(ne=>l.jsxs("button",{className:"list-row sidebar-row",onClick:()=>Ct(ne.path,ne.name),children:[l.jsx(X,{name:Dl(ne.name),size:18}),l.jsxs("span",{children:[l.jsx("strong",{children:ne.name}),l.jsxs("small",{children:[Ka(ne.size)," · ",on(ne.updatedAt)]})]}),l.jsx("b",{children:"›"})]},ne.id))]},z):null),$?.loaded&&!(h==="任务"?C.length:S.length)&&!$.error?l.jsx(Oe,{children:h==="任务"?"分派的任务会显示在这里":"还没有产出文件"}):null,$?.error?l.jsxs("div",{className:"badline",children:["加载失败:",$.error," ",l.jsx("button",{onClick:()=>void(h==="任务"?ff(a,$.failedMore):hf(a,$.failedMore)),children:"重试"})]}):null,!$?.loaded&&!$?.error||$?.loadingMore?l.jsx(OC,{}):null,$?.hasMore&&!$.error?l.jsx("div",{ref:k}):null]})},h)]})}const Oa=["off","minimal","low","medium","high","xhigh","max"];function sy(n){return n?.thinkingLevels??["off"]}function sr(n,a){const r=sy(n);if(!n||r.includes(a))return a;const o=Oa.indexOf(a);return[...r].reverse().find(c=>Oa.indexOf(c)<=o)??"off"}function RC(n,a){const r=a.trim().toLowerCase();return r?n.filter(o=>o.name.toLowerCase().includes(r)||o.ref.toLowerCase().includes(r)):n}function DC(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 $C(){const[n,a]=y.useState({screens:[],profiles:{}});return y.useEffect(()=>{if(zl){(ac()==="ready"||ac()==="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(x=>({profiles:p.profiles,screens:o===h?p.screens:x.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 a3(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 UC=y.lazy(()=>rr(()=>import("./DesktopView-CEBJFAIN.js"),[]).then(n=>({default:n.DesktopMini}))),LC=y.lazy(()=>rr(()=>import("./DesktopView-CEBJFAIN.js"),[]).then(n=>({default:n.DesktopView}))),HC={读:"读取",跑:"运行",改:"修改",写:"写入",搜:"搜索"};function If(n){return[HC[n.verb]??n.verb,n.verb==="跑"?ny(n.text):n.text]}function Yf({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 x=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(tr,{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]}):x}),children:[f==="now"?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"hob-icon-btn",title:"编辑助手",onClick:ah,children:l.jsx(X,{name:"edit",size:17})}),l.jsx("button",{className:"hob-icon-btn panel-close",title:"收起右栏",onClick:QN,children:l.jsx(X,{name:"dbl",size:17})})]}):null,f==="routines"?l.jsx("button",{className:"hob-icon-btn",title:"新建定时任务",onClick:IN,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 UN(c.id),children:"立即运行"}):null]}),l.jsx("div",{className:`pbody sidebar-page-${f}`,children:f==="routine"?l.jsx(GC,{id:c.kind==="routine"?c.id:""},c.kind==="routine"?c.id:""):f==="newRoutine"?l.jsx(YC,{}):f==="assistant"?l.jsx(FC,{},r.sel??"hob"):f==="routines"?l.jsx(qC,{}):f==="skills"?l.jsx(ZC,{aid:r.sel??"hob"}):f==="knowledge"?l.jsx(XC,{aid:r.sel??"hob"}):f==="rules"?l.jsx(IC,{aid:r.sel??"hob"}):l.jsxs(l.Fragment,{children:[l.jsx(BC,{}),l.jsx(_C,{})]})})]})}function BC(){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}=CC(o,a),h=r?Nh(r,o,Object.values(n.approvals),Object.values(n.delegations)):"空闲",m=ey(n.routines.filter(N=>N.assistantId===a),n.settings.settings.general.timezone),p=$C(),x=p.profiles[n.sel??"hob"],v=!!x&&p.screens.some(N=>N.id===x&&N.running),[b,j]=y.useState(null),T=v&&n.nowWide,S=y.useRef([]);c&&(S.current=c.activity);const C=(c?.activity??S.current).slice(v&&!T?-2:-8),M=wn(!!c&&!v),A=C.map(N=>`${N.at}|${N.verb}|${N.text}`),U=y.useRef(null);U.current===null&&(U.current=new Set(A));const $=new Set(A.filter(N=>!U.current.has(N)));y.useEffect(()=>{for(const N of A)U.current.add(N)});const k=(N,E,_)=>l.jsxs("button",{className:`screen ${N}`,title:E,onClick:_,children:[C.map((z,V)=>z.verb==="$"?l.jsxs("div",{className:$.has(A[V])?"new":void 0,children:[l.jsx("span",{className:"p",children:"$"})," ",z.text]},A[V]):l.jsxs("div",{className:$.has(A[V])?"new":void 0,children:[l.jsx("span",{className:"v",children:If(z)[0]}),If(z)[1]]},A[V])),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:T?"收起":"在侧栏展开","aria-label":T?"收起":"在侧栏展开",onClick:gf}),l.jsx(y.Suspense,{fallback:null,children:l.jsx(UC,{screen:x},x)}),l.jsx("span",{className:"now-live",children:"实时"}),l.jsxs("div",{className:"now-acts",children:[T?l.jsx("button",{className:"now-btn",title:"收起","aria-label":"收起",onClick:gf,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?k("strip",T?"收起":"在侧栏展开",gf):null]}):null,b&&x?l.jsx(y.Suspense,{fallback:null,children:l.jsx(LC,{initialScreen:x,takeOver:b==="take",onClose:()=>j(null)})}):null,v?null:l.jsx("div",{className:`now-log${c?" open":""}`,inert:!c,children:l.jsx("div",{children:M.mounted&&c?k("jd-open","打开任务详情",()=>Un(c.id)):M.mounted?k("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?" · 定时执行":""," · 已进行 ",dr(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:[jh(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:ty(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 E=n.assistants.find(_=>_.id===N.to);return l.jsxs("button",{className:"sidebar-delegation",onClick:()=>void sh("hob",N.id,!1),children:[E?l.jsx(rt,{sprite:E.sprite,prop:E.prop,size:22}):null,l.jsxs("span",{children:["交给「",E?.name??N.to,"」"]}),l.jsx("small",{children:l.jsx(ys,{meta:L0[N.status]})})," ›"]},N.id)}):null]})}function qC(){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:()=>f0(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:[kh(r.schedules[0]??""),r.runs[0]?l.jsxs(l.Fragment,{children:[" · 上次 ",l.jsx(ys,{meta:Pn[r.runs[0].status]})," ",on(r.runs[0].at)]}):null]}):"已暂停"})]}),l.jsx("b",{children:"›"})]},r.id))}):l.jsx(Oe,{children:"这个助手还没有定时任务"})}function IC({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(Oe,{children:"还没有执行前确认事项"}),l.jsxs("div",{className:"group-card sidebar-card-group card-rows",children:[a.map(r=>l.jsx(JC,{aid:n,rule:r},r.id)),l.jsx(PC,{aid:n})]})]})}function ly({value:n,onSave:a,onRemove:r}){const[o,c]=y.useState(!1),f=yh(n);if(!o)return l.jsxs("button",{className:"w",onClick:()=>c(!0),children:[l.jsx(X,{name:"clock",size:15}),kh(n)]});const h=p=>{const x=f.kind==="raw"?{...f,kind:"daily"}:f;a(cT({...x,...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:U0.map((p,x)=>l.jsxs("option",{value:x,children:["周",p]},x))}):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[x,v]=p.target.value.split(":").map(Number);h({hour:x||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 YC(){const n=je(),[a,r]=y.useState(""),[o,c]=y.useState(""),[f,h]=y.useState("0 9 * * *"),[m,p]=y.useState(!0),[x,v]=y.useState(""),[b,j]=y.useState(!1),T=n.sel??"hob";y.useEffect(()=>{xs(T)},[T]);const S=a.trim()!==""&&o.trim()!==""&&!b,C=async()=>{j(!0),await DN({assistantId:n.sel??"hob",name:a.trim(),instruction:o.trim(),schedules:[f],active:m,...x?{skill:x}:{}}),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:M=>r(M.target.value)})}),l.jsx("div",{className:"lbl",children:"任务内容"}),l.jsx("label",{className:"field",children:l.jsx("textarea",{rows:4,value:o,placeholder:"到点后交给后台任务执行的内容,写清楚需要什么结果",onChange:M=>c(M.target.value)})}),l.jsx("div",{className:"lbl",children:"执行时间"}),l.jsx("div",{className:"when",children:l.jsx(ly,{value:f,onSave:h})}),l.jsx("div",{className:"lbl",children:"技能"}),n.assistantSkills[T]?.error?l.jsxs("div",{className:"badline",children:["加载失败:",n.assistantSkills[T].error," ",l.jsx("button",{onClick:()=>void xs(T),children:"重试"})]}):null,l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsxs("select",{className:"pick","aria-label":"技能",value:x,disabled:!n.assistantSkills[T]||n.assistantSkills[T].loading||!!n.assistantSkills[T].error,onChange:M=>v(M.target.value),children:[l.jsx("option",{value:"",children:"不用技能"}),(n.assistantSkills[T]?.skills??[]).filter(M=>M.enabled).map(M=>l.jsx("option",{value:M.name,children:M.title},M.name))]})}),l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"sp"}),l.jsx("button",{className:"hob-btn",onClick:lr,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:!S,onClick:()=>void C(),children:"创建"})]})]})}function GC({id:n}){const a=je(),r=a.routines.find(c=>c.id===n),o=r?.assistantId;return y.useEffect(()=>{o&&xs(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(ly,{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 xs(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",x=iT(c);return l.jsxs("button",{className:`run${p?" bad":""}`,onClick:()=>void qN(r.assistantId,c.jobId),children:[l.jsxs("span",{className:"rt",children:[on(c.at),x?l.jsx("small",{children:x}):null]}),l.jsx(X,{name:m?"spin":p?"close":"check",size:16,className:m?"spin":""})]},c.jobId)}):l.jsx(Oe,{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 $N(r.id),lr())},children:"删除定时任务"})})]}):l.jsx(Oe,{children:"这个定时任务已不存在。"})}function fr(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 cc(n,h);return c(!1),r(m??"已保存"),!m},busy:o,message:a,fail:h=>r(h)}}function hr({message:n}){return n?l.jsx("div",{role:"status",className:n==="已保存"?"okline":"badline",children:n}):null}function Fo({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 KC({aid:n}){const a=je(),r=fr(n),o=a.profiles[n],[c,f]=y.useState(null);y.useEffect(()=>{Wf().then(f)},[]);const h=a.settings.settings.models.roster;if(!o)return null;const m=o.assistant.models??{},p=a.settings.settings.models,x=M=>c?.models.find(A=>A.ref===M)?.name??M,v=M=>h.find(A=>A.ref===M),b=M=>void r.save({models:M}),j=M=>A=>{const U={...m};if(A){const $=M==="conversation"?p.conversation.thinking:p.work.thinking;U[M]={ref:A,thinking:sr(c?.models.find(k=>k.ref===A),v(A)?.thinking??$)}}else delete U[M];b(U)},T=m.allowed??[],S=M=>{const A={...m};M.length?A.allowed=M:delete A.allowed,b(A)},C=(M,A)=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:M}),l.jsx("div",{className:"ctl",children:l.jsxs("select",{className:"pick grow",value:m[A]?.ref??"",onChange:U=>j(A)(U.target.value),children:[l.jsxs("option",{value:"",children:["跟随全局(",x(A==="conversation"?p.conversation.ref:p.work.ref),")"]}),h.map(U=>l.jsx("option",{value:U.ref,children:x(U.ref)},U.ref))]})})]});return l.jsxs(l.Fragment,{children:[l.jsx(hr,{message:r.message}),C("对话模型","conversation"),C("默认任务模型","work"),l.jsx("div",{className:"lbl",children:"可分派的模型"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:`hob-btn${T.length?"":" hob-btn-primary"}`,onClick:()=>S([]),children:"全部"}),l.jsx("button",{className:`hob-btn${T.length?" hob-btn-primary":""}`,onClick:()=>S(h.map(M=>M.ref)),children:"指定"}),l.jsx("span",{className:"note",style:{margin:0},children:T.length?`已选 ${T.length} 个`:`可用模型共 ${h.length} 个`})]}),T.length?l.jsx("div",{className:"chips",style:{marginTop:8},children:h.map(M=>{const A=T.includes(M.ref);return l.jsx("button",{className:`chip${A?" on":""}`,onClick:()=>S(A?T.filter(U=>U!==M.ref):[...T,M.ref]),children:x(M.ref)},M.ref)})}):null]})}function VC({aid:n}){const a=je(),r=fr(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,x,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${x?"":" off"}`,title:x?"关闭":"开启",onClick:v})]}),b?l.jsx("div",{className:"note",children:b}):null]});return l.jsxs(l.Fragment,{children:[l.jsx(hr,{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 ay(){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 XC({aid:n}){const a=je(),r=fr(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(hr,{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(Oe,{action:{label:"去知识库",onClick:ih},children:"还没有知识库"}):a.knowledge.error?null:l.jsx(ay,{})]})}function ZC({aid:n}){const a=je().assistantSkills[n],r=bc();y.useEffect(()=>{a?.loading||xs(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 xs(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} · ${bb(c)}`,children:[l.jsx("strong",{children:c.title}),l.jsxs("span",{children:[c.description," · ",bb(c)]})]}),l.jsx("button",{className:`tog${c.enabled?"":" off"}`,"aria-label":c.title,"aria-pressed":c.enabled,onClick:()=>void df(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(Oe,{children:"还没有技能。任务完成后会自动沉淀,也可以在任务详情里点「沉淀成技能」。"}):a?.error?null:l.jsx(ay,{}),o&&r.menu&&ir.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(),df(n,o.name,"rollback")},children:"回退到上一版"}):null,l.jsx("button",{onClick:()=>{r.close(),window.confirm(`删除「${o.title}」?`)&&df(n,o.name,"delete")},children:"删除"})]}),document.body)]})}function QC({aid:n,sprite:a,prop:r,onDone:o}){const c=fr(n),f=k0(a)??{prop:"hob",color:"slate"},h=m=>{m!==a&&c.save({sprite:m})};return l.jsxs(l.Fragment,{children:[l.jsx(hr,{message:c.message}),l.jsxs("div",{className:"sprite-pick",children:[r?l.jsx("button",{className:f.prop==="custom"?"on":void 0,title:"自画道具",onClick:()=>h(vf(f.color)),children:l.jsx(rt,{sprite:vf(f.color),prop:r,size:34})}):null,lS.map(m=>l.jsx("button",{className:m===f.prop?"on":void 0,title:Ol[m].label,onClick:()=>h(xf(m,f.color)),children:l.jsx(rt,{sprite:xf(m,f.color),size:34})},m))]}),l.jsxs("div",{className:"sprite-colors",children:[aS.map(m=>l.jsx("button",{className:m===f.color?"on":void 0,title:Ha[m].name,style:{background:Ha[m].o},onClick:()=>h(f.prop==="custom"?vf(m):xf(f.prop,m))},m)),l.jsx("button",{className:"hob-btn",onClick:o,children:"完成"})]})]})}function JC({aid:n,rule:a}){const[r,o]=y.useState(!1),[c,f]=y.useState(a.text),[h,m]=y.useState(!1),[p,x]=y.useState(!1),[v,b]=y.useState(null),j=y.useRef(!1);y.useEffect(()=>{if(v!=="已保存")return;const C=setTimeout(()=>b(null),3e3);return()=>clearTimeout(C)},[v]);const T=async C=>{x(!0);const M=await HN(n,{id:a.id,...C});x(!1),b(M??"已保存"),M||o(!1)},S=()=>{if(j.current){j.current=!1;return}const C=c.trim();if(C===a.text){o(!1);return}if(!C){b("规则内容不能为空。");return}T({text:C})};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:C=>f(C.target.value),onBlur:S,onKeyDown:C=>{C.key==="Enter"&&C.currentTarget.blur(),C.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 T({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 BN(n,a.id),children:"确认删除"})]}):null,v?l.jsx("div",{className:v==="已保存"?"okline":"badline",role:"status",children:v}):null]})}function PC({aid:n}){const[a,r]=y.useState(!1),[o,c]=y.useState(""),[f,h]=y.useState("ask"),[m,p]=y.useState(!1),[x,v]=y.useState(null);y.useEffect(()=>{if(x!=="已保存")return;const T=setTimeout(()=>v(null),3e3);return()=>clearTimeout(T)},[x]);const b=()=>{r(!1),c(""),h("ask"),v(null)},j=async()=>{if(m||!o.trim())return;p(!0),v(null);const T=await LN(n,o.trim(),f);if(p(!1),T){v(T);return}c(""),h("ask"),r(!1),v("已保存")};return l.jsxs("div",{className:"rule-wrap",children:[a?l.jsxs("form",{className:"rule-new",onSubmit:T=>{T.preventDefault(),j()},onKeyDown:T=>{T.key==="Escape"&&!m&&(T.preventDefault(),b())},children:[l.jsx("input",{className:"rule-input",autoFocus:!0,"aria-label":"规则文字",placeholder:"输入规则内容",maxLength:1e3,value:o,disabled:m,onChange:T=>c(T.target.value)}),l.jsxs("div",{className:"ctl",children:[l.jsxs("select",{className:"pick","aria-label":"规则确认方式",value:f,disabled:m,onChange:T=>h(T.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:"+ 新增规则"}),x?l.jsx("div",{className:x==="已保存"?"okline":"badline",role:"status",children:x}):null]})}function FC(){const n=je(),a=n.sel??"hob",r=n.profiles[a],[o,c]=y.useState(!1),[f,h]=y.useState(!1),m=fr(a);if(!r)return l.jsx(Oe,{children:l.jsx(Fs,{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(x=>!x),title:"换头像"})}),l.jsx("div",{className:"avatar-hint",children:"点头像更换"}),o?l.jsx(QC,{aid:a,sprite:p.sprite,prop:p.prop,onDone:()=>c(!1)}):null,l.jsx(hr,{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(Fo,{value:p.name,save:x=>x.trim()?m.save({name:x.trim()}):(m.fail("名字不能为空。"),Promise.resolve(!1))}),l.jsx("div",{className:"lbl",children:"职责简介"}),l.jsx(Fo,{value:p.duty,save:x=>m.save({duty:x})}),l.jsx("div",{className:"lbl",children:"详细职责"}),l.jsx(Fo,{multiline:!0,value:p.dutyLong??"",save:x=>m.save({dutyLong:x})}),l.jsx("div",{className:"lbl",children:"补充说明"}),l.jsx(Fo,{multiline:!0,value:p.instructions,placeholder:"这个助手特有的做法,如“周报先列要点再展开”",save:x=>m.save({instructions:x})})]})]}),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(KC,{aid:a})}),l.jsx("div",{className:"sech",children:l.jsx("span",{children:"能力"})}),l.jsx("div",{className:"group-card sidebar-card-group",children:l.jsx(VC,{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 ON(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 kb(n,a){return Nh(a,Object.values(n.jobs),Object.values(n.approvals),Object.values(n.delegations))!=="空闲"}function Sh(n){const a=je();return!n||!kb(a,n)?{busy:!1,slot:0}:{busy:!0,slot:a.assistants.filter(r=>kb(a,r)).findIndex(r=>r.id===n.id)}}function iy(n,a){const r=je();if(Nh(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).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 ry({a:n,sel:a,size:r=52}){const o=x0(n),{busy:c,slot:f}=Sh(n),h=iy(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}),n.unread>0?l.jsx("span",{className:"badge",children:n.unread>99?"99+":n.unread}):null,l.jsx("div",{className:"nm",children:n.name}),l.jsx("div",{className:"sub",children:n.duty})]})}function oy(n){return n===1?{cls:" n1",size:72}:n===2?{cls:" n2",size:62}:{cls:"",size:52}}function jb({a:n,sel:a,size:r=42,onClick:o}){const c=x0(n),{busy:f,slot:h}=Sh(n),m=iy(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:nc(n.last?.at)})]}),l.jsx("div",{className:"pv",children:n.last?Ua(n.last.text):n.duty})]})]})}function WC(n,a){const r=n.activity.at(-1);return[a?.name,r?If(r).join(" "):""].filter(Boolean).join(" · ")}function wb(n,a){ar(),a&&Vt(n.assistantId),Un(n.id)}function Nb({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(Gf,{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:Ua(o)}),l.jsx(ys,{meta:Pn[n.status]})]})}function Ma({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 Gf({owner:n,size:a,moving:r}){const{slot:o}=Sh(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 Sb({title:n,text:a}){return l.jsx(Ma,{title:n,children:l.jsx(Oe,{children:a})})}function cy({size:n=42,markSel:a=!1}){const r=je(),[o,c]=y.useState(!0),f=kC(r),h=v=>r.assistants.find(b=>b.id===v),m=!o||f.searching,p=new Set,x=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(Ma,{title:"等你确认",children:f.asks.map(v=>l.jsxs("button",{className:"list-row home-row",onClick:()=>void Vt(v.assistantId),children:[l.jsx(Gf,{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:nc(v.createdAt)})]}),l.jsxs("div",{className:"pv",children:[h(v.assistantId)?.name??""," · 等待你的选择"]})]})]},v.id))}):null,f.live.length?l.jsx(Ma,{title:"进行中",children:f.live.map(v=>l.jsx(Nb,{job:v,owner:h(v.assistantId),moving:x(v),time:dr(v.startedAt??v.createdAt),text:WC(v,h(v.assistantId)),size:n,onClick:()=>wb(v,h(v.assistantId))},v.id))}):null,f.rows.length||f.hidden.length?l.jsxs(Ma,{title:"日常",children:[f.rows.map(v=>l.jsx(jb,{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(jb,{a:v,size:n,sel:a&&v.id===r.sel},v.id))})})]}):null,f.recent.length?l.jsx(Ma,{title:"最近任务",more:l.jsx("button",{className:"more",onClick:()=>c0(),children:"全部"}),children:f.recent.map(v=>l.jsx(Nb,{job:v,owner:h(v.assistantId),time:nc(v.endedAt??v.createdAt),text:v.summary||v.statusReason||"",size:n,onClick:()=>wb(v,h(v.assistantId))},v.id))}):null,f.routines.length?l.jsx(Ma,{title:"定时任务",children:f.routines.map(v=>{const b=v.runs[0];return l.jsxs("button",{className:"list-row home-row",onClick:()=>{ar(),Vt(v.assistantId),f0(v.id)},children:[l.jsx(Gf,{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:kh(v.schedules[0]??"")})]}),l.jsx("div",{className:"pv",children:b?l.jsxs(l.Fragment,{children:["上次运行 ",nc(b.at)," · ",l.jsx(ys,{meta:Pn[b.status]})]}):"尚未运行"})]})]},v.id)})}):null,f.empty?l.jsxs(l.Fragment,{children:[l.jsx(Sb,{title:"最近任务",text:"分派的任务会显示在这里"}),l.jsx(Sb,{title:"定时任务",text:"定时任务会显示在这里"})]}):null]})}function eE(){const n=je(),a=n.assistants.filter(o=>o.pinned&&!o.hidden&&Qi(o,n.query)),r=oy(a.length);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mhead",children:[l.jsx("button",{className:"me",title:"设置",onClick:xc,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=>p0(o.target.value)}),l.jsx("button",{onClick:()=>Ux(!1),title:"关闭搜索",children:l.jsx(X,{name:"close",size:14})})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"hob-icon-btn",title:"知识库",onClick:ih,children:l.jsx(X,{name:"archive",size:19})}),l.jsx("button",{className:"hob-icon-btn",title:"搜索助手",onClick:()=>Ux(!0),children:l.jsx(X,{name:"search",size:19})}),l.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:d0,children:l.jsx(X,{name:"plus",size:21})})]})]}),l.jsx("div",{className:`mpins${r.cls}`,children:a.map(o=>l.jsx(ry,{a:o,size:r.size},o.id))}),l.jsx("div",{className:"mlist",children:l.jsx(cy,{size:36})})]})}function Tb({leaving:n,page:a}){return l.jsx("div",{className:`mfull${n?" leaving":""}`,children:l.jsx(Yf,{mobile:!0,page:a})})}const uy={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 Th(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 Cb(n,a){return uy[n].reduce((r,o)=>Math.abs(o.value-a)<Math.abs(r.value-a)?o:r).label}function dy(n){return`聪明 ${n.smart}% · 成本 ${n.cost}% · 速度 ${n.speed}%`}function Ch(n){if(n>=1e6){const a=n/1e6;return`${Number.isInteger(a)?a:a.toFixed(1)}M`}return`${Math.round(n/1e3)}K`}const tE=y.lazy(()=>rr(()=>import("./DesktopView-CEBJFAIN.js"),[]).then(n=>({default:n.DesktopView})));function et({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 bs({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 es({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 Da(){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 Ff(f);return o(!1),a(h?"已保存":Ps().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 $a({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)},x={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",{...x,rows:3}):l.jsx("input",{...x})})}const wf=[{id:"general",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:"关于"}],nE=[{key:"system",label:"跟随系统"},{key:"light",label:"浅色"},{key:"dark",label:"深色"}];function sE(){return Intl.supportedValuesOf?.("timeZone")??[]}function lE({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:zf,children:l.jsx(X,{name:"left",size:17})}),l.jsx("span",{className:"t",children:"设置"})]}),l.jsx("div",{className:"setbody",children:wf.map(f=>l.jsxs("button",{className:"setitem",onClick:()=>Ml(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:()=>Ml(null),children:l.jsx(X,{name:"left",size:17})}),l.jsx("span",{className:"t",children:r.sub?.title??wf.find(f=>f.id===o)?.label??"设置"})]}):l.jsxs("div",{className:"setnav",children:[l.jsx("div",{className:"setnavtitle",children:"设置"}),wf.map(f=>l.jsx("button",{className:`navrow${o===f.id?" sel":""}`,onClick:()=>Ml(f.id),children:f.label},f.id)),l.jsx("span",{className:"sp"}),l.jsx("button",{className:"navrow",onClick:zf,children:"返回 Hob"})]}),l.jsx("div",{className:"setmain",ref:c,children:o==="providers"?l.jsx(dE,{}):o==="models"?l.jsx(bE,{}):o==="memory"?l.jsx(EE,{}):o==="image"?l.jsx(OE,{}):o==="knowledge"?l.jsx(zE,{}):o==="search"?l.jsx(VE,{}):o==="skills"?l.jsx(DE,{}):o==="mcp"?l.jsx(BE,{}):o==="desktop"?l.jsx(aE,{}):o==="work"?l.jsx(wE,{}):o==="push"?l.jsx(NE,{}):o==="about"?l.jsx(ZE,{}):l.jsx(iE,{})})]})}function aE(){const[n,a]=y.useState(null),[r,o]=y.useState(""),[c,f]=y.useState(""),[h,m]=y.useState(!1),[p,x]=y.useState(!1),[v,b]=y.useState(null),[j,T]=y.useState(null),[S,C]=y.useState(!1),[M,A]=y.useState(null),[U,$]=y.useState([]),k=je().assistants;y.useEffect(()=>{Jw().then(ee=>{a(ee),o(ee.url),m(ee.enabled),x(!ee.tokenConfigured),$(ee.publicAssistants)}).catch(ee=>T({ok:!1,text:`无法读取云桌面配置:${ee.message}`}))},[]);const N=n?.deployed??!1,E=n!==null&&h!==n.enabled;async function _(){if(n){C(!0),T(null);try{const ee=await Pw({revision:n.revision,url:r,enabled:h,...c?{token:c}:{}});a(ee),f(""),x(!ee.tokenConfigured),T({ok:!0,text:"已保存"})}catch(ee){T({ok:!1,text:ee instanceof Error?ee.message:String(ee)})}finally{C(!1)}}}async function z(){if(n){C(!0),T(null);try{const ee=await Fw(n.revision,U);a(ee),$(ee.publicAssistants),T({ok:!0,text:"已保存"})}catch(ee){T({ok:!1,text:ee instanceof Error?ee.message:String(ee)})}finally{C(!1)}}}async function V(){C(!0),b(null);try{const ee=await Ww();if(!ee.ok){b({ok:!1,text:ee.error});return}const Ee=ee.health.screens.filter(he=>he.browserRunning).map(he=>he.id).join("、");b({ok:!0,text:`已连接 · ${ee.health.display.width}×${ee.health.display.height} · 浏览器:${Ee||"无"}`})}catch(ee){b({ok:!1,text:ee instanceof Error?ee.message:String(ee)})}finally{C(!1)}}const ne=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(et,{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 V(),children:"测试连接"}),l.jsx("button",{className:"hob-btn",disabled:!n?.enabled,onClick:()=>A("hob"),children:"打开桌面"}),ne]})]})]}):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 的人可以观看桌面,接管后可以操作。":"未启用。界面不打开桌面,任务也不能使用桌面。")+(E?"(保存后生效)":"")})]})]}),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:ee=>o(ee.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:ee=>f(ee.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:()=>x(!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 V(),children:"测试连接"}),ne??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 _(),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:[k.map(ee=>l.jsxs("label",{className:"ctl",children:[l.jsx("input",{type:"checkbox",className:"rcheck",checked:U.includes(ee.id),disabled:S||!n,onChange:Ee=>$(he=>Ee.target.checked?[...he,ee.id]:he.filter(we=>we!==ee.id))}),l.jsx("span",{children:ee.name})]},ee.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 z(),children:"保存公共屏幕设置"}),j?l.jsx("span",{className:j.ok?"okline":"badline",role:"status",children:j.text}):null]})]})]}),M?l.jsx(y.Suspense,{fallback:null,children:l.jsx(tE,{initialScreen:M,takeOver:M==="public",onClose:()=>A(null)})}):null]})}function iE(){const n=je(),a=n.settings.settings.general.aboutYou,r=Da(),o=Da(),c=Da(),[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(et,{title:"通用",desc:"主题、时区、个人信息、登录密码。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"主题"}),l.jsx(bs,{items:nE,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(rE,{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($a,{placeholder:"如「王先生」",value:a.name,onSave:m=>c.save({general:{aboutYou:{name:m.trim()}}})}),l.jsx("div",{className:"lbl sub",children:"语言"}),l.jsx($a,{placeholder:"如「中文」",value:a.language,onSave:m=>c.save({general:{aboutYou:{language:m.trim()}}})}),l.jsx("div",{className:"lbl sub",children:"其他"}),l.jsx($a,{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(oE,{onDone:h}),f?l.jsx("div",{className:"note",children:f}):null]})})]})}function rE({value:n,onSave:a}){const r=sE(),[o,c]=y.useState(n),[f,h]=y.useState(!1),[m,p]=y.useState(null),x=y.useRef(null);y.useEffect(()=>c(n),[n]),y.useEffect(()=>{if(!f)return;const j=T=>{x.current?.contains(T.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(T=>{T||c(n)})};return l.jsxs("div",{className:"tz",ref:x,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 oE({onDone:n}){const[a,r]=y.useState(""),[o,c]=y.useState(""),[f,h]=y.useState(""),[m,p]=y.useState(!1),x=async()=>{if(m)return;if(!a||!o){n("请填写旧密码和新密码。");return}if(o!==f){n("两次输入的新密码不一致。");return}p(!0);const v=await $w(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(es,{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 x(),disabled:m||!a||!o||!f,children:m?"正在验证…":"保存"})]})]})}function fy({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 hy({value:n,model:a,onChange:r}){const o=sy(a);return o.length===1?null:l.jsx(fy,{value:n,label:"思考强度",icon:"bulb",options:o.map(c=>({value:c,text:ec[c]})),onChange:r})}function Eb({modelRef:n,info:a,disabled:r,onSaved:o}){const[c,f]=y.useState(!1),[h,m]=y.useState(null),[p,x]=y.useState(""),[v,b]=y.useState(!1),[j,T]=y.useState(null),[S,C]=y.useState(!1);y.useEffect(()=>{if(!S)return;const E=setTimeout(()=>C(!1),3e3);return()=>clearTimeout(E)},[S]);const M=h??a.levels,A=Oa.filter(E=>!M.some(_=>_.level===E)),U=h!==null,$=E=>{m(E.slice().sort((_,z)=>Oa.indexOf(_.level)-Oa.indexOf(z.level))),T(null),C(!1)},k=async E=>{b(!0),T(null);const _=await qw(n,E);if(b(!1),!_.ok){m(null),T(_.error);return}m(null),C(!0),o(_.thinking,_.settings)},N=(E=M)=>{const _={};for(const z of Oa){const V=E.find(ne=>ne.level===z);_[z]=V?V.text.trim():null}k(_)};return l.jsxs("div",{className:"think-levels",children:[l.jsxs("button",{className:"thinkhead",onClick:()=>f(E=>!E),disabled:v,children:[l.jsx("span",{className:"lbl sub",children:"思考档"}),l.jsxs("span",{className:"note",children:[M.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:M.map(E=>l.jsxs("div",{className:"thinkrow",children:[l.jsx("span",{className:"tname",children:ec[E.level]}),l.jsx("input",{className:"ttext",value:E.text,placeholder:"默认",title:"留空就按服务商协议的默认值发",onChange:_=>$(M.map(z=>z.level===E.level?{...z,text:_.target.value}:z)),onBlur:()=>{U&&N()},onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur()},disabled:v||r}),E.level==="off"?l.jsx("span",{className:"rremove still",title:"关闭这一档不能删","aria-hidden":!0}):l.jsx("button",{className:"rremove",title:`删掉「${ec[E.level]}」`,onClick:()=>N(M.filter(_=>_.level!==E.level)),disabled:v||r,children:l.jsx(X,{name:"close",size:13})})]},E.level))}),l.jsxs("div",{className:"ctl",style:{gap:8,flexWrap:"wrap",marginTop:10},children:[l.jsxs("select",{className:"pick",value:p,onChange:E=>x(E.target.value),disabled:v||r||!A.length,"aria-label":"添加思考档",children:[l.jsx("option",{value:"",children:A.length?"选择档位":"七个档都用上了"}),A.map(E=>l.jsx("option",{value:E,children:ec[E]},E))]}),l.jsx("button",{className:"hob-btn",onClick:()=>{p&&(N([...M,{level:p,text:""}]),x(""))},disabled:v||r||!p,children:"添加思考档"}),l.jsx("span",{className:"sp"}),a.custom?l.jsx("button",{className:"hob-btn",onClick:()=>void k(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 my({info:n}){const a=Ch(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 py=[{key:"openai-completions",label:"OpenAI 兼容"},{key:"openai-responses",label:"OpenAI Responses 兼容"},{key:"anthropic-messages",label:"Anthropic 兼容"},{key:"google-generative-ai",label:"Google 兼容"}],cE=Object.fromEntries(py.map(n=>[n.key,n.label])),Wo=128e3,Nf=n=>n.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),uE={literal:"包含 Key",env:"包含 Key",command:"需手动填写",none:"无 Key"};function dE(){const a=je().sub,[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),[p,x]=y.useState({}),v=(T,S)=>x(C=>({...C,[T]:S}));if(y.useEffect(()=>{Bw().then(T=>T.ok?o(T.view):f(T.error))},[]),y.useEffect(()=>{a&&m(null)},[a]),y.useEffect(()=>{r&&x(T=>Object.fromEntries(Object.entries(T).filter(([S])=>r.providers.some(C=>C.id===S))))},[r]),c)return l.jsx("div",{className:"note",children:c});if(!r)return l.jsx(Oe,{children:"正在读取服务商…"});const b=(T,S)=>{S.startsWith("已导入")&&x({}),o(T),m(S),Ht()},j=(T,S,C)=>{o(M=>M&&{...M,settings:C,models:{...M.models,[T]:(M.models[T]??[]).map(A=>A.ref===S.ref?S:A)}})};return a?.kind==="provider"?l.jsx(mE,{id:a.id,view:r,onView:o,onSaved:b,onThinking:j,onConnection:v}):a?.kind==="addProvider"?l.jsx(pE,{view:r,onSaved:b,onConnection:v}):a?.kind==="importProviders"?l.jsx(gE,{onSaved:b}):l.jsx(fE,{view:r,notice:h,connectionStatus:p})}function fE({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(et,{title:"服务商",desc:"模型服务商与 API Key。内置服务商只需填写 API Key;兼容接口需填写服务地址、协议与模型。API Key 只保存在本机,保存后不再显示。"}),l.jsx(hE,{}),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(Oe,{children:"尚未添加其他服务商。"}),l.jsx("div",{className:"note",children:"从本机导入会只读本机配置并一次性复制到 Hob,不会修改来源。"}),a?l.jsx("div",{className:"okline",children:a}):null]})]})}function hE(){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 Lw();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 x(){f(!0),m("");try{a(await Hw(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 x(),children:"保存"}),h?l.jsx("span",{className:"note",role:"status",children:h}):null]})]})]})}function mE({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(gy,{view:a,initial:m,onSaved:o,onView:r,onConnection:f,onThinking:(p,x)=>c(n,p,x),extra:l.jsx(vE,{view:a,provider:h,onDeleted:p=>{r(p),Ht()}})})}function pE({view:n,onSaved:a,onConnection:r}){const[o,c]=y.useState(null),[f,h]=y.useState(null),m=n.builtin.filter(x=>!n.providers.some(v=>v.id===x.id));if(o===null)return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"服务商"}),l.jsx(et,{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(et,{title:"选择内置服务商",desc:"选择服务商后填写 API Key。"}),l.jsx(be,{children:l.jsx("div",{className:"group-card settings-card",children:m.length?m.map(x=>l.jsxs("button",{className:"list-row model-row",onClick:()=>h(x.id),children:[l.jsxs("span",{className:"mtop",children:[l.jsx("span",{className:"mname",children:x.name}),l.jsx("span",{className:"sp"}),l.jsx(X,{name:"chev",size:14})]}),l.jsx("span",{className:"mprev",children:"内置服务商"})]},x.id)):l.jsx(Oe,{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(gy,{view:n,initial:p,onSaved:a,onConnection:r,onThinking:()=>{}})}function gE({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(()=>{Gw().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 x=b=>c(j=>{const T=new Set(j);return T.has(b)?T.delete(b):T.add(b),T}),v=async()=>{if(f||!o.size)return;h(!0),p(null);const b=[...o],j=await Kw(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(et,{title:"从本机导入",desc:"读取本机其他客户端保存的服务商配置。来源文件只读,导入后 Key 存入 Hob,不再显示。"}),a===null?m?null:l.jsx(Oe,{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:()=>x(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?` · ${cE[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:uE[b.key]})}),b.note?l.jsx("div",{className:"note",children:b.note}):null]})]},b.id))}):l.jsx(Oe,{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 vE({view:n,provider:a,onDeleted:r}){const[o,c]=y.useState(!1),[f,h]=y.useState(null),[m,p]=y.useState(!1),x=["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 Iw(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,"」后,该服务商的模型将不可用。",x.length?`受影响的默认模型:${x.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 gy({view:n,initial:a,onSaved:r,onView:o,onConnection:c,onThinking:f,extra:h}){const m=je(),[p,x]=y.useState(a),[v,b]=y.useState(!1),[j,T]=y.useState(null);y.useEffect(()=>{if(!j||j!=="已保存")return;const K=setTimeout(()=>T(null),3e3);return()=>clearTimeout(K)},[j]);const[S,C]=y.useState([]),[M,A]=y.useState(a.isNew||!n.providers.find(K=>K.id===a.id)?.keyConfigured),[U,$]=y.useState(null),[k,N]=y.useState(null),[E,_]=y.useState(null),[z,V]=y.useState(!1),ne=new Set(n.providers.map(K=>K.id)),ee=K=>n.builtin.find(ae=>ae.id===K)?.name??K,Ee=K=>n.models[p.id]?.find(ae=>ae.id===K),he=K=>x(ae=>({...ae,...K})),we=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()}:{}},se=JSON.stringify(_e),ve=async()=>{if(z)return;V(!0),_(null),N(null);const K=await bx(_e);if(V(!1),!we&&p.id&&c(p.id,K?"failed":"connected"),K){$(null),_(K);return}$(se),N("连接成功")},me=K=>{const ae=`${p.id}/${K.id}`,le=m.settings.settings.models,ce=le.roster.some(st=>st.ref===ae),xe=le.conversation.ref===ae||le.work.ref===ae;return l.jsxs("label",{className:"ctl",children:[l.jsx("input",{type:"checkbox",checked:ce,disabled:p.isNew||!Ee(K.id)||v||z||xe,onChange:()=>{const st=ce?le.roster.filter(Cn=>Cn.ref!==ae):[...le.roster,{ref:ae,note:"",scores:Th({id:K.id,name:K.name??K.id,reasoning:!!K.reasoning}),scoresConfirmed:!1}];b(!0),T(null),Ff({models:{roster:st}}).then(Cn=>{b(!1),T(Cn?"已保存":"保存失败,请重试。")})}}),l.jsx("span",{children:xe?"默认模型已加入":"加入可用模型"})]})},ze=async()=>{if(p.kind!=="custom"||z)return;V(!0),_(null);const K=await Yw({api:p.api,baseUrl:p.baseUrl.trim(),...p.key.trim()?{apiKey:p.key.trim()}:{},...p.id?{id:p.id}:{}});if(V(!1),!K.ok){_(K.error),C([]);return}C(K.models)},Ae=async K=>{if(p.kind!=="custom")return;if(p.isNew){he({models:K});return}const ae=n.providers.find(Cn=>Cn.id===p.id);if(!ae||ae.kind!=="custom")return;V(!0),_(null);const{id:le,keyConfigured:ce,...xe}=ae,st=await xx(le,{...xe,models:K});if(V(!1),!st.ok){_(st.error);return}he({models:K}),o?.(st.view),T("已保存")},bt=K=>{if(p.kind!=="custom")return;const ae=p.models.some(le=>le.id===K.id);Ae(ae?p.models.filter(le=>le.id!==K.id):[...p.models,{id:K.id,...K.name?{name:K.name}:{}}])},Ot=K=>{if(p.kind!=="custom")return;const ae=K.trim();!ae||p.models.some(le=>le.id===ae)||Ae([...p.models,{id:ae}])},Et=(K,ae)=>{p.kind==="custom"&&Ae(p.models.map(le=>le.id===K?{...le,...ae}:le))},D=K=>{const ae=n.models[K]??[];return ae.length?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"lbl",children:"模型"}),l.jsx("div",{className:"group-card settings-card",children:ae.map(le=>l.jsx("div",{className:"list-row setting-row",children:l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[le.name,l.jsx("span",{className:"rtags",children:l.jsx("span",{className:"rtag mono",children:le.id})})]}),l.jsxs("div",{className:"caps",children:[le.input?.includes("image")?l.jsx("span",{title:"支持图片输入","aria-label":"支持图片输入",children:l.jsx(X,{name:"image",size:14})}):null,le.reasoning?l.jsx("span",{title:"支持推理","aria-label":"支持推理",children:l.jsx(X,{name:"bulb",size:14})}):null,le.contextWindow?l.jsx("span",{className:"ctx",children:Ch(le.contextWindow)}):null]}),me(le),le.reasoning?l.jsx(Eb,{modelRef:le.ref,info:le,disabled:z,onSaved:f}):l.jsx("div",{className:"note",children:"不推理,没有思考档。"})]})},le.id))}),l.jsx("div",{className:"note",children:"模型由服务商提供。会推理的模型可以改每个思考档发给服务商的字符。"})]}):null},J=async()=>{if(z)return;V(!0),_(null);const K=n.providers.find(xe=>xe.id===p.id),ae=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()}:{}},le=p.kind==="custom"&&p.isNew?p.id.trim()||Nf(p.name):p.id;if(!le){V(!1),_("保存失败:请填写标识。模型引用使用该标识,只能包含小写字母、数字、点和短横线,例如 my-proxy。");return}if(p.isNew&&ne.has(le)){V(!1),_("该服务商标识已存在,请使用其他标识。");return}if(U!==se){N("正在验证连接…");const xe=await bx(_e);if(N(null),xe){V(!1),_(`测试连接失败:${xe}`);return}}const ce=await xx(le,ae);if(V(!1),!ce.ok){_(ce.error);return}c(le,"connected"),r(ce.view,"已保存")},W=p.kind==="builtin"?p.isNew?"添加内置服务商":ee(p.id):p.isNew?"添加兼容接口":p.name||"兼容接口",re=p.kind==="builtin"?p.id:p.id||Nf(p.name);return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"服务商"}),l.jsx(et,{title:W,desc:re?l.jsx("span",{className:"mono",children:re}):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=>he({id:K.target.value}),disabled:!0,children:n.builtin.filter(K=>!p.isNew||!ne.has(K.id)).map(K=>l.jsxs("option",{value:K.id,children:[K.name,ne.has(K.id)?"(已配置)":""]},K.id))})}),l.jsx("div",{className:"lbl sub",children:"API Key"}),M?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=>he({key:K.target.value}),disabled:z})}):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:z,onClick:()=>void ve(),children:"测试连接"}),l.jsx("span",{className:"note",children:"测试会请求模型,可能产生费用。"}),k&&U===se?l.jsx("span",{className:"okline",children:k}):null]}),l.jsx(Ab,{busy:z,error:E,dirty:we,onCancel:Ht,onSave:()=>void J()})]})]}):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=>he({name:K.target.value}),disabled:z})}),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:Nf(p.name)||"my-proxy",onChange:K=>he({id:K.target.value}),disabled:z})}),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=>he({api:K.target.value}),disabled:z,children:py.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=>he({baseUrl:K.target.value}),disabled:z})}),l.jsx("div",{className:"lbl sub",children:"API Key"}),M?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=>he({key:K.target.value}),disabled:z})}):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:z||!p.baseUrl.trim(),onClick:()=>void ve(),children:"测试连接"}),k&&U===se?l.jsx("span",{className:"okline",children:k}):null,l.jsx("button",{className:"hob-btn",onClick:()=>void ze(),disabled:z||!p.baseUrl.trim(),children:z?"正在获取…":"获取模型列表"}),l.jsx("span",{className:"note",children:"从接口获取模型列表,选择需要使用的模型。"})]}),l.jsx(Ab,{busy:z,error:E,dirty:we,onCancel:Ht,onSave:()=>void J()})]})]}),S.length?l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"接口上的模型"}),l.jsx("div",{className:"chips",children:S.map(K=>{const ae=p.models.some(le=>le.id===K.id);return l.jsx("button",{className:`chip${ae?" on":""}`,onClick:()=>bt(K),disabled:z,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:z,children:"支持图片输入"}),l.jsx("button",{className:`chip${K.reasoning?" on":""}`,onClick:()=>Et(K.id,{reasoning:!K.reasoning}),disabled:z,children:"支持推理"}),l.jsx("span",{className:"rtag",children:"上下文"}),l.jsx("input",{className:"pmctx",type:"number",min:1,defaultValue:K.contextWindow??Wo,title:"上下文窗口(token)",onBlur:ae=>{const le=Number(ae.target.value)||Wo;le!==(K.contextWindow??Wo)&&Et(K.id,{contextWindow:le})},onKeyDown:ae=>{ae.key==="Enter"&&ae.currentTarget.blur()},disabled:z},`${K.id}:${K.contextWindow??Wo}`)]}),me(K),K.reasoning?Ee(K.id)?l.jsx(Eb,{modelRef:`${p.id}/${K.id}`,info:Ee(K.id),disabled:z,onSaved:f}):l.jsx("div",{className:"note",children:"保存服务商后可以设置思考档。"}):null]}),l.jsx("button",{className:"rremove",title:"移除该模型",disabled:z,onClick:()=>void Ae(p.models.filter(ae=>ae.id!==K.id)),children:l.jsx(X,{name:"close",size:13})})]},K.id))}):l.jsx(Oe,{children:"尚未添加模型。可获取模型列表后勾选,或手动填写模型 ID。"}),l.jsx(xE,{disabled:z,onAdd:Ot})]})]}),p.kind==="builtin"&&!p.isNew?l.jsx(be,{children:D(p.id)}):null,j?l.jsx("div",{className:j==="已保存"?"okline":"badline",role:"status",children:j}):null,h]})}function xE({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 Ab({busy:n,error:a,dirty:r,onCancel:o,onSave:c}){return l.jsxs(es,{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 bE(){const n=je(),[a,r]=y.useState(null);return y.useEffect(()=>{Wf().then(r)},[]),a?n.sub?.kind==="model"?l.jsx(kE,{view:a,modelRef:n.sub.ref}):n.sub?.kind==="addModels"?l.jsx(jE,{view:a}):l.jsx(yE,{view:a}):l.jsx(Oe,{children:"正在读取模型列表…"})}function Kf(n,a){return{scores:n.scores??Th(a??{id:n.ref.split("/").at(-1)??n.ref,name:"",reasoning:!1}),unconfirmed:!n.scores||n.scoresConfirmed!==!0}}function vy({entry:n,info:a,update:r,collapsible:o=!1}){const c=Kf(n,a),[f,h]=y.useState(!o||c.unconfirmed),[m,p]=y.useState(c.scores),[x,v]=y.useState(n.note),b=y.useRef(!1),j=y.useRef(m);j.current=m,y.useEffect(()=>{b.current||p(Kf(n,a).scores)},[n.scores,a]),y.useEffect(()=>v(n.note),[n.note]);const T=M=>r({scores:M,scoresConfirmed:!0}),S=()=>{if(!b.current)return;b.current=!1;const M=n.scores,A=j.current;(!M||n.scoresConfirmed!==!0||M.smart!==A.smart||M.cost!==A.cost||M.speed!==A.speed)&&T(A)};if(!f)return l.jsxs("div",{className:"ctl",children:[l.jsx("span",{className:"note",children:dy(n.scores??m)}),l.jsx("button",{className:"hob-btn",onClick:()=>h(!0),children:"修改"})]});const C={smart:"聪明程度",cost:"成本",speed:"速度"};return l.jsxs("div",{className:"group",children:[l.jsxs("div",{className:"note",children:["Hob 按用途选择分派任务的模型。",c.unconfirmed?"数值按模型名称推测,请确认。":""]}),Object.keys(C).map(M=>l.jsxs("div",{className:"score-row",children:[l.jsxs("div",{className:"score-head",children:[l.jsx("label",{htmlFor:`${n.ref}-${M}`,children:C[M]}),l.jsxs("span",{children:[Cb(M,m[M])," · ",m[M],"%"]})]}),l.jsx("input",{id:`${n.ref}-${M}`,className:"score-range",type:"range",min:"0",max:"100",step:"5",value:m[M],onChange:A=>{b.current=!0,p({...j.current,[M]:Number(A.target.value)})},onPointerUp:S,onTouchEnd:S,onKeyUp:S,onBlur:S}),l.jsx("div",{className:"score-ticks",children:uy[M].map(A=>l.jsx("button",{style:{left:`${A.value}%`},className:A.value===0?"first":A.value===100?"last":void 0,"aria-pressed":A.label===Cb(M,m[M]),onClick:()=>{const U={...j.current,[M]:A.value};p(U),T(U)},children:A.label},A.value))})]},M)),l.jsx("div",{className:"field",children:l.jsx("input",{value:x,onChange:M=>v(M.target.value),onBlur:()=>{x!==n.note&&r({note:x})},onKeyDown:M=>{M.key==="Enter"&&M.currentTarget.blur()},placeholder:"补充说明(选填),如「中文写作特别好」"})}),o?l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"hob-btn",onClick:()=>h(!1),children:"收起"})}):null]})}function Eh(){const a=je().settings.settings.models,r=Da(),o=m=>void r.save({models:m});return{models:a,save:o,setRoster:m=>o({roster:m}),update:(m,p)=>void r.save(x=>({models:{roster:x.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 yE({view:n}){const{models:a,save:r,roles:o,feedback:c}=Eh(),f=new Map(n.models.map(p=>[p.ref,p])),h=p=>[...a.roster.length?[]:[{value:"",text:"未设置"}],...a.roster.filter(x=>f.has(x.ref)||x.ref===p).map(x=>({value:x.ref,text:f.get(x.ref)?.name??x.ref}))],m=(p,x,v)=>l.jsxs("div",{className:"mline",children:[l.jsx("span",{className:"k",children:x}),l.jsxs("span",{className:"vals",children:[l.jsx(fy,{value:a[p].ref,label:v,options:h(a[p].ref),onChange:b=>r({[p]:{ref:b,thinking:sr(f.get(b),a[p].thinking)}})}),l.jsx(hy,{value:sr(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(et,{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(bs,{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 x=f.get(p.ref),v=x?.name??p.ref,b=Kf(p,x);return l.jsxs("button",{className:`list-row model-row${x?"":" 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"}),x?l.jsx(my,{info:x}):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)),dy(b.scores),b.unconfirmed?l.jsx("span",{className:"model-use-warning",children:"请确认用途"}):null,x?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 kE({view:n,modelRef:a}){const{models:r,setRoster:o,update:c,roles:f,feedback:h}=Eh(),[m,p]=y.useState(!1),x=r.roster.find(j=>j.ref===a);if(y.useEffect(()=>{x||Ht()},[x]),!x)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(et,{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(vy,{entry:x,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(hy,{value:sr(v,x.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:Ch(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 jE({view:n}){const{models:a,setRoster:r,roles:o,update:c,feedback:f}=Eh(),[h,m]=y.useState(""),p=new Set(a.roster.map(C=>C.ref)),[x,v]=y.useState(()=>[...new Set(n.models.filter(C=>p.has(C.ref)).map(C=>C.provider))]),b=DC(RC(n.models,h)),j=h.trim().length>0,T=C=>v(M=>M.includes(C)?M.filter(A=>A!==C):[...M,C]),S=C=>r(p.has(C.ref)?a.roster.filter(M=>M.ref!==C.ref):[...a.roster,{ref:C.ref,scores:Th(C),note:"",scoresConfirmed:!1,...C.reasoning?{thinking:sr(C,"medium")}:{}}]);return l.jsxs(l.Fragment,{children:[l.jsx(cn,{}),l.jsx(et,{title:"添加模型",desc:"「服务商」提供的全部模型,打勾的已在可用模型中。"}),l.jsx(Sn,{message:f.message,toast:!0}),n.models.length===0?l.jsxs(be,{children:[l.jsx(Oe,{children:"尚无可用模型。请先在「服务商」中配置服务商并填写 API Key。"}),l.jsx("div",{className:"ctl",children:l.jsx("button",{className:"hob-btn",onClick:()=>Ml("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:C=>m(C.target.value)})]}),b.length===0?l.jsx(Oe,{children:"没有匹配的模型。"}):b.map(C=>{const M=j||x.includes(C.provider),A=C.models.filter(U=>p.has(U.ref)).length;return l.jsxs(y.Fragment,{children:[l.jsxs("button",{className:"mgroup","aria-expanded":M,onClick:()=>T(C.provider),children:[l.jsx("span",{className:"n",children:C.provider}),l.jsx("span",{className:"c",children:A?`已加入 ${A} / ${C.models.length}`:C.models.length}),l.jsx(X,{name:M?"down":"chev",size:14})]}),M?C.models.map(U=>{const $=p.has(U.ref),k=o(U.ref).length>0,N=a.roster.find(E=>E.ref===U.ref);return l.jsxs("div",{children:[l.jsxs("button",{className:`madd${$?" on":""}`,disabled:k,title:k?"默认模型不能在这里移除":$?"从可用模型中移除":"加入可用模型",onClick:()=>S(U),children:[l.jsx("span",{className:"mname",children:U.name}),l.jsx(my,{info:U}),l.jsx(X,{name:$?"check":"plus",size:16,className:"mtog"})]}),N?l.jsx("div",{className:"model-use-inline",children:l.jsx(vy,{entry:N,info:U,collapsible:!0,update:E=>c(U.ref,E)})}):null]},U.ref)}):null]},C.provider)})]})]})}function wE(){const a=je().settings.settings.work,r=Da(),o=c=>r.save({work:c});return l.jsxs(l.Fragment,{children:[l.jsx(et,{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($a,{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($a,{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:()=>c0(),children:"查看全部任务"})}),l.jsx("div",{className:"note",children:"可查看每个任务的完整执行过程。"})]})]})}function NE(){const n=je(),a=Da(),[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState(null),[p,x]=y.useState(null),[v,b]=y.useState(!1),[j,T]=y.useState(null),[S,C]=y.useState(null),M=Zf(),A=()=>void Qf().then(_=>m(_?.endpoint??null));if(y.useEffect(()=>{Pi().then(_=>_.ok?o(_.view):f(_.error)),A()},[]),c)return l.jsx("div",{className:"note",children:c});if(!r)return l.jsx(Oe,{children:"正在读取推送设置…"});const U=typeof Notification<"u"&&Notification.permission==="denied",$=!!(h&&r.devices.some(_=>_.endpoint===h)),k=async()=>{if(!v){b(!0),T(null),C(null);try{const _=$?await xN():await vN();if(!_.ok){T(_.error);return}o(_.view),A(),C($?"此设备将不再接收推送":"此设备将接收推送")}finally{b(!1)}}},N=async _=>{const z=await Fb(_);if(!z.ok){T(z.error);return}o(z.view),x(null),A()},E=async()=>{if(!v){b(!0),T(null),C(null);try{const _=await yN();if(!_.ok){T(_.error);return}_.sent?C("测试通知已发送"):_.removed?(T("这台设备的订阅已失效,已移除;请重新开启本机推送"),Pi().then(z=>z.ok&&o(z.view))):C("未发送:这台设备尚未订阅")}finally{b(!1)}}};return l.jsxs(l.Fragment,{children:[l.jsx(et,{title:"通知",desc:"本机推送与已订阅的设备。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"本机推送"}),M?l.jsxs("div",{className:"ctl",children:[l.jsx("span",{style:{fontSize:14},children:"需要确认或任务受阻时推送给我"}),l.jsx("span",{className:"sp"}),l.jsx("button",{className:`tog${$?"":" off"}`,title:$?"关闭本机推送":"开启本机推送",onClick:()=>void k(),disabled:v})]}):l.jsx("div",{className:"note",children:"这个浏览器不支持推送:请使用 Chrome、Edge、Safari 16.4+,或在 iPhone 上将 Hob 添加到主屏幕。"}),U?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(_=>l.jsxs("div",{className:"dev",children:[l.jsx("span",{className:"n",children:_.label}),l.jsx("span",{className:"tm",children:on(_.createdAt)}),l.jsx("span",{className:"sp"}),p===_.endpoint?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"note",children:"确认删除?"}),l.jsx("button",{className:"hob-btn",onClick:()=>x(null),children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void N(_.endpoint),children:"确认删除"})]}):l.jsx("button",{className:"del",title:"删除这台设备",onClick:()=>x(_.endpoint),children:"删除"})]},_.endpoint)):l.jsx(Oe,{children:"暂无已订阅的设备"}),l.jsxs("div",{className:"ctl",children:[l.jsx("button",{className:"hob-btn",onClick:()=>void E(),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($a,{placeholder:"name@example.com",value:n.settings.settings.push.email,onSave:_=>a.save({push:{email:_.trim()}})}),l.jsx(Sn,{message:a.message}),l.jsx("div",{className:"note",children:"推送服务使用此地址联系你;留空使用 Hob 的项目主页。"})]})]})}const Vi="https://api.loremem.com",SE={saas:"https://app.loremem.com/login"},TE=[{key:"saas",label:"Lore 云服务"},{key:"self",label:"自部署"}],CE=[{key:"local",label:"本地记忆"},{key:"lore",label:"Lore"},{key:"off",label:"关闭"}],Mb={invalid_url:"服务地址无效。",insecure_http:"公网地址必须使用 https,明文 http 仅允许本机或局域网地址。",missing_token:"缺少 API Token。",unauthorized:"API Token 被拒绝。",unreachable:"无法连接该地址。"},Vf=n=>n.trim().replace(/\/+$/,"");function zb(n){return n===null||Vf(n)===Vi?"saas":"self"}function EE(){const[n,a]=y.useState(null),[r,o]=y.useState(null),[c,f]=y.useState(null),[h,m]=y.useState("saas"),[p,x]=y.useState(Vi),[v,b]=y.useState(""),[j,T]=y.useState(!1),[S,C]=y.useState(!1),[M,A]=y.useState(null),[U,$]=y.useState(!1),[k,N]=y.useState(null),[E,_]=y.useState(!1),[z,V]=y.useState(null),[ne,ee]=y.useState(null),[Ee,he]=y.useState(!1);y.useEffect(()=>{if(!E)return;const W=setTimeout(()=>_(!1),3e3);return()=>clearTimeout(W)},[E]);const we=W=>{a(W),o(null),f(null),m(zb(W.lore.baseUrl)),x(W.lore.baseUrl??Vi),b(""),T(!1),C(!1),A(null),N(null),_(!1)};if(y.useEffect(()=>{uf().then(W=>{W.ok?we(W.config):o(W.error)})},[]),r)return l.jsx("div",{className:"note",children:r});if(!n)return l.jsx(Oe,{children:"正在读取记忆设置…"});const _e=c??n.provider,se=n.lore.tokenConfigured&&Vf(p)===Vf(n.lore.baseUrl??""),ve=c==="lore"&&!j?n.lore.configured:S,me=c!==null||j,ze=async W=>{if(U)return;if(W===n.provider){f(null);return}if(N(null),_(!1),W==="lore"&&!n.lore.configured){f("lore");return}$(!0);const re=await wx(n.revision,W);if($(!1),!re.ok){N(re.error);return}we(re.config),_(!0)},Ae=W=>{U||(W(),T(!0),C(!1),A(null),N(null),_(!1))},bt=W=>Ae(()=>{m(W),x(W==="saas"?Vi:zb(n.lore.baseUrl)==="self"?n.lore.baseUrl??"":"")}),Ot=async()=>{if(U)return;$(!0),ee(null),he(!1);const W=await pN();if(!W.ok){$(!1),ee(W.error);return}if(V({source:W.view.source,found:W.view.found}),!W.view.found){$(!1);return}const re=await gN();if($(!1),!re.ok){ee(re.error);return}we(re.config),f("lore"),he(!0)},Et=async()=>{if(U)return;$(!0),A(null);const W={baseUrl:p.trim(),...v?{token:v}:{}},re=await Nx(W);if($(!1),!re.ok){A({ok:!1,text:re.error});return}re.result.ok?(C(!0),A({ok:!0,text:"已连接"})):A({ok:!1,text:Mb[re.result.reason]})},D=async()=>{if(U||!me)return;if($(!0),N(null),_e==="lore"&&!ve){const K=await Nx({baseUrl:p.trim(),...v?{token:v}:{}});if(!K.ok){$(!1),N(K.error);return}if(!K.result.ok){$(!1),N(Mb[K.result.reason]);return}C(!0)}let W=n;if(_e==="lore"&&j){const K=await mN({baseUrl:p.trim(),...v?{token:v}:{}});if(!K.ok){$(!1),N(K.error);return}W=K.config}const re=await wx(W.revision,_e);if($(!1),!re.ok){N(re.error),/已刷新/.test(re.error)&&uf().then(K=>K.ok&&we(K.config));return}we(re.config),_(!0)},J=n.provider==="lore"?n.lore.configured?`Lore · 已连接 · 插件 ${n.lorePlugin}`:"Lore · 尚未配置完成:请填写服务地址与 API Token 后保存":n.provider==="local"?"本地记忆 · 已启用":"关闭 · 助手不使用长期记忆";return l.jsxs(l.Fragment,{children:[l.jsx(et,{title:"记忆",desc:"所有助手共用同一份长期记忆。各助手特有的做法写在助手设置的「补充说明」中。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"提供者"}),l.jsx(bs,{items:CE,value:_e,onChange:W=>void ze(W),disabled:U}),l.jsx("div",{className:"sline",children:J}),l.jsx(Sn,{message:k??(E?"已保存":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(bs,{items:TE,value:h,onChange:bt,disabled:U}),l.jsx("div",{className:"lbl",children:"服务地址"}),h==="saas"?l.jsx("div",{className:"field ro",children:Vi}):l.jsx("div",{className:"field",children:l.jsx("input",{value:p,placeholder:"http://192.168.1.10:18901",onChange:W=>Ae(()=>x(W.target.value)),disabled:U})}),l.jsxs("div",{className:"lblrow",children:[l.jsx("span",{className:"lbl",children:"Token"}),l.jsx("a",{className:"link",href:SE.saas,target:"_blank",rel:"noreferrer",children:"注册 / 登录 Lore"})]}),l.jsx("div",{className:"field",children:l.jsx("input",{type:"password",value:v,placeholder:se?"已保存,留空则沿用":"lm_…",onChange:W=>Ae(()=>b(W.target.value)),disabled:U})}),l.jsxs("div",{className:"ctl",style:{gap:10,flexWrap:"wrap"},children:[l.jsx("button",{className:"hob-btn",onClick:()=>void Et(),disabled:U||p.trim()==="",children:"测试连接"}),M?l.jsx("span",{className:M.ok?"okline":"badline",children:M.text}):null]}),l.jsxs(es,{saved:E&&!me,error:k,children:[!k&&me?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"hob-btn",onClick:()=>void uf().then(W=>W.ok?we(W.config):o(W.error)),disabled:U||!me,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void D(),disabled:U||!me,children:U?"正在验证…":"保存"})]})]})}),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:U,children:U?"正在导入…":"从本机导入"}),Ee?l.jsx("span",{className:"okline",children:"已导入本机的连接"}):null]}),l.jsx("div",{className:"note",children:"读取这台电脑上已保存的 Lore 连接,导入后无需重新填写。"}),z?l.jsxs("div",{className:"sline",children:["来源:",z.source]}):null,z&&!z.found?l.jsx("div",{className:"note",children:"未找到可导入的配置。"}):null,ne?l.jsx("div",{className:"badline",children:ne}):null]})]}):null]})}const AE=[{key:"off",label:"关闭"},{key:"openai",label:"OpenAI 兼容接口"}],ME=["1024x1024","1536x1024","1024x1536","512x512"],xy=n=>n.trim().replace(/\/+$/,"");function zE(){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,x]=y.useState(""),[v,b]=y.useState(!1),[j,T]=y.useState(!1),[S,C]=y.useState(null);y.useEffect(()=>{oN().then(U=>b(U.keyConfigured)).catch(U=>C({ok:!1,text:`读取设置失败:${U instanceof Error?U.message:String(U)}`}))},[]);const M=r==="off"?{source:"off"}:{source:"openai",baseUrl:xy(c),model:h.trim()},A=async U=>{T(!0),C(null);try{if(U){const $=await uN(M,p.trim()||void 0);b($.keyConfigured),x(""),C({ok:!0,text:"已保存"})}else{const $=await cN({embedding:M,...p.trim()?{apiKey:p.trim()}:{}});C($.ok?{ok:!0,text:`连接成功 · ${$.dims} 维`}:{ok:!1,text:$.error})}}catch($){C({ok:!1,text:$ instanceof Error?$.message:String($)})}finally{T(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx(et,{title:"知识库",desc:"配置向量模型,关闭时只按关键词查找。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"向量模型"}),l.jsx(bs,{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:U=>f(U.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:U=>m(U.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:U=>x(U.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(es,{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 OE(){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,x]=y.useState(a.source==="openai"?a.size??"":""),[v,b]=y.useState(""),[j,T]=y.useState(!1),[S,C]=y.useState(null),[M,A]=y.useState(null),[U,$]=y.useState(!1),[k,N]=y.useState(null),[E,_]=y.useState(null);y.useEffect(()=>{if(!k)return;const he=setTimeout(()=>N(null),3e3);return()=>clearTimeout(he)},[k]),y.useEffect(()=>{hN().then(he=>{he&&T(he.keyConfigured)})},[]);const z=r==="openai"?{source:"openai",baseUrl:xy(c),model:h.trim(),...p?{size:p}:{}}:{source:"off"},V=JSON.stringify(z)!==JSON.stringify(a)||v.trim()!=="",ne=JSON.stringify({form:z,apiKey:v.trim()});y.useEffect(()=>{C(null),A(null)},[ne]);const ee=async()=>{if(U)return;$(!0),C(null);const he=await jx({image:z,...v.trim()?{apiKey:v.trim()}:{}});$(!1),he.ok?(A(ne),C({ok:!0,text:"生成成功",path:he.path})):(A(null),C({ok:!1,text:he.error}))},Ee=async()=>{if(U||!V)return;if($(!0),_(null),N(null),z.source==="openai"&&M!==ne){const we=await jx({image:z,...v.trim()?{apiKey:v.trim()}:{}});if(!we.ok){$(!1),A(null),_(`测试连接失败:${we.error}`);return}A(ne),C({ok:!0,text:"生成成功",path:we.path})}const he=await kx(z,v.trim()||void 0);if($(!1),!he.ok){_(he.error);return}z.source==="openai"&&(f(z.baseUrl),m(z.model)),b(""),T(he.keyConfigured),C(null),N("已保存")};return l.jsxs(l.Fragment,{children:[l.jsx(et,{title:"图像生成",desc:"选择图像生成方式:关闭,或使用 OpenAI 兼容接口。配置完成后,开启了图像生成能力的助手可以在任务中生成图片。"}),l.jsxs(be,{children:[l.jsx("div",{className:"lbl",children:"生成方式"}),l.jsx(bs,{items:AE,value:r,onChange:he=>{C(null),_(null),N(null),he==="off"&&a.source!=="off"?($(!0),kx({source:"off"}).then(we=>{if($(!1),!we.ok){_(we.error);return}o("off"),b(""),N("已保存")})):o(he)},disabled:U})]}),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:he=>f(he.target.value),disabled:U})}),l.jsx("div",{className:"lbl",children:"模型名称"}),l.jsx("div",{className:"field",children:l.jsx("input",{value:h,placeholder:"gpt-image-1",onChange:he=>m(he.target.value),disabled:U})}),l.jsx("div",{className:"lbl",children:"默认尺寸"}),l.jsx("div",{className:"ctl",children:l.jsxs("select",{className:"pick grow",value:p,onChange:he=>x(he.target.value),disabled:U,children:[l.jsx("option",{value:"",children:"不指定,使用接口默认值"}),ME.map(he=>l.jsx("option",{value:he,children:he},he))]})}),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:he=>b(he.target.value),disabled:U})}),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 ee(),disabled:U,children:U?"正在生成…":"生成测试图片"}),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(es,{saved:k!==null&&!V,error:E,children:[!E&&V?l.jsx("span",{className:"note",children:"未保存的修改"}):null,l.jsx("button",{className:"hob-btn",disabled:U||!V,onClick:()=>{o(a.source),f(a.source==="openai"?a.baseUrl:""),m(a.source==="openai"?a.model:""),x(a.source==="openai"?a.size??"":""),b(""),C(null),A(null),_(null)},children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",onClick:()=>void Ee(),disabled:U||!V,children:U?"正在验证…":"保存"})]})]})}):l.jsx(Sn,{message:E??k})]})}const _E={hob:"Hob 的技能",common:"通用技能 · ~/.agents/skills",lore:"Lore 技能"},RE=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"pi",label:"pi"}],Sf=n=>`${n.source}:${n.id}`,Xt=n=>n instanceof Error?n.message:String(n);function DE(){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 Vw()),f(null)}catch(T){f(Xt(T))}};y.useEffect(()=>{p()},[]),y.useEffect(()=>{a&&m(null)},[a]);const x=async T=>{const S=`${T.source}:${T.name}`,C=n.settings.settings.skills?.disabled??[],M=T.enabled?[...C,S]:C.filter(A=>A!==S);await Ff({skills:{disabled:M}})?await p():f(Ps().notice??"保存失败")},v=T=>{p(),m(T),Ht()};if(!r)return c?l.jsx("div",{className:"badline",children:c}):l.jsx(Oe,{children:"正在读取技能…"});if(a?.kind==="skill")return l.jsx($E,{skill:r.skills.find(T=>Sf(T)===a.key),onDeleted:v});if(a?.kind==="importSkills")return l.jsx(UE,{onDone:v});const b=(T,S)=>T.length?T.map(C=>l.jsxs("div",{className:`list-row setting-row${C.enabled?"":" gone"}`,children:[l.jsxs("button",{className:"rmain rbtn",onClick:()=>Tn({kind:"skill",key:Sf(C),title:C.name}),children:[l.jsxs("div",{className:"rname",children:[C.name,C.overridden?l.jsx("span",{className:"rtag",children:"被同名技能覆盖"}):null]}),l.jsx("div",{className:"rprov rclamp",children:C.description})]}),l.jsx("button",{className:`tog${C.enabled?"":" off"}`,"aria-label":`${C.name}启用`,"aria-pressed":C.enabled,onClick:()=>void x(C)})]},Sf(C))):l.jsx(Oe,{children:S}),j=r.skills.filter(T=>T.source==="hob");return l.jsxs(l.Fragment,{children:[l.jsx(et,{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(T=>T.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.loreActive?l.jsx("div",{className:"group-card settings-card",children:b(r.skills.filter(T=>T.source==="lore"),"Lore 中没有技能")}):l.jsx("div",{className:"note",children:"在 设置 → 记忆 中连接 Lore 后,这里会列出 Lore 中的技能。"})]}),c?l.jsx("div",{className:"badline",role:"alert",children:c}):null]})}function $E({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 Qw(n.id),a(`已删除「${n.name}」`)}catch(f){o(Xt(f))}};return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"技能"}),l.jsx(et,{title:n.name,desc:n.description}),l.jsxs("div",{className:"sline",children:[_E[n.source],n.overridden?" · 被优先级更高的同名技能覆盖":"",n.enabled?"":" · 已停用"]}),l.jsx(Ia,{className:"skill-doc fp-md markdown-body",text:n.content}),n.source==="hob"?l.jsx(es,{saved:!1,error:r,children:l.jsx("button",{className:"hob-btn hob-btn-danger",onClick:()=>void c(),children:"删除技能"})}):null]})}function UE({onDone:n}){const[a,r]=y.useState("claude"),[o,c]=y.useState(null),[f,h]=y.useState([]),[m,p]=y.useState(!1),[x,v]=y.useState(!1),[b,j]=y.useState(null);y.useEffect(()=>{let S=!0;return c(null),h([]),j(null),Xw(a).then(C=>{S&&c(C)}).catch(C=>{S&&j(Xt(C))}),()=>{S=!1}},[a]);const T=async()=>{v(!0),j(null);try{const S=await Zw(a,f,m),C=[...S.skipped,...S.errors];C.length?j(C.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(et,{title:"导入技能",desc:"从其他工具的技能目录复制到 Hob,来源只读。"}),l.jsx(be,{children:l.jsx(bs,{items:RE,value:a,onChange:r,disabled:x})}),l.jsxs(be,{children:[o===null?b?null:l.jsx(Oe,{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:x,onChange:C=>h(C.target.checked?[...f,S.id]:f.filter(M=>M!==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(Oe,{children:"目录中没有技能"})}):l.jsx(Oe,{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(es,{saved:!1,error:b,children:[l.jsx("button",{className:"hob-btn",onClick:Ht,disabled:x,children:"取消"}),l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:x||!f.length,onClick:()=>void T(),children:x?"正在导入…":f.length?`导入 ${f.length} 个`:"导入所选"})]})]})}const LE={pi:"pi",claude:"Claude Code",cursor:"Cursor"};function HE(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 BE(){const n=je().sub,[a,r]=y.useState(null),[o,c]=y.useState(null),[f,h]=y.useState(null),[m,p]=y.useState({}),x=y.useRef(new Set);y.useEffect(()=>{yx().then(r).catch(S=>c(Xt(S)))},[]),y.useEffect(()=>{n&&h(null)},[n]);const v=async(S,C=!1)=>{if(S.valid){p(M=>({...M,[S.name]:{state:"probing"}}));try{const M=await nN(S.name,C);p(A=>({...A,[S.name]:M.ok?{state:"connected",tools:M.tools}:{state:M.state,error:M.error,stderrTail:M.stderrTail}}))}catch{p(M=>({...M,[S.name]:{state:"failed",error:"无法测试连接"}}))}}};y.useEffect(()=>{if(a)for(const S of a.servers)!S.valid||!S.enabled||x.current.has(S.name)||(x.current.add(S.name),v(S))},[a]);const b=S=>{yx().then(r).catch(()=>{}),h(S),Ht()};if(o)return l.jsxs(l.Fragment,{children:[l.jsx(et,{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(Oe,{children:"正在读取 MCP 服务…"});if(n?.kind==="mcpServer")return l.jsx(GE,{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(YE,{onDone:b});if(n?.kind==="importMcp")return l.jsx(KE,{onDone:b});const j=S=>S.kind==="http"?"远程地址":"本地命令",T=async S=>{try{const C=await Pb(S.name,{enabled:!S.enabled});if(r(C),!S.enabled)for(const M of C.servers)M.name===S.name&&M.valid&&v(M,!0)}catch(C){h(Xt(C))}};return l.jsxs(l.Fragment,{children:[l.jsx(et,{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)} · ${HE(S,m[S.name])}`}),S.valid?l.jsx("button",{className:`tog${S.enabled?"":" off"}`,"aria-label":`${S.name}启用`,"aria-pressed":S.enabled,onClick:()=>void T(S)}):null]},S.name)),a.servers.length?null:l.jsx(Oe,{children:"还没有配置 MCP 服务"})]}),f?l.jsx("div",{className:f.startsWith("已")?"okline":"badline",role:"status",children:f}):null,l.jsx("div",{className:"note",children:"环境变量和请求头的值只保存在本机,保存后不再显示。远程服务需要 OAuth 登录时这版暂不支持。"})]})]})}function Ob(n){return Object.entries(n??{}).map(([a,r])=>({key:a,value:r.redacted?"":r.value??"",secret:r.redacted}))}function _b(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 Rb({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 qE={kind:"stdio",command:"",args:"",env:[],cwd:"",url:"",headers:[],description:""};function IE(n){return{kind:n.kind??"stdio",command:n.command??"",args:(n.args??[]).join(`
264
+ `),env:Ob(n.env),cwd:n.cwd??"",url:n.url??"",headers:Ob(n.headers),description:n.description??""}}function by({initial:n,name:a,onName:r,fixedName:o,onSaved:c,saveLabel:f}){const[h,m]=y.useState(n),[p,x]=y.useState(!1),[v,b]=y.useState(null),j=S=>m(C=>({...C,...S})),T=async()=>{b(null);const S=a.trim();if(!/^[A-Za-z0-9_-]{1,64}$/.test(S)){b("名称只能用字母、数字、_ 和 -,最长 64 字符。");return}const C=Object.fromEntries(n.env.map($=>[$.key,$.secret?{redacted:!0}:{redacted:!1,value:$.value}])),M=Object.fromEntries(n.headers.map($=>[$.key,$.secret?{redacted:!0}:{redacted:!1,value:$.value}])),A=_b(n.env.length?C:void 0,h.env),U=_b(n.headers.length?M:void 0,h.headers);x(!0);try{await eN(S,{kind:h.kind,...h.kind==="stdio"?{command:h.command.trim(),...h.args.trim()?{args:h.args.split(/\r?\n/).map($=>$.trim()).filter(Boolean)}:{},...h.cwd.trim()?{cwd:h.cwd.trim()}:{},...A?{env:A}:{}}:{url:h.url.trim(),...U?{headers:U}:{}},...h.description.trim()?{description:h.description.trim()}:{}}),c(o?`已保存「${S}」`:`已添加「${S}」`)}catch($){b(Xt($))}finally{x(!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(bs,{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(Rb,{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(Rb,{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(es,{saved:!1,error:null,children:l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:p,onClick:()=>void T(),children:p?"正在保存…":f})})]})}function YE({onDone:n}){const[a,r]=y.useState("");return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"MCP"}),l.jsx(et,{title:"添加 MCP 服务",desc:"本地命令(stdio)或远程地址(streamable HTTP)。保存后可以在详情里测试连接并开关单个工具。"}),l.jsx(be,{children:l.jsx(by,{initial:qE,name:a,onName:r,fixedName:!1,onSaved:n,saveLabel:"添加"})})]})}function GE({server:n,setView:a,probe:r,onProbe:o,onDone:c}){const[f,h]=y.useState(null),[m,p]=y.useState(!1),[x,v]=y.useState(!1),[b,j]=y.useState(null);if(y.useEffect(()=>{n||Ht()},[n]),!n)return null;const T=b??n.hiddenTools??[],S=r?.state==="connected"?r.tools??[]:void 0,C=async $=>{p(!0),h(null);try{const k=await Pb(n.name,$);return a(k),k}catch(k){return h(Xt(k)),null}finally{p(!1)}},M=async()=>{v(!0);try{await o(n,!0)}finally{v(!1)}},A=async()=>{if(window.confirm(`删除 MCP 服务「${n.name}」?此操作不能撤销。`))try{a(await tN(n.name)),c(`已删除「${n.name}」`)}catch($){h(Xt($))}},U=n.kind==="http"?"远程地址":"本地命令";return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"MCP"}),l.jsx(et,{title:n.name,desc:n.description??(n.valid?`${U}的 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 C({enabled:!n.enabled})})]}),l.jsx("div",{className:"lbl",children:"提供方式"}),l.jsx(bs,{items:[{key:"direct",label:"直接提供"},{key:"deferred",label:"按需搜索"}],value:n.exposure,disabled:m,onChange:$=>void C({exposure:$})}),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 M(),disabled:x,children:x?"正在测试…":"测试连接"}),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($=>{const k=T.includes($.name);return l.jsxs("div",{className:`list-row setting-row${k?" gone":""}`,children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname mono",children:$.name}),l.jsx("div",{className:"rprov rclamp",children:$.description||"(没有说明)"})]}),l.jsx("button",{className:`tog${k?" off":""}`,"aria-label":`${$.name}启用`,"aria-pressed":!k,disabled:m,onClick:()=>{const N=k?T.filter(E=>E!==$.name):[...T,$.name];j(N),C({hiddenTools:N})}})]},$.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(by,{initial:IE(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 KE({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 sN().then(j=>{b&&r(j)}).catch(j=>{b&&p(Xt(j))}),()=>{b=!1}},[]);const x=async()=>{h(!0),p(null);try{const b=await lN(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(et,{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(T=>T!==b.id))}),l.jsxs("div",{className:"rmain",children:[l.jsxs("div",{className:"rname",children:[b.name,l.jsx("span",{className:"rtag",children:LE[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(Oe,{children:"没有找到可导入的 MCP 服务"})}),l.jsxs(es,{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 x(),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 VE(){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),x=async()=>c(await aN());y.useEffect(()=>{x().catch(C=>h(Xt(C)))},[]),y.useEffect(()=>{a&&h(null)},[a]);const v=C=>o?.providers.find(M=>M.name===C)?.keyConfigured??!1,b=async(C,M)=>{p(!0);try{const A=await rN(C,M);return A?(h(A),A):(await x(),null)}catch(A){const U=Xt(A);return h(U),U}finally{p(!1)}},j=r.filter(C=>C.enabled),T=(C,M)=>{const A=j.map(k=>k.name),U=A.indexOf(C),$=U+M;$<0||$>=A.length||([A[U],A[$]]=[A[$],A[U]],b([...A.map(k=>r.find(N=>N.name===k)),...r.filter(k=>!k.enabled)]))};if(a?.kind==="searchProvider"){const C=r.find(M=>M.name===a.name);return C?l.jsx(XE,{provider:C,configured:v(C.name),busy:m,save:(M,A)=>b(r.map(U=>U.name===M.name?M:U),A===void 0?void 0:{[M.name]:A})}):l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"联网搜索"}),l.jsx("div",{className:"note",children:"没有这个服务商。"})]})}const S=C=>v(C.name)?"已配置 Key":C.baseUrl?"已填服务地址":"未配置";return l.jsxs(l.Fragment,{children:[l.jsx(et,{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((C,M)=>l.jsxs("div",{className:"list-row setting-row",children:[l.jsx("span",{className:"rorder",children:M+1}),l.jsxs("button",{className:"rmain rbtn",onClick:()=>Tn({kind:"searchProvider",name:C.name,title:Sl[C.name].label}),children:[l.jsx("div",{className:"rname",children:Sl[C.name].label}),l.jsx("div",{className:"rprov",children:Sl[C.name].desc})]}),l.jsx("button",{className:"hob-icon-btn rmove",title:"上移",disabled:m||M===0,onClick:()=>T(C.name,-1),children:l.jsx(X,{name:"down",size:15,className:"up"})}),l.jsx("button",{className:"hob-icon-btn rmove",title:"下移",disabled:m||M===j.length-1,onClick:()=>T(C.name,1),children:l.jsx(X,{name:"down",size:15})})]},C.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(C=>!C.enabled).map(C=>l.jsxs("button",{className:"list-row setting-row",onClick:()=>Tn({kind:"searchProvider",name:C.name,title:Sl[C.name].label}),children:[l.jsxs("div",{className:"rmain",children:[l.jsx("div",{className:"rname",children:Sl[C.name].label}),l.jsx("div",{className:"rprov",children:Sl[C.name].desc})]}),l.jsx("span",{className:"note",children:S(C)}),l.jsx(X,{name:"chev",size:15,className:"rgo"})]},C.name))})]})]})}function XE({provider:n,configured:a,busy:r,save:o}){const c=Sl[n.name],[f,h]=y.useState(n.baseUrl??""),[m,p]=y.useState(""),[x,v]=y.useState(null),[b,j]=y.useState(!1),[T,S]=y.useState(null),[C,M]=y.useState(!1);y.useEffect(()=>h(n.baseUrl??""),[n.baseUrl]);const A=f.trim()!==(n.baseUrl??"")||!!m.trim(),U=a||!!m.trim()||c.keyOptional&&!!f.trim(),$=async()=>{j(!0),v(null);try{const E=await iN(n.name,f.trim(),m.trim()||void 0);return v({ok:E.ok,text:E.ok?`搜索成功,返回 ${E.count} 条结果`:E.error??"搜索失败"}),E.ok}catch(E){return v({ok:!1,text:Xt(E)}),!1}finally{j(!1)}},k=async(E,_)=>{S(null),M(!1);const z=await o(E,_);return z?(S(z),!1):(M(!0),!0)},N=async()=>{await $()&&await k({...n,baseUrl:f.trim()||void 0},m.trim()||void 0)&&p("")};return l.jsxs(l.Fragment,{children:[l.jsx(cn,{label:"联网搜索"}),l.jsx(et,{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&&!U,onClick:()=>void k({...n,enabled:!n.enabled})})]}),!n.enabled&&!U?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:E=>{h(E.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:E=>{p(E.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 $(),disabled:r||b,children:b?"正在搜索…":"测试搜索"}),x?l.jsx("span",{className:x.ok?"okline":"badline",children:x.text}):null]}),l.jsxs(es,{saved:C&&!A,error:T,children:[a?l.jsx("button",{className:"hob-btn",disabled:r,onClick:()=>void k(n,""),children:"删除 Key"}):null,l.jsx("button",{className:"hob-btn hob-btn-primary",disabled:r||b||!A,onClick:()=>void N(),children:"保存"})]})]})})]})}function ZE(){const[n,a]=y.useState(null);if(y.useEffect(()=>{Uw().then(a)},[]),!n)return l.jsx(Oe,{children:"正在读取版本信息…"});const r=[["Hob 版本",n.version],["数据目录",n.home]];return l.jsxs(l.Fragment,{children:[l.jsx(et,{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 QE=n=>n.id;function JE(){const n=je(),a=n.assistants.filter(c=>c.pinned&&!c.hidden&&Qi(c,n.query)),r=q1(a,QE),o=oy(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=>p0(c.target.value)})]}),l.jsx("button",{className:"hob-icon-btn",title:"创建专属助手",onClick:d0,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(ry,{a:c.item,sel:c.item.id===n.sel,size:o.size})})},c.key))}),l.jsx(cy,{size:42,markSel:!0})]}),l.jsxs("div",{className:"side-foot",children:[l.jsxs("button",{className:"frow",onClick:ih,children:[l.jsx(X,{name:"archive",size:18}),l.jsx("span",{className:"sp",children:"知识库"})]}),l.jsxs("button",{className:"frow",onClick:xc,children:[l.jsx(X,{name:"gear",size:18}),l.jsx("span",{className:"sp",children:"设置"})]})]})]})}function PE(){"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&&WN()})};a(n.installing),n.addEventListener("updatefound",()=>a(n.installing))}).catch(()=>{})})}async function FE(){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 WE(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(La));f(r.owner!==a?[]:[...c.filter(m=>!h.has(La(m.page))),...Cw(r.stack,n)]),o({stack:n,owner:a})}return y.useEffect(()=>{if(!c.length)return;const h=setTimeout(()=>f([]),240);return()=>clearTimeout(h)},[c]),Ew(n,c)}function e3(n){return n.replace(/^无法连接 Hob:/,"")}function t3(){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=WE(n.panelStack,n.sel),x=p.map(({page:j,leaving:T})=>l.jsx("div",{className:`mlayer${T?" leaving":""}`,children:j.kind==="file"?l.jsx(sc,{page:j}):j.kind==="job"||j.kind==="jobs"?l.jsx(kf,{page:j}):l.jsx(Tb,{page:j,leaving:!1})},La(j)));if(y.useLayoutEffect(()=>{Gb(n,a)},[n.phase,n.page,n.mobile,n.sheet,n.panelStack,n.theme,a]),y.useEffect(()=>{kN()},[]),y.useEffect(()=>{if(!n.panelStack.length)return;const j=T=>{T.key==="Escape"&&!T.defaultPrevented&&lr()};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(()=>eS(),3e4);return()=>clearInterval(j)},[]),y.useEffect(()=>{const j=n.assistants.reduce((T,S)=>T+S.unread,0);document.title=j>0?`(${j}) Hob`:"Hob"},[n.assistants]),y.useEffect(()=>{if(!n.notice)return;const j=setTimeout(()=>FN(),6e3);return()=>clearTimeout(j)},[n.notice]),n.phase==="login")return l.jsx(lC,{});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:e3(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 FE(),children:"有新版本,点击更新"}):null;if(c.mounted)return l.jsxs(l.Fragment,{children:[l.jsx(lE,{narrow:a,leaving:c.leaving}),a?x:l.jsxs(l.Fragment,{children:[l.jsx(kf,{}),l.jsx(sc,{})]}),v]});if(f.mounted)return l.jsxs(l.Fragment,{children:[l.jsx(gC,{narrow:a,leaving:f.leaving}),a?x: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(eE,{})}),o.mounted?l.jsx("div",{className:`mpane chat${o.leaving?" out":""}`,children:l.jsx(ST,{})}):null,h.mounted?l.jsx(Tb,{leaving:h.leaving,page:null}):null,x]}),l.jsx(Hx,{}),v]}):l.jsxs("div",{className:`app${b?.full?" preview-full":""}`,children:[l.jsx(JE,{}),l.jsx(NT,{}),l.jsxs("div",{className:`panelwrap${b?.full?" full":n.collapsed?" off":n.nowWide?" wide":""}`,children:[l.jsx(Yf,{page:null}),p.map(({page:j,leaving:T})=>l.jsx("div",{className:`panel-layer${j.kind==="file"||j.kind==="job"||j.kind==="jobs"?" wide":""}${T?" leaving":""}`,children:j.kind==="file"?l.jsx(sc,{embedded:!0,page:j}):j.kind==="job"||j.kind==="jobs"?l.jsx(kf,{embedded:!0,page:j}):l.jsx(Yf,{page:j})},La(j)))]}),l.jsx(Hx,{}),n.offline?l.jsx("div",{className:"toast",children:n.offline}):null,v]})}function Tf(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 n3={panelPage:lr,sheet:g0,knowledge:()=>{Wi(),Of("list")},chat:()=>Of("list"),sub:Ht,section:()=>Ml(null),settings:zf};function s3(n=()=>window.innerWidth<768){let a=0,r=0,o=!1;const c=()=>location.pathname+location.search+A1(Ps(),n());history.replaceState({hobDepth:0},"",c());const f=()=>{if(o||r>0)return;const h=Tf(Ps(),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 x=Tf(Ps(),n()).at(-1);if(!x||Tf(Ps(),n()).length<=m)break;n3[x]()}o=!1,f()}),Jb(f),f()}N1.createRoot(document.getElementById("root")).render(l.jsx(t3,{}));s3();document.addEventListener("gesturestart",n=>n.preventDefault());PE();export{X as I,zl as M,$C as a,ir as b,ac as d,l as j,y as r,a3 as s,je as u};