@gavinc-cn/touchstone-dsh 0.2.0 → 0.4.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.
Files changed (116) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +23 -15
  3. package/README.zh.md +17 -12
  4. package/auth.py +0 -0
  5. package/backend/lib/access.js +44 -0
  6. package/backend/lib/agents.js +341 -0
  7. package/backend/lib/args.js +94 -0
  8. package/backend/lib/auth.js +195 -0
  9. package/backend/lib/board.js +6227 -0
  10. package/backend/lib/builtin-assets.js +1177 -0
  11. package/backend/lib/casescan.js +456 -0
  12. package/backend/lib/chat.js +2090 -0
  13. package/backend/lib/cookie.js +76 -0
  14. package/backend/lib/db.js +2260 -0
  15. package/backend/lib/dshdriver.js +1148 -0
  16. package/backend/lib/dshevents.js +851 -0
  17. package/backend/lib/export-cases.js +261 -0
  18. package/backend/lib/feishu.js +1747 -0
  19. package/backend/lib/feishu_cfg.js +262 -0
  20. package/backend/lib/feishu_conv.js +1484 -0
  21. package/backend/lib/feishu_device.js +428 -0
  22. package/backend/lib/feishu_inbound.js +2077 -0
  23. package/backend/lib/feishu_provision.js +886 -0
  24. package/backend/lib/feishu_rest.js +398 -0
  25. package/backend/lib/feishu_slash.js +568 -0
  26. package/backend/lib/feishu_ws.js +950 -0
  27. package/backend/lib/http.js +312 -0
  28. package/backend/lib/lib.js +973 -0
  29. package/backend/lib/loadcase.js +749 -0
  30. package/backend/lib/loadgen.js +1407 -0
  31. package/backend/lib/localbus.js +164 -0
  32. package/backend/lib/lock.js +426 -0
  33. package/backend/lib/proc.js +361 -0
  34. package/backend/lib/prompts.js +1021 -0
  35. package/backend/lib/pybase64.js +114 -0
  36. package/backend/lib/pyjson.js +214 -0
  37. package/backend/lib/query.js +125 -0
  38. package/backend/lib/rag.js +1310 -0
  39. package/backend/lib/runner.js +4546 -0
  40. package/backend/lib/seed_hint.js +40 -0
  41. package/backend/lib/servercaps.js +182 -0
  42. package/backend/lib/serverstate.js +227 -0
  43. package/backend/lib/sessparse.js +1176 -0
  44. package/backend/lib/sse.js +207 -0
  45. package/backend/lib/static.js +84 -0
  46. package/backend/lib/taskjson.js +302 -0
  47. package/backend/lib/waitq.js +2114 -0
  48. package/backend/lib/worktree.js +588 -0
  49. package/backend/lib/zstd-frames.js +218 -0
  50. package/backend/routes/admin.js +553 -0
  51. package/backend/routes/agents.js +149 -0
  52. package/backend/routes/assets.js +145 -0
  53. package/backend/routes/board.js +1228 -0
  54. package/backend/routes/feishu.js +269 -0
  55. package/backend/routes/feishu_app.js +249 -0
  56. package/backend/routes/feishu_hook.js +358 -0
  57. package/backend/routes/index.js +298 -0
  58. package/backend/routes/projects.js +1138 -0
  59. package/backend/routes/sessions.js +1003 -0
  60. package/backend/routes/tasks.js +1530 -0
  61. package/backend/schema/fixtures/ancient.sql +189 -0
  62. package/backend/schema/fixtures/pre_alter.sql +177 -0
  63. package/backend/schema/migrations.json +154 -0
  64. package/backend/schema/schema.json +1451 -0
  65. package/backend/schema/schema.sql +216 -0
  66. package/backend/server.js +505 -0
  67. package/board.py +96 -13
  68. package/builtin_assets.py +0 -0
  69. package/builtin_prompts/free_style/flow.md +0 -0
  70. package/builtin_prompts/free_style/load_test.md +0 -0
  71. package/builtin_prompts/free_style/templates/bug_report_template.md +0 -0
  72. package/builtin_prompts/free_style/templates/case_template.md +0 -0
  73. package/builtin_prompts/free_style/templates/index_template.md +0 -0
  74. package/builtin_prompts/free_style/templates/load_charts_template.md +0 -0
  75. package/builtin_prompts/free_style/templates/load_index_template.md +0 -0
  76. package/builtin_prompts/free_style/templates/load_plan_template.md +0 -0
  77. package/builtin_prompts/free_style/templates/load_scenario_template.md +0 -0
  78. package/builtin_prompts/free_style/templates/status_template.md +0 -0
  79. package/chat.py +33 -0
  80. package/db.py +294 -129
  81. package/dsh-plugin/cordis.patch.yml +0 -0
  82. package/dsh-plugin/install.sh +22 -8
  83. package/dsh-plugin/lib/client.bundle.js +111 -2
  84. package/dsh-plugin/lib/index.js +340 -29
  85. package/dsh-plugin/lib/pack-closure.mjs +291 -0
  86. package/dsh-plugin/scripts/build.mjs +0 -0
  87. package/dsh-plugin/scripts/prepack-check.mjs +30 -2
  88. package/dsh-plugin/scripts/select-bundle.mjs +0 -0
  89. package/dsh-plugin/src/client.js +111 -2
  90. package/dshevents.py +0 -0
  91. package/export_cases.py +0 -0
  92. package/extensions/dsh-autocommit/asset.json +0 -0
  93. package/extensions/dsh-autocommit/pkg/lib/index.mjs +0 -0
  94. package/extensions/dsh-autocommit/pkg/package.json +0 -0
  95. package/feishu.py +417 -3
  96. package/feishu_conv.py +0 -0
  97. package/lib.py +0 -0
  98. package/lifecycle.py +116 -13
  99. package/loadcase.py +0 -0
  100. package/loadgen.py +0 -0
  101. package/localbus.py +0 -0
  102. package/migrate_p7b.py +0 -0
  103. package/package.json +6 -1
  104. package/platcompat.py +0 -0
  105. package/prompts.py +0 -0
  106. package/rag.py +0 -0
  107. package/requirements.txt +0 -0
  108. package/server.py +155 -11
  109. package/touchstone.py +0 -0
  110. package/waitq.py +0 -0
  111. package/webui/dist-plugin/assets/index-3QsYQi7y.css +1 -0
  112. package/webui/dist-plugin/assets/index-B8AMtW7y.js +486 -0
  113. package/webui/dist-plugin/index.html +2 -2
  114. package/worktree.py +0 -0
  115. package/webui/dist-plugin/assets/index-JLwyZZxC.js +0 -484
  116. package/webui/dist-plugin/assets/index-tJ0TlvQ3.css +0 -1
@@ -0,0 +1,486 @@
1
+ var ah=e=>{throw TypeError(e)};var ih=(e,t,n)=>t.has(e)||ah("Cannot "+n);var wn=(e,t,n)=>(ih(e,t,"read from private field"),n?n.call(e):t.get(e)),ch=(e,t,n)=>t.has(e)?ah("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),$u=(e,t,n,s)=>(ih(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);function b1(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(s,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function Hx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ux={exports:{}},eu={},Vx={exports:{}},Ye={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ri=Symbol.for("react.element"),_1=Symbol.for("react.portal"),k1=Symbol.for("react.fragment"),S1=Symbol.for("react.strict_mode"),N1=Symbol.for("react.profiler"),C1=Symbol.for("react.provider"),E1=Symbol.for("react.context"),R1=Symbol.for("react.forward_ref"),P1=Symbol.for("react.suspense"),M1=Symbol.for("react.memo"),T1=Symbol.for("react.lazy"),uh=Symbol.iterator;function $1(e){return e===null||typeof e!="object"?null:(e=uh&&e[uh]||e["@@iterator"],typeof e=="function"?e:null)}var Wx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qx=Object.assign,Gx={};function Yl(e,t,n){this.props=e,this.context=t,this.refs=Gx,this.updater=n||Wx}Yl.prototype.isReactComponent={};Yl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Yl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Kx(){}Kx.prototype=Yl.prototype;function cp(e,t,n){this.props=e,this.context=t,this.refs=Gx,this.updater=n||Wx}var up=cp.prototype=new Kx;up.constructor=cp;qx(up,Yl.prototype);up.isPureReactComponent=!0;var dh=Array.isArray,Qx=Object.prototype.hasOwnProperty,dp={current:null},Yx={key:!0,ref:!0,__self:!0,__source:!0};function Xx(e,t,n){var s,o={},l=null,a=null;if(t!=null)for(s in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(l=""+t.key),t)Qx.call(t,s)&&!Yx.hasOwnProperty(s)&&(o[s]=t[s]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var c=Array(i),d=0;d<i;d++)c[d]=arguments[d+2];o.children=c}if(e&&e.defaultProps)for(s in i=e.defaultProps,i)o[s]===void 0&&(o[s]=i[s]);return{$$typeof:ri,type:e,key:l,ref:a,props:o,_owner:dp.current}}function I1(e,t){return{$$typeof:ri,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function fp(e){return typeof e=="object"&&e!==null&&e.$$typeof===ri}function A1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var fh=/\/+/g;function Iu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?A1(""+e.key):t.toString(36)}function Zi(e,t,n,s,o){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(l){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case ri:case _1:a=!0}}if(a)return a=e,o=o(a),e=s===""?"."+Iu(a,0):s,dh(o)?(n="",e!=null&&(n=e.replace(fh,"$&/")+"/"),Zi(o,t,n,"",function(d){return d})):o!=null&&(fp(o)&&(o=I1(o,n+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(fh,"$&/")+"/")+e)),t.push(o)),1;if(a=0,s=s===""?".":s+":",dh(e))for(var i=0;i<e.length;i++){l=e[i];var c=s+Iu(l,i);a+=Zi(l,t,n,c,o)}else if(c=$1(e),typeof c=="function")for(e=c.call(e),i=0;!(l=e.next()).done;)l=l.value,c=s+Iu(l,i++),a+=Zi(l,t,n,c,o);else if(l==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function gi(e,t,n){if(e==null)return e;var s=[],o=0;return Zi(e,s,"","",function(l){return t.call(n,l,o++)}),s}function O1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ln={current:null},ec={transition:null},L1={ReactCurrentDispatcher:Ln,ReactCurrentBatchConfig:ec,ReactCurrentOwner:dp};function Jx(){throw Error("act(...) is not supported in production builds of React.")}Ye.Children={map:gi,forEach:function(e,t,n){gi(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return gi(e,function(){t++}),t},toArray:function(e){return gi(e,function(t){return t})||[]},only:function(e){if(!fp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ye.Component=Yl;Ye.Fragment=k1;Ye.Profiler=N1;Ye.PureComponent=cp;Ye.StrictMode=S1;Ye.Suspense=P1;Ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L1;Ye.act=Jx;Ye.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=qx({},e.props),o=e.key,l=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(l=t.ref,a=dp.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)Qx.call(t,c)&&!Yx.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&i!==void 0?i[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){i=Array(c);for(var d=0;d<c;d++)i[d]=arguments[d+2];s.children=i}return{$$typeof:ri,type:e.type,key:o,ref:l,props:s,_owner:a}};Ye.createContext=function(e){return e={$$typeof:E1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:C1,_context:e},e.Consumer=e};Ye.createElement=Xx;Ye.createFactory=function(e){var t=Xx.bind(null,e);return t.type=e,t};Ye.createRef=function(){return{current:null}};Ye.forwardRef=function(e){return{$$typeof:R1,render:e}};Ye.isValidElement=fp;Ye.lazy=function(e){return{$$typeof:T1,_payload:{_status:-1,_result:e},_init:O1}};Ye.memo=function(e,t){return{$$typeof:M1,type:e,compare:t===void 0?null:t}};Ye.startTransition=function(e){var t=ec.transition;ec.transition={};try{e()}finally{ec.transition=t}};Ye.unstable_act=Jx;Ye.useCallback=function(e,t){return Ln.current.useCallback(e,t)};Ye.useContext=function(e){return Ln.current.useContext(e)};Ye.useDebugValue=function(){};Ye.useDeferredValue=function(e){return Ln.current.useDeferredValue(e)};Ye.useEffect=function(e,t){return Ln.current.useEffect(e,t)};Ye.useId=function(){return Ln.current.useId()};Ye.useImperativeHandle=function(e,t,n){return Ln.current.useImperativeHandle(e,t,n)};Ye.useInsertionEffect=function(e,t){return Ln.current.useInsertionEffect(e,t)};Ye.useLayoutEffect=function(e,t){return Ln.current.useLayoutEffect(e,t)};Ye.useMemo=function(e,t){return Ln.current.useMemo(e,t)};Ye.useReducer=function(e,t,n){return Ln.current.useReducer(e,t,n)};Ye.useRef=function(e){return Ln.current.useRef(e)};Ye.useState=function(e){return Ln.current.useState(e)};Ye.useSyncExternalStore=function(e,t,n){return Ln.current.useSyncExternalStore(e,t,n)};Ye.useTransition=function(){return Ln.current.useTransition()};Ye.version="18.3.1";Vx.exports=Ye;var u=Vx.exports;const Zx=Hx(u),Qo=b1({__proto__:null,default:Zx},[u]);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var D1=u,z1=Symbol.for("react.element"),F1=Symbol.for("react.fragment"),B1=Object.prototype.hasOwnProperty,H1=D1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,U1={key:!0,ref:!0,__self:!0,__source:!0};function ev(e,t,n){var s,o={},l=null,a=null;n!==void 0&&(l=""+n),t.key!==void 0&&(l=""+t.key),t.ref!==void 0&&(a=t.ref);for(s in t)B1.call(t,s)&&!U1.hasOwnProperty(s)&&(o[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)o[s]===void 0&&(o[s]=t[s]);return{$$typeof:z1,type:e,key:l,ref:a,props:o,_owner:H1.current}}eu.Fragment=F1;eu.jsx=ev;eu.jsxs=ev;Ux.exports=eu;var r=Ux.exports,tv={exports:{}},ts={},nv={exports:{}},sv={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(F,Z){var D=F.length;F.push(Z);e:for(;0<D;){var be=D-1>>>1,ge=F[be];if(0<o(ge,Z))F[be]=Z,F[D]=ge,D=be;else break e}}function n(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var Z=F[0],D=F.pop();if(D!==Z){F[0]=D;e:for(var be=0,ge=F.length,Te=ge>>>1;be<Te;){var re=2*(be+1)-1,$e=F[re],he=re+1,De=F[he];if(0>o($e,D))he<ge&&0>o(De,$e)?(F[be]=De,F[he]=D,be=he):(F[be]=$e,F[re]=D,be=re);else if(he<ge&&0>o(De,D))F[be]=De,F[he]=D,be=he;else break e}}return Z}function o(F,Z){var D=F.sortIndex-Z.sortIndex;return D!==0?D:F.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,i=a.now();e.unstable_now=function(){return a.now()-i}}var c=[],d=[],f=1,p=null,m=3,g=!1,h=!1,y=!1,j=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(F){for(var Z=n(d);Z!==null;){if(Z.callback===null)s(d);else if(Z.startTime<=F)s(d),Z.sortIndex=Z.expirationTime,t(c,Z);else break;Z=n(d)}}function b(F){if(y=!1,v(F),!h)if(n(c)!==null)h=!0,O(S);else{var Z=n(d);Z!==null&&U(b,Z.startTime-F)}}function S(F,Z){h=!1,y&&(y=!1,w(R),R=-1),g=!0;var D=m;try{for(v(Z),p=n(c);p!==null&&(!(p.expirationTime>Z)||F&&!I());){var be=p.callback;if(typeof be=="function"){p.callback=null,m=p.priorityLevel;var ge=be(p.expirationTime<=Z);Z=e.unstable_now(),typeof ge=="function"?p.callback=ge:p===n(c)&&s(c),v(Z)}else s(c);p=n(c)}if(p!==null)var Te=!0;else{var re=n(d);re!==null&&U(b,re.startTime-Z),Te=!1}return Te}finally{p=null,m=D,g=!1}}var k=!1,E=null,R=-1,z=5,N=-1;function I(){return!(e.unstable_now()-N<z)}function A(){if(E!==null){var F=e.unstable_now();N=F;var Z=!0;try{Z=E(!0,F)}finally{Z?W():(k=!1,E=null)}}else k=!1}var W;if(typeof x=="function")W=function(){x(A)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,J=L.port2;L.port1.onmessage=A,W=function(){J.postMessage(null)}}else W=function(){j(A,0)};function O(F){E=F,k||(k=!0,W())}function U(F,Z){R=j(function(){F(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_continueExecution=function(){h||g||(h=!0,O(S))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(F){switch(m){case 1:case 2:case 3:var Z=3;break;default:Z=m}var D=m;m=Z;try{return F()}finally{m=D}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,Z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var D=m;m=F;try{return Z()}finally{m=D}},e.unstable_scheduleCallback=function(F,Z,D){var be=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?be+D:be):D=be,F){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=D+ge,F={id:f++,callback:Z,priorityLevel:F,startTime:D,expirationTime:ge,sortIndex:-1},D>be?(F.sortIndex=D,t(d,F),n(c)===null&&F===n(d)&&(y?(w(R),R=-1):y=!0,U(b,D-be))):(F.sortIndex=ge,t(c,F),h||g||(h=!0,O(S))),F},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(F){var Z=m;return function(){var D=m;m=Z;try{return F.apply(this,arguments)}finally{m=D}}}})(sv);nv.exports=sv;var V1=nv.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var W1=u,es=V1;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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."}var rv=new Set,Ia={};function Yo(e,t){Ll(e,t),Ll(e+"Capture",t)}function Ll(e,t){for(Ia[e]=t,e=0;e<t.length;e++)rv.add(t[e])}var vr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Md=Object.prototype.hasOwnProperty,q1=/^[: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]*$/,ph={},mh={};function G1(e){return Md.call(mh,e)?!0:Md.call(ph,e)?!1:q1.test(e)?mh[e]=!0:(ph[e]=!0,!1)}function K1(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q1(e,t,n,s){if(t===null||typeof t>"u"||K1(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Dn(e,t,n,s,o,l,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=a}var vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vn[e]=new Dn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vn[t]=new Dn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vn[e]=new Dn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vn[e]=new Dn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){vn[e]=new Dn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vn[e]=new Dn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vn[e]=new Dn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vn[e]=new Dn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vn[e]=new Dn(e,5,!1,e.toLowerCase(),null,!1,!1)});var pp=/[\-:]([a-z])/g;function mp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(pp,mp);vn[t]=new Dn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(pp,mp);vn[t]=new Dn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(pp,mp);vn[t]=new Dn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!1,!1)});vn.xlinkHref=new Dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vn[e]=new Dn(e,1,!1,e.toLowerCase(),null,!0,!0)});function hp(e,t,n,s){var o=vn.hasOwnProperty(t)?vn[t]:null;(o!==null?o.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Q1(t,n,o,s)&&(n=null),s||o===null?G1(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,s=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var Sr=W1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,xi=Symbol.for("react.element"),fl=Symbol.for("react.portal"),pl=Symbol.for("react.fragment"),gp=Symbol.for("react.strict_mode"),Td=Symbol.for("react.profiler"),ov=Symbol.for("react.provider"),lv=Symbol.for("react.context"),xp=Symbol.for("react.forward_ref"),$d=Symbol.for("react.suspense"),Id=Symbol.for("react.suspense_list"),vp=Symbol.for("react.memo"),Dr=Symbol.for("react.lazy"),av=Symbol.for("react.offscreen"),hh=Symbol.iterator;function la(e){return e===null||typeof e!="object"?null:(e=hh&&e[hh]||e["@@iterator"],typeof e=="function"?e:null)}var Tt=Object.assign,Au;function ya(e){if(Au===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Au=t&&t[1]||""}return`
34
+ `+Au+e}var Ou=!1;function Lu(e,t){if(!e||Ou)return"";Ou=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}catch(d){if(d&&s&&typeof d.stack=="string"){for(var o=d.stack.split(`
35
+ `),l=s.stack.split(`
36
+ `),a=o.length-1,i=l.length-1;1<=a&&0<=i&&o[a]!==l[i];)i--;for(;1<=a&&0<=i;a--,i--)if(o[a]!==l[i]){if(a!==1||i!==1)do if(a--,i--,0>i||o[a]!==l[i]){var c=`
37
+ `+o[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=i);break}}}finally{Ou=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ya(e):""}function Y1(e){switch(e.tag){case 5:return ya(e.type);case 16:return ya("Lazy");case 13:return ya("Suspense");case 19:return ya("SuspenseList");case 0:case 2:case 15:return e=Lu(e.type,!1),e;case 11:return e=Lu(e.type.render,!1),e;case 1:return e=Lu(e.type,!0),e;default:return""}}function Ad(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case pl:return"Fragment";case fl:return"Portal";case Td:return"Profiler";case gp:return"StrictMode";case $d:return"Suspense";case Id:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case lv:return(e.displayName||"Context")+".Consumer";case ov:return(e._context.displayName||"Context")+".Provider";case xp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vp:return t=e.displayName||null,t!==null?t:Ad(e.type)||"Memo";case Dr:t=e._payload,e=e._init;try{return Ad(e(t))}catch{}}return null}function X1(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ad(t);case 8:return t===gp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function lo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function iv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function J1(e){var t=iv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){s=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(a){s=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function vi(e){e._valueTracker||(e._valueTracker=J1(e))}function cv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=iv(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}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 Od(e,t){var n=t.checked;return Tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function gh(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=lo(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function uv(e,t){t=t.checked,t!=null&&hp(e,"checked",t,!1)}function Ld(e,t){uv(e,t);var n=lo(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Dd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Dd(e,t.type,lo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xh(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Dd(e,t,n){(t!=="number"||vc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var wa=Array.isArray;function Cl(e,t,n,s){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&s&&(e[n].defaultSelected=!0)}else{for(n=""+lo(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,s&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function zd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ne(91));return Tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function vh(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ne(92));if(wa(n)){if(1<n.length)throw Error(ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:lo(n)}}function dv(e,t){var n=lo(t.value),s=lo(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function yh(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function fv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Fd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?fv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var yi,pv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(yi=yi||document.createElement("div"),yi.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=yi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Aa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Sa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Z1=["Webkit","ms","Moz","O"];Object.keys(Sa).forEach(function(e){Z1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Sa[t]=Sa[e]})});function mv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Sa.hasOwnProperty(e)&&Sa[e]?(""+t).trim():t+"px"}function hv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,o=mv(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,o):e[n]=o}}var eb=Tt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Bd(e,t){if(t){if(eb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function Hd(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ud=null;function yp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vd=null,El=null,Rl=null;function wh(e){if(e=ai(e)){if(typeof Vd!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=ou(t),Vd(e.stateNode,e.type,t))}}function gv(e){El?Rl?Rl.push(e):Rl=[e]:El=e}function xv(){if(El){var e=El,t=Rl;if(Rl=El=null,wh(e),t)for(e=0;e<t.length;e++)wh(t[e])}}function vv(e,t){return e(t)}function yv(){}var Du=!1;function wv(e,t,n){if(Du)return e(t,n);Du=!0;try{return vv(e,t,n)}finally{Du=!1,(El!==null||Rl!==null)&&(yv(),xv())}}function Oa(e,t){var n=e.stateNode;if(n===null)return null;var s=ou(n);if(s===null)return null;n=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ne(231,t,typeof n));return n}var Wd=!1;if(vr)try{var aa={};Object.defineProperty(aa,"passive",{get:function(){Wd=!0}}),window.addEventListener("test",aa,aa),window.removeEventListener("test",aa,aa)}catch{Wd=!1}function tb(e,t,n,s,o,l,a,i,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var Na=!1,yc=null,wc=!1,qd=null,nb={onError:function(e){Na=!0,yc=e}};function sb(e,t,n,s,o,l,a,i,c){Na=!1,yc=null,tb.apply(nb,arguments)}function rb(e,t,n,s,o,l,a,i,c){if(sb.apply(this,arguments),Na){if(Na){var d=yc;Na=!1,yc=null}else throw Error(ne(198));wc||(wc=!0,qd=d)}}function Xo(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function jv(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 jh(e){if(Xo(e)!==e)throw Error(ne(188))}function ob(e){var t=e.alternate;if(!t){if(t=Xo(e),t===null)throw Error(ne(188));return t!==e?null:e}for(var n=e,s=t;;){var o=n.return;if(o===null)break;var l=o.alternate;if(l===null){if(s=o.return,s!==null){n=s;continue}break}if(o.child===l.child){for(l=o.child;l;){if(l===n)return jh(o),e;if(l===s)return jh(o),t;l=l.sibling}throw Error(ne(188))}if(n.return!==s.return)n=o,s=l;else{for(var a=!1,i=o.child;i;){if(i===n){a=!0,n=o,s=l;break}if(i===s){a=!0,s=o,n=l;break}i=i.sibling}if(!a){for(i=l.child;i;){if(i===n){a=!0,n=l,s=o;break}if(i===s){a=!0,s=l,n=o;break}i=i.sibling}if(!a)throw Error(ne(189))}}if(n.alternate!==s)throw Error(ne(190))}if(n.tag!==3)throw Error(ne(188));return n.stateNode.current===n?e:t}function bv(e){return e=ob(e),e!==null?_v(e):null}function _v(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=_v(e);if(t!==null)return t;e=e.sibling}return null}var kv=es.unstable_scheduleCallback,bh=es.unstable_cancelCallback,lb=es.unstable_shouldYield,ab=es.unstable_requestPaint,Ut=es.unstable_now,ib=es.unstable_getCurrentPriorityLevel,wp=es.unstable_ImmediatePriority,Sv=es.unstable_UserBlockingPriority,jc=es.unstable_NormalPriority,cb=es.unstable_LowPriority,Nv=es.unstable_IdlePriority,tu=null,Gs=null;function ub(e){if(Gs&&typeof Gs.onCommitFiberRoot=="function")try{Gs.onCommitFiberRoot(tu,e,void 0,(e.current.flags&128)===128)}catch{}}var Cs=Math.clz32?Math.clz32:pb,db=Math.log,fb=Math.LN2;function pb(e){return e>>>=0,e===0?32:31-(db(e)/fb|0)|0}var wi=64,ji=4194304;function ja(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function bc(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,o=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var i=a&~o;i!==0?s=ja(i):(l&=a,l!==0&&(s=ja(l)))}else a=n&~o,a!==0?s=ja(a):l!==0&&(s=ja(l));if(s===0)return 0;if(t!==0&&t!==s&&!(t&o)&&(o=s&-s,l=t&-t,o>=l||o===16&&(l&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Cs(t),o=1<<n,s|=e[n],t&=~o;return s}function mb(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hb(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,l=e.pendingLanes;0<l;){var a=31-Cs(l),i=1<<a,c=o[a];c===-1?(!(i&n)||i&s)&&(o[a]=mb(i,t)):c<=t&&(e.expiredLanes|=i),l&=~i}}function Gd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Cv(){var e=wi;return wi<<=1,!(wi&4194240)&&(wi=64),e}function zu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function oi(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Cs(t),e[t]=n}function gb(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Cs(n),l=1<<o;t[o]=0,s[o]=-1,e[o]=-1,n&=~l}}function jp(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Cs(n),o=1<<s;o&t|e[s]&t&&(e[s]|=t),n&=~o}}var it=0;function Ev(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Rv,bp,Pv,Mv,Tv,Kd=!1,bi=[],Gr=null,Kr=null,Qr=null,La=new Map,Da=new Map,Fr=[],xb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _h(e,t){switch(e){case"focusin":case"focusout":Gr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":Qr=null;break;case"pointerover":case"pointerout":La.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Da.delete(t.pointerId)}}function ia(e,t,n,s,o,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:l,targetContainers:[o]},t!==null&&(t=ai(t),t!==null&&bp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function vb(e,t,n,s,o){switch(t){case"focusin":return Gr=ia(Gr,e,t,n,s,o),!0;case"dragenter":return Kr=ia(Kr,e,t,n,s,o),!0;case"mouseover":return Qr=ia(Qr,e,t,n,s,o),!0;case"pointerover":var l=o.pointerId;return La.set(l,ia(La.get(l)||null,e,t,n,s,o)),!0;case"gotpointercapture":return l=o.pointerId,Da.set(l,ia(Da.get(l)||null,e,t,n,s,o)),!0}return!1}function $v(e){var t=Mo(e.target);if(t!==null){var n=Xo(t);if(n!==null){if(t=n.tag,t===13){if(t=jv(n),t!==null){e.blockedOn=t,Tv(e.priority,function(){Pv(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function tc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Ud=s,n.target.dispatchEvent(s),Ud=null}else return t=ai(n),t!==null&&bp(t),e.blockedOn=n,!1;t.shift()}return!0}function kh(e,t,n){tc(e)&&n.delete(t)}function yb(){Kd=!1,Gr!==null&&tc(Gr)&&(Gr=null),Kr!==null&&tc(Kr)&&(Kr=null),Qr!==null&&tc(Qr)&&(Qr=null),La.forEach(kh),Da.forEach(kh)}function ca(e,t){e.blockedOn===t&&(e.blockedOn=null,Kd||(Kd=!0,es.unstable_scheduleCallback(es.unstable_NormalPriority,yb)))}function za(e){function t(o){return ca(o,e)}if(0<bi.length){ca(bi[0],e);for(var n=1;n<bi.length;n++){var s=bi[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Gr!==null&&ca(Gr,e),Kr!==null&&ca(Kr,e),Qr!==null&&ca(Qr,e),La.forEach(t),Da.forEach(t),n=0;n<Fr.length;n++)s=Fr[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Fr.length&&(n=Fr[0],n.blockedOn===null);)$v(n),n.blockedOn===null&&Fr.shift()}var Pl=Sr.ReactCurrentBatchConfig,_c=!0;function wb(e,t,n,s){var o=it,l=Pl.transition;Pl.transition=null;try{it=1,_p(e,t,n,s)}finally{it=o,Pl.transition=l}}function jb(e,t,n,s){var o=it,l=Pl.transition;Pl.transition=null;try{it=4,_p(e,t,n,s)}finally{it=o,Pl.transition=l}}function _p(e,t,n,s){if(_c){var o=Qd(e,t,n,s);if(o===null)Qu(e,t,s,kc,n),_h(e,s);else if(vb(o,e,t,n,s))s.stopPropagation();else if(_h(e,s),t&4&&-1<xb.indexOf(e)){for(;o!==null;){var l=ai(o);if(l!==null&&Rv(l),l=Qd(e,t,n,s),l===null&&Qu(e,t,s,kc,n),l===o)break;o=l}o!==null&&s.stopPropagation()}else Qu(e,t,s,null,n)}}var kc=null;function Qd(e,t,n,s){if(kc=null,e=yp(s),e=Mo(e),e!==null)if(t=Xo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=jv(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return kc=e,null}function Iv(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ib()){case wp:return 1;case Sv:return 4;case jc:case cb:return 16;case Nv:return 536870912;default:return 16}default:return 16}}var Ur=null,kp=null,nc=null;function Av(){if(nc)return nc;var e,t=kp,n=t.length,s,o="value"in Ur?Ur.value:Ur.textContent,l=o.length;for(e=0;e<n&&t[e]===o[e];e++);var a=n-e;for(s=1;s<=a&&t[n-s]===o[l-s];s++);return nc=o.slice(e,1<s?1-s:void 0)}function sc(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 _i(){return!0}function Sh(){return!1}function ns(e){function t(n,s,o,l,a){this._reactName=n,this._targetInst=o,this.type=s,this.nativeEvent=l,this.target=a,this.currentTarget=null;for(var i in e)e.hasOwnProperty(i)&&(n=e[i],this[i]=n?n(l):l[i]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?_i:Sh,this.isPropagationStopped=Sh,this}return Tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=_i)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=_i)},persist:function(){},isPersistent:_i}),t}var Xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sp=ns(Xl),li=Tt({},Xl,{view:0,detail:0}),bb=ns(li),Fu,Bu,ua,nu=Tt({},li,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Np,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!==ua&&(ua&&e.type==="mousemove"?(Fu=e.screenX-ua.screenX,Bu=e.screenY-ua.screenY):Bu=Fu=0,ua=e),Fu)},movementY:function(e){return"movementY"in e?e.movementY:Bu}}),Nh=ns(nu),_b=Tt({},nu,{dataTransfer:0}),kb=ns(_b),Sb=Tt({},li,{relatedTarget:0}),Hu=ns(Sb),Nb=Tt({},Xl,{animationName:0,elapsedTime:0,pseudoElement:0}),Cb=ns(Nb),Eb=Tt({},Xl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Rb=ns(Eb),Pb=Tt({},Xl,{data:0}),Ch=ns(Pb),Mb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tb={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"},$b={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ib(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$b[e])?!!t[e]:!1}function Np(){return Ib}var Ab=Tt({},li,{key:function(e){if(e.key){var t=Mb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=sc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Np,charCode:function(e){return e.type==="keypress"?sc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?sc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ob=ns(Ab),Lb=Tt({},nu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eh=ns(Lb),Db=Tt({},li,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Np}),zb=ns(Db),Fb=Tt({},Xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bb=ns(Fb),Hb=Tt({},nu,{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}),Ub=ns(Hb),Vb=[9,13,27,32],Cp=vr&&"CompositionEvent"in window,Ca=null;vr&&"documentMode"in document&&(Ca=document.documentMode);var Wb=vr&&"TextEvent"in window&&!Ca,Ov=vr&&(!Cp||Ca&&8<Ca&&11>=Ca),Rh=" ",Ph=!1;function Lv(e,t){switch(e){case"keyup":return Vb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ml=!1;function qb(e,t){switch(e){case"compositionend":return Dv(t);case"keypress":return t.which!==32?null:(Ph=!0,Rh);case"textInput":return e=t.data,e===Rh&&Ph?null:e;default:return null}}function Gb(e,t){if(ml)return e==="compositionend"||!Cp&&Lv(e,t)?(e=Av(),nc=kp=Ur=null,ml=!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 Ov&&t.locale!=="ko"?null:t.data;default:return null}}var Kb={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 Mh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Kb[e.type]:t==="textarea"}function zv(e,t,n,s){gv(s),t=Sc(t,"onChange"),0<t.length&&(n=new Sp("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Ea=null,Fa=null;function Qb(e){Yv(e,0)}function su(e){var t=xl(e);if(cv(t))return e}function Yb(e,t){if(e==="change")return t}var Fv=!1;if(vr){var Uu;if(vr){var Vu="oninput"in document;if(!Vu){var Th=document.createElement("div");Th.setAttribute("oninput","return;"),Vu=typeof Th.oninput=="function"}Uu=Vu}else Uu=!1;Fv=Uu&&(!document.documentMode||9<document.documentMode)}function $h(){Ea&&(Ea.detachEvent("onpropertychange",Bv),Fa=Ea=null)}function Bv(e){if(e.propertyName==="value"&&su(Fa)){var t=[];zv(t,Fa,e,yp(e)),wv(Qb,t)}}function Xb(e,t,n){e==="focusin"?($h(),Ea=t,Fa=n,Ea.attachEvent("onpropertychange",Bv)):e==="focusout"&&$h()}function Jb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return su(Fa)}function Zb(e,t){if(e==="click")return su(t)}function e_(e,t){if(e==="input"||e==="change")return su(t)}function t_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Rs=typeof Object.is=="function"?Object.is:t_;function Ba(e,t){if(Rs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var o=n[s];if(!Md.call(t,o)||!Rs(e[o],t[o]))return!1}return!0}function Ih(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ah(e,t){var n=Ih(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ih(n)}}function Hv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Uv(){for(var e=window,t=vc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=vc(e.document)}return t}function Ep(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function n_(e){var t=Uv(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Hv(n.ownerDocument.documentElement,n)){if(s!==null&&Ep(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,l=Math.min(s.start,o);s=s.end===void 0?l:Math.min(s.end,o),!e.extend&&l>s&&(o=s,s=l,l=o),o=Ah(n,l);var a=Ah(n,s);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),l>s?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var s_=vr&&"documentMode"in document&&11>=document.documentMode,hl=null,Yd=null,Ra=null,Xd=!1;function Oh(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xd||hl==null||hl!==vc(s)||(s=hl,"selectionStart"in s&&Ep(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ra&&Ba(Ra,s)||(Ra=s,s=Sc(Yd,"onSelect"),0<s.length&&(t=new Sp("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=hl)))}function ki(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var gl={animationend:ki("Animation","AnimationEnd"),animationiteration:ki("Animation","AnimationIteration"),animationstart:ki("Animation","AnimationStart"),transitionend:ki("Transition","TransitionEnd")},Wu={},Vv={};vr&&(Vv=document.createElement("div").style,"AnimationEvent"in window||(delete gl.animationend.animation,delete gl.animationiteration.animation,delete gl.animationstart.animation),"TransitionEvent"in window||delete gl.transitionend.transition);function ru(e){if(Wu[e])return Wu[e];if(!gl[e])return e;var t=gl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vv)return Wu[e]=t[n];return e}var Wv=ru("animationend"),qv=ru("animationiteration"),Gv=ru("animationstart"),Kv=ru("transitionend"),Qv=new Map,Lh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function fo(e,t){Qv.set(e,t),Yo(t,[e])}for(var qu=0;qu<Lh.length;qu++){var Gu=Lh[qu],r_=Gu.toLowerCase(),o_=Gu[0].toUpperCase()+Gu.slice(1);fo(r_,"on"+o_)}fo(Wv,"onAnimationEnd");fo(qv,"onAnimationIteration");fo(Gv,"onAnimationStart");fo("dblclick","onDoubleClick");fo("focusin","onFocus");fo("focusout","onBlur");fo(Kv,"onTransitionEnd");Ll("onMouseEnter",["mouseout","mouseover"]);Ll("onMouseLeave",["mouseout","mouseover"]);Ll("onPointerEnter",["pointerout","pointerover"]);Ll("onPointerLeave",["pointerout","pointerover"]);Yo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ba="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(" "),l_=new Set("cancel close invalid load scroll toggle".split(" ").concat(ba));function Dh(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,rb(s,t,void 0,e),e.currentTarget=null}function Yv(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],o=s.event;s=s.listeners;e:{var l=void 0;if(t)for(var a=s.length-1;0<=a;a--){var i=s[a],c=i.instance,d=i.currentTarget;if(i=i.listener,c!==l&&o.isPropagationStopped())break e;Dh(o,i,d),l=c}else for(a=0;a<s.length;a++){if(i=s[a],c=i.instance,d=i.currentTarget,i=i.listener,c!==l&&o.isPropagationStopped())break e;Dh(o,i,d),l=c}}}if(wc)throw e=qd,wc=!1,qd=null,e}function yt(e,t){var n=t[nf];n===void 0&&(n=t[nf]=new Set);var s=e+"__bubble";n.has(s)||(Xv(t,e,2,!1),n.add(s))}function Ku(e,t,n){var s=0;t&&(s|=4),Xv(n,e,s,t)}var Si="_reactListening"+Math.random().toString(36).slice(2);function Ha(e){if(!e[Si]){e[Si]=!0,rv.forEach(function(n){n!=="selectionchange"&&(l_.has(n)||Ku(n,!1,e),Ku(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Si]||(t[Si]=!0,Ku("selectionchange",!1,t))}}function Xv(e,t,n,s){switch(Iv(t)){case 1:var o=wb;break;case 4:o=jb;break;default:o=_p}n=o.bind(null,t,n,e),o=void 0,!Wd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),s?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Qu(e,t,n,s,o){var l=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var a=s.tag;if(a===3||a===4){var i=s.stateNode.containerInfo;if(i===o||i.nodeType===8&&i.parentNode===o)break;if(a===4)for(a=s.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===o||c.nodeType===8&&c.parentNode===o))return;a=a.return}for(;i!==null;){if(a=Mo(i),a===null)return;if(c=a.tag,c===5||c===6){s=l=a;continue e}i=i.parentNode}}s=s.return}wv(function(){var d=l,f=yp(n),p=[];e:{var m=Qv.get(e);if(m!==void 0){var g=Sp,h=e;switch(e){case"keypress":if(sc(n)===0)break e;case"keydown":case"keyup":g=Ob;break;case"focusin":h="focus",g=Hu;break;case"focusout":h="blur",g=Hu;break;case"beforeblur":case"afterblur":g=Hu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=kb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=zb;break;case Wv:case qv:case Gv:g=Cb;break;case Kv:g=Bb;break;case"scroll":g=bb;break;case"wheel":g=Ub;break;case"copy":case"cut":case"paste":g=Rb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Eh}var y=(t&4)!==0,j=!y&&e==="scroll",w=y?m!==null?m+"Capture":null:m;y=[];for(var x=d,v;x!==null;){v=x;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,w!==null&&(b=Oa(x,w),b!=null&&y.push(Ua(x,b,v)))),j)break;x=x.return}0<y.length&&(m=new g(m,h,null,n,f),p.push({event:m,listeners:y}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==Ud&&(h=n.relatedTarget||n.fromElement)&&(Mo(h)||h[yr]))break e;if((g||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,g?(h=n.relatedTarget||n.toElement,g=d,h=h?Mo(h):null,h!==null&&(j=Xo(h),h!==j||h.tag!==5&&h.tag!==6)&&(h=null)):(g=null,h=d),g!==h)){if(y=Nh,b="onMouseLeave",w="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=Eh,b="onPointerLeave",w="onPointerEnter",x="pointer"),j=g==null?m:xl(g),v=h==null?m:xl(h),m=new y(b,x+"leave",g,n,f),m.target=j,m.relatedTarget=v,b=null,Mo(f)===d&&(y=new y(w,x+"enter",h,n,f),y.target=v,y.relatedTarget=j,b=y),j=b,g&&h)t:{for(y=g,w=h,x=0,v=y;v;v=ll(v))x++;for(v=0,b=w;b;b=ll(b))v++;for(;0<x-v;)y=ll(y),x--;for(;0<v-x;)w=ll(w),v--;for(;x--;){if(y===w||w!==null&&y===w.alternate)break t;y=ll(y),w=ll(w)}y=null}else y=null;g!==null&&zh(p,m,g,y,!1),h!==null&&j!==null&&zh(p,j,h,y,!0)}}e:{if(m=d?xl(d):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var S=Yb;else if(Mh(m))if(Fv)S=e_;else{S=Jb;var k=Xb}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=Zb);if(S&&(S=S(e,d))){zv(p,S,n,f);break e}k&&k(e,m,d),e==="focusout"&&(k=m._wrapperState)&&k.controlled&&m.type==="number"&&Dd(m,"number",m.value)}switch(k=d?xl(d):window,e){case"focusin":(Mh(k)||k.contentEditable==="true")&&(hl=k,Yd=d,Ra=null);break;case"focusout":Ra=Yd=hl=null;break;case"mousedown":Xd=!0;break;case"contextmenu":case"mouseup":case"dragend":Xd=!1,Oh(p,n,f);break;case"selectionchange":if(s_)break;case"keydown":case"keyup":Oh(p,n,f)}var E;if(Cp)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else ml?Lv(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(Ov&&n.locale!=="ko"&&(ml||R!=="onCompositionStart"?R==="onCompositionEnd"&&ml&&(E=Av()):(Ur=f,kp="value"in Ur?Ur.value:Ur.textContent,ml=!0)),k=Sc(d,R),0<k.length&&(R=new Ch(R,e,null,n,f),p.push({event:R,listeners:k}),E?R.data=E:(E=Dv(n),E!==null&&(R.data=E)))),(E=Wb?qb(e,n):Gb(e,n))&&(d=Sc(d,"onBeforeInput"),0<d.length&&(f=new Ch("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:d}),f.data=E))}Yv(p,t)})}function Ua(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Sc(e,t){for(var n=t+"Capture",s=[];e!==null;){var o=e,l=o.stateNode;o.tag===5&&l!==null&&(o=l,l=Oa(e,n),l!=null&&s.unshift(Ua(e,l,o)),l=Oa(e,t),l!=null&&s.push(Ua(e,l,o))),e=e.return}return s}function ll(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function zh(e,t,n,s,o){for(var l=t._reactName,a=[];n!==null&&n!==s;){var i=n,c=i.alternate,d=i.stateNode;if(c!==null&&c===s)break;i.tag===5&&d!==null&&(i=d,o?(c=Oa(n,l),c!=null&&a.unshift(Ua(n,c,i))):o||(c=Oa(n,l),c!=null&&a.push(Ua(n,c,i)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var a_=/\r\n?/g,i_=/\u0000|\uFFFD/g;function Fh(e){return(typeof e=="string"?e:""+e).replace(a_,`
38
+ `).replace(i_,"")}function Ni(e,t,n){if(t=Fh(t),Fh(e)!==t&&n)throw Error(ne(425))}function Nc(){}var Jd=null,Zd=null;function ef(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var tf=typeof setTimeout=="function"?setTimeout:void 0,c_=typeof clearTimeout=="function"?clearTimeout:void 0,Bh=typeof Promise=="function"?Promise:void 0,u_=typeof queueMicrotask=="function"?queueMicrotask:typeof Bh<"u"?function(e){return Bh.resolve(null).then(e).catch(d_)}:tf;function d_(e){setTimeout(function(){throw e})}function Yu(e,t){var n=t,s=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(s===0){e.removeChild(o),za(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=o}while(n);za(t)}function Yr(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==="$?")break;if(t==="/$")return null}}return e}function Hh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Jl=Math.random().toString(36).slice(2),Us="__reactFiber$"+Jl,Va="__reactProps$"+Jl,yr="__reactContainer$"+Jl,nf="__reactEvents$"+Jl,f_="__reactListeners$"+Jl,p_="__reactHandles$"+Jl;function Mo(e){var t=e[Us];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yr]||n[Us]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Hh(e);e!==null;){if(n=e[Us])return n;e=Hh(e)}return t}e=n,n=e.parentNode}return null}function ai(e){return e=e[Us]||e[yr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ne(33))}function ou(e){return e[Va]||null}var sf=[],vl=-1;function po(e){return{current:e}}function wt(e){0>vl||(e.current=sf[vl],sf[vl]=null,vl--)}function xt(e,t){vl++,sf[vl]=e.current,e.current=t}var ao={},Rn=po(ao),Hn=po(!1),zo=ao;function Dl(e,t){var n=e.type.contextTypes;if(!n)return ao;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var o={},l;for(l in n)o[l]=t[l];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Un(e){return e=e.childContextTypes,e!=null}function Cc(){wt(Hn),wt(Rn)}function Uh(e,t,n){if(Rn.current!==ao)throw Error(ne(168));xt(Rn,t),xt(Hn,n)}function Jv(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var o in s)if(!(o in t))throw Error(ne(108,X1(e)||"Unknown",o));return Tt({},n,s)}function Ec(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ao,zo=Rn.current,xt(Rn,e),xt(Hn,Hn.current),!0}function Vh(e,t,n){var s=e.stateNode;if(!s)throw Error(ne(169));n?(e=Jv(e,t,zo),s.__reactInternalMemoizedMergedChildContext=e,wt(Hn),wt(Rn),xt(Rn,e)):wt(Hn),xt(Hn,n)}var ir=null,lu=!1,Xu=!1;function Zv(e){ir===null?ir=[e]:ir.push(e)}function m_(e){lu=!0,Zv(e)}function mo(){if(!Xu&&ir!==null){Xu=!0;var e=0,t=it;try{var n=ir;for(it=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}ir=null,lu=!1}catch(o){throw ir!==null&&(ir=ir.slice(e+1)),kv(wp,mo),o}finally{it=t,Xu=!1}}return null}var yl=[],wl=0,Rc=null,Pc=0,cs=[],us=0,Fo=null,cr=1,ur="";function Eo(e,t){yl[wl++]=Pc,yl[wl++]=Rc,Rc=e,Pc=t}function ey(e,t,n){cs[us++]=cr,cs[us++]=ur,cs[us++]=Fo,Fo=e;var s=cr;e=ur;var o=32-Cs(s)-1;s&=~(1<<o),n+=1;var l=32-Cs(t)+o;if(30<l){var a=o-o%5;l=(s&(1<<a)-1).toString(32),s>>=a,o-=a,cr=1<<32-Cs(t)+o|n<<o|s,ur=l+e}else cr=1<<l|n<<o|s,ur=e}function Rp(e){e.return!==null&&(Eo(e,1),ey(e,1,0))}function Pp(e){for(;e===Rc;)Rc=yl[--wl],yl[wl]=null,Pc=yl[--wl],yl[wl]=null;for(;e===Fo;)Fo=cs[--us],cs[us]=null,ur=cs[--us],cs[us]=null,cr=cs[--us],cs[us]=null}var Jn=null,Yn=null,kt=!1,Ns=null;function ty(e,t){var n=fs(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Wh(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Jn=e,Yn=Yr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Jn=e,Yn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Fo!==null?{id:cr,overflow:ur}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=fs(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Jn=e,Yn=null,!0):!1;default:return!1}}function rf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function of(e){if(kt){var t=Yn;if(t){var n=t;if(!Wh(e,t)){if(rf(e))throw Error(ne(418));t=Yr(n.nextSibling);var s=Jn;t&&Wh(e,t)?ty(s,n):(e.flags=e.flags&-4097|2,kt=!1,Jn=e)}}else{if(rf(e))throw Error(ne(418));e.flags=e.flags&-4097|2,kt=!1,Jn=e}}}function qh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Jn=e}function Ci(e){if(e!==Jn)return!1;if(!kt)return qh(e),kt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ef(e.type,e.memoizedProps)),t&&(t=Yn)){if(rf(e))throw ny(),Error(ne(418));for(;t;)ty(e,t),t=Yr(t.nextSibling)}if(qh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Yn=Yr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Yn=null}}else Yn=Jn?Yr(e.stateNode.nextSibling):null;return!0}function ny(){for(var e=Yn;e;)e=Yr(e.nextSibling)}function zl(){Yn=Jn=null,kt=!1}function Mp(e){Ns===null?Ns=[e]:Ns.push(e)}var h_=Sr.ReactCurrentBatchConfig;function da(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ne(309));var s=n.stateNode}if(!s)throw Error(ne(147,e));var o=s,l=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===l?t.ref:(t=function(a){var i=o.refs;a===null?delete i[l]:i[l]=a},t._stringRef=l,t)}if(typeof e!="string")throw Error(ne(284));if(!n._owner)throw Error(ne(290,e))}return e}function Ei(e,t){throw e=Object.prototype.toString.call(t),Error(ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Gh(e){var t=e._init;return t(e._payload)}function sy(e){function t(w,x){if(e){var v=w.deletions;v===null?(w.deletions=[x],w.flags|=16):v.push(x)}}function n(w,x){if(!e)return null;for(;x!==null;)t(w,x),x=x.sibling;return null}function s(w,x){for(w=new Map;x!==null;)x.key!==null?w.set(x.key,x):w.set(x.index,x),x=x.sibling;return w}function o(w,x){return w=eo(w,x),w.index=0,w.sibling=null,w}function l(w,x,v){return w.index=v,e?(v=w.alternate,v!==null?(v=v.index,v<x?(w.flags|=2,x):v):(w.flags|=2,x)):(w.flags|=1048576,x)}function a(w){return e&&w.alternate===null&&(w.flags|=2),w}function i(w,x,v,b){return x===null||x.tag!==6?(x=rd(v,w.mode,b),x.return=w,x):(x=o(x,v),x.return=w,x)}function c(w,x,v,b){var S=v.type;return S===pl?f(w,x,v.props.children,b,v.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Dr&&Gh(S)===x.type)?(b=o(x,v.props),b.ref=da(w,x,v),b.return=w,b):(b=uc(v.type,v.key,v.props,null,w.mode,b),b.ref=da(w,x,v),b.return=w,b)}function d(w,x,v,b){return x===null||x.tag!==4||x.stateNode.containerInfo!==v.containerInfo||x.stateNode.implementation!==v.implementation?(x=od(v,w.mode,b),x.return=w,x):(x=o(x,v.children||[]),x.return=w,x)}function f(w,x,v,b,S){return x===null||x.tag!==7?(x=Ao(v,w.mode,b,S),x.return=w,x):(x=o(x,v),x.return=w,x)}function p(w,x,v){if(typeof x=="string"&&x!==""||typeof x=="number")return x=rd(""+x,w.mode,v),x.return=w,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case xi:return v=uc(x.type,x.key,x.props,null,w.mode,v),v.ref=da(w,null,x),v.return=w,v;case fl:return x=od(x,w.mode,v),x.return=w,x;case Dr:var b=x._init;return p(w,b(x._payload),v)}if(wa(x)||la(x))return x=Ao(x,w.mode,v,null),x.return=w,x;Ei(w,x)}return null}function m(w,x,v,b){var S=x!==null?x.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return S!==null?null:i(w,x,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case xi:return v.key===S?c(w,x,v,b):null;case fl:return v.key===S?d(w,x,v,b):null;case Dr:return S=v._init,m(w,x,S(v._payload),b)}if(wa(v)||la(v))return S!==null?null:f(w,x,v,b,null);Ei(w,v)}return null}function g(w,x,v,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return w=w.get(v)||null,i(x,w,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case xi:return w=w.get(b.key===null?v:b.key)||null,c(x,w,b,S);case fl:return w=w.get(b.key===null?v:b.key)||null,d(x,w,b,S);case Dr:var k=b._init;return g(w,x,v,k(b._payload),S)}if(wa(b)||la(b))return w=w.get(v)||null,f(x,w,b,S,null);Ei(x,b)}return null}function h(w,x,v,b){for(var S=null,k=null,E=x,R=x=0,z=null;E!==null&&R<v.length;R++){E.index>R?(z=E,E=null):z=E.sibling;var N=m(w,E,v[R],b);if(N===null){E===null&&(E=z);break}e&&E&&N.alternate===null&&t(w,E),x=l(N,x,R),k===null?S=N:k.sibling=N,k=N,E=z}if(R===v.length)return n(w,E),kt&&Eo(w,R),S;if(E===null){for(;R<v.length;R++)E=p(w,v[R],b),E!==null&&(x=l(E,x,R),k===null?S=E:k.sibling=E,k=E);return kt&&Eo(w,R),S}for(E=s(w,E);R<v.length;R++)z=g(E,w,R,v[R],b),z!==null&&(e&&z.alternate!==null&&E.delete(z.key===null?R:z.key),x=l(z,x,R),k===null?S=z:k.sibling=z,k=z);return e&&E.forEach(function(I){return t(w,I)}),kt&&Eo(w,R),S}function y(w,x,v,b){var S=la(v);if(typeof S!="function")throw Error(ne(150));if(v=S.call(v),v==null)throw Error(ne(151));for(var k=S=null,E=x,R=x=0,z=null,N=v.next();E!==null&&!N.done;R++,N=v.next()){E.index>R?(z=E,E=null):z=E.sibling;var I=m(w,E,N.value,b);if(I===null){E===null&&(E=z);break}e&&E&&I.alternate===null&&t(w,E),x=l(I,x,R),k===null?S=I:k.sibling=I,k=I,E=z}if(N.done)return n(w,E),kt&&Eo(w,R),S;if(E===null){for(;!N.done;R++,N=v.next())N=p(w,N.value,b),N!==null&&(x=l(N,x,R),k===null?S=N:k.sibling=N,k=N);return kt&&Eo(w,R),S}for(E=s(w,E);!N.done;R++,N=v.next())N=g(E,w,R,N.value,b),N!==null&&(e&&N.alternate!==null&&E.delete(N.key===null?R:N.key),x=l(N,x,R),k===null?S=N:k.sibling=N,k=N);return e&&E.forEach(function(A){return t(w,A)}),kt&&Eo(w,R),S}function j(w,x,v,b){if(typeof v=="object"&&v!==null&&v.type===pl&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case xi:e:{for(var S=v.key,k=x;k!==null;){if(k.key===S){if(S=v.type,S===pl){if(k.tag===7){n(w,k.sibling),x=o(k,v.props.children),x.return=w,w=x;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Dr&&Gh(S)===k.type){n(w,k.sibling),x=o(k,v.props),x.ref=da(w,k,v),x.return=w,w=x;break e}n(w,k);break}else t(w,k);k=k.sibling}v.type===pl?(x=Ao(v.props.children,w.mode,b,v.key),x.return=w,w=x):(b=uc(v.type,v.key,v.props,null,w.mode,b),b.ref=da(w,x,v),b.return=w,w=b)}return a(w);case fl:e:{for(k=v.key;x!==null;){if(x.key===k)if(x.tag===4&&x.stateNode.containerInfo===v.containerInfo&&x.stateNode.implementation===v.implementation){n(w,x.sibling),x=o(x,v.children||[]),x.return=w,w=x;break e}else{n(w,x);break}else t(w,x);x=x.sibling}x=od(v,w.mode,b),x.return=w,w=x}return a(w);case Dr:return k=v._init,j(w,x,k(v._payload),b)}if(wa(v))return h(w,x,v,b);if(la(v))return y(w,x,v,b);Ei(w,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,x!==null&&x.tag===6?(n(w,x.sibling),x=o(x,v),x.return=w,w=x):(n(w,x),x=rd(v,w.mode,b),x.return=w,w=x),a(w)):n(w,x)}return j}var Fl=sy(!0),ry=sy(!1),Mc=po(null),Tc=null,jl=null,Tp=null;function $p(){Tp=jl=Tc=null}function Ip(e){var t=Mc.current;wt(Mc),e._currentValue=t}function lf(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Ml(e,t){Tc=e,Tp=jl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Bn=!0),e.firstContext=null)}function gs(e){var t=e._currentValue;if(Tp!==e)if(e={context:e,memoizedValue:t,next:null},jl===null){if(Tc===null)throw Error(ne(308));jl=e,Tc.dependencies={lanes:0,firstContext:e}}else jl=jl.next=e;return t}var To=null;function Ap(e){To===null?To=[e]:To.push(e)}function oy(e,t,n,s){var o=t.interleaved;return o===null?(n.next=n,Ap(t)):(n.next=o.next,o.next=n),t.interleaved=n,wr(e,s)}function wr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var zr=!1;function Op(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ly(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function mr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Xr(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,tt&2){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,wr(e,n)}return o=s.interleaved,o===null?(t.next=t,Ap(s)):(t.next=o.next,o.next=t),s.interleaved=t,wr(e,n)}function rc(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,jp(e,n)}}function Kh(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var o=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?o=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?o=l=t:l=l.next=t}else o=l=t;n={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:l,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $c(e,t,n,s){var o=e.updateQueue;zr=!1;var l=o.firstBaseUpdate,a=o.lastBaseUpdate,i=o.shared.pending;if(i!==null){o.shared.pending=null;var c=i,d=c.next;c.next=null,a===null?l=d:a.next=d,a=c;var f=e.alternate;f!==null&&(f=f.updateQueue,i=f.lastBaseUpdate,i!==a&&(i===null?f.firstBaseUpdate=d:i.next=d,f.lastBaseUpdate=c))}if(l!==null){var p=o.baseState;a=0,f=d=c=null,i=l;do{var m=i.lane,g=i.eventTime;if((s&m)===m){f!==null&&(f=f.next={eventTime:g,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var h=e,y=i;switch(m=t,g=n,y.tag){case 1:if(h=y.payload,typeof h=="function"){p=h.call(g,p,m);break e}p=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=y.payload,m=typeof h=="function"?h.call(g,p,m):h,m==null)break e;p=Tt({},p,m);break e;case 2:zr=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,m=o.effects,m===null?o.effects=[i]:m.push(i))}else g={eventTime:g,lane:m,tag:i.tag,payload:i.payload,callback:i.callback,next:null},f===null?(d=f=g,c=p):f=f.next=g,a|=m;if(i=i.next,i===null){if(i=o.shared.pending,i===null)break;m=i,i=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}}while(!0);if(f===null&&(c=p),o.baseState=c,o.firstBaseUpdate=d,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else l===null&&(o.shared.lanes=0);Ho|=a,e.lanes=a,e.memoizedState=p}}function Qh(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],o=s.callback;if(o!==null){if(s.callback=null,s=n,typeof o!="function")throw Error(ne(191,o));o.call(s)}}}var ii={},Ks=po(ii),Wa=po(ii),qa=po(ii);function $o(e){if(e===ii)throw Error(ne(174));return e}function Lp(e,t){switch(xt(qa,t),xt(Wa,e),xt(Ks,ii),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Fd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Fd(t,e)}wt(Ks),xt(Ks,t)}function Bl(){wt(Ks),wt(Wa),wt(qa)}function ay(e){$o(qa.current);var t=$o(Ks.current),n=Fd(t,e.type);t!==n&&(xt(Wa,e),xt(Ks,n))}function Dp(e){Wa.current===e&&(wt(Ks),wt(Wa))}var Rt=po(0);function Ic(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)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 Ju=[];function zp(){for(var e=0;e<Ju.length;e++)Ju[e]._workInProgressVersionPrimary=null;Ju.length=0}var oc=Sr.ReactCurrentDispatcher,Zu=Sr.ReactCurrentBatchConfig,Bo=0,Mt=null,sn=null,cn=null,Ac=!1,Pa=!1,Ga=0,g_=0;function jn(){throw Error(ne(321))}function Fp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Rs(e[n],t[n]))return!1;return!0}function Bp(e,t,n,s,o,l){if(Bo=l,Mt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oc.current=e===null||e.memoizedState===null?w_:j_,e=n(s,o),Pa){l=0;do{if(Pa=!1,Ga=0,25<=l)throw Error(ne(301));l+=1,cn=sn=null,t.updateQueue=null,oc.current=b_,e=n(s,o)}while(Pa)}if(oc.current=Oc,t=sn!==null&&sn.next!==null,Bo=0,cn=sn=Mt=null,Ac=!1,t)throw Error(ne(300));return e}function Hp(){var e=Ga!==0;return Ga=0,e}function Hs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Mt.memoizedState=cn=e:cn=cn.next=e,cn}function xs(){if(sn===null){var e=Mt.alternate;e=e!==null?e.memoizedState:null}else e=sn.next;var t=cn===null?Mt.memoizedState:cn.next;if(t!==null)cn=t,sn=e;else{if(e===null)throw Error(ne(310));sn=e,e={memoizedState:sn.memoizedState,baseState:sn.baseState,baseQueue:sn.baseQueue,queue:sn.queue,next:null},cn===null?Mt.memoizedState=cn=e:cn=cn.next=e}return cn}function Ka(e,t){return typeof t=="function"?t(e):t}function ed(e){var t=xs(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var s=sn,o=s.baseQueue,l=n.pending;if(l!==null){if(o!==null){var a=o.next;o.next=l.next,l.next=a}s.baseQueue=o=l,n.pending=null}if(o!==null){l=o.next,s=s.baseState;var i=a=null,c=null,d=l;do{var f=d.lane;if((Bo&f)===f)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var p={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(i=c=p,a=s):c=c.next=p,Mt.lanes|=f,Ho|=f}d=d.next}while(d!==null&&d!==l);c===null?a=s:c.next=i,Rs(s,t.memoizedState)||(Bn=!0),t.memoizedState=s,t.baseState=a,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){o=e;do l=o.lane,Mt.lanes|=l,Ho|=l,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function td(e){var t=xs(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var s=n.dispatch,o=n.pending,l=t.memoizedState;if(o!==null){n.pending=null;var a=o=o.next;do l=e(l,a.action),a=a.next;while(a!==o);Rs(l,t.memoizedState)||(Bn=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,s]}function iy(){}function cy(e,t){var n=Mt,s=xs(),o=t(),l=!Rs(s.memoizedState,o);if(l&&(s.memoizedState=o,Bn=!0),s=s.queue,Up(fy.bind(null,n,s,e),[e]),s.getSnapshot!==t||l||cn!==null&&cn.memoizedState.tag&1){if(n.flags|=2048,Qa(9,dy.bind(null,n,s,o,t),void 0,null),fn===null)throw Error(ne(349));Bo&30||uy(n,t,o)}return o}function uy(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Mt.updateQueue,t===null?(t={lastEffect:null,stores:null},Mt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function dy(e,t,n,s){t.value=n,t.getSnapshot=s,py(t)&&my(e)}function fy(e,t,n){return n(function(){py(t)&&my(e)})}function py(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rs(e,n)}catch{return!0}}function my(e){var t=wr(e,1);t!==null&&Es(t,e,1,-1)}function Yh(e){var t=Hs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ka,lastRenderedState:e},t.queue=e,e=e.dispatch=y_.bind(null,Mt,e),[t.memoizedState,e]}function Qa(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=Mt.updateQueue,t===null?(t={lastEffect:null,stores:null},Mt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function hy(){return xs().memoizedState}function lc(e,t,n,s){var o=Hs();Mt.flags|=e,o.memoizedState=Qa(1|t,n,void 0,s===void 0?null:s)}function au(e,t,n,s){var o=xs();s=s===void 0?null:s;var l=void 0;if(sn!==null){var a=sn.memoizedState;if(l=a.destroy,s!==null&&Fp(s,a.deps)){o.memoizedState=Qa(t,n,l,s);return}}Mt.flags|=e,o.memoizedState=Qa(1|t,n,l,s)}function Xh(e,t){return lc(8390656,8,e,t)}function Up(e,t){return au(2048,8,e,t)}function gy(e,t){return au(4,2,e,t)}function xy(e,t){return au(4,4,e,t)}function vy(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yy(e,t,n){return n=n!=null?n.concat([e]):null,au(4,4,vy.bind(null,t,e),n)}function Vp(){}function wy(e,t){var n=xs();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Fp(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function jy(e,t){var n=xs();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Fp(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function by(e,t,n){return Bo&21?(Rs(n,t)||(n=Cv(),Mt.lanes|=n,Ho|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Bn=!0),e.memoizedState=n)}function x_(e,t){var n=it;it=n!==0&&4>n?n:4,e(!0);var s=Zu.transition;Zu.transition={};try{e(!1),t()}finally{it=n,Zu.transition=s}}function _y(){return xs().memoizedState}function v_(e,t,n){var s=Zr(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},ky(e))Sy(t,n);else if(n=oy(e,t,n,s),n!==null){var o=On();Es(n,e,s,o),Ny(n,t,s)}}function y_(e,t,n){var s=Zr(e),o={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(ky(e))Sy(t,o);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,i=l(a,n);if(o.hasEagerState=!0,o.eagerState=i,Rs(i,a)){var c=t.interleaved;c===null?(o.next=o,Ap(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=oy(e,t,o,s),n!==null&&(o=On(),Es(n,e,s,o),Ny(n,t,s))}}function ky(e){var t=e.alternate;return e===Mt||t!==null&&t===Mt}function Sy(e,t){Pa=Ac=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ny(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,jp(e,n)}}var Oc={readContext:gs,useCallback:jn,useContext:jn,useEffect:jn,useImperativeHandle:jn,useInsertionEffect:jn,useLayoutEffect:jn,useMemo:jn,useReducer:jn,useRef:jn,useState:jn,useDebugValue:jn,useDeferredValue:jn,useTransition:jn,useMutableSource:jn,useSyncExternalStore:jn,useId:jn,unstable_isNewReconciler:!1},w_={readContext:gs,useCallback:function(e,t){return Hs().memoizedState=[e,t===void 0?null:t],e},useContext:gs,useEffect:Xh,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,lc(4194308,4,vy.bind(null,t,e),n)},useLayoutEffect:function(e,t){return lc(4194308,4,e,t)},useInsertionEffect:function(e,t){return lc(4,2,e,t)},useMemo:function(e,t){var n=Hs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Hs();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=v_.bind(null,Mt,e),[s.memoizedState,e]},useRef:function(e){var t=Hs();return e={current:e},t.memoizedState=e},useState:Yh,useDebugValue:Vp,useDeferredValue:function(e){return Hs().memoizedState=e},useTransition:function(){var e=Yh(!1),t=e[0];return e=x_.bind(null,e[1]),Hs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=Mt,o=Hs();if(kt){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),fn===null)throw Error(ne(349));Bo&30||uy(s,t,n)}o.memoizedState=n;var l={value:n,getSnapshot:t};return o.queue=l,Xh(fy.bind(null,s,l,e),[e]),s.flags|=2048,Qa(9,dy.bind(null,s,l,n,t),void 0,null),n},useId:function(){var e=Hs(),t=fn.identifierPrefix;if(kt){var n=ur,s=cr;n=(s&~(1<<32-Cs(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ga++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=g_++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},j_={readContext:gs,useCallback:wy,useContext:gs,useEffect:Up,useImperativeHandle:yy,useInsertionEffect:gy,useLayoutEffect:xy,useMemo:jy,useReducer:ed,useRef:hy,useState:function(){return ed(Ka)},useDebugValue:Vp,useDeferredValue:function(e){var t=xs();return by(t,sn.memoizedState,e)},useTransition:function(){var e=ed(Ka)[0],t=xs().memoizedState;return[e,t]},useMutableSource:iy,useSyncExternalStore:cy,useId:_y,unstable_isNewReconciler:!1},b_={readContext:gs,useCallback:wy,useContext:gs,useEffect:Up,useImperativeHandle:yy,useInsertionEffect:gy,useLayoutEffect:xy,useMemo:jy,useReducer:td,useRef:hy,useState:function(){return td(Ka)},useDebugValue:Vp,useDeferredValue:function(e){var t=xs();return sn===null?t.memoizedState=e:by(t,sn.memoizedState,e)},useTransition:function(){var e=td(Ka)[0],t=xs().memoizedState;return[e,t]},useMutableSource:iy,useSyncExternalStore:cy,useId:_y,unstable_isNewReconciler:!1};function ks(e,t){if(e&&e.defaultProps){t=Tt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function af(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var iu={isMounted:function(e){return(e=e._reactInternals)?Xo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=On(),o=Zr(e),l=mr(s,o);l.payload=t,n!=null&&(l.callback=n),t=Xr(e,l,o),t!==null&&(Es(t,e,o,s),rc(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=On(),o=Zr(e),l=mr(s,o);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=Xr(e,l,o),t!==null&&(Es(t,e,o,s),rc(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=On(),s=Zr(e),o=mr(n,s);o.tag=2,t!=null&&(o.callback=t),t=Xr(e,o,s),t!==null&&(Es(t,e,s,n),rc(t,e,s))}};function Jh(e,t,n,s,o,l,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,l,a):t.prototype&&t.prototype.isPureReactComponent?!Ba(n,s)||!Ba(o,l):!0}function Cy(e,t,n){var s=!1,o=ao,l=t.contextType;return typeof l=="object"&&l!==null?l=gs(l):(o=Un(t)?zo:Rn.current,s=t.contextTypes,l=(s=s!=null)?Dl(e,o):ao),t=new t(n,l),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=iu,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=l),t}function Zh(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&iu.enqueueReplaceState(t,t.state,null)}function cf(e,t,n,s){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Op(e);var l=t.contextType;typeof l=="object"&&l!==null?o.context=gs(l):(l=Un(t)?zo:Rn.current,o.context=Dl(e,l)),o.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&(af(e,t,l,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&iu.enqueueReplaceState(o,o.state,null),$c(e,n,o,s),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Hl(e,t){try{var n="",s=t;do n+=Y1(s),s=s.return;while(s);var o=n}catch(l){o=`
39
+ Error generating stack: `+l.message+`
40
+ `+l.stack}return{value:e,source:t,stack:o,digest:null}}function nd(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function uf(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var __=typeof WeakMap=="function"?WeakMap:Map;function Ey(e,t,n){n=mr(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Dc||(Dc=!0,wf=s),uf(e,t)},n}function Ry(e,t,n){n=mr(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var o=t.value;n.payload=function(){return s(o)},n.callback=function(){uf(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){uf(e,t),typeof s!="function"&&(Jr===null?Jr=new Set([this]):Jr.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function eg(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new __;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(n)||(o.add(n),e=L_.bind(null,e,t,n),t.then(e,e))}function tg(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ng(e,t,n,s,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=mr(-1,1),t.tag=2,Xr(n,t,1))),n.lanes|=1),e)}var k_=Sr.ReactCurrentOwner,Bn=!1;function Tn(e,t,n,s){t.child=e===null?ry(t,null,n,s):Fl(t,e.child,n,s)}function sg(e,t,n,s,o){n=n.render;var l=t.ref;return Ml(t,o),s=Bp(e,t,n,s,l,o),n=Hp(),e!==null&&!Bn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,jr(e,t,o)):(kt&&n&&Rp(t),t.flags|=1,Tn(e,t,s,o),t.child)}function rg(e,t,n,s,o){if(e===null){var l=n.type;return typeof l=="function"&&!Jp(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,Py(e,t,l,s,o)):(e=uc(n.type,null,s,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!(e.lanes&o)){var a=l.memoizedProps;if(n=n.compare,n=n!==null?n:Ba,n(a,s)&&e.ref===t.ref)return jr(e,t,o)}return t.flags|=1,e=eo(l,s),e.ref=t.ref,e.return=t,t.child=e}function Py(e,t,n,s,o){if(e!==null){var l=e.memoizedProps;if(Ba(l,s)&&e.ref===t.ref)if(Bn=!1,t.pendingProps=s=l,(e.lanes&o)!==0)e.flags&131072&&(Bn=!0);else return t.lanes=e.lanes,jr(e,t,o)}return df(e,t,n,s,o)}function My(e,t,n){var s=t.pendingProps,o=s.children,l=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xt(_l,Kn),Kn|=n;else{if(!(n&1073741824))return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xt(_l,Kn),Kn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=l!==null?l.baseLanes:n,xt(_l,Kn),Kn|=s}else l!==null?(s=l.baseLanes|n,t.memoizedState=null):s=n,xt(_l,Kn),Kn|=s;return Tn(e,t,o,n),t.child}function Ty(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function df(e,t,n,s,o){var l=Un(n)?zo:Rn.current;return l=Dl(t,l),Ml(t,o),n=Bp(e,t,n,s,l,o),s=Hp(),e!==null&&!Bn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,jr(e,t,o)):(kt&&s&&Rp(t),t.flags|=1,Tn(e,t,n,o),t.child)}function og(e,t,n,s,o){if(Un(n)){var l=!0;Ec(t)}else l=!1;if(Ml(t,o),t.stateNode===null)ac(e,t),Cy(t,n,s),cf(t,n,s,o),s=!0;else if(e===null){var a=t.stateNode,i=t.memoizedProps;a.props=i;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=gs(d):(d=Un(n)?zo:Rn.current,d=Dl(t,d));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function";p||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(i!==s||c!==d)&&Zh(t,a,s,d),zr=!1;var m=t.memoizedState;a.state=m,$c(t,s,a,o),c=t.memoizedState,i!==s||m!==c||Hn.current||zr?(typeof f=="function"&&(af(t,n,f,s),c=t.memoizedState),(i=zr||Jh(t,n,i,s,m,c,d))?(p||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),a.props=s,a.state=c,a.context=d,s=i):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{a=t.stateNode,ly(e,t),i=t.memoizedProps,d=t.type===t.elementType?i:ks(t.type,i),a.props=d,p=t.pendingProps,m=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=gs(c):(c=Un(n)?zo:Rn.current,c=Dl(t,c));var g=n.getDerivedStateFromProps;(f=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(i!==p||m!==c)&&Zh(t,a,s,c),zr=!1,m=t.memoizedState,a.state=m,$c(t,s,a,o);var h=t.memoizedState;i!==p||m!==h||Hn.current||zr?(typeof g=="function"&&(af(t,n,g,s),h=t.memoizedState),(d=zr||Jh(t,n,d,s,m,h,c)||!1)?(f||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(s,h,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(s,h,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=h),a.props=s,a.state=h,a.context=c,s=d):(typeof a.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),s=!1)}return ff(e,t,n,s,l,o)}function ff(e,t,n,s,o,l){Ty(e,t);var a=(t.flags&128)!==0;if(!s&&!a)return o&&Vh(t,n,!1),jr(e,t,l);s=t.stateNode,k_.current=t;var i=a&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&a?(t.child=Fl(t,e.child,null,l),t.child=Fl(t,null,i,l)):Tn(e,t,i,l),t.memoizedState=s.state,o&&Vh(t,n,!0),t.child}function $y(e){var t=e.stateNode;t.pendingContext?Uh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Uh(e,t.context,!1),Lp(e,t.containerInfo)}function lg(e,t,n,s,o){return zl(),Mp(o),t.flags|=256,Tn(e,t,n,s),t.child}var pf={dehydrated:null,treeContext:null,retryLane:0};function mf(e){return{baseLanes:e,cachePool:null,transitions:null}}function Iy(e,t,n){var s=t.pendingProps,o=Rt.current,l=!1,a=(t.flags&128)!==0,i;if((i=a)||(i=e!==null&&e.memoizedState===null?!1:(o&2)!==0),i?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),xt(Rt,o&1),e===null)return of(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=s.children,e=s.fallback,l?(s=t.mode,l=t.child,a={mode:"hidden",children:a},!(s&1)&&l!==null?(l.childLanes=0,l.pendingProps=a):l=du(a,s,0,null),e=Ao(e,s,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=mf(n),t.memoizedState=pf,e):Wp(t,a));if(o=e.memoizedState,o!==null&&(i=o.dehydrated,i!==null))return S_(e,t,a,s,i,o,n);if(l){l=s.fallback,a=t.mode,o=e.child,i=o.sibling;var c={mode:"hidden",children:s.children};return!(a&1)&&t.child!==o?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=eo(o,c),s.subtreeFlags=o.subtreeFlags&14680064),i!==null?l=eo(i,l):(l=Ao(l,a,n,null),l.flags|=2),l.return=t,s.return=t,s.sibling=l,t.child=s,s=l,l=t.child,a=e.child.memoizedState,a=a===null?mf(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},l.memoizedState=a,l.childLanes=e.childLanes&~n,t.memoizedState=pf,s}return l=e.child,e=l.sibling,s=eo(l,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Wp(e,t){return t=du({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ri(e,t,n,s){return s!==null&&Mp(s),Fl(t,e.child,null,n),e=Wp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function S_(e,t,n,s,o,l,a){if(n)return t.flags&256?(t.flags&=-257,s=nd(Error(ne(422))),Ri(e,t,a,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=s.fallback,o=t.mode,s=du({mode:"visible",children:s.children},o,0,null),l=Ao(l,o,a,null),l.flags|=2,s.return=t,l.return=t,s.sibling=l,t.child=s,t.mode&1&&Fl(t,e.child,null,a),t.child.memoizedState=mf(a),t.memoizedState=pf,l);if(!(t.mode&1))return Ri(e,t,a,null);if(o.data==="$!"){if(s=o.nextSibling&&o.nextSibling.dataset,s)var i=s.dgst;return s=i,l=Error(ne(419)),s=nd(l,s,void 0),Ri(e,t,a,s)}if(i=(a&e.childLanes)!==0,Bn||i){if(s=fn,s!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(s.suspendedLanes|a)?0:o,o!==0&&o!==l.retryLane&&(l.retryLane=o,wr(e,o),Es(s,e,o,-1))}return Xp(),s=nd(Error(ne(421))),Ri(e,t,a,s)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=D_.bind(null,e),o._reactRetry=t,null):(e=l.treeContext,Yn=Yr(o.nextSibling),Jn=t,kt=!0,Ns=null,e!==null&&(cs[us++]=cr,cs[us++]=ur,cs[us++]=Fo,cr=e.id,ur=e.overflow,Fo=t),t=Wp(t,s.children),t.flags|=4096,t)}function ag(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),lf(e.return,t,n)}function sd(e,t,n,s,o){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:o}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=s,l.tail=n,l.tailMode=o)}function Ay(e,t,n){var s=t.pendingProps,o=s.revealOrder,l=s.tail;if(Tn(e,t,s.children,n),s=Rt.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ag(e,n,t);else if(e.tag===19)ag(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(xt(Rt,s),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Ic(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),sd(t,!1,o,n,l);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Ic(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}sd(t,!0,n,null,l);break;case"together":sd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ac(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function jr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ho|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ne(153));if(t.child!==null){for(e=t.child,n=eo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=eo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function N_(e,t,n){switch(t.tag){case 3:$y(t),zl();break;case 5:ay(t);break;case 1:Un(t.type)&&Ec(t);break;case 4:Lp(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,o=t.memoizedProps.value;xt(Mc,s._currentValue),s._currentValue=o;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(xt(Rt,Rt.current&1),t.flags|=128,null):n&t.child.childLanes?Iy(e,t,n):(xt(Rt,Rt.current&1),e=jr(e,t,n),e!==null?e.sibling:null);xt(Rt,Rt.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Ay(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),xt(Rt,Rt.current),s)break;return null;case 22:case 23:return t.lanes=0,My(e,t,n)}return jr(e,t,n)}var Oy,hf,Ly,Dy;Oy=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};hf=function(){};Ly=function(e,t,n,s){var o=e.memoizedProps;if(o!==s){e=t.stateNode,$o(Ks.current);var l=null;switch(n){case"input":o=Od(e,o),s=Od(e,s),l=[];break;case"select":o=Tt({},o,{value:void 0}),s=Tt({},s,{value:void 0}),l=[];break;case"textarea":o=zd(e,o),s=zd(e,s),l=[];break;default:typeof o.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Nc)}Bd(n,s);var a;n=null;for(d in o)if(!s.hasOwnProperty(d)&&o.hasOwnProperty(d)&&o[d]!=null)if(d==="style"){var i=o[d];for(a in i)i.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Ia.hasOwnProperty(d)?l||(l=[]):(l=l||[]).push(d,null));for(d in s){var c=s[d];if(i=o!=null?o[d]:void 0,s.hasOwnProperty(d)&&c!==i&&(c!=null||i!=null))if(d==="style")if(i){for(a in i)!i.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&i[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(l||(l=[]),l.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,i=i?i.__html:void 0,c!=null&&i!==c&&(l=l||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(l=l||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Ia.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&yt("scroll",e),l||i===c||(l=[])):(l=l||[]).push(d,c))}n&&(l=l||[]).push("style",n);var d=l;(t.updateQueue=d)&&(t.flags|=4)}};Dy=function(e,t,n,s){n!==s&&(t.flags|=4)};function fa(e,t){if(!kt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function bn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,s|=o.subtreeFlags&14680064,s|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,s|=o.subtreeFlags,s|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function C_(e,t,n){var s=t.pendingProps;switch(Pp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bn(t),null;case 1:return Un(t.type)&&Cc(),bn(t),null;case 3:return s=t.stateNode,Bl(),wt(Hn),wt(Rn),zp(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Ci(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ns!==null&&(_f(Ns),Ns=null))),hf(e,t),bn(t),null;case 5:Dp(t);var o=$o(qa.current);if(n=t.type,e!==null&&t.stateNode!=null)Ly(e,t,n,s,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(ne(166));return bn(t),null}if(e=$o(Ks.current),Ci(t)){s=t.stateNode,n=t.type;var l=t.memoizedProps;switch(s[Us]=t,s[Va]=l,e=(t.mode&1)!==0,n){case"dialog":yt("cancel",s),yt("close",s);break;case"iframe":case"object":case"embed":yt("load",s);break;case"video":case"audio":for(o=0;o<ba.length;o++)yt(ba[o],s);break;case"source":yt("error",s);break;case"img":case"image":case"link":yt("error",s),yt("load",s);break;case"details":yt("toggle",s);break;case"input":gh(s,l),yt("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!l.multiple},yt("invalid",s);break;case"textarea":vh(s,l),yt("invalid",s)}Bd(n,l),o=null;for(var a in l)if(l.hasOwnProperty(a)){var i=l[a];a==="children"?typeof i=="string"?s.textContent!==i&&(l.suppressHydrationWarning!==!0&&Ni(s.textContent,i,e),o=["children",i]):typeof i=="number"&&s.textContent!==""+i&&(l.suppressHydrationWarning!==!0&&Ni(s.textContent,i,e),o=["children",""+i]):Ia.hasOwnProperty(a)&&i!=null&&a==="onScroll"&&yt("scroll",s)}switch(n){case"input":vi(s),xh(s,l,!0);break;case"textarea":vi(s),yh(s);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(s.onclick=Nc)}s=o,t.updateQueue=s,s!==null&&(t.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=fv(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=a.createElement(n,{is:s.is}):(e=a.createElement(n),n==="select"&&(a=e,s.multiple?a.multiple=!0:s.size&&(a.size=s.size))):e=a.createElementNS(e,n),e[Us]=t,e[Va]=s,Oy(e,t,!1,!1),t.stateNode=e;e:{switch(a=Hd(n,s),n){case"dialog":yt("cancel",e),yt("close",e),o=s;break;case"iframe":case"object":case"embed":yt("load",e),o=s;break;case"video":case"audio":for(o=0;o<ba.length;o++)yt(ba[o],e);o=s;break;case"source":yt("error",e),o=s;break;case"img":case"image":case"link":yt("error",e),yt("load",e),o=s;break;case"details":yt("toggle",e),o=s;break;case"input":gh(e,s),o=Od(e,s),yt("invalid",e);break;case"option":o=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},o=Tt({},s,{value:void 0}),yt("invalid",e);break;case"textarea":vh(e,s),o=zd(e,s),yt("invalid",e);break;default:o=s}Bd(n,o),i=o;for(l in i)if(i.hasOwnProperty(l)){var c=i[l];l==="style"?hv(e,c):l==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&pv(e,c)):l==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Aa(e,c):typeof c=="number"&&Aa(e,""+c):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Ia.hasOwnProperty(l)?c!=null&&l==="onScroll"&&yt("scroll",e):c!=null&&hp(e,l,c,a))}switch(n){case"input":vi(e),xh(e,s,!1);break;case"textarea":vi(e),yh(e);break;case"option":s.value!=null&&e.setAttribute("value",""+lo(s.value));break;case"select":e.multiple=!!s.multiple,l=s.value,l!=null?Cl(e,!!s.multiple,l,!1):s.defaultValue!=null&&Cl(e,!!s.multiple,s.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Nc)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return bn(t),null;case 6:if(e&&t.stateNode!=null)Dy(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(ne(166));if(n=$o(qa.current),$o(Ks.current),Ci(t)){if(s=t.stateNode,n=t.memoizedProps,s[Us]=t,(l=s.nodeValue!==n)&&(e=Jn,e!==null))switch(e.tag){case 3:Ni(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ni(s.nodeValue,n,(e.mode&1)!==0)}l&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[Us]=t,t.stateNode=s}return bn(t),null;case 13:if(wt(Rt),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(kt&&Yn!==null&&t.mode&1&&!(t.flags&128))ny(),zl(),t.flags|=98560,l=!1;else if(l=Ci(t),s!==null&&s.dehydrated!==null){if(e===null){if(!l)throw Error(ne(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(ne(317));l[Us]=t}else zl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bn(t),l=!1}else Ns!==null&&(_f(Ns),Ns=null),l=!0;if(!l)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||Rt.current&1?rn===0&&(rn=3):Xp())),t.updateQueue!==null&&(t.flags|=4),bn(t),null);case 4:return Bl(),hf(e,t),e===null&&Ha(t.stateNode.containerInfo),bn(t),null;case 10:return Ip(t.type._context),bn(t),null;case 17:return Un(t.type)&&Cc(),bn(t),null;case 19:if(wt(Rt),l=t.memoizedState,l===null)return bn(t),null;if(s=(t.flags&128)!==0,a=l.rendering,a===null)if(s)fa(l,!1);else{if(rn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ic(e),a!==null){for(t.flags|=128,fa(l,!1),s=a.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)l=n,e=s,l.flags&=14680066,a=l.alternate,a===null?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=a.childLanes,l.lanes=a.lanes,l.child=a.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=a.memoizedProps,l.memoizedState=a.memoizedState,l.updateQueue=a.updateQueue,l.type=a.type,e=a.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return xt(Rt,Rt.current&1|2),t.child}e=e.sibling}l.tail!==null&&Ut()>Ul&&(t.flags|=128,s=!0,fa(l,!1),t.lanes=4194304)}else{if(!s)if(e=Ic(a),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!kt)return bn(t),null}else 2*Ut()-l.renderingStartTime>Ul&&n!==1073741824&&(t.flags|=128,s=!0,fa(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(n=l.last,n!==null?n.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Ut(),t.sibling=null,n=Rt.current,xt(Rt,s?n&1|2:n&1),t):(bn(t),null);case 22:case 23:return Yp(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?Kn&1073741824&&(bn(t),t.subtreeFlags&6&&(t.flags|=8192)):bn(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function E_(e,t){switch(Pp(t),t.tag){case 1:return Un(t.type)&&Cc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bl(),wt(Hn),wt(Rn),zp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Dp(t),null;case 13:if(wt(Rt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));zl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return wt(Rt),null;case 4:return Bl(),null;case 10:return Ip(t.type._context),null;case 22:case 23:return Yp(),null;case 24:return null;default:return null}}var Pi=!1,Sn=!1,R_=typeof WeakSet=="function"?WeakSet:Set,je=null;function bl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){At(e,t,s)}else n.current=null}function gf(e,t,n){try{n()}catch(s){At(e,t,s)}}var ig=!1;function P_(e,t){if(Jd=_c,e=Uv(),Ep(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var o=s.anchorOffset,l=s.focusNode;s=s.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,i=-1,c=-1,d=0,f=0,p=e,m=null;t:for(;;){for(var g;p!==n||o!==0&&p.nodeType!==3||(i=a+o),p!==l||s!==0&&p.nodeType!==3||(c=a+s),p.nodeType===3&&(a+=p.nodeValue.length),(g=p.firstChild)!==null;)m=p,p=g;for(;;){if(p===e)break t;if(m===n&&++d===o&&(i=a),m===l&&++f===s&&(c=a),(g=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=g}n=i===-1||c===-1?null:{start:i,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Zd={focusedElem:e,selectionRange:n},_c=!1,je=t;je!==null;)if(t=je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,je=e;else for(;je!==null;){t=je;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var y=h.memoizedProps,j=h.memoizedState,w=t.stateNode,x=w.getSnapshotBeforeUpdate(t.elementType===t.type?y:ks(t.type,y),j);w.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(b){At(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,je=e;break}je=t.return}return h=ig,ig=!1,h}function Ma(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&e)===e){var l=o.destroy;o.destroy=void 0,l!==void 0&&gf(t,n,l)}o=o.next}while(o!==s)}}function cu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function xf(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function zy(e){var t=e.alternate;t!==null&&(e.alternate=null,zy(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Us],delete t[Va],delete t[nf],delete t[f_],delete t[p_])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Fy(e){return e.tag===5||e.tag===3||e.tag===4}function cg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fy(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function vf(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Nc));else if(s!==4&&(e=e.child,e!==null))for(vf(e,t,n),e=e.sibling;e!==null;)vf(e,t,n),e=e.sibling}function yf(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(yf(e,t,n),e=e.sibling;e!==null;)yf(e,t,n),e=e.sibling}var gn=null,Ss=!1;function Ir(e,t,n){for(n=n.child;n!==null;)By(e,t,n),n=n.sibling}function By(e,t,n){if(Gs&&typeof Gs.onCommitFiberUnmount=="function")try{Gs.onCommitFiberUnmount(tu,n)}catch{}switch(n.tag){case 5:Sn||bl(n,t);case 6:var s=gn,o=Ss;gn=null,Ir(e,t,n),gn=s,Ss=o,gn!==null&&(Ss?(e=gn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):gn.removeChild(n.stateNode));break;case 18:gn!==null&&(Ss?(e=gn,n=n.stateNode,e.nodeType===8?Yu(e.parentNode,n):e.nodeType===1&&Yu(e,n),za(e)):Yu(gn,n.stateNode));break;case 4:s=gn,o=Ss,gn=n.stateNode.containerInfo,Ss=!0,Ir(e,t,n),gn=s,Ss=o;break;case 0:case 11:case 14:case 15:if(!Sn&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){o=s=s.next;do{var l=o,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&gf(n,t,a),o=o.next}while(o!==s)}Ir(e,t,n);break;case 1:if(!Sn&&(bl(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){At(n,t,i)}Ir(e,t,n);break;case 21:Ir(e,t,n);break;case 22:n.mode&1?(Sn=(s=Sn)||n.memoizedState!==null,Ir(e,t,n),Sn=s):Ir(e,t,n);break;default:Ir(e,t,n)}}function ug(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new R_),t.forEach(function(s){var o=z_.bind(null,e,s);n.has(s)||(n.add(s),s.then(o,o))})}}function bs(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var o=n[s];try{var l=e,a=t,i=a;e:for(;i!==null;){switch(i.tag){case 5:gn=i.stateNode,Ss=!1;break e;case 3:gn=i.stateNode.containerInfo,Ss=!0;break e;case 4:gn=i.stateNode.containerInfo,Ss=!0;break e}i=i.return}if(gn===null)throw Error(ne(160));By(l,a,o),gn=null,Ss=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(d){At(o,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Hy(t,e),t=t.sibling}function Hy(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(bs(t,e),Os(e),s&4){try{Ma(3,e,e.return),cu(3,e)}catch(y){At(e,e.return,y)}try{Ma(5,e,e.return)}catch(y){At(e,e.return,y)}}break;case 1:bs(t,e),Os(e),s&512&&n!==null&&bl(n,n.return);break;case 5:if(bs(t,e),Os(e),s&512&&n!==null&&bl(n,n.return),e.flags&32){var o=e.stateNode;try{Aa(o,"")}catch(y){At(e,e.return,y)}}if(s&4&&(o=e.stateNode,o!=null)){var l=e.memoizedProps,a=n!==null?n.memoizedProps:l,i=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{i==="input"&&l.type==="radio"&&l.name!=null&&uv(o,l),Hd(i,a);var d=Hd(i,l);for(a=0;a<c.length;a+=2){var f=c[a],p=c[a+1];f==="style"?hv(o,p):f==="dangerouslySetInnerHTML"?pv(o,p):f==="children"?Aa(o,p):hp(o,f,p,d)}switch(i){case"input":Ld(o,l);break;case"textarea":dv(o,l);break;case"select":var m=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!l.multiple;var g=l.value;g!=null?Cl(o,!!l.multiple,g,!1):m!==!!l.multiple&&(l.defaultValue!=null?Cl(o,!!l.multiple,l.defaultValue,!0):Cl(o,!!l.multiple,l.multiple?[]:"",!1))}o[Va]=l}catch(y){At(e,e.return,y)}}break;case 6:if(bs(t,e),Os(e),s&4){if(e.stateNode===null)throw Error(ne(162));o=e.stateNode,l=e.memoizedProps;try{o.nodeValue=l}catch(y){At(e,e.return,y)}}break;case 3:if(bs(t,e),Os(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{za(t.containerInfo)}catch(y){At(e,e.return,y)}break;case 4:bs(t,e),Os(e);break;case 13:bs(t,e),Os(e),o=e.child,o.flags&8192&&(l=o.memoizedState!==null,o.stateNode.isHidden=l,!l||o.alternate!==null&&o.alternate.memoizedState!==null||(Kp=Ut())),s&4&&ug(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Sn=(d=Sn)||f,bs(t,e),Sn=d):bs(t,e),Os(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(je=e,f=e.child;f!==null;){for(p=je=f;je!==null;){switch(m=je,g=m.child,m.tag){case 0:case 11:case 14:case 15:Ma(4,m,m.return);break;case 1:bl(m,m.return);var h=m.stateNode;if(typeof h.componentWillUnmount=="function"){s=m,n=m.return;try{t=s,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(y){At(s,n,y)}}break;case 5:bl(m,m.return);break;case 22:if(m.memoizedState!==null){fg(p);continue}}g!==null?(g.return=m,je=g):fg(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,d?(l=o.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(i=p.stateNode,c=p.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=mv("display",a))}catch(y){At(e,e.return,y)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=d?"":p.memoizedProps}catch(y){At(e,e.return,y)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:bs(t,e),Os(e),s&4&&ug(e);break;case 21:break;default:bs(t,e),Os(e)}}function Os(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Fy(n)){var s=n;break e}n=n.return}throw Error(ne(160))}switch(s.tag){case 5:var o=s.stateNode;s.flags&32&&(Aa(o,""),s.flags&=-33);var l=cg(e);yf(e,l,o);break;case 3:case 4:var a=s.stateNode.containerInfo,i=cg(e);vf(e,i,a);break;default:throw Error(ne(161))}}catch(c){At(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function M_(e,t,n){je=e,Uy(e)}function Uy(e,t,n){for(var s=(e.mode&1)!==0;je!==null;){var o=je,l=o.child;if(o.tag===22&&s){var a=o.memoizedState!==null||Pi;if(!a){var i=o.alternate,c=i!==null&&i.memoizedState!==null||Sn;i=Pi;var d=Sn;if(Pi=a,(Sn=c)&&!d)for(je=o;je!==null;)a=je,c=a.child,a.tag===22&&a.memoizedState!==null?pg(o):c!==null?(c.return=a,je=c):pg(o);for(;l!==null;)je=l,Uy(l),l=l.sibling;je=o,Pi=i,Sn=d}dg(e)}else o.subtreeFlags&8772&&l!==null?(l.return=o,je=l):dg(e)}}function dg(e){for(;je!==null;){var t=je;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Sn||cu(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!Sn)if(n===null)s.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ks(t.type,n.memoizedProps);s.componentDidUpdate(o,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&Qh(t,l,s);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Qh(t,a,n)}break;case 5:var i=t.stateNode;if(n===null&&t.flags&4){n=i;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&za(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ne(163))}Sn||t.flags&512&&xf(t)}catch(m){At(t,t.return,m)}}if(t===e){je=null;break}if(n=t.sibling,n!==null){n.return=t.return,je=n;break}je=t.return}}function fg(e){for(;je!==null;){var t=je;if(t===e){je=null;break}var n=t.sibling;if(n!==null){n.return=t.return,je=n;break}je=t.return}}function pg(e){for(;je!==null;){var t=je;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{cu(4,t)}catch(c){At(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var o=t.return;try{s.componentDidMount()}catch(c){At(t,o,c)}}var l=t.return;try{xf(t)}catch(c){At(t,l,c)}break;case 5:var a=t.return;try{xf(t)}catch(c){At(t,a,c)}}}catch(c){At(t,t.return,c)}if(t===e){je=null;break}var i=t.sibling;if(i!==null){i.return=t.return,je=i;break}je=t.return}}var T_=Math.ceil,Lc=Sr.ReactCurrentDispatcher,qp=Sr.ReactCurrentOwner,ms=Sr.ReactCurrentBatchConfig,tt=0,fn=null,Kt=null,xn=0,Kn=0,_l=po(0),rn=0,Ya=null,Ho=0,uu=0,Gp=0,Ta=null,Fn=null,Kp=0,Ul=1/0,lr=null,Dc=!1,wf=null,Jr=null,Mi=!1,Vr=null,zc=0,$a=0,jf=null,ic=-1,cc=0;function On(){return tt&6?Ut():ic!==-1?ic:ic=Ut()}function Zr(e){return e.mode&1?tt&2&&xn!==0?xn&-xn:h_.transition!==null?(cc===0&&(cc=Cv()),cc):(e=it,e!==0||(e=window.event,e=e===void 0?16:Iv(e.type)),e):1}function Es(e,t,n,s){if(50<$a)throw $a=0,jf=null,Error(ne(185));oi(e,n,s),(!(tt&2)||e!==fn)&&(e===fn&&(!(tt&2)&&(uu|=n),rn===4&&Br(e,xn)),Vn(e,s),n===1&&tt===0&&!(t.mode&1)&&(Ul=Ut()+500,lu&&mo()))}function Vn(e,t){var n=e.callbackNode;hb(e,t);var s=bc(e,e===fn?xn:0);if(s===0)n!==null&&bh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&bh(n),t===1)e.tag===0?m_(mg.bind(null,e)):Zv(mg.bind(null,e)),u_(function(){!(tt&6)&&mo()}),n=null;else{switch(Ev(s)){case 1:n=wp;break;case 4:n=Sv;break;case 16:n=jc;break;case 536870912:n=Nv;break;default:n=jc}n=Xy(n,Vy.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Vy(e,t){if(ic=-1,cc=0,tt&6)throw Error(ne(327));var n=e.callbackNode;if(Tl()&&e.callbackNode!==n)return null;var s=bc(e,e===fn?xn:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=Fc(e,s);else{t=s;var o=tt;tt|=2;var l=qy();(fn!==e||xn!==t)&&(lr=null,Ul=Ut()+500,Io(e,t));do try{A_();break}catch(i){Wy(e,i)}while(!0);$p(),Lc.current=l,tt=o,Kt!==null?t=0:(fn=null,xn=0,t=rn)}if(t!==0){if(t===2&&(o=Gd(e),o!==0&&(s=o,t=bf(e,o))),t===1)throw n=Ya,Io(e,0),Br(e,s),Vn(e,Ut()),n;if(t===6)Br(e,s);else{if(o=e.current.alternate,!(s&30)&&!$_(o)&&(t=Fc(e,s),t===2&&(l=Gd(e),l!==0&&(s=l,t=bf(e,l))),t===1))throw n=Ya,Io(e,0),Br(e,s),Vn(e,Ut()),n;switch(e.finishedWork=o,e.finishedLanes=s,t){case 0:case 1:throw Error(ne(345));case 2:Ro(e,Fn,lr);break;case 3:if(Br(e,s),(s&130023424)===s&&(t=Kp+500-Ut(),10<t)){if(bc(e,0)!==0)break;if(o=e.suspendedLanes,(o&s)!==s){On(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=tf(Ro.bind(null,e,Fn,lr),t);break}Ro(e,Fn,lr);break;case 4:if(Br(e,s),(s&4194240)===s)break;for(t=e.eventTimes,o=-1;0<s;){var a=31-Cs(s);l=1<<a,a=t[a],a>o&&(o=a),s&=~l}if(s=o,s=Ut()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*T_(s/1960))-s,10<s){e.timeoutHandle=tf(Ro.bind(null,e,Fn,lr),s);break}Ro(e,Fn,lr);break;case 5:Ro(e,Fn,lr);break;default:throw Error(ne(329))}}}return Vn(e,Ut()),e.callbackNode===n?Vy.bind(null,e):null}function bf(e,t){var n=Ta;return e.current.memoizedState.isDehydrated&&(Io(e,t).flags|=256),e=Fc(e,t),e!==2&&(t=Fn,Fn=n,t!==null&&_f(t)),e}function _f(e){Fn===null?Fn=e:Fn.push.apply(Fn,e)}function $_(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var o=n[s],l=o.getSnapshot;o=o.value;try{if(!Rs(l(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Br(e,t){for(t&=~Gp,t&=~uu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Cs(t),s=1<<n;e[n]=-1,t&=~s}}function mg(e){if(tt&6)throw Error(ne(327));Tl();var t=bc(e,0);if(!(t&1))return Vn(e,Ut()),null;var n=Fc(e,t);if(e.tag!==0&&n===2){var s=Gd(e);s!==0&&(t=s,n=bf(e,s))}if(n===1)throw n=Ya,Io(e,0),Br(e,t),Vn(e,Ut()),n;if(n===6)throw Error(ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ro(e,Fn,lr),Vn(e,Ut()),null}function Qp(e,t){var n=tt;tt|=1;try{return e(t)}finally{tt=n,tt===0&&(Ul=Ut()+500,lu&&mo())}}function Uo(e){Vr!==null&&Vr.tag===0&&!(tt&6)&&Tl();var t=tt;tt|=1;var n=ms.transition,s=it;try{if(ms.transition=null,it=1,e)return e()}finally{it=s,ms.transition=n,tt=t,!(tt&6)&&mo()}}function Yp(){Kn=_l.current,wt(_l)}function Io(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,c_(n)),Kt!==null)for(n=Kt.return;n!==null;){var s=n;switch(Pp(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Cc();break;case 3:Bl(),wt(Hn),wt(Rn),zp();break;case 5:Dp(s);break;case 4:Bl();break;case 13:wt(Rt);break;case 19:wt(Rt);break;case 10:Ip(s.type._context);break;case 22:case 23:Yp()}n=n.return}if(fn=e,Kt=e=eo(e.current,null),xn=Kn=t,rn=0,Ya=null,Gp=uu=Ho=0,Fn=Ta=null,To!==null){for(t=0;t<To.length;t++)if(n=To[t],s=n.interleaved,s!==null){n.interleaved=null;var o=s.next,l=n.pending;if(l!==null){var a=l.next;l.next=o,s.next=a}n.pending=s}To=null}return e}function Wy(e,t){do{var n=Kt;try{if($p(),oc.current=Oc,Ac){for(var s=Mt.memoizedState;s!==null;){var o=s.queue;o!==null&&(o.pending=null),s=s.next}Ac=!1}if(Bo=0,cn=sn=Mt=null,Pa=!1,Ga=0,qp.current=null,n===null||n.return===null){rn=1,Ya=t,Kt=null;break}e:{var l=e,a=n.return,i=n,c=t;if(t=xn,i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,f=i,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var m=f.alternate;m?(f.updateQueue=m.updateQueue,f.memoizedState=m.memoizedState,f.lanes=m.lanes):(f.updateQueue=null,f.memoizedState=null)}var g=tg(a);if(g!==null){g.flags&=-257,ng(g,a,i,l,t),g.mode&1&&eg(l,d,t),t=g,c=d;var h=t.updateQueue;if(h===null){var y=new Set;y.add(c),t.updateQueue=y}else h.add(c);break e}else{if(!(t&1)){eg(l,d,t),Xp();break e}c=Error(ne(426))}}else if(kt&&i.mode&1){var j=tg(a);if(j!==null){!(j.flags&65536)&&(j.flags|=256),ng(j,a,i,l,t),Mp(Hl(c,i));break e}}l=c=Hl(c,i),rn!==4&&(rn=2),Ta===null?Ta=[l]:Ta.push(l),l=a;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t;var w=Ey(l,c,t);Kh(l,w);break e;case 1:i=c;var x=l.type,v=l.stateNode;if(!(l.flags&128)&&(typeof x.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Jr===null||!Jr.has(v)))){l.flags|=65536,t&=-t,l.lanes|=t;var b=Ry(l,i,t);Kh(l,b);break e}}l=l.return}while(l!==null)}Ky(n)}catch(S){t=S,Kt===n&&n!==null&&(Kt=n=n.return);continue}break}while(!0)}function qy(){var e=Lc.current;return Lc.current=Oc,e===null?Oc:e}function Xp(){(rn===0||rn===3||rn===2)&&(rn=4),fn===null||!(Ho&268435455)&&!(uu&268435455)||Br(fn,xn)}function Fc(e,t){var n=tt;tt|=2;var s=qy();(fn!==e||xn!==t)&&(lr=null,Io(e,t));do try{I_();break}catch(o){Wy(e,o)}while(!0);if($p(),tt=n,Lc.current=s,Kt!==null)throw Error(ne(261));return fn=null,xn=0,rn}function I_(){for(;Kt!==null;)Gy(Kt)}function A_(){for(;Kt!==null&&!lb();)Gy(Kt)}function Gy(e){var t=Yy(e.alternate,e,Kn);e.memoizedProps=e.pendingProps,t===null?Ky(e):Kt=t,qp.current=null}function Ky(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=E_(n,t),n!==null){n.flags&=32767,Kt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{rn=6,Kt=null;return}}else if(n=C_(n,t,Kn),n!==null){Kt=n;return}if(t=t.sibling,t!==null){Kt=t;return}Kt=t=e}while(t!==null);rn===0&&(rn=5)}function Ro(e,t,n){var s=it,o=ms.transition;try{ms.transition=null,it=1,O_(e,t,n,s)}finally{ms.transition=o,it=s}return null}function O_(e,t,n,s){do Tl();while(Vr!==null);if(tt&6)throw Error(ne(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ne(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(gb(e,l),e===fn&&(Kt=fn=null,xn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Mi||(Mi=!0,Xy(jc,function(){return Tl(),null})),l=(n.flags&15990)!==0,n.subtreeFlags&15990||l){l=ms.transition,ms.transition=null;var a=it;it=1;var i=tt;tt|=4,qp.current=null,P_(e,n),Hy(n,e),n_(Zd),_c=!!Jd,Zd=Jd=null,e.current=n,M_(n),ab(),tt=i,it=a,ms.transition=l}else e.current=n;if(Mi&&(Mi=!1,Vr=e,zc=o),l=e.pendingLanes,l===0&&(Jr=null),ub(n.stateNode),Vn(e,Ut()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],s(o.value,{componentStack:o.stack,digest:o.digest});if(Dc)throw Dc=!1,e=wf,wf=null,e;return zc&1&&e.tag!==0&&Tl(),l=e.pendingLanes,l&1?e===jf?$a++:($a=0,jf=e):$a=0,mo(),null}function Tl(){if(Vr!==null){var e=Ev(zc),t=ms.transition,n=it;try{if(ms.transition=null,it=16>e?16:e,Vr===null)var s=!1;else{if(e=Vr,Vr=null,zc=0,tt&6)throw Error(ne(331));var o=tt;for(tt|=4,je=e.current;je!==null;){var l=je,a=l.child;if(je.flags&16){var i=l.deletions;if(i!==null){for(var c=0;c<i.length;c++){var d=i[c];for(je=d;je!==null;){var f=je;switch(f.tag){case 0:case 11:case 15:Ma(8,f,l)}var p=f.child;if(p!==null)p.return=f,je=p;else for(;je!==null;){f=je;var m=f.sibling,g=f.return;if(zy(f),f===d){je=null;break}if(m!==null){m.return=g,je=m;break}je=g}}}var h=l.alternate;if(h!==null){var y=h.child;if(y!==null){h.child=null;do{var j=y.sibling;y.sibling=null,y=j}while(y!==null)}}je=l}}if(l.subtreeFlags&2064&&a!==null)a.return=l,je=a;else e:for(;je!==null;){if(l=je,l.flags&2048)switch(l.tag){case 0:case 11:case 15:Ma(9,l,l.return)}var w=l.sibling;if(w!==null){w.return=l.return,je=w;break e}je=l.return}}var x=e.current;for(je=x;je!==null;){a=je;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,je=v;else e:for(a=x;je!==null;){if(i=je,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:cu(9,i)}}catch(S){At(i,i.return,S)}if(i===a){je=null;break e}var b=i.sibling;if(b!==null){b.return=i.return,je=b;break e}je=i.return}}if(tt=o,mo(),Gs&&typeof Gs.onPostCommitFiberRoot=="function")try{Gs.onPostCommitFiberRoot(tu,e)}catch{}s=!0}return s}finally{it=n,ms.transition=t}}return!1}function hg(e,t,n){t=Hl(n,t),t=Ey(e,t,1),e=Xr(e,t,1),t=On(),e!==null&&(oi(e,1,t),Vn(e,t))}function At(e,t,n){if(e.tag===3)hg(e,e,n);else for(;t!==null;){if(t.tag===3){hg(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Jr===null||!Jr.has(s))){e=Hl(n,e),e=Ry(t,e,1),t=Xr(t,e,1),e=On(),t!==null&&(oi(t,1,e),Vn(t,e));break}}t=t.return}}function L_(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=On(),e.pingedLanes|=e.suspendedLanes&n,fn===e&&(xn&n)===n&&(rn===4||rn===3&&(xn&130023424)===xn&&500>Ut()-Kp?Io(e,0):Gp|=n),Vn(e,t)}function Qy(e,t){t===0&&(e.mode&1?(t=ji,ji<<=1,!(ji&130023424)&&(ji=4194304)):t=1);var n=On();e=wr(e,t),e!==null&&(oi(e,t,n),Vn(e,n))}function D_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qy(e,n)}function z_(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(ne(314))}s!==null&&s.delete(t),Qy(e,n)}var Yy;Yy=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Hn.current)Bn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Bn=!1,N_(e,t,n);Bn=!!(e.flags&131072)}else Bn=!1,kt&&t.flags&1048576&&ey(t,Pc,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;ac(e,t),e=t.pendingProps;var o=Dl(t,Rn.current);Ml(t,n),o=Bp(null,t,s,e,o,n);var l=Hp();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Un(s)?(l=!0,Ec(t)):l=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Op(t),o.updater=iu,t.stateNode=o,o._reactInternals=t,cf(t,s,e,n),t=ff(null,t,s,!0,l,n)):(t.tag=0,kt&&l&&Rp(t),Tn(null,t,o,n),t=t.child),t;case 16:s=t.elementType;e:{switch(ac(e,t),e=t.pendingProps,o=s._init,s=o(s._payload),t.type=s,o=t.tag=B_(s),e=ks(s,e),o){case 0:t=df(null,t,s,e,n);break e;case 1:t=og(null,t,s,e,n);break e;case 11:t=sg(null,t,s,e,n);break e;case 14:t=rg(null,t,s,ks(s.type,e),n);break e}throw Error(ne(306,s,""))}return t;case 0:return s=t.type,o=t.pendingProps,o=t.elementType===s?o:ks(s,o),df(e,t,s,o,n);case 1:return s=t.type,o=t.pendingProps,o=t.elementType===s?o:ks(s,o),og(e,t,s,o,n);case 3:e:{if($y(t),e===null)throw Error(ne(387));s=t.pendingProps,l=t.memoizedState,o=l.element,ly(e,t),$c(t,s,null,n);var a=t.memoizedState;if(s=a.element,l.isDehydrated)if(l={element:s,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){o=Hl(Error(ne(423)),t),t=lg(e,t,s,n,o);break e}else if(s!==o){o=Hl(Error(ne(424)),t),t=lg(e,t,s,n,o);break e}else for(Yn=Yr(t.stateNode.containerInfo.firstChild),Jn=t,kt=!0,Ns=null,n=ry(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zl(),s===o){t=jr(e,t,n);break e}Tn(e,t,s,n)}t=t.child}return t;case 5:return ay(t),e===null&&of(t),s=t.type,o=t.pendingProps,l=e!==null?e.memoizedProps:null,a=o.children,ef(s,o)?a=null:l!==null&&ef(s,l)&&(t.flags|=32),Ty(e,t),Tn(e,t,a,n),t.child;case 6:return e===null&&of(t),null;case 13:return Iy(e,t,n);case 4:return Lp(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Fl(t,null,s,n):Tn(e,t,s,n),t.child;case 11:return s=t.type,o=t.pendingProps,o=t.elementType===s?o:ks(s,o),sg(e,t,s,o,n);case 7:return Tn(e,t,t.pendingProps,n),t.child;case 8:return Tn(e,t,t.pendingProps.children,n),t.child;case 12:return Tn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,o=t.pendingProps,l=t.memoizedProps,a=o.value,xt(Mc,s._currentValue),s._currentValue=a,l!==null)if(Rs(l.value,a)){if(l.children===o.children&&!Hn.current){t=jr(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var i=l.dependencies;if(i!==null){a=l.child;for(var c=i.firstContext;c!==null;){if(c.context===s){if(l.tag===1){c=mr(-1,n&-n),c.tag=2;var d=l.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?c.next=c:(c.next=f.next,f.next=c),d.pending=c}}l.lanes|=n,c=l.alternate,c!==null&&(c.lanes|=n),lf(l.return,n,t),i.lanes|=n;break}c=c.next}}else if(l.tag===10)a=l.type===t.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(ne(341));a.lanes|=n,i=a.alternate,i!==null&&(i.lanes|=n),lf(a,n,t),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===t){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}Tn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,s=t.pendingProps.children,Ml(t,n),o=gs(o),s=s(o),t.flags|=1,Tn(e,t,s,n),t.child;case 14:return s=t.type,o=ks(s,t.pendingProps),o=ks(s.type,o),rg(e,t,s,o,n);case 15:return Py(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,o=t.pendingProps,o=t.elementType===s?o:ks(s,o),ac(e,t),t.tag=1,Un(s)?(e=!0,Ec(t)):e=!1,Ml(t,n),Cy(t,s,o),cf(t,s,o,n),ff(null,t,s,!0,e,n);case 19:return Ay(e,t,n);case 22:return My(e,t,n)}throw Error(ne(156,t.tag))};function Xy(e,t){return kv(e,t)}function F_(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fs(e,t,n,s){return new F_(e,t,n,s)}function Jp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function B_(e){if(typeof e=="function")return Jp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xp)return 11;if(e===vp)return 14}return 2}function eo(e,t){var n=e.alternate;return n===null?(n=fs(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function uc(e,t,n,s,o,l){var a=2;if(s=e,typeof e=="function")Jp(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case pl:return Ao(n.children,o,l,t);case gp:a=8,o|=8;break;case Td:return e=fs(12,n,t,o|2),e.elementType=Td,e.lanes=l,e;case $d:return e=fs(13,n,t,o),e.elementType=$d,e.lanes=l,e;case Id:return e=fs(19,n,t,o),e.elementType=Id,e.lanes=l,e;case av:return du(n,o,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ov:a=10;break e;case lv:a=9;break e;case xp:a=11;break e;case vp:a=14;break e;case Dr:a=16,s=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=fs(a,n,t,o),t.elementType=e,t.type=s,t.lanes=l,t}function Ao(e,t,n,s){return e=fs(7,e,s,t),e.lanes=n,e}function du(e,t,n,s){return e=fs(22,e,s,t),e.elementType=av,e.lanes=n,e.stateNode={isHidden:!1},e}function rd(e,t,n){return e=fs(6,e,null,t),e.lanes=n,e}function od(e,t,n){return t=fs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function H_(e,t,n,s,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zu(0),this.expirationTimes=zu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zu(0),this.identifierPrefix=s,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Zp(e,t,n,s,o,l,a,i,c){return e=new H_(e,t,n,i,c),t===1?(t=1,l===!0&&(t|=8)):t=0,l=fs(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Op(l),e}function U_(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:fl,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function Jy(e){if(!e)return ao;e=e._reactInternals;e:{if(Xo(e)!==e||e.tag!==1)throw Error(ne(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Un(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ne(171))}if(e.tag===1){var n=e.type;if(Un(n))return Jv(e,n,t)}return t}function Zy(e,t,n,s,o,l,a,i,c){return e=Zp(n,s,!0,e,o,l,a,i,c),e.context=Jy(null),n=e.current,s=On(),o=Zr(n),l=mr(s,o),l.callback=t??null,Xr(n,l,o),e.current.lanes=o,oi(e,o,s),Vn(e,s),e}function fu(e,t,n,s){var o=t.current,l=On(),a=Zr(o);return n=Jy(n),t.context===null?t.context=n:t.pendingContext=n,t=mr(l,a),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Xr(o,t,a),e!==null&&(Es(e,o,a,l),rc(e,o,a)),a}function Bc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function gg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function em(e,t){gg(e,t),(e=e.alternate)&&gg(e,t)}function V_(){return null}var e0=typeof reportError=="function"?reportError:function(e){console.error(e)};function tm(e){this._internalRoot=e}pu.prototype.render=tm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ne(409));fu(e,t,null,null)};pu.prototype.unmount=tm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Uo(function(){fu(null,e,null,null)}),t[yr]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mv();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Fr.length&&t!==0&&t<Fr[n].priority;n++);Fr.splice(n,0,e),n===0&&$v(e)}};function nm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function xg(){}function W_(e,t,n,s,o){if(o){if(typeof s=="function"){var l=s;s=function(){var d=Bc(a);l.call(d)}}var a=Zy(t,s,e,0,null,!1,!1,"",xg);return e._reactRootContainer=a,e[yr]=a.current,Ha(e.nodeType===8?e.parentNode:e),Uo(),a}for(;o=e.lastChild;)e.removeChild(o);if(typeof s=="function"){var i=s;s=function(){var d=Bc(c);i.call(d)}}var c=Zp(e,0,!1,null,null,!1,!1,"",xg);return e._reactRootContainer=c,e[yr]=c.current,Ha(e.nodeType===8?e.parentNode:e),Uo(function(){fu(t,c,n,s)}),c}function hu(e,t,n,s,o){var l=n._reactRootContainer;if(l){var a=l;if(typeof o=="function"){var i=o;o=function(){var c=Bc(a);i.call(c)}}fu(t,a,e,o)}else a=W_(n,t,e,o,s);return Bc(a)}Rv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ja(t.pendingLanes);n!==0&&(jp(t,n|1),Vn(t,Ut()),!(tt&6)&&(Ul=Ut()+500,mo()))}break;case 13:Uo(function(){var s=wr(e,1);if(s!==null){var o=On();Es(s,e,1,o)}}),em(e,1)}};bp=function(e){if(e.tag===13){var t=wr(e,134217728);if(t!==null){var n=On();Es(t,e,134217728,n)}em(e,134217728)}};Pv=function(e){if(e.tag===13){var t=Zr(e),n=wr(e,t);if(n!==null){var s=On();Es(n,e,t,s)}em(e,t)}};Mv=function(){return it};Tv=function(e,t){var n=it;try{return it=e,t()}finally{it=n}};Vd=function(e,t,n){switch(t){case"input":if(Ld(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var o=ou(s);if(!o)throw Error(ne(90));cv(s),Ld(s,o)}}}break;case"textarea":dv(e,n);break;case"select":t=n.value,t!=null&&Cl(e,!!n.multiple,t,!1)}};vv=Qp;yv=Uo;var q_={usingClientEntryPoint:!1,Events:[ai,xl,ou,gv,xv,Qp]},pa={findFiberByHostInstance:Mo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},G_={bundleType:pa.bundleType,version:pa.version,rendererPackageName:pa.rendererPackageName,rendererConfig:pa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Sr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bv(e),e===null?null:e.stateNode},findFiberByHostInstance:pa.findFiberByHostInstance||V_,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ti=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ti.isDisabled&&Ti.supportsFiber)try{tu=Ti.inject(G_),Gs=Ti}catch{}}ts.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=q_;ts.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nm(t))throw Error(ne(200));return U_(e,t,null,n)};ts.createRoot=function(e,t){if(!nm(e))throw Error(ne(299));var n=!1,s="",o=e0;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Zp(e,1,!1,null,null,n,!1,s,o),e[yr]=t.current,Ha(e.nodeType===8?e.parentNode:e),new tm(t)};ts.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ne(188)):(e=Object.keys(e).join(","),Error(ne(268,e)));return e=bv(t),e=e===null?null:e.stateNode,e};ts.flushSync=function(e){return Uo(e)};ts.hydrate=function(e,t,n){if(!mu(t))throw Error(ne(200));return hu(null,e,t,!0,n)};ts.hydrateRoot=function(e,t,n){if(!nm(e))throw Error(ne(405));var s=n!=null&&n.hydratedSources||null,o=!1,l="",a=e0;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Zy(t,null,e,1,n??null,o,!1,l,a),e[yr]=t.current,Ha(e),s)for(e=0;e<s.length;e++)n=s[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new pu(t)};ts.render=function(e,t,n){if(!mu(t))throw Error(ne(200));return hu(null,e,t,!1,n)};ts.unmountComponentAtNode=function(e){if(!mu(e))throw Error(ne(40));return e._reactRootContainer?(Uo(function(){hu(null,null,e,!1,function(){e._reactRootContainer=null,e[yr]=null})}),!0):!1};ts.unstable_batchedUpdates=Qp;ts.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!mu(n))throw Error(ne(200));if(e==null||e._reactInternals===void 0)throw Error(ne(38));return hu(e,t,n,!1,s)};ts.version="18.3.1-next-f1338f8080-20240426";function t0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t0)}catch(e){console.error(e)}}t0(),tv.exports=ts;var Jo=tv.exports,n0,vg=Jo;n0=vg.createRoot,vg.hydrateRoot;/**
41
+ * @remix-run/router v1.23.4
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */function Xa(){return Xa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Xa.apply(null,arguments)}var Wr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Wr||(Wr={}));const yg="popstate";function K_(e){e===void 0&&(e={});function t(s,o){let{pathname:l,search:a,hash:i}=s.location;return kf("",{pathname:l,search:a,hash:i},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(s,o){return typeof o=="string"?o:r0(o)}return Y_(t,n,null,e)}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function s0(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Q_(){return Math.random().toString(36).substr(2,8)}function wg(e,t){return{usr:e.state,key:e.key,idx:t}}function kf(e,t,n,s){return n===void 0&&(n=null),Xa({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Zl(t):t,{state:n,key:t&&t.key||s||Q_()})}function r0(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Zl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function Y_(e,t,n,s){s===void 0&&(s={});let{window:o=document.defaultView,v5Compat:l=!1}=s,a=o.history,i=Wr.Pop,c=null,d=f();d==null&&(d=0,a.replaceState(Xa({},a.state,{idx:d}),""));function f(){return(a.state||{idx:null}).idx}function p(){i=Wr.Pop;let j=f(),w=j==null?null:j-d;d=j,c&&c({action:i,location:y.location,delta:w})}function m(j,w){i=Wr.Push;let x=kf(y.location,j,w);d=f()+1;let v=wg(x,d),b=y.createHref(x);try{a.pushState(v,"",b)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;o.location.assign(b)}l&&c&&c({action:i,location:y.location,delta:1})}function g(j,w){i=Wr.Replace;let x=kf(y.location,j,w);d=f();let v=wg(x,d),b=y.createHref(x);a.replaceState(v,"",b),l&&c&&c({action:i,location:y.location,delta:0})}function h(j){let w=o.location.origin!=="null"?o.location.origin:o.location.href,x=typeof j=="string"?j:r0(j);return x=x.replace(/ $/,"%20"),Jt(w,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,w)}let y={get action(){return i},get location(){return e(o,a)},listen(j){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(yg,p),c=j,()=>{o.removeEventListener(yg,p),c=null}},createHref(j){return t(o,j)},createURL:h,encodeLocation(j){let w=h(j);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:g,go(j){return a.go(j)}};return y}var jg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(jg||(jg={}));function X_(e,t,n){return n===void 0&&(n="/"),J_(e,t,n)}function J_(e,t,n,s){let o=typeof t=="string"?Zl(t):t,l=a0(o.pathname||"/",n);if(l==null)return null;let a=o0(e);Z_(a);let i=null,c=dk(l);for(let d=0;i==null&&d<a.length;++d)i=ik(a[d],c);return i}function o0(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let o=(l,a,i)=>{let c={relativePath:i===void 0?l.path||"":i,caseSensitive:l.caseSensitive===!0,childrenIndex:a,route:l};c.relativePath.startsWith("/")&&(Jt(c.relativePath.startsWith(s),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(s.length));let d=Oo([s,c.relativePath]),f=n.concat(c);l.children&&l.children.length>0&&(Jt(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),o0(l.children,t,f,d)),!(l.path==null&&!l.index)&&t.push({path:d,score:lk(d,l.index),routesMeta:f})};return e.forEach((l,a)=>{var i;if(l.path===""||!((i=l.path)!=null&&i.includes("?")))o(l,a);else for(let c of l0(l.path))o(l,a,c)}),t}function l0(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,o=n.endsWith("?"),l=n.replace(/\?$/,"");if(s.length===0)return o?[l,""]:[l];let a=l0(s.join("/")),i=[];return i.push(...a.map(c=>c===""?l:[l,c].join("/"))),o&&i.push(...a),i.map(c=>e.startsWith("/")&&c===""?"/":c)}function Z_(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ak(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const ek=/^:[\w-]+$/,tk=3,nk=2,sk=1,rk=10,ok=-2,bg=e=>e==="*";function lk(e,t){let n=e.split("/"),s=n.length;return n.some(bg)&&(s+=ok),t&&(s+=nk),n.filter(o=>!bg(o)).reduce((o,l)=>o+(ek.test(l)?tk:l===""?sk:rk),s)}function ak(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function ik(e,t,n){let{routesMeta:s}=e,o={},l="/",a=[];for(let i=0;i<s.length;++i){let c=s[i],d=i===s.length-1,f=l==="/"?t:t.slice(l.length)||"/",p=ck({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},f),m=c.route;if(!p)return null;Object.assign(o,p.params),a.push({params:o,pathname:Oo([l,p.pathname]),pathnameBase:mk(Oo([l,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(l=Oo([l,p.pathnameBase]))}return a}function ck(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=uk(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let l=o[0],a=l.replace(/(.)\/+$/,"$1"),i=o.slice(1);return{params:s.reduce((d,f,p)=>{let{paramName:m,isOptional:g}=f;if(m==="*"){let y=i[p]||"";a=l.slice(0,l.length-y.length).replace(/(.)\/+$/,"$1")}const h=i[p];return g&&!h?d[m]=void 0:d[m]=(h||"").replace(/%2F/g,"/"),d},{}),pathname:l,pathnameBase:a,pattern:e}}function uk(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),s0(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,i,c)=>(s.push({paramName:i,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function dk(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return s0(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function a0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function fk(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Zl(e):e,l;return n?(n=u0(n),n.startsWith("/")?l=_g(n.substring(1),"/"):l=_g(n,t)):l=t,{pathname:l,search:hk(s),hash:gk(o)}}function _g(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function ld(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function pk(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function i0(e,t){let n=pk(e);return t?n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function c0(e,t,n,s){s===void 0&&(s=!1);let o;typeof e=="string"?o=Zl(e):(o=Xa({},e),Jt(!o.pathname||!o.pathname.includes("?"),ld("?","pathname","search",o)),Jt(!o.pathname||!o.pathname.includes("#"),ld("#","pathname","hash",o)),Jt(!o.search||!o.search.includes("#"),ld("#","search","hash",o)));let l=e===""||o.pathname==="",a=l?"/":o.pathname,i;if(a==null)i=n;else{let p=t.length-1;if(!s&&a.startsWith("..")){let m=a.split("/");for(;m[0]==="..";)m.shift(),p-=1;o.pathname=m.join("/")}i=p>=0?t[p]:"/"}let c=fk(o,i),d=a&&a!=="/"&&a.endsWith("/"),f=(l||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}const u0=e=>e.replace(/\/\/+/g,"/"),Oo=e=>u0(e.join("/")),mk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),hk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,gk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function xk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const d0=["post","put","patch","delete"];new Set(d0);const vk=["get",...d0];new Set(vk);/**
50
+ * React Router v6.30.6
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */function Ja(){return Ja=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ja.apply(null,arguments)}const sm=u.createContext(null),yk=u.createContext(null),ci=u.createContext(null),gu=u.createContext(null),ho=u.createContext({outlet:null,matches:[],isDataRoute:!1}),f0=u.createContext(null);function ui(){return u.useContext(gu)!=null}function di(){return ui()||Jt(!1),u.useContext(gu).location}function p0(e){u.useContext(ci).static||u.useLayoutEffect(e)}function ea(){let{isDataRoute:e}=u.useContext(ho);return e?$k():wk()}function wk(){ui()||Jt(!1);let e=u.useContext(sm),{basename:t,future:n,navigator:s}=u.useContext(ci),{matches:o}=u.useContext(ho),{pathname:l}=di(),a=JSON.stringify(i0(o,n.v7_relativeSplatPath)),i=u.useRef(!1);return p0(()=>{i.current=!0}),u.useCallback(function(d,f){if(f===void 0&&(f={}),!i.current)return;if(typeof d=="number"){s.go(d);return}let p=c0(d,JSON.parse(a),l,f.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Oo([t,p.pathname])),(f.replace?s.replace:s.push)(p,f.state,f)},[t,s,a,l,e])}function jk(){let{matches:e}=u.useContext(ho),t=e[e.length-1];return t?t.params:{}}function bk(e,t){return _k(e,t)}function _k(e,t,n,s){ui()||Jt(!1);let{navigator:o}=u.useContext(ci),{matches:l}=u.useContext(ho),a=l[l.length-1],i=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let d=di(),f;if(t){var p;let j=typeof t=="string"?Zl(t):t;c==="/"||(p=j.pathname)!=null&&p.startsWith(c)||Jt(!1),f=j}else f=d;let m=f.pathname||"/",g=m;if(c!=="/"){let j=c.replace(/^\//,"").split("/");g="/"+m.replace(/^\//,"").split("/").slice(j.length).join("/")}let h=X_(e,{pathname:g}),y=Ek(h&&h.map(j=>Object.assign({},j,{params:Object.assign({},i,j.params),pathname:Oo([c,o.encodeLocation?o.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?c:Oo([c,o.encodeLocation?o.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),l,n,s);return t&&y?u.createElement(gu.Provider,{value:{location:Ja({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Wr.Pop}},y):y}function kk(){let e=Tk(),t=xk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},t),n?u.createElement("pre",{style:o},n):null,null)}const Sk=u.createElement(kk,null);class Nk extends u.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?u.createElement(ho.Provider,{value:this.props.routeContext},u.createElement(f0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ck(e){let{routeContext:t,match:n,children:s}=e,o=u.useContext(sm);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),u.createElement(ho.Provider,{value:t},s)}function Ek(e,t,n,s){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var l;if(!n)return null;if(n.errors)e=n.matches;else if((l=s)!=null&&l.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,i=(o=n)==null?void 0:o.errors;if(i!=null){let f=a.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);f>=0||Jt(!1),a=a.slice(0,Math.min(a.length,f+1))}let c=!1,d=-1;if(n&&s&&s.v7_partialHydration)for(let f=0;f<a.length;f++){let p=a[f];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=f),p.route.id){let{loaderData:m,errors:g}=n,h=p.route.loader&&m[p.route.id]===void 0&&(!g||g[p.route.id]===void 0);if(p.route.lazy||h){c=!0,d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}return a.reduceRight((f,p,m)=>{let g,h=!1,y=null,j=null;n&&(g=i&&p.route.id?i[p.route.id]:void 0,y=p.route.errorElement||Sk,c&&(d<0&&m===0?(Ik("route-fallback"),h=!0,j=null):d===m&&(h=!0,j=p.route.hydrateFallbackElement||null)));let w=t.concat(a.slice(0,m+1)),x=()=>{let v;return g?v=y:h?v=j:p.route.Component?v=u.createElement(p.route.Component,null):p.route.element?v=p.route.element:v=f,u.createElement(Ck,{match:p,routeContext:{outlet:f,matches:w,isDataRoute:n!=null},children:v})};return n&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?u.createElement(Nk,{location:n.location,revalidation:n.revalidation,component:y,error:g,children:x(),routeContext:{outlet:null,matches:w,isDataRoute:!0}}):x()},null)}var m0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(m0||{}),h0=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(h0||{});function Rk(e){let t=u.useContext(sm);return t||Jt(!1),t}function Pk(e){let t=u.useContext(yk);return t||Jt(!1),t}function Mk(e){let t=u.useContext(ho);return t||Jt(!1),t}function g0(e){let t=Mk(),n=t.matches[t.matches.length-1];return n.route.id||Jt(!1),n.route.id}function Tk(){var e;let t=u.useContext(f0),n=Pk(),s=g0();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function $k(){let{router:e}=Rk(m0.UseNavigateStable),t=g0(h0.UseNavigateStable),n=u.useRef(!1);return p0(()=>{n.current=!0}),u.useCallback(function(o,l){l===void 0&&(l={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Ja({fromRouteId:t},l)))},[e,t])}const kg={};function Ik(e,t,n){kg[e]||(kg[e]=!0)}function Ak(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Vl(e){let{to:t,replace:n,state:s,relative:o}=e;ui()||Jt(!1);let{future:l,static:a}=u.useContext(ci),{matches:i}=u.useContext(ho),{pathname:c}=di(),d=ea(),f=c0(t,i0(i,l.v7_relativeSplatPath),c,o==="path"),p=JSON.stringify(f);return u.useEffect(()=>d(JSON.parse(p),{replace:n,state:s,relative:o}),[d,p,o,n,s]),null}function Fs(e){Jt(!1)}function Ok(e){let{basename:t="/",children:n=null,location:s,navigationType:o=Wr.Pop,navigator:l,static:a=!1,future:i}=e;ui()&&Jt(!1);let c=t.replace(/^\/*/,"/"),d=u.useMemo(()=>({basename:c,navigator:l,static:a,future:Ja({v7_relativeSplatPath:!1},i)}),[c,i,l,a]);typeof s=="string"&&(s=Zl(s));let{pathname:f="/",search:p="",hash:m="",state:g=null,key:h="default"}=s,y=u.useMemo(()=>{let j=a0(f,c);return j==null?null:{location:{pathname:j,search:p,hash:m,state:g,key:h},navigationType:o}},[c,f,p,m,g,h,o]);return y==null?null:u.createElement(ci.Provider,{value:d},u.createElement(gu.Provider,{children:n,value:y}))}function Lk(e){let{children:t,location:n}=e;return bk(Sf(t),n)}new Promise(()=>{});function Sf(e,t){t===void 0&&(t=[]);let n=[];return u.Children.forEach(e,(s,o)=>{if(!u.isValidElement(s))return;let l=[...t,o];if(s.type===u.Fragment){n.push.apply(n,Sf(s.props.children,l));return}s.type!==Fs&&Jt(!1),!s.props.index||!s.props.children||Jt(!1);let a={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(a.children=Sf(s.props.children,l)),n.push(a)}),n}/**
59
+ * React Router DOM v6.30.6
60
+ *
61
+ * Copyright (c) Remix Software Inc.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE.md file in the root directory of this source tree.
65
+ *
66
+ * @license MIT
67
+ */function Nf(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(o=>[n,o]):[[n,s]])},[]))}function Dk(e,t){let n=Nf(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(l=>{n.append(o,l)})}),n}const zk="6";try{window.__reactRouterVersion=zk}catch{}const Fk="startTransition",Sg=Qo[Fk];function Bk(e){let{basename:t,children:n,future:s,window:o}=e,l=u.useRef();l.current==null&&(l.current=K_({window:o,v5Compat:!0}));let a=l.current,[i,c]=u.useState({action:a.action,location:a.location}),{v7_startTransition:d}=s||{},f=u.useCallback(p=>{d&&Sg?Sg(()=>c(p)):c(p)},[c,d]);return u.useLayoutEffect(()=>a.listen(f),[a,f]),u.useEffect(()=>Ak(s),[s]),u.createElement(Ok,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:a,future:s})}var Ng;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ng||(Ng={}));var Cg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Cg||(Cg={}));function Hk(e){let t=u.useRef(Nf(e)),n=u.useRef(!1),s=di(),o=u.useMemo(()=>Dk(s.search,n.current?null:t.current),[s.search]),l=ea(),a=u.useCallback((i,c)=>{const d=Nf(typeof i=="function"?i(o):i);n.current=!0,l("?"+d,c)},[l,o]);return[o,a]}const Uk={},Eg=e=>{let t;const n=new Set,s=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const g=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(h=>h(t,g))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Uk?"plugin":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(s,o,c);return c},Vk=e=>e?Eg(e):Eg;var x0={exports:{}},v0={},y0={exports:{}},w0={};/**
68
+ * @license React
69
+ * use-sync-external-store-shim.production.js
70
+ *
71
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
72
+ *
73
+ * This source code is licensed under the MIT license found in the
74
+ * LICENSE file in the root directory of this source tree.
75
+ */var Wl=u;function Wk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qk=typeof Object.is=="function"?Object.is:Wk,Gk=Wl.useState,Kk=Wl.useEffect,Qk=Wl.useLayoutEffect,Yk=Wl.useDebugValue;function Xk(e,t){var n=t(),s=Gk({inst:{value:n,getSnapshot:t}}),o=s[0].inst,l=s[1];return Qk(function(){o.value=n,o.getSnapshot=t,ad(o)&&l({inst:o})},[e,n,t]),Kk(function(){return ad(o)&&l({inst:o}),e(function(){ad(o)&&l({inst:o})})},[e]),Yk(n),n}function ad(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qk(e,n)}catch{return!0}}function Jk(e,t){return t()}var Zk=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Jk:Xk;w0.useSyncExternalStore=Wl.useSyncExternalStore!==void 0?Wl.useSyncExternalStore:Zk;y0.exports=w0;var eS=y0.exports;/**
76
+ * @license React
77
+ * use-sync-external-store-shim/with-selector.production.js
78
+ *
79
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
80
+ *
81
+ * This source code is licensed under the MIT license found in the
82
+ * LICENSE file in the root directory of this source tree.
83
+ */var xu=u,tS=eS;function nS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sS=typeof Object.is=="function"?Object.is:nS,rS=tS.useSyncExternalStore,oS=xu.useRef,lS=xu.useEffect,aS=xu.useMemo,iS=xu.useDebugValue;v0.useSyncExternalStoreWithSelector=function(e,t,n,s,o){var l=oS(null);if(l.current===null){var a={hasValue:!1,value:null};l.current=a}else a=l.current;l=aS(function(){function c(g){if(!d){if(d=!0,f=g,g=s(g),o!==void 0&&a.hasValue){var h=a.value;if(o(h,g))return p=h}return p=g}if(h=p,sS(f,g))return h;var y=s(g);return o!==void 0&&o(h,y)?(f=g,h):(f=g,p=y)}var d=!1,f,p,m=n===void 0?null:n;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,n,s,o]);var i=rS(e,l[0],l[1]);return lS(function(){a.hasValue=!0,a.value=i},[i]),iS(i),i};x0.exports=v0;var cS=x0.exports;const uS=Hx(cS),j0={},{useDebugValue:dS}=Zx,{useSyncExternalStoreWithSelector:fS}=uS;let Rg=!1;const pS=e=>e;function mS(e,t=pS,n){(j0?"plugin":void 0)!=="production"&&n&&!Rg&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Rg=!0);const s=fS(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dS(s),s}const Pg=e=>{(j0?"plugin":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Vk(e):e,n=(s,o)=>mS(t,s,o);return Object.assign(n,t),n},rm=e=>e?Pg(e):Pg,ps="/touchstone/".replace(/\/+$/,"");async function $i(e,t,n){const s={method:e,credentials:"same-origin",headers:{}};n!==void 0&&(s.headers["Content-Type"]="application/json",s.body=JSON.stringify(n));const o=await fetch(ps+t,s);if(o.status===401)throw window.location.pathname!==ps+"/login"&&!window.__ts_redirecting&&(window.__ts_redirecting=!0,window.location.href=ps+"/login"),new Error("unauthorized");let l=null;const a=await o.text();if(a)try{l=JSON.parse(a)}catch{l=a}if(!o.ok){const i=l&&(l.error||l.message)||`HTTP ${o.status}`;throw new Error(i)}return l}const X={get:e=>$i("GET",e),post:(e,t)=>$i("POST",e,t),patch:(e,t)=>$i("PATCH",e,t),del:(e,t)=>$i("DELETE",e,t)},$l={me:()=>X.get("/api/auth/me"),login:(e,t)=>X.post("/api/auth/login",{username:e,password:t}),register:(e,t)=>X.post("/api/auth/register",{username:e,password:t}),logout:()=>X.post("/api/auth/logout"),changePassword:(e,t)=>X.post("/api/auth/change_password",{old_password:e,new_password:t})},$n={feishuGet:()=>X.get("/api/me/feishu"),feishuBindcode:()=>X.post("/api/me/feishu-bindcode"),feishuUnbind:()=>X.del("/api/me/feishu"),feishuCfgGet:()=>X.get("/api/me/feishu-cfg"),feishuCfgSet:e=>X.patch("/api/me/feishu-cfg",e),feishuOutbox:()=>X.get("/api/me/feishu/outbox"),feishuSlashGet:()=>X.get("/api/me/feishu/slash-commands"),feishuSlashSet:e=>X.post("/api/me/feishu/slash-commands",{action:e}),feishuProvisionGet:()=>X.get("/api/me/feishu/provision"),feishuProvisionSet:(e,t={})=>X.post("/api/me/feishu/provision",{action:e,...t}),feishuDoctor:(e=!1)=>X.post("/api/me/feishu/doctor",{send_probe:!!e}),feishuReconnect:()=>X.post("/api/me/feishu/reconnect")},Pt={list:()=>X.get("/api/projects"),get:e=>X.get(`/api/projects/${e}`),create:e=>X.post("/api/projects",e),update:(e,t)=>X.patch(`/api/projects/${e}`,t),remove:(e,t)=>X.del(`/api/projects/${e}`,t),archive:e=>X.post(`/api/projects/${e}/archive`),unarchive:e=>X.post(`/api/projects/${e}/unarchive`),fsBrowse:e=>X.get(`/api/fs/browse?path=${encodeURIComponent(e||"")}`),fsMkdir:(e,t)=>X.post("/api/fs/mkdir",{path:e,name:t}),dupCheck:e=>{const t=new URLSearchParams(e).toString();return X.get(`/api/projects/dup_check?${t}`)},agents:()=>X.get("/api/agents/scan"),agentModels:e=>X.get(`/api/agents/models?agent_path=${encodeURIComponent(e||"")}`),agentSkills:(e,t)=>X.get(`/api/agents/skills?agent_path=${encodeURIComponent(e||"")}&project_dir=${encodeURIComponent(t||"")}`),feishuHookGet:e=>X.get(`/api/projects/${e}/feishu-hook`),feishuHookSet:(e,t)=>X.patch(`/api/projects/${e}/feishu-hook`,t),feishuHookApplyAll:e=>X.post("/api/me/feishu-hook/apply",e),filePreview:(e,t)=>X.get(`/api/projects/${e}/file?path=${encodeURIComponent(t)}`),fileRawUrl:(e,t)=>`${ps}/api/projects/${e}/file?path=${encodeURIComponent(t)}&raw=1`},kl={get:e=>X.get(`/api/prefs?project_id=${e||0}`),set:(e,t,n)=>X.post("/api/prefs",{project_id:e||0,key:t,value:n})},Ve={list:e=>X.get(`/api/projects/${e}/tasks`),create:(e,t)=>X.post(`/api/projects/${e}/tasks`,t),get:e=>X.get(`/api/tasks/${e}`),update:(e,t)=>X.patch(`/api/tasks/${e}`,t),stop:e=>X.post(`/api/tasks/${e}/stop`),restart:e=>X.post(`/api/tasks/${e}/restart`),continue:(e,t)=>X.post(`/api/tasks/${e}/continue`,t),remove:e=>X.del(`/api/tasks/${e}`),rounds:e=>X.get(`/api/tasks/${e}/rounds`),dialogue:e=>X.get(`/api/tasks/${e}/dialogue`),log:(e,t,n=300)=>X.get(`/api/tasks/${e}/log?round=${t}&tail=${n}`),loadCase:e=>X.get(`/api/tasks/${e}/load/case`),loadCaseMeta:e=>X.get(`/api/tasks/${e}/load/case?meta=1`),loadRuns:e=>X.get(`/api/tasks/${e}/load/runs`),loadRerun:e=>X.post(`/api/tasks/${e}/load/rerun`),loadDiagnose:e=>X.post(`/api/tasks/${e}/load/diagnose`),loadMetrics:(e,t=0,n=2e4,s="")=>X.get(`/api/tasks/${e}/load/metrics?after=${t}&limit=${n}`+(s?`&run=${encodeURIComponent(s)}`:"")),loadReport:(e,t="")=>X.get(`/api/tasks/${e}/load_report${t?`?run=${encodeURIComponent(t)}`:""}`),loadStream:(e,t="")=>new EventSource(`${ps}/api/tasks/${e}/load/stream${t?`?run=${encodeURIComponent(t)}`:""}`),loadCustomHtmlUrl:e=>`${ps}/api/tasks/${e}/load/custom_html`,sessionMessages:(e,t="main",n=0)=>X.get(`/api/tasks/${e}/session/messages?agent=${encodeURIComponent(t)}&after=${n}`),sessionStream:(e,t="main")=>new EventSource(`${ps}/api/tasks/${e}/session/stream?agent=${encodeURIComponent(t)}`),sessionChat:(e,t,n=!1)=>X.post(`/api/tasks/${e}/session/chat`,{message:t,inject:n}),sessionChatInject:(e,t)=>X.post(`/api/tasks/${e}/session/chat/inject`,{msg_id:t}),sessionRewind:(e,t)=>X.post(`/api/tasks/${e}/session/rewind`,{mid:t}),answerInteraction:(e,t)=>X.post(`/api/tasks/${e}/session/interaction/answer`,t),sessionChatStop:e=>X.post(`/api/tasks/${e}/session/chat/stop`),sessionChatCancelQueue:(e,t)=>X.post(`/api/tasks/${e}/session/chat/stop`,t?{mode:"cancel_queue",msg_id:t}:{mode:"cancel_queue"}),sessionProfile:(e,t)=>X.post(`/api/tasks/${e}/session/profile`,t),sessionMediaUrl:(e,t,n)=>`${ps}/api/tasks/${e}/session/media/${encodeURIComponent(n)}?agent=${encodeURIComponent(t)}`},Cf={list:e=>X.get(`/api/projects/${e}/bugs`),get:(e,t)=>X.get(`/api/projects/${e}/bugs/${encodeURIComponent(t)}`),reject:(e,t,n)=>X.post(`/api/projects/${e}/bugs/${encodeURIComponent(t)}/reject`,{reason:n})},qr={users:()=>X.get("/api/admin/users"),createUser:e=>X.post("/api/admin/users",e),updateUser:(e,t)=>X.patch(`/api/admin/users/${e}`,t),deleteUser:e=>X.del(`/api/admin/users/${e}`),ragGet:()=>X.get("/api/admin/rag"),ragSet:e=>X.patch("/api/admin/rag",e),ragTest:e=>X.post("/api/admin/rag/test",e)},id={list:(e,t)=>{const n=e==="project"?"project":"user";return X.get(`/api/builtin-assets?target=${n}`+(n==="project"&&t?`&project_id=${t}`:""))},install:(e,t,n)=>X.post(`/api/builtin-assets/${e}/install`,{target:t,project_id:n??null}),uninstall:(e,t,n)=>X.post(`/api/builtin-assets/${e}/uninstall`,{target:t,project_id:n??null})},Mg={state:e=>X.get(`/api/state?project=${e}`),stream:e=>new EventSource(`${ps}/api/stream?project=${e}`)},Re={get:e=>X.get(`/api/projects/${e}/board`),createCard:(e,t)=>X.post(`/api/projects/${e}/board/cards`,t),updateCard:(e,t,n)=>X.patch(`/api/projects/${e}/board/cards/${t}`,n),removeCard:(e,t)=>X.del(`/api/projects/${e}/board/cards/${t}`),moveCard:(e,t,n,s,o=null,l=!1)=>X.post(`/api/projects/${e}/board/cards/${t}/move`,{column:n,block_text:s,before_id:o,merge_ack:!!l}),startCard:(e,t,n,s,o)=>X.post(`/api/projects/${e}/board/cards/${t}/start`,{opinion:n,force:!!s,worktree:!!o}),worktreePreview:(e,t)=>X.get(`/api/projects/${e}/board/cards/${t}/worktree`),mergeWorktree:(e,t)=>X.post(`/api/projects/${e}/board/cards/${t}/worktree/merge`,{}),removeWorktree:(e,t)=>X.del(`/api/projects/${e}/board/cards/${t}/worktree`),stopCard:(e,t)=>X.post(`/api/projects/${e}/board/cards/${t}/stop`),cancelQueue:(e,t,n)=>X.post(`/api/projects/${e}/board/cards/${t}/stop`,n?{mode:"cancel_queue",msg_id:n}:{mode:"cancel_queue"}),markViewed:(e,t)=>X.post(`/api/projects/${e}/board/cards/${t}/viewed`),addComment:(e,t,n)=>X.post(`/api/projects/${e}/board/cards/${t}/comments`,{text:n}),sendComment:(e,t,n,s=!1)=>X.post(`/api/projects/${e}/board/cards/${t}/comments/${n}/send`,{inject:s}),removeComment:(e,t,n)=>X.del(`/api/projects/${e}/board/cards/${t}/comments/${n}`),listSessions:e=>X.get(`/api/projects/${e}/board/sessions`),compact:(e,t,n)=>X.post(`/api/projects/${e}/board/cards/${t}/compact`,n?{sid:n}:{}),forkCompact:(e,t,n)=>X.post(`/api/projects/${e}/board/cards/${t}/fork-compact`,n?{sid:n}:{}),forkSession:(e,t,n)=>X.post(`/api/projects/${e}/board/cards/${t}/fork`,n?{sid:n}:{}),answerInteraction:(e,t,n)=>X.post(`/api/projects/${e}/board/cards/${t}/interaction/answer`,n),deliverAnswer:(e,t)=>X.post(`/api/projects/${e}/board/cards/${t}/answer/deliver`),injectSessionMsg:(e,t,n)=>X.post(`/api/projects/${e}/board/sessions/${encodeURIComponent(t)}/inject`,{msg_id:n}),rewindSession:(e,t,n)=>X.post(`/api/projects/${e}/board/sessions/${encodeURIComponent(t)}/rewind`,{mid:n}),updateSettings:(e,t)=>X.patch(`/api/projects/${e}/board/settings`,t),jiraTest:(e,t)=>X.post(`/api/projects/${e}/board/jira/test`,t),jiraImport:e=>X.post(`/api/projects/${e}/board/jira/import`),sessionMessages:(e,t,n=0,s="main")=>X.get(`/api/projects/${e}/board/session/messages?sid=${encodeURIComponent(t)}&after=${n}&agent=${encodeURIComponent(s)}`),sessionMediaUrl:(e,t,n,s)=>`${ps}/api/projects/${e}/board/session/media/${encodeURIComponent(s)}?sid=${encodeURIComponent(t)}&agent=${encodeURIComponent(n)}`,reorderCard:(e,t,n)=>X.post(`/api/projects/${e}/board/reorder`,{card_id:t,before_id:n}),trashList:e=>X.get(`/api/projects/${e}/board/trash`),restoreCard:(e,t)=>X.post(`/api/projects/${e}/board/trash/${t}/restore`),purgeCard:(e,t)=>X.del(`/api/projects/${e}/board/trash/${t}`),emptyTrash:e=>X.post(`/api/projects/${e}/board/trash/empty`),setSessionProfile:(e,t,n)=>X.post(`/api/projects/${e}/board/sessions/${encodeURIComponent(t)}/profile`,n),uploadMedia:(e,t)=>X.post(`/api/projects/${e}/board/media`,t),stream:e=>new EventSource(`${ps}/api/projects/${e}/board/stream`),sessionStream:(e,t)=>new EventSource(`${ps}/api/projects/${e}/board/sessions/${encodeURIComponent(t)}/stream`)},Zn=rm((e,t)=>({username:"",isAdmin:!1,mustChangePassword:!1,loaded:!1,load:async()=>{try{const n=await $l.me();e({username:n.username,isAdmin:!!n.is_admin,mustChangePassword:!!n.must_change_password,loaded:!0})}catch{e({username:"",mustChangePassword:!1,loaded:!0})}},login:async(n,s)=>{await $l.login(n,s),await t().load()},logout:async()=>{try{await $l.logout()}catch{}e({username:"",isAdmin:!1,mustChangePassword:!1})}}));function vu({size:e=22}){return r.jsxs("svg",{className:"ts-logo",width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:"tsLogoG",x1:"0",y1:"1",x2:"1",y2:"0",children:[r.jsx("stop",{offset:"0",style:{stopColor:"var(--logo-1)"}}),r.jsx("stop",{offset:"1",style:{stopColor:"var(--logo-2)"}})]})}),r.jsx("path",{fill:"url(#tsLogoG)",fillRule:"evenodd",d:`M8.6 3H15.4A5.6 5.6 0 0 1 21 8.6V15.4A5.6 5.6 0 0 1 15.4 21H8.6A5.6 5.6 0 0 1 3 15.4V8.6A5.6 5.6 0 0 1 8.6 3Z
84
+ M7.6 6.6H16.4V9.8H13.6V17.8H10.4V9.8H7.6Z`})]})}var hS=Object.defineProperty,om=(e,t)=>hS(e,"name",{value:t,configurable:!0});function Ef(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}om(Ef,"setRef");function b0(...e){return t=>{let n=!1;const s=e.map(o=>{const l=Ef(o,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():Ef(e[o],null)}}}}om(b0,"composeRefs");function St(...e){return u.useCallback(b0(...e),e)}om(St,"useComposedRefs");var gS=Object.defineProperty,Ms=(e,t)=>gS(e,"name",{value:t,configurable:!0});function br(e){const t=u.forwardRef((n,s)=>{let{children:o,...l}=n,a=null,i=!1;const c=[];Rf(o)&&typeof Ii=="function"&&(o=Ii(o._payload)),u.Children.forEach(o,m=>{var g;if(N0(m)){i=!0;const h=m;let y="child"in h.props?h.props.child:h.props.children;Rf(y)&&typeof Ii=="function"&&(y=Ii(y._payload)),a=yS(h,y),c.push((g=a==null?void 0:a.props)==null?void 0:g.children)}else c.push(m)}),a?a=u.cloneElement(a,void 0,c):!i&&u.Children.count(o)===1&&u.isValidElement(o)&&(a=o);const d=a?S0(a):void 0,f=St(s,d);if(!a){if(o||o===0)throw new Error(i?bS(e):jS(e));return o}const p=k0(l,a.props??{});return a.type!==u.Fragment&&(p.ref=s?f:d),u.cloneElement(a,p)});return t.displayName=`${e}.Slot`,t}Ms(br,"createSlot");var xS=br("Slot"),_0=Symbol.for("radix.slottable");function vS(e){const t=Ms(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=_0,t}Ms(vS,"createSlottable");var yS=Ms((e,t)=>{if("child"in e.props){const n=e.props.child;return u.isValidElement(n)?u.cloneElement(n,void 0,e.props.children(n.props.children)):null}return u.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function k0(e,t){const n={...t};for(const s in t){const o=e[s],l=t[s];/^on[A-Z]/.test(s)?o&&l?n[s]=(...i)=>{const c=l(...i);return o(...i),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...l}:s==="className"&&(n[s]=[o,l].filter(Boolean).join(" "))}return{...e,...n}}Ms(k0,"mergeProps");function S0(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ms(S0,"getElementRef");function N0(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_0}Ms(N0,"isSlottable");var wS=Symbol.for("react.lazy");function Rf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===wS&&"_payload"in e&&C0(e._payload)}Ms(Rf,"isLazyComponent");function C0(e){return typeof e=="object"&&e!==null&&"then"in e}Ms(C0,"isPromiseLike");var jS=Ms(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),bS=Ms(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ii=Qo[" use ".trim().toString()];function E0(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=E0(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function R0(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=E0(e))&&(s&&(s+=" "),s+=t);return s}const Tg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$g=R0,P0=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return $g(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:l}=t,a=Object.keys(o).map(d=>{const f=n==null?void 0:n[d],p=l==null?void 0:l[d];if(f===null)return null;const m=Tg(f)||Tg(p);return o[d][m]}),i=n&&Object.entries(n).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(h=>{let[y,j]=h;return Array.isArray(j)?j.includes({...l,...i}[y]):{...l,...i}[y]===j})?[...d,p,m]:d},[]);return $g(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)},_S=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},kS=(e,t)=>({classGroupId:e,validator:t}),M0=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hc="-",Ig=[],SS="arbitrary..",NS=e=>{const t=ES(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return CS(a);const i=a.split(Hc),c=i[0]===""&&i.length>1?1:0;return T0(i,c,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const c=s[a],d=n[a];return c?d?_S(d,c):c:d||Ig}return n[a]||Ig}}},T0=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],l=n.nextPart.get(o);if(l){const d=T0(e,t+1,l);if(d)return d}const a=n.validators;if(a===null)return;const i=t===0?e.join(Hc):e.slice(t).join(Hc),c=a.length;for(let d=0;d<c;d++){const f=a[d];if(f.validator(i))return f.classGroupId}},CS=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?SS+s:void 0})(),ES=e=>{const{theme:t,classGroups:n}=e;return RS(n,t)},RS=(e,t)=>{const n=M0();for(const s in e){const o=e[s];lm(o,n,s,t)}return n},lm=(e,t,n,s)=>{const o=e.length;for(let l=0;l<o;l++){const a=e[l];PS(a,t,n,s)}},PS=(e,t,n,s)=>{if(typeof e=="string"){MS(e,t,n);return}if(typeof e=="function"){TS(e,t,n,s);return}$S(e,t,n,s)},MS=(e,t,n)=>{const s=e===""?t:$0(t,e);s.classGroupId=n},TS=(e,t,n,s)=>{if(IS(e)){lm(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(kS(n,e))},$S=(e,t,n,s)=>{const o=Object.entries(e),l=o.length;for(let a=0;a<l;a++){const[i,c]=o[a];lm(c,$0(t,i),n,s)}},$0=(e,t)=>{let n=e;const s=t.split(Hc),o=s.length;for(let l=0;l<o;l++){const a=s[l];let i=n.nextPart.get(a);i||(i=M0(),n.nextPart.set(a,i)),n=i}return n},IS=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,AS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const o=(l,a)=>{n[l]=a,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(l){let a=n[l];if(a!==void 0)return a;if((a=s[l])!==void 0)return o(l,a),a},set(l,a){l in n?n[l]=a:o(l,a)}}},Pf="!",Ag=":",OS=[],Og=(e,t,n,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:o}),LS=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=o=>{const l=[];let a=0,i=0,c=0,d;const f=o.length;for(let y=0;y<f;y++){const j=o[y];if(a===0&&i===0){if(j===Ag){l.push(o.slice(c,y)),c=y+1;continue}if(j==="/"){d=y;continue}}j==="["?a++:j==="]"?a--:j==="("?i++:j===")"&&i--}const p=l.length===0?o:o.slice(c);let m=p,g=!1;p.endsWith(Pf)?(m=p.slice(0,-1),g=!0):p.startsWith(Pf)&&(m=p.slice(1),g=!0);const h=d&&d>c?d-c:void 0;return Og(l,g,m,h)};if(t){const o=t+Ag,l=s;s=a=>a.startsWith(o)?l(a.slice(o.length)):Og(OS,!1,a,void 0,!0)}if(n){const o=s;s=l=>n({className:l,parseClassName:o})}return s},DS=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let o=[];for(let l=0;l<n.length;l++){const a=n[l],i=a[0]==="[",c=t.has(a);i||c?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(a)):o.push(a)}return o.length>0&&(o.sort(),s.push(...o)),s}},zS=e=>({cache:AS(e.cacheSize),parseClassName:LS(e),sortModifiers:DS(e),postfixLookupClassGroupIds:FS(e),...NS(e)}),FS=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},BS=/\s+/,HS=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:a}=t,i=[],c=e.trim().split(BS);let d="";for(let f=c.length-1;f>=0;f-=1){const p=c[f],{isExternal:m,modifiers:g,hasImportantModifier:h,baseClassName:y,maybePostfixModifierPosition:j}=n(p);if(m){d=p+(d.length>0?" "+d:d);continue}let w=!!j,x;if(w){const E=y.substring(0,j);x=s(E);const R=x&&a[x]?s(y):void 0;R&&R!==x&&(x=R,w=!1)}else x=s(y);if(!x){if(!w){d=p+(d.length>0?" "+d:d);continue}if(x=s(y),!x){d=p+(d.length>0?" "+d:d);continue}w=!1}const v=g.length===0?"":g.length===1?g[0]:l(g).join(":"),b=h?v+Pf:v,S=b+x;if(i.indexOf(S)>-1)continue;i.push(S);const k=o(x,w);for(let E=0;E<k.length;++E){const R=k[E];i.push(b+R)}d=p+(d.length>0?" "+d:d)}return d},US=(...e)=>{let t=0,n,s,o="";for(;t<e.length;)(n=e[t++])&&(s=I0(n))&&(o&&(o+=" "),o+=s);return o},I0=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=I0(e[s]))&&(n&&(n+=" "),n+=t);return n},VS=(e,...t)=>{let n,s,o,l;const a=c=>{const d=t.reduce((f,p)=>p(f),e());return n=zS(d),s=n.cache.get,o=n.cache.set,l=i,i(c)},i=c=>{const d=s(c);if(d)return d;const f=HS(c,n);return o(c,f),f};return l=a,(...c)=>l(US(...c))},WS=[],nn=e=>{const t=n=>n[e]||WS;return t.isThemeGetter=!0,t},A0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,O0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,GS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,KS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,QS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,YS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,XS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ar=e=>qS.test(e),Ge=e=>!!e&&!Number.isNaN(Number(e)),Ls=e=>!!e&&Number.isInteger(Number(e)),cd=e=>e.endsWith("%")&&Ge(e.slice(0,-1)),rr=e=>GS.test(e),L0=()=>!0,JS=e=>KS.test(e)&&!QS.test(e),am=()=>!1,ZS=e=>YS.test(e),eN=e=>XS.test(e),tN=e=>!ve(e)&&!we(e),nN=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),sN=e=>go(e,F0,am),ve=e=>A0.test(e),ko=e=>go(e,B0,JS),Lg=e=>go(e,dN,Ge),rN=e=>go(e,U0,L0),oN=e=>go(e,H0,am),Dg=e=>go(e,D0,am),lN=e=>go(e,z0,eN),Ai=e=>go(e,V0,ZS),we=e=>O0.test(e),ma=e=>Zo(e,B0),aN=e=>Zo(e,H0),zg=e=>Zo(e,D0),iN=e=>Zo(e,F0),cN=e=>Zo(e,z0),Oi=e=>Zo(e,V0,!0),uN=e=>Zo(e,U0,!0),go=(e,t,n)=>{const s=A0.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Zo=(e,t,n=!1)=>{const s=O0.exec(e);return s?s[1]?t(s[1]):n:!1},D0=e=>e==="position"||e==="percentage",z0=e=>e==="image"||e==="url",F0=e=>e==="length"||e==="size"||e==="bg-size",B0=e=>e==="length",dN=e=>e==="number",H0=e=>e==="family-name",U0=e=>e==="number"||e==="weight",V0=e=>e==="shadow",fN=()=>{const e=nn("color"),t=nn("font"),n=nn("text"),s=nn("font-weight"),o=nn("tracking"),l=nn("leading"),a=nn("breakpoint"),i=nn("container"),c=nn("spacing"),d=nn("radius"),f=nn("shadow"),p=nn("inset-shadow"),m=nn("text-shadow"),g=nn("drop-shadow"),h=nn("blur"),y=nn("perspective"),j=nn("aspect"),w=nn("ease"),x=nn("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...b(),we,ve],k=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],R=()=>[we,ve,c],z=()=>[Ar,"full","auto",...R()],N=()=>[Ls,"none","subgrid",we,ve],I=()=>["auto",{span:["full",Ls,we,ve]},Ls,we,ve],A=()=>[Ls,"auto",we,ve],W=()=>["auto","min","max","fr",we,ve],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...R()],U=()=>[Ar,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],F=()=>[Ar,"screen","full","dvw","lvw","svw","min","max","fit",...R()],Z=()=>[Ar,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],D=()=>[e,we,ve],be=()=>[...b(),zg,Dg,{position:[we,ve]}],ge=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Te=()=>["auto","cover","contain",iN,sN,{size:[we,ve]}],re=()=>[cd,ma,ko],$e=()=>["","none","full",d,we,ve],he=()=>["",Ge,ma,ko],De=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[Ge,cd,zg,Dg],Ce=()=>["","none",h,we,ve],_e=()=>["none",Ge,we,ve],C=()=>["none",Ge,we,ve],H=()=>[Ge,we,ve],pe=()=>[Ar,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rr],breakpoint:[rr],color:[L0],container:[rr],"drop-shadow":[rr],ease:["in","out","in-out"],font:[tN],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rr],shadow:[rr],spacing:["px",Ge],text:[rr],"text-shadow":[rr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ar,ve,we,j]}],container:["container"],"container-type":[{"@container":["","normal","size",we,ve]}],"container-named":[nN],columns:[{columns:[Ge,ve,we,i]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{"inset-s":z(),start:z()}],end:[{"inset-e":z(),end:z()}],"inset-bs":[{"inset-bs":z()}],"inset-be":[{"inset-be":z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[Ls,"auto",we,ve]}],basis:[{basis:[Ar,"full","auto",i,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,Ar,"auto","initial","none",ve]}],grow:[{grow:["",Ge,we,ve]}],shrink:[{shrink:["",Ge,we,ve]}],order:[{order:[Ls,"first","last","none",we,ve]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[i,"screen",...U()]}],"min-w":[{"min-w":[i,"screen","none",...U()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,ma,ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,uN,rN]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",cd,ve]}],"font-family":[{font:[aN,oN,t]}],"font-features":[{"font-features":[ve]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,we,ve]}],"line-clamp":[{"line-clamp":[Ge,"none",we,Lg]}],leading:[{leading:[l,...R()]}],"list-image":[{"list-image":["none",we,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...De(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",we,ko]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Ge,"auto",we,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[Ls,we,ve]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:be()}],"bg-repeat":[{bg:ge()}],"bg-size":[{bg:Te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ls,we,ve],radial:["",we,ve],conic:[Ls,we,ve]},cN,lN]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:$e()}],"rounded-s":[{"rounded-s":$e()}],"rounded-e":[{"rounded-e":$e()}],"rounded-t":[{"rounded-t":$e()}],"rounded-r":[{"rounded-r":$e()}],"rounded-b":[{"rounded-b":$e()}],"rounded-l":[{"rounded-l":$e()}],"rounded-ss":[{"rounded-ss":$e()}],"rounded-se":[{"rounded-se":$e()}],"rounded-ee":[{"rounded-ee":$e()}],"rounded-es":[{"rounded-es":$e()}],"rounded-tl":[{"rounded-tl":$e()}],"rounded-tr":[{"rounded-tr":$e()}],"rounded-br":[{"rounded-br":$e()}],"rounded-bl":[{"rounded-bl":$e()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...De(),"hidden","none"]}],"divide-style":[{divide:[...De(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...De(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,we,ve]}],"outline-w":[{outline:["",Ge,ma,ko]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",f,Oi,Ai]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",p,Oi,Ai]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Ge,ko]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",m,Oi,Ai]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[Ge,we,ve]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[we,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:be()}],"mask-repeat":[{mask:ge()}],"mask-size":[{mask:Te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ve]}],filter:[{filter:["","none",we,ve]}],blur:[{blur:Ce()}],brightness:[{brightness:[Ge,we,ve]}],contrast:[{contrast:[Ge,we,ve]}],"drop-shadow":[{"drop-shadow":["","none",g,Oi,Ai]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",Ge,we,ve]}],"hue-rotate":[{"hue-rotate":[Ge,we,ve]}],invert:[{invert:["",Ge,we,ve]}],saturate:[{saturate:[Ge,we,ve]}],sepia:[{sepia:["",Ge,we,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ve]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,we,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,we,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,we,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,we,ve]}],"backdrop-invert":[{"backdrop-invert":["",Ge,we,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,we,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,we,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,we,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",we,ve]}],ease:[{ease:["linear","initial",w,we,ve]}],delay:[{delay:[Ge,we,ve]}],animate:[{animate:["none",x,we,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,we,ve]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:C()}],"scale-x":[{"scale-x":C()}],"scale-y":[{"scale-y":C()}],"scale-z":[{"scale-z":C()}],"scale-3d":["scale-3d"],skew:[{skew:H()}],"skew-x":[{"skew-x":H()}],"skew-y":[{"skew-y":H()}],transform:[{transform:[we,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":["translate-none"],zoom:[{zoom:[Ls,we,ve]}],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,ve]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Ge,ma,ko,Lg]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},pN=VS(fN);function Ke(...e){return pN(R0(e))}const mN=P0("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function V({className:e,variant:t,size:n,asChild:s=!1,...o}){const l=s?xS:"button";return r.jsx(l,{"data-slot":"button",className:Ke(mN({variant:t,size:n,className:e})),...o})}function Ae({className:e,type:t,...n}){return r.jsx("input",{type:t,"data-slot":"input",className:Ke("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",e),...n})}var hN=Object.defineProperty,gN=(e,t)=>hN(e,"name",{value:t,configurable:!0}),xN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dt=xN.reduce((e,t)=>{const n=br(`Primitive.${t}`),s=u.forwardRef((o,l)=>{const{asChild:a,...i}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...i,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function W0(e,t){e&&Jo.flushSync(()=>e.dispatchEvent(t))}gN(W0,"dispatchDiscreteCustomEvent");var vN=Object.defineProperty,yN=(e,t)=>vN(e,"name",{value:t,configurable:!0}),wN=u.forwardRef(yN(function(t,n){return r.jsx(dt.label,{...t,ref:n,onMouseDown:s=>{var l;s.target.closest("button, input, select, textarea")||((l=t.onMouseDown)==null||l.call(t,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}})},"Label")),jN=wN;const st=u.forwardRef(({className:e,...t},n)=>r.jsx(jN,{ref:n,"data-slot":"label",className:Ke("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t}));st.displayName="Label";function Cn({className:e,...t}){return r.jsx("div",{"data-slot":"card",className:Ke("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function qn({className:e,...t}){return r.jsx("div",{"data-slot":"card-header",className:Ke("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Gn({className:e,...t}){return r.jsx("div",{"data-slot":"card-title",className:Ke("leading-none font-semibold",e),...t})}function q0({className:e,...t}){return r.jsx("div",{"data-slot":"card-description",className:Ke("text-muted-foreground text-sm",e),...t})}function En({className:e,...t}){return r.jsx("div",{"data-slot":"card-content",className:Ke("px-6",e),...t})}function G0({className:e,...t}){return r.jsx("div",{"data-slot":"card-footer",className:Ke("flex items-center px-6",e),...t})}/**
85
+ * @license lucide-react v1.35.0 - ISC
86
+ *
87
+ * This source code is licensed under the ISC license.
88
+ * See the LICENSE file in the root directory of this source tree.
89
+ */const K0=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
90
+ * @license lucide-react v1.35.0 - ISC
91
+ *
92
+ * This source code is licensed under the ISC license.
93
+ * See the LICENSE file in the root directory of this source tree.
94
+ */const bN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
95
+ * @license lucide-react v1.35.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */const _N=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
100
+ * @license lucide-react v1.35.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */const Fg=e=>{const t=_N(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
105
+ * @license lucide-react v1.35.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */var ud={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
110
+ * @license lucide-react v1.35.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */const kN=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},SN=u.createContext({}),NN=()=>u.useContext(SN),CN=u.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:o="",children:l,iconNode:a,...i},c)=>{const{size:d=24,strokeWidth:f=2,absoluteStrokeWidth:p=!1,color:m="currentColor",className:g=""}=NN()??{},h=s??p?Number(n??f)*24/Number(t??d):n??f;return u.createElement("svg",{ref:c,...ud,width:t??d??ud.width,height:t??d??ud.height,stroke:e??m,strokeWidth:h,className:K0("lucide",g,o),...!l&&!kN(i)&&{"aria-hidden":"true"},...i},[...a.map(([y,j])=>u.createElement(y,j)),...Array.isArray(l)?l:[l]])});/**
115
+ * @license lucide-react v1.35.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const Ne=(e,t)=>{const n=u.forwardRef(({className:s,...o},l)=>u.createElement(CN,{ref:l,iconNode:t,className:K0(`lucide-${bN(Fg(e))}`,`lucide-${e}`,s),...o}));return n.displayName=Fg(e),n};/**
120
+ * @license lucide-react v1.35.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const EN=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],dd=Ne("archive-restore",EN);/**
125
+ * @license lucide-react v1.35.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const RN=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],fd=Ne("archive",RN);/**
130
+ * @license lucide-react v1.35.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const PN=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],MN=Ne("arrow-down-to-line",PN);/**
135
+ * @license lucide-react v1.35.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const TN=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],im=Ne("arrow-left",TN);/**
140
+ * @license lucide-react v1.35.0 - ISC
141
+ *
142
+ * This source code is licensed under the ISC license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */const $N=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Bg=Ne("arrow-right",$N);/**
145
+ * @license lucide-react v1.35.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */const IN=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],AN=Ne("arrow-up",IN);/**
150
+ * @license lucide-react v1.35.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */const ON=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],LN=Ne("ban",ON);/**
155
+ * @license lucide-react v1.35.0 - ISC
156
+ *
157
+ * This source code is licensed under the ISC license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */const DN=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],zN=Ne("bell",DN);/**
160
+ * @license lucide-react v1.35.0 - ISC
161
+ *
162
+ * This source code is licensed under the ISC license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */const FN=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],Q0=Ne("boxes",FN);/**
165
+ * @license lucide-react v1.35.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */const BN=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Y0=Ne("brain",BN);/**
170
+ * @license lucide-react v1.35.0 - ISC
171
+ *
172
+ * This source code is licensed under the ISC license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */const HN=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dr=Ne("check",HN);/**
175
+ * @license lucide-react v1.35.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const UN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ql=Ne("chevron-down",UN);/**
180
+ * @license lucide-react v1.35.0 - ISC
181
+ *
182
+ * This source code is licensed under the ISC license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */const VN=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Uc=Ne("chevron-up",VN);/**
185
+ * @license lucide-react v1.35.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */const WN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],qN=Ne("circle-x",WN);/**
190
+ * @license lucide-react v1.35.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */const GN=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],KN=Ne("command",GN);/**
195
+ * @license lucide-react v1.35.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */const QN=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],YN=Ne("copy-plus",QN);/**
200
+ * @license lucide-react v1.35.0 - ISC
201
+ *
202
+ * This source code is licensed under the ISC license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */const XN=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],cm=Ne("copy",XN);/**
205
+ * @license lucide-react v1.35.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */const JN=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ZN=Ne("download",JN);/**
210
+ * @license lucide-react v1.35.0 - ISC
211
+ *
212
+ * This source code is licensed under the ISC license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */const eC=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],um=Ne("external-link",eC);/**
215
+ * @license lucide-react v1.35.0 - ISC
216
+ *
217
+ * This source code is licensed under the ISC license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */const tC=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Hg=Ne("eye-off",tC);/**
220
+ * @license lucide-react v1.35.0 - ISC
221
+ *
222
+ * This source code is licensed under the ISC license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */const nC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sC=Ne("file-exclamation-point",nC);/**
225
+ * @license lucide-react v1.35.0 - ISC
226
+ *
227
+ * This source code is licensed under the ISC license.
228
+ * See the LICENSE file in the root directory of this source tree.
229
+ */const rC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],X0=Ne("file-text",rC);/**
230
+ * @license lucide-react v1.35.0 - ISC
231
+ *
232
+ * This source code is licensed under the ISC license.
233
+ * See the LICENSE file in the root directory of this source tree.
234
+ */const oC=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ug=Ne("folder-open",oC);/**
235
+ * @license lucide-react v1.35.0 - ISC
236
+ *
237
+ * This source code is licensed under the ISC license.
238
+ * See the LICENSE file in the root directory of this source tree.
239
+ */const lC=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],aC=Ne("folder-plus",lC);/**
240
+ * @license lucide-react v1.35.0 - ISC
241
+ *
242
+ * This source code is licensed under the ISC license.
243
+ * See the LICENSE file in the root directory of this source tree.
244
+ */const iC=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],cC=Ne("git-fork",iC);/**
245
+ * @license lucide-react v1.35.0 - ISC
246
+ *
247
+ * This source code is licensed under the ISC license.
248
+ * See the LICENSE file in the root directory of this source tree.
249
+ */const uC=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],dm=Ne("key-round",uC);/**
250
+ * @license lucide-react v1.35.0 - ISC
251
+ *
252
+ * This source code is licensed under the ISC license.
253
+ * See the LICENSE file in the root directory of this source tree.
254
+ */const dC=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],J0=Ne("link-2",dC);/**
255
+ * @license lucide-react v1.35.0 - ISC
256
+ *
257
+ * This source code is licensed under the ISC license.
258
+ * See the LICENSE file in the root directory of this source tree.
259
+ */const fC=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],pC=Ne("list",fC);/**
260
+ * @license lucide-react v1.35.0 - ISC
261
+ *
262
+ * This source code is licensed under the ISC license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */const mC=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Z0=Ne("loader-circle",mC);/**
265
+ * @license lucide-react v1.35.0 - ISC
266
+ *
267
+ * This source code is licensed under the ISC license.
268
+ * See the LICENSE file in the root directory of this source tree.
269
+ */const hC=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],fm=Ne("log-out",hC);/**
270
+ * @license lucide-react v1.35.0 - ISC
271
+ *
272
+ * This source code is licensed under the ISC license.
273
+ * See the LICENSE file in the root directory of this source tree.
274
+ */const gC=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],xC=Ne("maximize-2",gC);/**
275
+ * @license lucide-react v1.35.0 - ISC
276
+ *
277
+ * This source code is licensed under the ISC license.
278
+ * See the LICENSE file in the root directory of this source tree.
279
+ */const vC=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],yC=Ne("menu",vC);/**
280
+ * @license lucide-react v1.35.0 - ISC
281
+ *
282
+ * This source code is licensed under the ISC license.
283
+ * See the LICENSE file in the root directory of this source tree.
284
+ */const wC=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],jC=Ne("message-square",wC);/**
285
+ * @license lucide-react v1.35.0 - ISC
286
+ *
287
+ * This source code is licensed under the ISC license.
288
+ * See the LICENSE file in the root directory of this source tree.
289
+ */const bC=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],_C=Ne("messages-square",bC);/**
290
+ * @license lucide-react v1.35.0 - ISC
291
+ *
292
+ * This source code is licensed under the ISC license.
293
+ * See the LICENSE file in the root directory of this source tree.
294
+ */const kC=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ew=Ne("palette",kC);/**
295
+ * @license lucide-react v1.35.0 - ISC
296
+ *
297
+ * This source code is licensed under the ISC license.
298
+ * See the LICENSE file in the root directory of this source tree.
299
+ */const SC=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],pm=Ne("pencil",SC);/**
300
+ * @license lucide-react v1.35.0 - ISC
301
+ *
302
+ * This source code is licensed under the ISC license.
303
+ * See the LICENSE file in the root directory of this source tree.
304
+ */const NC=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],_a=Ne("play",NC);/**
305
+ * @license lucide-react v1.35.0 - ISC
306
+ *
307
+ * This source code is licensed under the ISC license.
308
+ * See the LICENSE file in the root directory of this source tree.
309
+ */const CC=[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]],EC=Ne("plug-zap",CC);/**
310
+ * @license lucide-react v1.35.0 - ISC
311
+ *
312
+ * This source code is licensed under the ISC license.
313
+ * See the LICENSE file in the root directory of this source tree.
314
+ */const RC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Lo=Ne("plus",RC);/**
315
+ * @license lucide-react v1.35.0 - ISC
316
+ *
317
+ * This source code is licensed under the ISC license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */const PC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Za=Ne("refresh-cw",PC);/**
320
+ * @license lucide-react v1.35.0 - ISC
321
+ *
322
+ * This source code is licensed under the ISC license.
323
+ * See the LICENSE file in the root directory of this source tree.
324
+ */const MC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Mf=Ne("rotate-ccw",MC);/**
325
+ * @license lucide-react v1.35.0 - ISC
326
+ *
327
+ * This source code is licensed under the ISC license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */const TC=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],$C=Ne("save",TC);/**
330
+ * @license lucide-react v1.35.0 - ISC
331
+ *
332
+ * This source code is licensed under the ISC license.
333
+ * See the LICENSE file in the root directory of this source tree.
334
+ */const IC=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Tf=Ne("send",IC);/**
335
+ * @license lucide-react v1.35.0 - ISC
336
+ *
337
+ * This source code is licensed under the ISC license.
338
+ * See the LICENSE file in the root directory of this source tree.
339
+ */const AC=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],tw=Ne("settings",AC);/**
340
+ * @license lucide-react v1.35.0 - ISC
341
+ *
342
+ * This source code is licensed under the ISC license.
343
+ * See the LICENSE file in the root directory of this source tree.
344
+ */const OC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M6.376 18.91a6 6 0 0 1 11.249.003",key:"hnjrf2"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}]],LC=Ne("shield-user",OC);/**
345
+ * @license lucide-react v1.35.0 - ISC
346
+ *
347
+ * This source code is licensed under the ISC license.
348
+ * See the LICENSE file in the root directory of this source tree.
349
+ */const DC=[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]],zC=Ne("shrink",DC);/**
350
+ * @license lucide-react v1.35.0 - ISC
351
+ *
352
+ * This source code is licensed under the ISC license.
353
+ * See the LICENSE file in the root directory of this source tree.
354
+ */const FC=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],mm=Ne("square",FC);/**
355
+ * @license lucide-react v1.35.0 - ISC
356
+ *
357
+ * This source code is licensed under the ISC license.
358
+ * See the LICENSE file in the root directory of this source tree.
359
+ */const BC=[["path",{d:"M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"1ystz2"}],["path",{d:"M3 4v16",key:"1ph11n"}]],HC=Ne("step-forward",BC);/**
360
+ * @license lucide-react v1.35.0 - ISC
361
+ *
362
+ * This source code is licensed under the ISC license.
363
+ * See the LICENSE file in the root directory of this source tree.
364
+ */const UC=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],VC=Ne("stethoscope",UC);/**
365
+ * @license lucide-react v1.35.0 - ISC
366
+ *
367
+ * This source code is licensed under the ISC license.
368
+ * See the LICENSE file in the root directory of this source tree.
369
+ */const WC=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Qs=Ne("trash-2",WC);/**
370
+ * @license lucide-react v1.35.0 - ISC
371
+ *
372
+ * This source code is licensed under the ISC license.
373
+ * See the LICENSE file in the root directory of this source tree.
374
+ */const qC=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],hm=Ne("triangle-alert",qC);/**
375
+ * @license lucide-react v1.35.0 - ISC
376
+ *
377
+ * This source code is licensed under the ISC license.
378
+ * See the LICENSE file in the root directory of this source tree.
379
+ */const GC=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Sl=Ne("undo-2",GC);/**
380
+ * @license lucide-react v1.35.0 - ISC
381
+ *
382
+ * This source code is licensed under the ISC license.
383
+ * See the LICENSE file in the root directory of this source tree.
384
+ */const KC=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],QC=Ne("users",KC);/**
385
+ * @license lucide-react v1.35.0 - ISC
386
+ *
387
+ * This source code is licensed under the ISC license.
388
+ * See the LICENSE file in the root directory of this source tree.
389
+ */const YC=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],XC=Ne("wand-sparkles",YC);/**
390
+ * @license lucide-react v1.35.0 - ISC
391
+ *
392
+ * This source code is licensed under the ISC license.
393
+ * See the LICENSE file in the root directory of this source tree.
394
+ */const JC=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],ZC=Ne("webhook",JC);/**
395
+ * @license lucide-react v1.35.0 - ISC
396
+ *
397
+ * This source code is licensed under the ISC license.
398
+ * See the LICENSE file in the root directory of this source tree.
399
+ */const e2=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],gm=Ne("wrench",e2);/**
400
+ * @license lucide-react v1.35.0 - ISC
401
+ *
402
+ * This source code is licensed under the ISC license.
403
+ * See the LICENSE file in the root directory of this source tree.
404
+ */const t2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ys=Ne("x",t2);/**
405
+ * @license lucide-react v1.35.0 - ISC
406
+ *
407
+ * This source code is licensed under the ISC license.
408
+ * See the LICENSE file in the root directory of this source tree.
409
+ */const n2=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],Nl=Ne("zap",n2);function s2(){const e=ea(),t=Zn(),[n,s]=u.useState("login"),[o,l]=u.useState(""),[a,i]=u.useState(""),[c,d]=u.useState(""),[f,p]=u.useState(""),[m,g]=u.useState(""),[h,y]=u.useState(""),[j,w]=u.useState(!1);function x(){s(n==="login"?"reg":"login"),y("")}async function v(){if(j)return;y("");const b=n==="reg";if(b&&f!==m){y("两次输入的密码不一致");return}w(!0);try{b?(await $l.register(c,f),await t.load()):await t.login(o,a),e("/app")}catch(S){y(S.message||(b?"注册失败":"登录失败"))}finally{w(!1)}}return r.jsx("div",{className:"flex min-h-svh items-center justify-center bg-[radial-gradient(1200px_600px_at_70%_-10%,var(--login-glow)_0%,var(--bg)_55%)] p-4",children:r.jsxs(Cn,{className:"w-[360px] shadow-xl",children:[r.jsxs(qn,{className:"items-center gap-3 border-b border-border/60 pb-5",children:[r.jsx("div",{className:"justify-self-center",children:r.jsx(vu,{size:40})}),r.jsxs("div",{className:"text-center",children:[r.jsx(Gn,{className:"font-serif text-lg",children:n==="login"?"Touchstone":"注册用户"}),r.jsx(q0,{className:"mt-1",children:"Free-style testing · Execution & monitoring"})]})]}),r.jsxs(En,{className:"flex flex-col gap-4",children:[n==="login"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"login-username",className:"text-xs text-muted-foreground",children:"用户名"}),r.jsx(Ae,{id:"login-username",value:o,onChange:b=>l(b.target.value.trim()),autoComplete:"username",placeholder:"请输入用户名",autoFocus:!0})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"login-password",className:"text-xs text-muted-foreground",children:"密码"}),r.jsx(Ae,{id:"login-password",value:a,onChange:b=>i(b.target.value),type:"password",autoComplete:"current-password",placeholder:"请输入密码",onKeyUp:b=>{b.key==="Enter"&&v()}})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"reg-username",className:"text-xs text-muted-foreground",children:"用户名"}),r.jsx(Ae,{id:"reg-username",value:c,onChange:b=>d(b.target.value.trim()),autoComplete:"username",autoFocus:!0})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"reg-password",className:"text-xs text-muted-foreground",children:"密码"}),r.jsx(Ae,{id:"reg-password",value:f,onChange:b=>p(b.target.value),type:"password",autoComplete:"new-password",placeholder:"至少 6 位"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"reg-password2",className:"text-xs text-muted-foreground",children:"确认密码"}),r.jsx(Ae,{id:"reg-password2",value:m,onChange:b=>g(b.target.value),type:"password",autoComplete:"new-password",onKeyUp:b=>{b.key==="Enter"&&v()}})]})]}),r.jsx("div",{className:"min-h-5 text-[calc(13px*var(--fs))] leading-5 text-destructive",children:h}),r.jsxs(V,{size:"lg",className:"w-full",disabled:j,onClick:v,children:[j&&r.jsx(Z0,{className:"size-4 animate-spin"}),n==="login"?"登 录":"注 册"]})]}),r.jsxs(G0,{className:"flex-col items-center gap-3 pt-0",children:[r.jsx("button",{type:"button",className:"text-sm text-[var(--run)] underline-offset-4 hover:underline",onClick:x,children:n==="login"?"没有账号?注册新用户":"已有账号?返回登录"}),n==="login"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入账号密码登录;登录后可在右上角修改密码"})]})]})})}const _n=rm((e,t)=>({projects:[],currentProject:null,tasks:[],bugs:[],loading:{projects:!1,tasks:!1,bugs:!1},loadProjects:async()=>{e(n=>({loading:{...n.loading,projects:!0}}));try{e({projects:await Pt.list()})}finally{e(n=>({loading:{...n.loading,projects:!1}}))}},selectProject:async n=>{const s=t().projects.find(o=>o.id===n)||null;e({currentProject:s}),s&&await Promise.all([t().loadTasks(),t().loadBugs()])},refreshProject:async()=>{const n=t().currentProject;if(!n)return;const s=await Pt.get(n.id);e(o=>({currentProject:s,projects:o.projects.map(l=>l.id===s.id?s:l)}))},loadTasks:async()=>{const n=t().currentProject;if(n){e(s=>({loading:{...s.loading,tasks:!0}}));try{e({tasks:await Ve.list(n.id)})}finally{e(s=>({loading:{...s.loading,tasks:!1}}))}}},loadBugs:async()=>{const n=t().currentProject;if(n){e(s=>({loading:{...s.loading,bugs:!0}}));try{e({bugs:await Cf.list(n.id)})}finally{e(s=>({loading:{...s.loading,bugs:!1}}))}}},createProject:async n=>{const s=await Pt.create(n);return await t().loadProjects(),s},updateProject:async(n,s)=>{await Pt.update(n,s),await t().refreshProject(),await t().loadProjects()},deleteProject:async(n,s)=>{var o;await Pt.remove(n,s),((o=t().currentProject)==null?void 0:o.id)===n&&e({currentProject:null}),await t().loadProjects()},archiveProject:async(n,s)=>{var o;await Pt[s?"archive":"unarchive"](n),await t().loadProjects(),((o=t().currentProject)==null?void 0:o.id)===n&&await t().refreshProject()}}));let So=null,Vg=null;function M(e,t=2500){So||(So=document.createElement("div"),So.className="ts-toast",document.body.appendChild(So)),So.textContent=e,So.classList.add("show"),clearTimeout(Vg),Vg=setTimeout(()=>So.classList.remove("show"),t)}const dc=400,fc=240,zn=8,r2={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",nw:"nwse-resize",se:"nwse-resize",sw:"nesw-resize"};function o2(e,t){if(!e)return null;try{const n=JSON.parse(localStorage.getItem(e));if(n&&+n.w>=dc&&(!t||+n.h>=fc))return t?{w:+n.w,h:+n.h}:{w:+n.w}}catch{}return null}function fr(e,t=!0){const[n,s]=u.useState(()=>o2(e,t)),o=u.useRef(null),l=u.useRef(null),a=u.useCallback(g=>{const h=o.current;if(!h)return;const y=g.clientX-h.sx,j=g.clientY-h.sy;let w=h.left,x=h.top,v=h.w,b=h.h;if(h.dir==="mv"){const E=window.innerWidth,R=window.innerHeight;w=Math.max(zn,Math.min(h.left+y,E-zn-v)),x=Math.max(zn,Math.min(h.top+j,R-zn-b)),s({left:w,top:x,w:v,h:b});return}h.dir.includes("e")&&(v=h.w+y),h.dir.includes("s")&&(b=h.h+j),h.dir.includes("w")&&(v=h.w-y,w=h.left+y),h.dir.includes("n")&&(b=h.h-j,x=h.top+j);const S=window.innerWidth,k=window.innerHeight;v<dc&&(h.dir.includes("w")&&(w-=dc-v),v=dc),b<fc&&(h.dir.includes("n")&&(x-=fc-b),b=fc),w<zn&&(h.dir.includes("w")&&(v-=zn-w),w=zn),x<zn&&(h.dir.includes("n")&&(b-=zn-x),x=zn),w+v>S-zn&&(v=S-zn-w),x+b>k-zn&&(b=k-zn-x),s({left:w,top:x,w:v,h:b})},[]),i=u.useCallback(()=>{l.current&&(window.removeEventListener("mousemove",l.current),window.removeEventListener("mouseup",i),l.current=null),document.body.style.cursor="",e&&s(g=>{if(g)try{localStorage.setItem(e,JSON.stringify(t?{w:g.w,h:g.h}:{w:g.w}))}catch{}return g})},[e,t]),c=u.useCallback((g,h)=>{const y=g.currentTarget.closest(".modal");if(!y)return;y.style.animation="none",y.style.transition="none";const j=y.getBoundingClientRect();o.current={dir:h,sx:g.clientX,sy:g.clientY,left:j.left,top:j.top,w:j.width,h:j.height},s({left:j.left,top:j.top,w:j.width,h:j.height}),l.current=a,window.addEventListener("mousemove",a),window.addEventListener("mouseup",i),document.body.style.cursor=r2[h]||"default"},[a,i]),d=u.useCallback(g=>{if(g.button!==0)return;const h=g.currentTarget.closest(".modal");if(!h)return;h.style.animation="none",h.style.transition="none";const y=h.getBoundingClientRect();o.current={dir:"mv",sx:g.clientX,sy:g.clientY,left:y.left,top:y.top,w:y.width,h:y.height},s({left:y.left,top:y.top,w:y.width,h:y.height}),l.current=a,window.addEventListener("mousemove",a),window.addEventListener("mouseup",i),document.body.style.cursor="move",g.preventDefault()},[a,i]),f=u.useCallback(()=>{if(e)try{localStorage.removeItem(e)}catch{}s(null)},[e]),p=!!n,m=n?n.left!=null?{left:n.left+"px",top:n.top+"px",width:n.w+"px",height:n.h+"px",transform:"none"}:n.h?{left:`calc(50% - ${n.w/2}px)`,top:`calc(50% - ${n.h/2}px)`,width:n.w+"px",height:n.h+"px"}:{left:`calc(50% - ${n.w/2}px)`,width:n.w+"px"}:{};return{rzOn:p,rzStyle:m,rzStart:c,rzDragStart:d,rzReset:f}}const l2=/[^\s\u0000\u0001<>",。、;:!?()〔〕【】「」『』《》〈〉…—~·“”‘’]+/g,a2=/^[([{`'*“「『【(〔〈《]+/,i2=/(?::\d+(?::\d+)?|[)\]}`'*.,;:!?。,、;:!?…’”」』)】〕〉》])+$/,c2=/[()[\]{}*?=,!#$%^|`]/,u2=/^[^/\\\s]*\.[A-Za-z][A-Za-z0-9]{0,9}$/,d2=new Set(["md","markdown","txt","rst","json","jsonl","ndjson","yaml","yml","toml","ini","cfg","conf","env","log","csv","tsv","xml","html","htm","css","scss","less","js","jsx","mjs","cjs","ts","tsx","vue","svelte","py","sh","bash","zsh","bat","cmd","ps1","sql","go","rs","java","kt","rb","php","c","h","cc","cpp","hpp","cs","swift","lua","pl","r","jl","lock","patch","diff","ipynb","pdf","zip","tar","gz","tgz","7z","png","jpg","jpeg","gif","webp","svg","ico","bmp","mp4","mov","mp3","xlsx","xls","docx","doc","pptx","ppt","db","sqlite","wasm","map"]);function f2(e){return e.slice(e.lastIndexOf(".")+1).toLowerCase()}function p2(e,t){if(!e||e.indexOf("://")>=0||c2.test(e))return!1;const n=e.split(/[/\\]/).pop();return u2.test(n)?/[/\\]/.test(e)||/^[A-Za-z]:/.test(e)?!0:t&&d2.has(f2(n)):!1}function m2(e){return`<a class="md-path" data-path="${e}" title="点击预览:${e}">${e}</a>`}function Wg(e,t){const n=!!(t&&t.bare);return String(e??"").replace(l2,s=>{const o=(s.match(a2)||[""])[0],l=s.slice(o.length),a=(l.match(i2)||[""])[0],i=l.slice(0,l.length-a.length);return p2(i,n)?o+m2(i)+a:s})}const Li=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function qg(e){const t=String(e||"").trim();return/^(\/|https?:\/\/|mailto:|tel:|data:image\/)/i.test(t)?t:""}function Or(e,t){const n=!!(t&&t.pathLinks);let s=Li(e);const o=[],l=[];return s=s.replace(/`([^`]+)`/g,(a,i)=>(o.push(i),"\0"+(o.length-1)+"\0")),n&&(s=s.replace(/!?\[[^\]]*\]\([^)\s]+(?:\s+"[^"]*")?\)/g,a=>(l.push(a),""+(l.length-1)+""))),s=s.replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>"),n&&(s=Wg(s)),l.length&&(s=s.replace(/\u0001(\d+)\u0001/g,(a,i)=>l[+i])),s=s.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g,(a,i,c)=>{const d=qg(c);return d?`<img class="md-img" src="${d}" alt="${Li(i)}" loading="lazy">`:Li(a)}),s=s.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g,(a,i,c)=>{const d=qg(c);return d?`<a href="${d}" target="_blank" rel="noreferrer">${i}</a>`:Li(a)}),s=s.replace(/\u0000(\d+)\u0000/g,(a,i)=>"<code>"+(n?Wg(o[+i],{bare:!0}):o[+i])+"</code>"),s}const Gg=e=>String(e).trim().replace(/^\||\|$/g,"").split("|").map(t=>t.trim());function Vo(e,t){const n=t||{},s=String(e||"").split(`
410
+ `);let o="",l=0;for(;l<s.length;){const a=s[l];if(/^```/.test(a)){const c=[];for(l++;l<s.length&&!/^```/.test(s[l]);)c.push(s[l]),l++;l++,o+="<pre><code>"+c.map(d=>Or(d)).join(`
411
+ `)+"</code></pre>";continue}if(/^\|/.test(a)&&l+1<s.length&&/^\|[\s:|-]+\|$/.test(s[l+1])){const c=Gg(a);l+=2;const d=[];for(;l<s.length&&/^\|/.test(s[l]);)d.push(Gg(s[l])),l++;o+="<table><thead><tr>"+c.map(f=>"<th>"+Or(f,n)+"</th>").join("")+"</tr></thead><tbody>"+d.map(f=>"<tr>"+f.map(p=>"<td>"+Or(p,n)+"</td>").join("")+"</tr>").join("")+"</tbody></table>";continue}const i=a.match(/^(#{1,4})\s+(.*)$/);if(i){o+="<h"+i[1].length+">"+Or(i[2],n)+"</h"+i[1].length+">",l++;continue}if(/^\s*(?:---|\*\*\*)\s*$/.test(a)){o+="<hr>",l++;continue}if(/^\s*[-*]\s+/.test(a)){const c=[];for(;l<s.length&&/^\s*[-*]\s+/.test(s[l]);)c.push(Or(s[l].replace(/^\s*[-*]\s+/,""),n)),l++;o+="<ul>"+c.map(d=>"<li>"+d+"</li>").join("")+"</ul>";continue}if(/^\s*\d{1,2}[.)]\s+/.test(a)){const c=[];for(;l<s.length&&/^\s*\d{1,2}[.)]\s+/.test(s[l]);)c.push(Or(s[l].replace(/^\s*\d{1,2}[.)]\s+/,""),n)),l++;o+="<ol>"+c.map(d=>"<li>"+d+"</li>").join("")+"</ol>";continue}if(/^\s*>\s?/.test(a)){const c=[];for(;l<s.length&&/^\s*>\s?/.test(s[l]);)c.push(s[l].replace(/^\s*>\s?/,"")),l++;o+="<blockquote>"+c.map(d=>"<p>"+Or(d,n)+"</p>").join("")+"</blockquote>";continue}if(a.trim()===""){l++;continue}o+="<p>"+Or(a,n)+"</p>",l++}return o}function is(e){return e||"—"}const hr={queued:"排队中",running:"运行中",done:"已完成",stopped:"已停止",failed:"失败",interrupted:"中断"};function pr({start:e,reset:t}){const n=["n","s","e","w","ne","nw","se","sw"];return r.jsx(r.Fragment,{children:n.map(s=>r.jsx("i",{className:"rz rz-"+s,onMouseDown:o=>e(o,s),onDoubleClick:t,title:"拖动调整大小,双击复位"},s))})}const $f={idle:"",queued_serial:"排队中",answer_pending:"已作答·待送达",interaction_pending:"等待作答",server_queued:"服务端排队中",foreign_busy:"等外部会话",starting:"启动中",running:"会话运行中"},nw={running:"run",starting:"run",interaction_pending:"queued",queued_serial:"queued",answer_pending:"queued",server_queued:"server",foreign_busy:"foreign"},h2={run:"bug-status run",queued:"bug-status retest",server:"bug-status retest",foreign:"bug-status retest"},g2={run:"sess-qstate run",queued:"sess-qstate queued",server:"sess-qstate server",foreign:"sess-qstate foreign"};function sw(e,t="board"){const n=nw[e];return n?(t==="sess"?g2:h2)[n]:t==="sess"?"sess-qstate":"bug-status pending"}function x2(e,t={}){const{found:n=!0,board:s=!1,canQueue:o=!1,chatRunning:l=!1,projectBusy:a=!1}=t;if(!n)return"会话不可用";if(e==="foreign_busy")return s?"外部会话运行中:Enter 排队,空闲后自动投递":"外部会话运行中:Enter 排队,空闲后自动发送";if(e==="interaction_pending")return s?"agent 等待你作答:回答上方提问,或 Enter 排队继续对话":"agent 等待你作答:回答上方提问";const i=!!nw[e]||a;return i&&o?s?"会话运行中:Enter 排队,排队行「立即注入」可插入当前轮":"任务运行中:Enter 排队,排队行「立即注入」可插入当前轮":i?s?"项目忙:Enter 排队,空闲后自动投递":"项目忙:Enter 排队,空闲后自动发送":l?"对话进行中:Enter 排队,等当前轮结束发送":"向该会话继续发消息…(Enter 发送,Shift+Enter 换行)"}const v2=/([!]?\[[^\]]*\]\()([^)\s]+)(\))/g,rw="m\\d{13}_[0-9a-f]{10}\\.[A-Za-z0-9]{1,10}",y2=new RegExp("^\\/.*\\/board_media\\/("+rw+")$"),w2=new RegExp("^\\/api\\/projects\\/\\d+\\/board\\/media\\/("+rw+")$"),j2=/\.(?:png|jpe?g|gif|webp|bmp)$/i,b2="/board_media/",If="/touchstone/".replace(/\/+$/,"");function xm(e,t=If){const n=typeof e=="string"?e:"";return w2.test(n)?t+n:n}function fi(e,t){if(!Array.isArray(e)||t===void 0||t===null||t==="")return[];const n=e.find(s=>s&&String(s.id)===String(t));return n?[n.project_dir,n.work_dir].filter(s=>typeof s=="string"&&s.trim()!=="").map(s=>s.replace(/[/\\]+$/,"")):[]}function _2(e,t){for(const n of t||[])if(e===n||e.startsWith(n+"/"))return!0;return!1}function k2(e,t,n,s){return!e.startsWith("/")||!j2.test(e)||!_2(e,s)&&e.indexOf(b2)<0?"":n+"/api/projects/"+t+"/file?path="+encodeURIComponent(e)+"&inline=1"}function S2(e){return typeof e=="string"?{base:e,roots:null}:e&&typeof e=="object"?{base:typeof e.base=="string"?e.base:If,roots:e.roots||null}:{base:If,roots:null}}function io(e,t,n){if(!e||!t)return e||"";const{base:s,roots:o}=S2(n);return String(e).replace(v2,(l,a,i,c)=>{const d=y2.exec(i);if(d)return a+s+"/api/projects/"+t+"/board/media/"+d[1]+c;const f=xm(i,s);if(f!==i)return a+f+c;const p=k2(i,t,s,o);return p?a+p+c:l})}const Kg=4;async function vm(e){try{if(!(e.type||"").startsWith("image/"))return!1;const t=new Uint8Array(await e.slice(0,24).arrayBuffer());if(t.length<24||[137,80,78,71,13,10,26,10].some((l,a)=>t[a]!==l))return!1;const s=t[16]<<24|t[17]<<16|t[18]<<8|t[19],o=t[20]<<24|t[21]<<16|t[22]<<8|t[23];return s<=Kg&&o<=Kg}catch{return!1}}var N2=Object.defineProperty,C2=(e,t)=>N2(e,"name",{value:t,configurable:!0});function Af(e,[t,n]){return Math.min(n,Math.max(t,e))}C2(Af,"clamp");var E2=Object.defineProperty,ta=(e,t)=>E2(e,"name",{value:t,configurable:!0}),ow=!!(typeof window<"u"&&window.document&&window.document.createElement);function et(e,t,{checkForDefaultPrevented:n=!0}={}){return ta(function(o){if(e==null||e(o),n===!1||!o||!o.defaultPrevented)return t==null?void 0:t(o)},"handleEvent")}ta(et,"composeEventHandlers");function R2(e){var t;if(!ow)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}ta(R2,"getOwnerWindow");function Of(e){if(!ow)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}ta(Of,"getOwnerDocument");function lw(e,t=!1){const{activeElement:n}=Of(e);if(!(n!=null&&n.nodeName))return null;if(aw(n)&&n.contentDocument)return lw(n.contentDocument.body,t);if(t){const s=n.getAttribute("aria-activedescendant");if(s){const o=Of(n).getElementById(s);if(o)return o}}return n}ta(lw,"getActiveElement");function aw(e){return e.tagName==="IFRAME"}ta(aw,"isFrame");var P2=Object.defineProperty,ds=(e,t)=>P2(e,"name",{value:t,configurable:!0});function M2(e,t){const n=u.createContext(t);n.displayName=e+"Context";const s=ds(l=>{const{children:a,...i}=l,c=u.useMemo(()=>i,Object.values(i));return r.jsx(n.Provider,{value:c,children:a})},"Provider");s.displayName=e+"Provider";function o(l,a={}){const{optional:i=!1}=a,c=u.useContext(n);if(c)return c;if(t!==void 0)return t;if(!i)throw new Error(`\`${l}\` must be used within \`${e}\``)}return ds(o,"useContext"),[s,o]}ds(M2,"createContext");function xo(e,t=[]){let n=[];function s(l,a){const i=u.createContext(a);i.displayName=l+"Context";const c=n.length;n=[...n,a];const d=ds(p=>{var w;const{scope:m,children:g,...h}=p,y=((w=m==null?void 0:m[e])==null?void 0:w[c])||i,j=u.useMemo(()=>h,Object.values(h));return r.jsx(y.Provider,{value:j,children:g})},"Provider");d.displayName=l+"Provider";function f(p,m,g={}){var w;const{optional:h=!1}=g,y=((w=m==null?void 0:m[e])==null?void 0:w[c])||i,j=u.useContext(y);if(j)return j;if(a!==void 0)return a;if(!h)throw new Error(`\`${p}\` must be used within \`${l}\``)}return ds(f,"useContext"),[d,f]}ds(s,"createContext");const o=ds(()=>{const l=n.map(a=>u.createContext(a));return ds(function(i){const c=(i==null?void 0:i[e])||l;return u.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])},"useScope")},"createScope");return o.scopeName=e,[s,iw(o,...t)]}ds(xo,"createContextScope");function iw(...e){const t=e[0];if(e.length===1)return t;const n=ds(()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return ds(function(l){const a=s.reduce((i,{useScope:c,scopeName:d})=>{const p=c(l)[`__scope${d}`];return{...i,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ds(iw,"composeContextScopes");var T2=Object.defineProperty,dn=(e,t)=>T2(e,"name",{value:t,configurable:!0});function ym(e){const t=e+"CollectionProvider",[n,s]=xo(t),[o,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=dn(y=>{const{scope:j,children:w}=y,x=u.useRef(null),v=u.useRef(new Map).current;return r.jsx(o,{scope:j,itemMap:v,collectionRef:x,children:w})},"CollectionProvider");a.displayName=t;const i=e+"CollectionSlot",c=br(i),d=u.forwardRef((y,j)=>{const{scope:w,children:x}=y,v=l(i,w),b=St(j,v.collectionRef);return r.jsx(c,{ref:b,children:x})});d.displayName=i;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=br(f),g=u.forwardRef((y,j)=>{const{scope:w,children:x,...v}=y,b=u.useRef(null),S=St(j,b),k=l(f,w);return u.useEffect(()=>(k.itemMap.set(b,{ref:b,...v}),()=>void k.itemMap.delete(b))),r.jsx(m,{[p]:"",ref:S,children:x})});g.displayName=f;function h(y){const j=l(e+"CollectionConsumer",y);return u.useCallback(()=>{const x=j.collectionRef.current;if(!x)return[];const v=Array.from(x.querySelectorAll(`[${p}]`));return Array.from(j.itemMap.values()).sort((k,E)=>v.indexOf(k.ref.current)-v.indexOf(E.ref.current))},[j.collectionRef,j.itemMap])}return dn(h,"useCollection"),[{Provider:a,Slot:d,ItemSlot:g},h,s]}dn(ym,"createCollection");var Qg=new WeakMap,qt,Qn,pd=(Qn=class extends Map{constructor(n){super(n);ch(this,qt);$u(this,qt,[...super.keys()]),Qg.set(this,!0)}set(n,s){return Qg.get(this)&&(this.has(n)?wn(this,qt)[wn(this,qt).indexOf(n)]=n:wn(this,qt).push(n)),super.set(n,s),this}insert(n,s,o){const l=this.has(s),a=wn(this,qt).length,i=wm(n);let c=i>=0?i:a+i;const d=c<0||c>=a?-1:c;if(d===this.size||l&&d===this.size-1||d===-1)return this.set(s,o),this;const f=this.size+(l?0:1);i<0&&c++;const p=[...wn(this,qt)];let m,g=!1;for(let h=c;h<f;h++)if(c===h){let y=p[h];p[h]===s&&(y=p[h+1]),l&&this.delete(s),m=this.get(y),this.set(s,o)}else{!g&&p[h-1]===s&&(g=!0);const y=p[g?h:h-1],j=m;m=this.get(y),this.delete(y),this.set(y,j)}return this}with(n,s,o){const l=new Qn(this);return l.insert(n,s,o),l}before(n){const s=wn(this,qt).indexOf(n)-1;if(!(s<0))return this.entryAt(s)}setBefore(n,s,o){const l=wn(this,qt).indexOf(n);return l===-1?this:this.insert(l,s,o)}after(n){let s=wn(this,qt).indexOf(n);if(s=s===-1||s===this.size-1?-1:s+1,s!==-1)return this.entryAt(s)}setAfter(n,s,o){const l=wn(this,qt).indexOf(n);return l===-1?this:this.insert(l+1,s,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return $u(this,qt,[]),super.clear()}delete(n){const s=super.delete(n);return s&&wn(this,qt).splice(wn(this,qt).indexOf(n),1),s}deleteAt(n){const s=this.keyAt(n);return s!==void 0?this.delete(s):!1}at(n){const s=pc(wn(this,qt),n);if(s!==void 0)return this.get(s)}entryAt(n){const s=pc(wn(this,qt),n);if(s!==void 0)return[s,this.get(s)]}indexOf(n){return wn(this,qt).indexOf(n)}keyAt(n){return pc(wn(this,qt),n)}from(n,s){const o=this.indexOf(n);if(o===-1)return;let l=o+s;return l<0&&(l=0),l>=this.size&&(l=this.size-1),this.at(l)}keyFrom(n,s){const o=this.indexOf(n);if(o===-1)return;let l=o+s;return l<0&&(l=0),l>=this.size&&(l=this.size-1),this.keyAt(l)}find(n,s){let o=0;for(const l of this){if(Reflect.apply(n,s,[l,o,this]))return l;o++}}findIndex(n,s){let o=0;for(const l of this){if(Reflect.apply(n,s,[l,o,this]))return o;o++}return-1}filter(n,s){const o=[];let l=0;for(const a of this)Reflect.apply(n,s,[a,l,this])&&o.push(a),l++;return new Qn(o)}map(n,s){const o=[];let l=0;for(const a of this)o.push([a[0],Reflect.apply(n,s,[a,l,this])]),l++;return new Qn(o)}reduce(...n){const[s,o]=n;let l=0,a=o??this.at(0);for(const i of this)l===0&&n.length===1?a=i:a=Reflect.apply(s,this,[a,i,l,this]),l++;return a}reduceRight(...n){const[s,o]=n;let l=o??this.at(-1);for(let a=this.size-1;a>=0;a--){const i=this.at(a);a===this.size-1&&n.length===1?l=i:l=Reflect.apply(s,this,[l,i,a,this])}return l}toSorted(n){const s=[...this.entries()].sort(n);return new Qn(s)}toReversed(){const n=new Qn;for(let s=this.size-1;s>=0;s--){const o=this.keyAt(s),l=this.get(o);n.set(o,l)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new Qn(s)}slice(n,s){const o=new Qn;let l=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),s!==void 0&&s>0&&(l=s-1);for(let a=n;a<=l;a++){const i=this.keyAt(a),c=this.get(i);o.set(i,c)}return o}every(n,s){let o=0;for(const l of this){if(!Reflect.apply(n,s,[l,o,this]))return!1;o++}return!0}some(n,s){let o=0;for(const l of this){if(Reflect.apply(n,s,[l,o,this]))return!0;o++}return!1}},qt=new WeakMap,dn(Qn,"OrderedDict"),Qn);function pc(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=cw(e,t);return n===-1?void 0:e[n]}dn(pc,"at");function cw(e,t){const n=e.length,s=wm(t),o=s>=0?s:n+s;return o<0||o>=n?-1:o}dn(cw,"toSafeIndex");function wm(e){return e!==e||e===0?0:Math.trunc(e)}dn(wm,"toSafeInteger");function $2(e){const t=e+"CollectionProvider",[n,s]=xo(t),[o,l]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new pd,setItemMap:dn(()=>{},"setItemMap")}),a=dn(({state:v,...b})=>v?r.jsx(c,{...b,state:v}):r.jsx(i,{...b}),"CollectionProvider");a.displayName=t;const i=dn(v=>{const b=j();return r.jsx(c,{...v,state:b})},"CollectionInit");i.displayName=t+"Init";const c=dn(v=>{const{scope:b,children:S,state:k}=v,E=u.useRef(null),[R,z]=u.useState(null),N=St(E,z),[I,A]=k;return u.useEffect(()=>{if(!R)return;const W=fw(()=>{});return W.observe(R,{childList:!0,subtree:!0}),()=>{W.disconnect()}},[R]),r.jsx(o,{scope:b,itemMap:I,setItemMap:A,collectionRef:N,collectionRefObject:E,collectionElement:R,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const d=e+"CollectionSlot",f=br(d),p=u.forwardRef((v,b)=>{const{scope:S,children:k}=v,E=l(d,S),R=St(b,E.collectionRef);return r.jsx(f,{ref:R,children:k})});p.displayName=d;const m=e+"CollectionItemSlot",g="data-radix-collection-item",h=br(m),y=u.forwardRef((v,b)=>{const{scope:S,children:k,...E}=v,R=u.useRef(null),[z,N]=u.useState(null),I=St(b,R,N),A=l(m,S),{setItemMap:W}=A,L=u.useRef(E);uw(L.current,E)||(L.current=E);const J=L.current;return u.useEffect(()=>{const O=J;return W(U=>z?U.has(z)?U.set(z,{...O,element:z}).toSorted(Lf):(U.set(z,{...O,element:z}),U.toSorted(Lf)):U),()=>{W(U=>!z||!U.has(z)?U:(U.delete(z),new pd(U)))}},[z,J,W]),r.jsx(h,{[g]:"",ref:I,children:k})});y.displayName=m;function j(){return u.useState(new pd)}dn(j,"useInitCollection");function w(v){const{itemMap:b}=l(e+"CollectionConsumer",v);return b}return dn(w,"useCollection"),[{Provider:a,Slot:p,ItemSlot:y},{createCollectionScope:s,useCollection:w,useInitCollection:j}]}dn($2,"createCollection");function uw(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}dn(uw,"shallowEqual");function dw(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}dn(dw,"isElementPreceding");function Lf(e,t){return!e[1].element||!t[1].element?0:dw(e[1].element,t[1].element)?-1:1}dn(Lf,"sortByDocumentPosition");function fw(e){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){e();return}})}dn(fw,"getChildListObserver");var I2=Object.defineProperty,A2=(e,t)=>I2(e,"name",{value:t,configurable:!0}),O2=u.createContext(void 0);function yu(e){const t=u.useContext(O2);return e||t||"ltr"}A2(yu,"useDirection");var L2=Object.defineProperty,D2=(e,t)=>L2(e,"name",{value:t,configurable:!0});function Ps(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}D2(Ps,"useCallbackRef");var z2=Object.defineProperty,un=(e,t)=>z2(e,"name",{value:t,configurable:!0}),Df="dismissableLayer.update",F2="dismissableLayer.pointerDownOutside",B2="dismissableLayer.focusOutside",Yg,pw=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),mw=u.forwardRef(un(function(t,n){const{disableOutsidePointerEvents:s=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:d,...f}=t,p=u.useContext(pw),[m,g]=u.useState(null),h=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=u.useState({}),j=St(n,g),w=Array.from(p.layers),[x]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),v=x?w.indexOf(x):-1,b=m?w.indexOf(m):-1,S=p.layersWithOutsidePointerEventsDisabled.size>0,k=b>=v,E=u.useRef(!1),R=gw(A=>{a==null||a(A),c==null||c(A),A.defaultPrevented||d==null||d()},{ownerDocument:h,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:u.useCallback(A=>{if(!(A instanceof Node))return!1;const W=[...p.branches].some(L=>L.contains(A));return k&&!W},[p.branches,k])}),z=xw(A=>{if(o&&E.current)return;const W=A.target;[...p.branches].some(J=>J.contains(W))||(i==null||i(A),c==null||c(A),A.defaultPrevented||d==null||d())},h),N=m?b===w.length-1:!1,I=Ps(A=>{A.key==="Escape"&&(l==null||l(A),!A.defaultPrevented&&d&&(A.preventDefault(),d()))});return u.useEffect(()=>{if(N)return h.addEventListener("keydown",I,{capture:!0}),()=>h.removeEventListener("keydown",I,{capture:!0})},[h,N,I]),u.useEffect(()=>{if(m)return s&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Yg=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(m)),p.layers.add(m),zf(),()=>{s&&(p.layersWithOutsidePointerEventsDisabled.delete(m),p.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=Yg))}},[m,h,s,p]),u.useEffect(()=>()=>{m&&(p.layers.delete(m),p.layersWithOutsidePointerEventsDisabled.delete(m),zf())},[m,p]),u.useEffect(()=>{const A=un(()=>y({}),"handleUpdate");return document.addEventListener(Df,A),()=>document.removeEventListener(Df,A)},[]),r.jsx(dt.div,{...f,ref:j,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:et(t.onFocusCapture,z.onFocusCapture),onBlurCapture:et(t.onBlurCapture,z.onBlurCapture),onPointerDownCapture:et(t.onPointerDownCapture,R.onPointerDownCapture)})},"DismissableLayer"));function hw(){const e=u.useContext(pw),[t,n]=u.useState(null);return u.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}un(hw,"useDismissableLayerSurface");var H2=un(()=>!0,"IS_TRUE");function gw(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:l,shouldHandlePointerDownOutside:a=H2}=t,i=Ps(e),c=u.useRef(!1),d=u.useRef(!1),f=u.useRef(new Map),p=u.useRef(()=>{});return u.useEffect(()=>{function m(){d.current=!1,o.current=!1,f.current.clear()}un(m,"resetOutsideInteraction");function g(){return Array.from(f.current.values()).some(Boolean)}un(g,"isOutsideInteractionIntercepted");function h(v){if(!d.current)return;const b=v.target;b instanceof Node&&[...l].some(k=>k.contains(b))||f.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{d.current&&p.current()},0)}un(h,"handleInteractionCapture");function y(v){d.current&&f.current.set(v.type,!1)}un(y,"handleInteractionBubble");const j=un(v=>{if(v.target&&!c.current){let b=function(){n.removeEventListener("click",p.current);const k=g();m(),k||jm(F2,i,S,{discrete:!0})};if(un(b,"handleAndDispatchPointerDownOutsideEvent"),!a(v.target)){n.removeEventListener("click",p.current),m(),c.current=!1;return}const S={originalEvent:v};d.current=!0,o.current=s&&v.button===0,f.current.clear(),!s||v.button!==0?b():(n.removeEventListener("click",p.current),p.current=b,n.addEventListener("click",p.current,{once:!0}))}else n.removeEventListener("click",p.current),m();c.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of w)n.addEventListener(v,h,!0),n.addEventListener(v,y);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",j)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",j),n.removeEventListener("click",p.current);for(const v of w)n.removeEventListener(v,h,!0),n.removeEventListener(v,y)}},[n,i,s,o,l,a]),{onPointerDownCapture:un(()=>c.current=!0,"onPointerDownCapture")}}un(gw,"usePointerDownOutside");function xw(e,t=globalThis==null?void 0:globalThis.document){const n=Ps(e),s=u.useRef(!1);return u.useEffect(()=>{const o=un(l=>{l.target&&!s.current&&jm(B2,n,{originalEvent:l},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:un(()=>s.current=!0,"onFocusCapture"),onBlurCapture:un(()=>s.current=!1,"onBlurCapture")}}un(xw,"useFocusOutside");function zf(){const e=new CustomEvent(Df);document.dispatchEvent(e)}un(zf,"dispatchUpdate");function jm(e,t,n,{discrete:s}){const o=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?W0(o,l):o.dispatchEvent(l)}un(jm,"handleAndDispatchCustomEvent");var U2=Object.defineProperty,bm=(e,t)=>U2(e,"name",{value:t,configurable:!0}),Di=0,Ds=null;function V2(e){return wu(),e.children}bm(V2,"FocusGuards");function wu(){u.useEffect(()=>{Ds||(Ds={start:Ff(),end:Ff()});const{start:e,end:t}=Ds;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Di++,()=>{Di===1&&(Ds==null||Ds.start.remove(),Ds==null||Ds.end.remove(),Ds=null),Di=Math.max(0,Di-1)}},[])}bm(wu,"useFocusGuards");function Ff(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}bm(Ff,"createFocusGuard");var W2=Object.defineProperty,An=(e,t)=>W2(e,"name",{value:t,configurable:!0}),md="focusScope.autoFocusOnMount",hd="focusScope.autoFocusOnUnmount",Xg={bubbles:!1,cancelable:!0},vw=u.forwardRef(An(function(t,n){const{loop:s=!1,trapped:o=!1,onMountAutoFocus:l,onUnmountAutoFocus:a,...i}=t,[c,d]=u.useState(null),f=Ps(l),p=Ps(a),m=u.useRef(null),g=St(n,d),h=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(o){let j=function(b){if(h.paused||!c)return;const S=b.target;c.contains(S)?m.current=S:ar(m.current,{select:!0})},w=function(b){if(h.paused||!c)return;const S=b.relatedTarget;S!==null&&(c.contains(S)||ar(m.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const k of b)k.removedNodes.length>0&&ar(c)};An(j,"handleFocusIn"),An(w,"handleFocusOut"),An(x,"handleMutations"),document.addEventListener("focusin",j),document.addEventListener("focusout",w);const v=new MutationObserver(x);return c&&v.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),v.disconnect()}}},[o,c,h.paused]),u.useEffect(()=>{if(c){Jg.add(h);const j=document.activeElement;if(!c.contains(j)){const x=new CustomEvent(md,Xg);c.addEventListener(md,f),c.dispatchEvent(x),x.defaultPrevented||(yw(kw(_m(c)),{select:!0}),document.activeElement===j&&ar(c))}return()=>{c.removeEventListener(md,f),setTimeout(()=>{const x=new CustomEvent(hd,Xg);c.addEventListener(hd,p),c.dispatchEvent(x),x.defaultPrevented||ar(j??document.body,{select:!0}),c.removeEventListener(hd,p),Jg.remove(h)},0)}}},[c,f,p,h]);const y=u.useCallback(j=>{if(!s&&!o||h.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,x=document.activeElement;if(w&&x){const v=j.currentTarget,[b,S]=ww(v);b&&S?!j.shiftKey&&x===S?(j.preventDefault(),s&&ar(b,{select:!0})):j.shiftKey&&x===b&&(j.preventDefault(),s&&ar(S,{select:!0})):x===v&&j.preventDefault()}},[s,o,h.paused]);return r.jsx(dt.div,{tabIndex:-1,...i,ref:g,onKeyDown:y})},"FocusScope"));function yw(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(ar(s,{select:t}),document.activeElement!==n)return}An(yw,"focusFirst");function ww(e){const t=_m(e),n=Bf(t,e),s=Bf(t.reverse(),e);return[n,s]}An(ww,"getTabbableEdges");function _m(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:An(s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}An(_m,"getTabbableCandidates");function Bf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):jw(s,{upTo:t})))return s}An(Bf,"findVisible");function jw(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}An(jw,"isHidden");function bw(e){return e instanceof HTMLInputElement&&"select"in e}An(bw,"isSelectableInput");function ar(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bw(e)&&t&&e.select()}}An(ar,"focus");var Jg=_w();function _w(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Hf(e,t),e.unshift(t)},remove(t){var n;e=Hf(e,t),(n=e[0])==null||n.resume()}}}An(_w,"createFocusScopesStack");function Hf(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}An(Hf,"arrayRemove");function kw(e){return e.filter(t=>t.tagName!=="A")}An(kw,"removeLinks");var Vt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},q2=Object.defineProperty,G2=(e,t)=>q2(e,"name",{value:t,configurable:!0}),K2=Qo[" useId ".trim().toString()]||(()=>{}),Q2=0;function to(e){const[t,n]=u.useState(K2());return Vt(()=>{e||n(s=>s??String(Q2++))},[e]),e||(t?`radix-${t}`:"")}G2(to,"useId");const Y2=["top","right","bottom","left"],co=Math.min,gr=Math.max,Vc=Math.round,zi=Math.floor,xr=e=>({x:e,y:e}),X2={left:"right",right:"left",bottom:"top",top:"bottom"};function Sw(e,t,n){return gr(e,co(t,n))}function _r(e,t){return typeof e=="function"?e(t):e}function uo(e){return e.split("-")[0]}function na(e){return e.split("-")[1]}function km(e){return e==="x"?"y":"x"}function Sm(e){return e==="y"?"height":"width"}function Ws(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Nm(e){return km(Ws(e))}function J2(e,t,n){n===void 0&&(n=!1);const s=na(e),o=Nm(e),l=Sm(o);let a=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(a=Wc(a)),[a,Wc(a)]}function Z2(e){const t=Wc(e);return[Uf(e),t,Uf(t)]}function Uf(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Zg=["left","right"],ex=["right","left"],eE=["top","bottom"],tE=["bottom","top"];function nE(e,t,n){switch(e){case"top":case"bottom":return n?t?ex:Zg:t?Zg:ex;case"left":case"right":return t?eE:tE;default:return[]}}function sE(e,t,n,s){const o=na(e);let l=nE(uo(e),n==="start",s);return o&&(l=l.map(a=>a+"-"+o),t&&(l=l.concat(l.map(Uf)))),l}function Wc(e){const t=uo(e);return X2[t]+e.slice(t.length)}function rE(e){var t,n,s,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(s=e.bottom)!=null?s:0,left:(o=e.left)!=null?o:0}}function Nw(e){return typeof e!="number"?rE(e):{top:e,right:e,bottom:e,left:e}}function qc(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function tx(e,t,n){let{reference:s,floating:o}=e;const l=Ws(t),a=Nm(t),i=Sm(a),c=uo(t),d=l==="y",f=s.x+s.width/2-o.width/2,p=s.y+s.height/2-o.height/2,m=s[i]/2-o[i]/2;let g;switch(c){case"top":g={x:f,y:s.y-o.height};break;case"bottom":g={x:f,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:p};break;case"left":g={x:s.x-o.width,y:p};break;default:g={x:s.x,y:s.y}}const h=na(t);return h&&(g[a]+=m*(h==="end"?1:-1)*(n&&d?-1:1)),g}async function oE(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:l,rects:a,elements:i,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=_r(t,e),h=Nw(g),j=i[m?p==="floating"?"reference":"floating":p],w=qc(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(j)))==null||n?j:j.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(i.floating)),boundary:d,rootBoundary:f,strategy:c})),x=p==="floating"?{x:s,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(l.getOffsetParent==null?void 0:l.getOffsetParent(i.floating)),b=await(l.isElement==null?void 0:l.isElement(v))&&await(l.getScale==null?void 0:l.getScale(v))||{x:1,y:1},S=qc(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:x,offsetParent:v,strategy:c}):x);return{top:(w.top-S.top+h.top)/b.y,bottom:(S.bottom-w.bottom+h.bottom)/b.y,left:(w.left-S.left+h.left)/b.x,right:(S.right-w.right+h.right)/b.x}}const lE=50,aE=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:l=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:oE},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=tx(d,s,c),m=s,g=0;const h={};for(let y=0;y<l.length;y++){const j=l[y];if(!j)continue;const{name:w,fn:x}=j,{x:v,y:b,data:S,reset:k}=await x({x:f,y:p,initialPlacement:s,placement:m,strategy:o,middlewareData:h,rects:d,platform:i,elements:{reference:e,floating:t}});f=v??f,p=b??p,h[w]={...h[w],...S},k&&g<lE&&(g++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:f,y:p}=tx(d,m,c)),y=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:h}},iE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:l,platform:a,elements:i,middlewareData:c}=t,{element:d,padding:f=0}=_r(e,t)||{};if(d==null)return{};const p=Nw(f),m={x:n,y:s},g=Nm(o),h=Sm(g),y=await a.getDimensions(d),j=g==="y",w=j?"top":"left",x=j?"bottom":"right",v=j?"clientHeight":"clientWidth",b=l.reference[h]+l.reference[g]-m[g]-l.floating[h],S=m[g]-l.reference[g],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let E=k?k[v]:0;(!E||!await(a.isElement==null?void 0:a.isElement(k)))&&(E=i.floating[v]||l.floating[h]);const R=b/2-S/2,z=E/2-y[h]/2-1,N=co(p[w],z),I=co(p[x],z),A=E-y[h]-I,W=E/2-y[h]/2+R,L=Sw(N,W,A),J=!c.arrow&&na(o)!=null&&W!==L&&l.reference[h]/2-(W<N?N:I)-y[h]/2<0,O=J?W<N?W-N:W-A:0;return{[g]:m[g]+O,data:{[g]:L,centerOffset:W-L-O,...J&&{alignmentOffset:O}},reset:J}}}),cE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:l,rects:a,initialPlacement:i,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:y=!0,...j}=_r(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const w=uo(o),x=Ws(i),v=uo(i)===i,b=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=m||(v||!y?[Wc(i)]:Z2(i)),k=h!=="none";!m&&k&&S.push(...sE(i,y,h,b));const E=[i,...S],R=await c.detectOverflow(t,j),z=[];let N=((s=l.flip)==null?void 0:s.overflows)||[];if(f&&z.push(R[w]),p){const L=J2(o,a,b);z.push(R[L[0]],R[L[1]])}if(N=[...N,{placement:o,overflows:z}],!z.every(L=>L<=0)){var I,A;const L=(((I=l.flip)==null?void 0:I.index)||0)+1,J=E[L];if(J&&(!(p==="alignment"?x!==Ws(J):!1)||N.every(F=>Ws(F.placement)===x?F.overflows[0]>0:!0)))return{data:{index:L,overflows:N},reset:{placement:J}};let O=(A=N.filter(U=>U.overflows[0]<=0).sort((U,F)=>U.overflows[1]-F.overflows[1])[0])==null?void 0:A.placement;if(!O)switch(g){case"bestFit":{var W;const U=(W=N.filter(F=>{if(k){const Z=Ws(F.placement);return Z===x||Z==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(Z=>Z>0).reduce((Z,D)=>Z+D,0)]).sort((F,Z)=>F[1]-Z[1])[0])==null?void 0:W[0];U&&(O=U);break}case"initialPlacement":O=i;break}if(o!==O)return{reset:{placement:O}}}return{}}}};function nx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function sx(e){return Y2.some(t=>e[t]>=0)}const uE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...l}=_r(e,t);switch(o){case"referenceHidden":{const a=await s.detectOverflow(t,{...l,elementContext:"reference"}),i=nx(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:sx(i)}}}case"escaped":{const a=await s.detectOverflow(t,{...l,altBoundary:!0}),i=nx(a,n.floating);return{data:{escapedOffsets:i,escaped:sx(i)}}}default:return{}}}}},Cw=new Set(["left","top"]);async function dE(e,t){const{placement:n,platform:s,elements:o}=e,l=await(s.isRTL==null?void 0:s.isRTL(o.floating)),a=uo(n),i=na(n),c=Ws(n)==="y",d=Cw.has(a)?-1:1,f=l&&c?-1:1,p=_r(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return i&&typeof h=="number"&&(g=i==="end"?h*-1:h),c?{x:g*f,y:m*d}:{x:m*d,y:g*f}}const fE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:l,placement:a,middlewareData:i}=t,c=await dE(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:l+c.y,data:{...c,placement:a}}}}},pE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:l}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:c={fn:x=>{let{x:v,y:b}=x;return{x:v,y:b}}},...d}=_r(e,t),f={x:n,y:s},p=await l.detectOverflow(t,d),m=Ws(o),g=km(m);let h=f[g],y=f[m];const j=(x,v)=>Sw(v+p[x==="y"?"top":"left"],v,v-p[x==="y"?"bottom":"right"]);a&&(h=j(g,h)),i&&(y=j(m,y));const w=c.fn({...t,[g]:h,[m]:y});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[g]:a,[m]:i}}}}}},mE=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:o,y:l,placement:a,rects:i,middlewareData:c}=t,{offset:d=0,mainAxis:f=!0,crossAxis:p=!0}=_r(e,t),m={x:o,y:l},g=Ws(a),h=km(g);let y=m[h],j=m[g];const w=_r(d,t),x=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(s=w.crossAxis)!=null?s:0};if(f){const S=h==="y"?"height":"width",k=i.reference[h]-i.floating[S]+x.mainAxis,E=i.reference[h]+i.reference[S]-x.mainAxis;y<k?y=k:y>E&&(y=E)}if(p){var v,b;const S=h==="y"?"width":"height",k=Cw.has(uo(a)),E=i.reference[g]-i.floating[S]+(k&&((v=c.offset)==null?void 0:v[g])||0)+(k?0:x.crossAxis),R=i.reference[g]+i.reference[S]+(k?0:((b=c.offset)==null?void 0:b[g])||0)-(k?x.crossAxis:0);j<E?j=E:j>R&&(j=R)}return{[h]:y,[g]:j}}}},hE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:o,elements:l}=t,{apply:a=()=>{},...i}=_r(e,t),c=await o.detectOverflow(t,i),d=uo(n),f=na(n),p=Ws(n)==="y",{width:m,height:g}=s.floating;let h,y;d==="top"||d==="bottom"?(h=d,y=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,h=f==="end"?"top":"bottom");const j=g-c.top-c.bottom,w=m-c.left-c.right,x=co(g-c[h],j),v=co(m-c[y],w),b=t.middlewareData.shift,S=!b;let k=x,E=v;b!=null&&b.enabled.x&&(E=w),b!=null&&b.enabled.y&&(k=j),S&&!f&&(p?E=m-2*gr(c.left,c.right):k=g-2*gr(c.top,c.bottom)),await a({...t,availableWidth:E,availableHeight:k});const R=await o.getDimensions(l.floating);return m!==R.width||g!==R.height?{reset:{rects:!0}}:{}}}};function ju(){return typeof window<"u"}function sa(e){return Ew(e)?(e.nodeName||"").toLowerCase():"#document"}function Wn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nr(e){var t;return(t=(Ew(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ew(e){return ju()?e instanceof Node||e instanceof Wn(e).Node:!1}function Xs(e){return ju()?e instanceof Element||e instanceof Wn(e).Element:!1}function vo(e){return ju()?e instanceof HTMLElement||e instanceof Wn(e).HTMLElement:!1}function rx(e){return!ju()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wn(e).ShadowRoot}function bu(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=Js(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function gE(e){return/^(table|td|th)$/.test(sa(e))}function _u(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xE=/transform|translate|scale|rotate|perspective|filter/,vE=/paint|layout|strict|content/,No=e=>!!e&&e!=="none";let gd;function Cm(e){const t=Xs(e)?Js(e):e;return No(t.transform)||No(t.translate)||No(t.scale)||No(t.rotate)||No(t.perspective)||!Em()&&(No(t.backdropFilter)||No(t.filter))||xE.test(t.willChange||"")||vE.test(t.contain||"")}function yE(e){let t=Wo(e);for(;vo(t)&&!ei(t);){if(Cm(t))return t;if(_u(t))return null;t=Wo(t)}return null}function Em(){return gd==null&&(gd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gd}function ei(e){return/^(html|body|#document)$/.test(sa(e))}function Js(e){return Wn(e).getComputedStyle(e)}function ku(e){return Xs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wo(e){if(sa(e)==="html")return e;const t=e.assignedSlot||e.parentNode||rx(e)&&e.host||Nr(e);return rx(t)?t.host:t}function Rw(e){const t=Wo(e);return ei(t)?(e.ownerDocument||e).body:vo(t)&&bu(t)?t:Rw(t)}function ti(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Rw(e),l=o===((s=e.ownerDocument)==null?void 0:s.body),a=Wn(o);if(l){const i=Vf(a);return t.concat(a,a.visualViewport||[],bu(o)?o:[],i&&n?ti(i):[])}else return t.concat(o,ti(o,[],n))}function Vf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pw(e){const t=Js(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=vo(e),l=o?e.offsetWidth:n,a=o?e.offsetHeight:s,i=Vc(n)!==l||Vc(s)!==a;return i&&(n=l,s=a),{width:n,height:s,$:i}}function Rm(e){return Xs(e)?e:e.contextElement}function Il(e){const t=Rm(e);if(!vo(t))return xr(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:l}=Pw(t);let a=(l?Vc(n.width):n.width)/s,i=(l?Vc(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const wE=xr(0);function Mw(e){const t=Wn(e);return!Em()||!t.visualViewport?wE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jE(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Wn(e)}function qo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),l=Rm(e);let a=xr(1);t&&(s?Xs(s)&&(a=Il(s)):a=Il(e));const i=jE(l,n,s)?Mw(l):xr(0);let c=(o.left+i.x)/a.x,d=(o.top+i.y)/a.y,f=o.width/a.x,p=o.height/a.y;if(l&&s){const m=Wn(l),g=Xs(s)?Wn(s):s;let h=m,y=Vf(h);for(;y&&g!==h;){const j=Il(y),w=y.getBoundingClientRect(),x=Js(y),v=w.left+(y.clientLeft+parseFloat(x.paddingLeft))*j.x,b=w.top+(y.clientTop+parseFloat(x.paddingTop))*j.y;c*=j.x,d*=j.y,f*=j.x,p*=j.y,c+=v,d+=b,h=Wn(y),y=Vf(h)}}return qc({width:f,height:p,x:c,y:d})}function Su(e,t){const n=ku(e).scrollLeft;return t?t.left+n:qo(Nr(e)).left+n}function Tw(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Su(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function bE(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const l=o==="fixed",a=Nr(s),i=t?_u(t.floating):!1;if(s===a||i&&l)return n;let c={scrollLeft:0,scrollTop:0},d=xr(1);const f=xr(0),p=vo(s);if((p||!l)&&((sa(s)!=="body"||bu(a))&&(c=ku(s)),p)){const g=qo(s);d=Il(s),f.x=g.x+s.clientLeft,f.y=g.y+s.clientTop}const m=a&&!p&&!l?Tw(a,c):xr(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function _E(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function kE(e){const t=ku(e),n=e.ownerDocument.body,s=gr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=gr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let l=-t.scrollLeft+Su(e);const a=-t.scrollTop;return Js(n).direction==="rtl"&&(l+=gr(e.clientWidth,n.clientWidth)-s),{width:s,height:o,x:l,y:a}}const SE=25;function NE(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",o=Wn(e),l=Nr(e),a=o.visualViewport;let i=l.clientWidth,c=l.clientHeight,d=0,f=0;if(a){const m=!Em()||t==="fixed";s?m||(d=-a.offsetLeft,f=-a.offsetTop):(i=a.width,c=a.height,m&&(d=a.offsetLeft,f=a.offsetTop))}if(Su(l)<=0){const m=l.ownerDocument,g=m.body,h=getComputedStyle(g),y=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,j=Math.abs(l.clientWidth-g.clientWidth-y),w=getComputedStyle(l).scrollbarGutter==="stable both-edges"?j/2:j;w<=SE&&(i-=w)}return{width:i,height:c,x:d,y:f}}function CE(e,t){const n=qo(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,l=Il(e),a=e.clientWidth*l.x,i=e.clientHeight*l.y,c=o*l.x,d=s*l.y;return{width:a,height:i,x:c,y:d}}function ox(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=NE(e,n,t);else if(t==="document")s=kE(Nr(e));else if(Xs(t))s=CE(t,n);else{const o=Mw(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return qc(s)}function EE(e,t){const n=t.get(e);if(n)return n;let s=ti(e,[],!1).filter(i=>Xs(i)&&sa(i)!=="body"),o=null;const l=Js(e).position==="fixed";let a=l?Wo(e):e;for(;Xs(a)&&!ei(a);){const i=Js(a),c=Cm(a),d=o?o.position:l?"fixed":"";!c&&(d==="fixed"||d==="absolute"&&i.position==="static")?s=s.filter(p=>p!==a):o=i,a=Wo(a)}return t.set(e,s),s}function RE(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const a=[...n==="clippingAncestors"?_u(t)?[]:EE(t,this._c):[].concat(n),s],i=ox(t,a[0],o);let c=i.top,d=i.right,f=i.bottom,p=i.left;for(let m=1;m<a.length;m++){const g=ox(t,a[m],o);c=gr(g.top,c),d=co(g.right,d),f=co(g.bottom,f),p=gr(g.left,p)}return{width:d-p,height:f-c,x:p,y:c}}function PE(e){const{width:t,height:n}=Pw(e);return{width:t,height:n}}function ME(e,t,n){const s=vo(t),o=Nr(t),l=n==="fixed",a=qo(e,!0,l,t);let i={scrollLeft:0,scrollTop:0};const c=xr(0);if((s||!l)&&((sa(t)!=="body"||bu(o))&&(i=ku(t)),s)){const m=qo(t,!0,l,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}!s&&o&&(c.x=Su(o));const d=o&&!s&&!l?Tw(o,i):xr(0),f=a.left+i.scrollLeft-c.x-d.x,p=a.top+i.scrollTop-c.y-d.y;return{x:f,y:p,width:a.width,height:a.height}}function xd(e){return Js(e).position==="static"}function lx(e,t){if(!vo(e)||Js(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nr(e)===n&&(n=n.ownerDocument.body),n}function $w(e,t){const n=Wn(e);if(_u(e))return n;if(!vo(e)){let o=Wo(e);for(;o&&!ei(o);){if(Xs(o)&&!xd(o))return o;o=Wo(o)}return n}let s=lx(e,t);for(;s&&gE(s)&&xd(s);)s=lx(s,t);return s&&ei(s)&&xd(s)&&!Cm(s)?n:s||yE(e)||n}const TE=async function(e){const t=this.getOffsetParent||$w,n=this.getDimensions,s=await n(e.floating);return{reference:ME(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function $E(e){return Js(e).direction==="rtl"}const IE={convertOffsetParentRelativeRectToViewportRelativeRect:bE,getDocumentElement:Nr,getClippingRect:RE,getOffsetParent:$w,getElementRects:TE,getClientRects:_E,getDimensions:PE,getScale:Il,isElement:Xs,isRTL:$E};function Iw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function AE(e,t,n){let s=null,o;const l=Nr(e);function a(){var f;clearTimeout(o),(f=s)==null||f.disconnect(),s=null}function i(f,p){f===void 0&&(f=!1),p===void 0&&(p=1),a();const m=e.getBoundingClientRect(),{left:g,top:h,width:y,height:j}=m;if(f||t(),!y||!j)return;const w=zi(h),x=zi(l.clientWidth-(g+y)),v=zi(l.clientHeight-(h+j)),b=zi(g),k={rootMargin:-w+"px "+-x+"px "+-v+"px "+-b+"px",threshold:gr(0,co(1,p))||1};let E=!0;function R(z){const N=z[0].intersectionRatio;if(!Iw(m,e.getBoundingClientRect()))return i();if(N!==p){if(!E)return i();N?i(!1,N):o=setTimeout(()=>{i(!1,1e-7)},1e3)}E=!1}try{s=new IntersectionObserver(R,{...k,root:l.ownerDocument})}catch{s=new IntersectionObserver(R,k)}s.observe(e)}const c=Wn(e),d=()=>i(n);return c.addEventListener("resize",d),i(!0),()=>{c.removeEventListener("resize",d),a()}}function OE(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,d=Rm(e),f=o||l?[...d?ti(d):[],...t?ti(t):[]]:[];f.forEach(w=>{o&&w.addEventListener("scroll",n),l&&w.addEventListener("resize",n)});const p=d&&i?AE(d,n,l):null;let m=-1,g=null;a&&(g=new ResizeObserver(w=>{let[x]=w;x&&x.target===d&&g&&t&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=g)==null||v.observe(t)})),n()}),d&&!c&&g.observe(d),t&&g.observe(t));let h,y=c?qo(e):null;c&&j();function j(){const w=qo(e);y&&!Iw(y,w)&&n(),y=w,h=requestAnimationFrame(j)}return n(),()=>{var w;f.forEach(x=>{o&&x.removeEventListener("scroll",n),l&&x.removeEventListener("resize",n)}),p==null||p(),(w=g)==null||w.disconnect(),g=null,c&&cancelAnimationFrame(h)}}const LE=fE,DE=pE,zE=cE,FE=hE,BE=uE,ax=iE,HE=mE,UE=(e,t,n)=>{const s=new Map,o=n??{},l={...IE,...o.platform,_c:s};return aE(e,t,{...o,platform:l})};var VE=typeof document<"u",WE=function(){},mc=VE?u.useLayoutEffect:WE;function Gc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Gc(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const l=o[s];if(!(l==="_owner"&&e.$$typeof)&&!Gc(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function Aw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ix(e,t){const n=Aw(e);return Math.round(t*n)/n}function vd(e){const t=u.useRef(e);return mc(()=>{t.current=e}),t}function qE(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:l,floating:a}={},transform:i=!0,whileElementsMounted:c,open:d}=e,[f,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=u.useState(s);Gc(m,s)||g(s);const[h,y]=u.useState(null),[j,w]=u.useState(null),x=u.useCallback(F=>{F!==k.current&&(k.current=F,y(F))},[]),v=u.useCallback(F=>{F!==E.current&&(E.current=F,w(F))},[]),b=l||h,S=a||j,k=u.useRef(null),E=u.useRef(null),R=u.useRef(f),z=c!=null,N=vd(c),I=vd(o),A=vd(d),W=u.useCallback(()=>{if(!k.current||!E.current)return;const F={placement:t,strategy:n,middleware:m};I.current&&(F.platform=I.current),UE(k.current,E.current,F).then(Z=>{const D={...Z,isPositioned:A.current!==!1};L.current&&!Gc(R.current,D)&&(R.current=D,Jo.flushSync(()=>{p(D)}))})},[m,t,n,I,A]);mc(()=>{d===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(F=>({...F,isPositioned:!1})))},[d]);const L=u.useRef(!1);mc(()=>(L.current=!0,()=>{L.current=!1}),[]),mc(()=>{if(b&&(k.current=b),S&&(E.current=S),b&&S){if(N.current)return N.current(b,S,W);W()}},[b,S,W,N,z]);const J=u.useMemo(()=>({reference:k,floating:E,setReference:x,setFloating:v}),[x,v]),O=u.useMemo(()=>({reference:b,floating:S}),[b,S]),U=u.useMemo(()=>{const F={position:n,left:0,top:0};if(!O.floating)return F;const Z=ix(O.floating,f.x),D=ix(O.floating,f.y);return i?{...F,transform:"translate("+Z+"px, "+D+"px)",...Aw(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:D}},[n,i,O.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:W,refs:J,elements:O,floatingStyles:U}),[f,W,J,O,U])}const GE=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ax({element:s.current,padding:o}).fn(n):{}:s?ax({element:s,padding:o}).fn(n):{}}}},KE=(e,t)=>{const n=LE(e);return{name:n.name,fn:n.fn,options:[e,t]}},QE=(e,t)=>{const n=DE(e);return{name:n.name,fn:n.fn,options:[e,t]}},YE=(e,t)=>({fn:HE(e).fn,options:[e,t]}),XE=(e,t)=>{const n=zE(e);return{name:n.name,fn:n.fn,options:[e,t]}},JE=(e,t)=>{const n=FE(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZE=(e,t)=>{const n=BE(e);return{name:n.name,fn:n.fn,options:[e,t]}},eR=(e,t)=>{const n=GE(e);return{name:n.name,fn:n.fn,options:[e,t]}};var tR=Object.defineProperty,nR=(e,t)=>tR(e,"name",{value:t,configurable:!0});function Ow(e){const[t,n]=u.useState(void 0);return Vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let a,i;if("borderBoxSize"in l){const c=l.borderBoxSize,d=Array.isArray(c)?c[0]:c;a=d.inlineSize,i=d.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}nR(Ow,"useSize");var sR=Object.defineProperty,no=(e,t)=>sR(e,"name",{value:t,configurable:!0}),Lw="Popper",[Dw,zw]=xo(Lw),[rR,Fw]=Dw(Lw),oR=no(e=>{const{__scopePopper:t,children:n}=e,[s,o]=u.useState(null),[l,a]=u.useState(void 0);return r.jsx(rR,{scope:t,anchor:s,onAnchorChange:o,placementState:l,setPlacementState:a,children:n})},"Popper"),lR="PopperAnchor",aR=u.forwardRef(no(function(t,n){const{__scopePopper:s,virtualRef:o,...l}=t,a=Fw(lR,s),i=u.useRef(null),c=a.onAnchorChange,d=u.useCallback(y=>{i.current=y,y&&c(y)},[c]),f=St(n,d),p=u.useRef(null);u.useEffect(()=>{if(!o)return;const y=p.current;p.current=o.current,y!==p.current&&c(p.current)});const m=a.placementState&&Nu(a.placementState),g=m==null?void 0:m[0],h=m==null?void 0:m[1];return o?null:r.jsx(dt.div,{"data-radix-popper-side":g,"data-radix-popper-align":h,...l,ref:f})},"PopperAnchor")),Bw="PopperContent",[iR,iA]=Dw(Bw),cR=u.forwardRef(no(function(t,n){var me,Ce,_e,C,H,pe,B;const{__scopePopper:s,side:o="bottom",sideOffset:l=0,align:a="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:h="optimized",onPlaced:y,...j}=t,w=Fw(Bw,s),[x,v]=u.useState(null),b=St(n,v),[S,k]=u.useState(null),E=Ow(S),R=(E==null?void 0:E.width)??0,z=(E==null?void 0:E.height)??0,N=o+(a!=="center"?"-"+a:""),I=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},A=Array.isArray(f)?f:[f],W=A.length>0,L={padding:I,boundary:A.filter(Hw),altBoundary:W},{refs:J,floatingStyles:O,placement:U,isPositioned:F,middlewareData:Z}=qE({strategy:"fixed",placement:N,whileElementsMounted:no((...te)=>OE(...te,{animationFrame:h==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[KE({mainAxis:l+z,alignmentAxis:i}),d&&QE({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?YE():void 0,...L}),d&&XE({...L}),JE({...L,apply:no(({elements:te,rects:ie,availableWidth:ze,availableHeight:Ee})=>{const{width:mt,height:ot}=ie.reference,Fe=te.floating.style;Fe.setProperty("--radix-popper-available-width",`${ze}px`),Fe.setProperty("--radix-popper-available-height",`${Ee}px`),Fe.setProperty("--radix-popper-anchor-width",`${mt}px`),Fe.setProperty("--radix-popper-anchor-height",`${ot}px`)},"apply")}),S&&eR({element:S,padding:c}),uR({arrowWidth:R,arrowHeight:z}),g&&ZE({strategy:"referenceHidden",...L,boundary:W?L.boundary:void 0})]}),D=w.setPlacementState;Vt(()=>(D(U),()=>{D(void 0)}),[U,D]);const[be,ge]=Nu(U),Te=Ps(y);Vt(()=>{F&&(Te==null||Te())},[F,Te]);const re=(me=Z.arrow)==null?void 0:me.x,$e=(Ce=Z.arrow)==null?void 0:Ce.y,he=((_e=Z.arrow)==null?void 0:_e.centerOffset)!==0,[De,de]=u.useState();return Vt(()=>{x&&de(window.getComputedStyle(x).zIndex)},[x]),r.jsx("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:F?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:De,"--radix-popper-transform-origin":[(C=Z.transformOrigin)==null?void 0:C.x,(H=Z.transformOrigin)==null?void 0:H.y].join(" "),...((pe=Z.hide)==null?void 0:pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:r.jsx(iR,{scope:s,placedSide:be,placedAlign:ge,onArrowChange:k,arrowX:re,arrowY:$e,shouldHideArrow:he,children:r.jsx(dt.div,{"data-side":be,"data-align":ge,...j,ref:b,style:{...j.style,animation:F?(B=j.style)==null?void 0:B.animation:"none"}})})})},"PopperContent"));function Hw(e){return e!==null}no(Hw,"isNotNull");var uR=no(e=>({name:"transformOrigin",options:e,fn(t){var j,w,x;const{placement:n,rects:s,middlewareData:o}=t,a=((j=o.arrow)==null?void 0:j.centerOffset)!==0,i=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[d,f]=Nu(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((w=o.arrow)==null?void 0:w.x)??0)+i/2,g=(((x=o.arrow)==null?void 0:x.y)??0)+c/2;let h="",y="";return d==="bottom"?(h=a?p:`${m}px`,y=`${-c}px`):d==="top"?(h=a?p:`${m}px`,y=`${s.floating.height+c}px`):d==="right"?(h=`${-c}px`,y=a?p:`${g}px`):d==="left"&&(h=`${s.floating.width+c}px`,y=a?p:`${g}px`),{data:{x:h,y}}}}),"transformOrigin");function Nu(e){const[t,n="center"]=e.split("-");return[t,n]}no(Nu,"getSideAndAlignFromPlacement");var dR=oR,fR=aR,pR=cR,mR=Object.defineProperty,hR=(e,t)=>mR(e,"name",{value:t,configurable:!0}),Uw=u.forwardRef(hR(function(t,n){var c;const{container:s,...o}=t,[l,a]=u.useState(!1);Vt(()=>a(!0),[]);const i=s||l&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return i?Jo.createPortal(r.jsx(dt.div,{...o,ref:n}),i):null},"Portal")),gR=Object.defineProperty,kr=(e,t)=>gR(e,"name",{value:t,configurable:!0});function Vw(e,t){return u.useReducer((n,s)=>t[n][s]??n,e)}kr(Vw,"useStateMachine");var pi=kr(e=>{const{present:t,children:n}=e,s=Ww(t),o=typeof n=="function"?n({present:s.isPresent}):u.Children.only(n),l=qw(s.ref,Gw(o));return typeof n=="function"||s.isPresent?u.cloneElement(o,{ref:l}):null},"Presence");function Ww(e){const[t,n]=u.useState(),s=u.useRef(null),o=u.useRef(e),l=u.useRef("none"),a=u.useRef(void 0),i=e?"mounted":"unmounted",[c,d]=Vw(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{c==="mounted"?(l.current=a.current??dl(s.current),a.current=void 0):l.current="none"},[c]),Vt(()=>{const f=s.current,p=o.current;if(p!==e){const g=l.current,h=dl(f);e?(a.current=h,d("MOUNT")):h==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(p&&g!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Vt(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,m=kr(h=>{const j=dl(s.current).includes(CSS.escape(h.animationName));if(h.target===t&&j&&(d("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},"handleAnimationEnd"),g=kr(h=>{h.target===t&&(l.current=dl(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:u.useCallback(f=>{if(f){const p=getComputedStyle(f);s.current=p,a.current=dl(p)}else s.current=null;n(f)},[])}}kr(Ww,"usePresence");function Wf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}kr(Wf,"setRef");function qw(...e){const t=u.useRef(e);return t.current=e,u.useCallback(n=>{const s=t.current;let o=!1;const l=s.map(a=>{const i=Wf(a,n);return!o&&typeof i=="function"&&(o=!0),i});if(o)return()=>{for(let a=0;a<l.length;a++){const i=l[a];typeof i=="function"?i():Wf(s[a],null)}}},[])}kr(qw,"useStableComposedRefs");function dl(e){return(e==null?void 0:e.animationName)||"none"}kr(dl,"getAnimationName");function Gw(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}kr(Gw,"getElementRef");var xR=Object.defineProperty,vR=(e,t)=>xR(e,"name",{value:t,configurable:!0}),cx=Qo[" useEffectEvent ".trim().toString()],ux=Qo[" useInsertionEffect ".trim().toString()];function Kw(e){if(typeof cx=="function")return cx(e);const t=u.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof ux=="function"?ux(()=>{t.current=e}):Vt(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}vR(Kw,"useEffectEvent");var yR=Object.defineProperty,mi=(e,t)=>yR(e,"name",{value:t,configurable:!0}),wR=Qo[" useInsertionEffect ".trim().toString()]||Vt;function Gl({prop:e,defaultProp:t,onChange:n=mi(()=>{},"onChange"),caller:s}){const[o,l,a]=Qw({defaultProp:t,onChange:n}),i=e!==void 0,c=i?e:o,d=u.useCallback(f=>{var p;if(i){const m=Yw(f)?f(e):f;m!==e&&((p=a.current)==null||p.call(a,m))}else l(f)},[i,e,l,a]);return[c,d]}mi(Gl,"useControllableState");function Qw({defaultProp:e,onChange:t}){const[n,s]=u.useState(e),o=u.useRef(n),l=u.useRef(t);return wR(()=>{l.current=t},[t]),u.useEffect(()=>{var a;o.current!==n&&((a=l.current)==null||a.call(l,n),o.current=n)},[n,o]),[n,s,l]}mi(Qw,"useUncontrolledState");function Yw(e){return typeof e=="function"}mi(Yw,"isFunction");var dx=Symbol("RADIX:SYNC_STATE");function jR(e,t,n,s){const{prop:o,defaultProp:l,onChange:a,caller:i}=t,c=o!==void 0,d=Kw(a),f=[{...n,state:l}];s&&f.push(s);const[p,m]=u.useReducer((j,w)=>{if(w.type===dx)return{...j,state:w.state};const x=e(j,w);return c&&!Object.is(x.state,j.state)&&d(x.state),x},...f),g=p.state,h=u.useRef(g);u.useEffect(()=>{h.current!==g&&(h.current=g,c||d(g))},[g,h,c]);const y=u.useMemo(()=>o!==void 0?{...p,state:o}:p,[p,o]);return u.useEffect(()=>{c&&!Object.is(o,p.state)&&m({type:dx,state:o})},[o,p.state,c]),[y,m]}mi(jR,"useControllableStateReducer");var bR=Object.defineProperty,_R=(e,t)=>bR(e,"name",{value:t,configurable:!0});function Xw(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}_R(Xw,"usePrevious");var kR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),SR=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},al=new WeakMap,Fi=new WeakMap,Bi={},yd=0,Jw=function(e){return e&&(e.host||Jw(e.parentNode))},NR=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Jw(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},CR=function(e,t,n,s){var o=NR(t,Array.isArray(e)?e:[e]);Bi[n]||(Bi[n]=new WeakMap);var l=Bi[n],a=[],i=new Set,c=new Set(o),d=function(p){!p||i.has(p)||(i.add(p),d(p.parentNode))};o.forEach(d);var f=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(i.has(m))f(m);else try{var g=m.getAttribute(s),h=g!==null&&g!=="false",y=(al.get(m)||0)+1,j=(l.get(m)||0)+1;al.set(m,y),l.set(m,j),a.push(m),y===1&&h&&Fi.set(m,!0),j===1&&m.setAttribute(n,"true"),h||m.setAttribute(s,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return f(t),i.clear(),yd++,function(){a.forEach(function(p){var m=al.get(p)-1,g=l.get(p)-1;al.set(p,m),l.set(p,g),m||(Fi.has(p)||p.removeAttribute(s),Fi.delete(p)),g||p.removeAttribute(n)}),yd--,yd||(al=new WeakMap,al=new WeakMap,Fi=new WeakMap,Bi={})}},Zw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=SR(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),CR(s,o,n,"aria-hidden")):function(){return null}},Vs=function(){return Vs=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Vs.apply(this,arguments)};function ej(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function ER(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,l;s<o;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var hc="right-scroll-bar-position",gc="width-before-scroll-bar",RR="with-scroll-bars-hidden",PR="--removed-body-scroll-bar-size";function wd(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function MR(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var TR=typeof window<"u"?u.useLayoutEffect:u.useEffect,fx=new WeakMap;function $R(e,t){var n=MR(null,function(s){return e.forEach(function(o){return wd(o,s)})});return TR(function(){var s=fx.get(n);if(s){var o=new Set(s),l=new Set(e),a=n.current;o.forEach(function(i){l.has(i)||wd(i,null)}),l.forEach(function(i){o.has(i)||wd(i,a)})}fx.set(n,e)},[e]),n}function IR(e){return e}function AR(e,t){t===void 0&&(t=IR);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var a=t(l,s);return n.push(a),function(){n=n.filter(function(i){return i!==a})}},assignSyncMedium:function(l){for(s=!0;n.length;){var a=n;n=[],a.forEach(l)}n={push:function(i){return l(i)},filter:function(){return n}}},assignMedium:function(l){s=!0;var a=[];if(n.length){var i=n;n=[],i.forEach(l),a=n}var c=function(){var f=a;a=[],f.forEach(l)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){a.push(f),d()},filter:function(f){return a=a.filter(f),n}}}};return o}function OR(e){e===void 0&&(e={});var t=AR(null);return t.options=Vs({async:!0,ssr:!1},e),t}var tj=function(e){var t=e.sideCar,n=ej(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return u.createElement(s,Vs({},n))};tj.isSideCarExport=!0;function LR(e,t){return e.useMedium(t),tj}var nj=OR(),jd=function(){},Cu=u.forwardRef(function(e,t){var n=u.useRef(null),s=u.useState({onScrollCapture:jd,onWheelCapture:jd,onTouchMoveCapture:jd}),o=s[0],l=s[1],a=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,g=e.noRelative,h=e.noIsolation,y=e.inert,j=e.allowPinchZoom,w=e.as,x=w===void 0?"div":w,v=e.gapMode,b=ej(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,k=$R([n,t]),E=Vs(Vs({},b),o);return u.createElement(u.Fragment,null,f&&u.createElement(S,{sideCar:nj,removeScrollBar:d,shards:p,noRelative:g,noIsolation:h,inert:y,setCallbacks:l,allowPinchZoom:!!j,lockRef:n,gapMode:v}),a?u.cloneElement(u.Children.only(i),Vs(Vs({},E),{ref:k})):u.createElement(x,Vs({},E,{className:c,ref:k}),i))});Cu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cu.classNames={fullWidth:gc,zeroRight:hc};var DR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zR(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=DR();return t&&e.setAttribute("nonce",t),e}function FR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function BR(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var HR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zR())&&(FR(t,n),BR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},UR=function(){var e=HR();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sj=function(){var e=UR(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},VR={left:0,top:0,right:0,gap:0},bd=function(e){return parseInt(e||"",10)||0},WR=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[bd(n),bd(s),bd(o)]},qR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return VR;var t=WR(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},GR=sj(),Al="data-scroll-locked",KR=function(e,t,n,s){var o=e.left,l=e.top,a=e.right,i=e.gap;return n===void 0&&(n="margin"),`
412
+ .`.concat(RR,` {
413
+ overflow: hidden `).concat(s,`;
414
+ padding-right: `).concat(i,"px ").concat(s,`;
415
+ }
416
+ body[`).concat(Al,`] {
417
+ overflow: hidden `).concat(s,`;
418
+ overscroll-behavior: contain;
419
+ `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
420
+ padding-left: `.concat(o,`px;
421
+ padding-top: `).concat(l,`px;
422
+ padding-right: `).concat(a,`px;
423
+ margin-left:0;
424
+ margin-top:0;
425
+ margin-right: `).concat(i,"px ").concat(s,`;
426
+ `),n==="padding"&&"padding-right: ".concat(i,"px ").concat(s,";")].filter(Boolean).join(""),`
427
+ }
428
+
429
+ .`).concat(hc,` {
430
+ right: `).concat(i,"px ").concat(s,`;
431
+ }
432
+
433
+ .`).concat(gc,` {
434
+ margin-right: `).concat(i,"px ").concat(s,`;
435
+ }
436
+
437
+ .`).concat(hc," .").concat(hc,` {
438
+ right: 0 `).concat(s,`;
439
+ }
440
+
441
+ .`).concat(gc," .").concat(gc,` {
442
+ margin-right: 0 `).concat(s,`;
443
+ }
444
+
445
+ body[`).concat(Al,`] {
446
+ `).concat(PR,": ").concat(i,`px;
447
+ }
448
+ `)},px=function(){var e=parseInt(document.body.getAttribute(Al)||"0",10);return isFinite(e)?e:0},QR=function(){u.useEffect(function(){return document.body.setAttribute(Al,(px()+1).toString()),function(){var e=px()-1;e<=0?document.body.removeAttribute(Al):document.body.setAttribute(Al,e.toString())}},[])},YR=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;QR();var l=u.useMemo(function(){return qR(o)},[o]);return u.createElement(GR,{styles:KR(l,!t,o,n?"":"!important")})},qf=!1;if(typeof window<"u")try{var Hi=Object.defineProperty({},"passive",{get:function(){return qf=!0,!0}});window.addEventListener("test",Hi,Hi),window.removeEventListener("test",Hi,Hi)}catch{qf=!1}var il=qf?{passive:!1}:!1,XR=function(e){return e.tagName==="TEXTAREA"},rj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!XR(e)&&n[t]==="visible")},JR=function(e){return rj(e,"overflowY")},ZR=function(e){return rj(e,"overflowX")},mx=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=oj(e,s);if(o){var l=lj(e,s),a=l[1],i=l[2];if(a>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},eP=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},tP=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},oj=function(e,t){return e==="v"?JR(t):ZR(t)},lj=function(e,t){return e==="v"?eP(t):tP(t)},nP=function(e,t){return e==="h"&&t==="rtl"?-1:1},sP=function(e,t,n,s,o){var l=nP(e,window.getComputedStyle(t).direction),a=l*s,i=n.target,c=t.contains(i),d=!1,f=a>0,p=0,m=0;do{if(!i)break;var g=lj(e,i),h=g[0],y=g[1],j=g[2],w=y-j-l*h;(h||w)&&oj(e,i)&&(p+=w,m+=h);var x=i.parentNode;i=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(d=!0),d},Ui=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hx=function(e){return[e.deltaX,e.deltaY]},gx=function(e){return e&&"current"in e?e.current:e},rP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},oP=function(e){return`
449
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
450
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
451
+ `)},lP=0,cl=[];function aP(e){var t=u.useRef([]),n=u.useRef([0,0]),s=u.useRef(),o=u.useState(lP++)[0],l=u.useState(sj)[0],a=u.useRef(e);u.useEffect(function(){a.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=ER([e.lockRef.current],(e.shards||[]).map(gx),!0).filter(Boolean);return y.forEach(function(j){return j.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var i=u.useCallback(function(y,j){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!a.current.allowPinchZoom;var w=Ui(y),x=n.current,v="deltaX"in y?y.deltaX:x[0]-w[0],b="deltaY"in y?y.deltaY:x[1]-w[1],S,k=y.target,E=Math.abs(v)>Math.abs(b)?"h":"v";if("touches"in y&&E==="h"&&k.type==="range")return!1;var R=window.getSelection(),z=R&&R.anchorNode,N=z?z===k||z.contains(k):!1;if(N)return!1;var I=mx(E,k);if(!I)return!0;if(I?S=E:(S=E==="v"?"h":"v",I=mx(E,k)),!I)return!1;if(!s.current&&"changedTouches"in y&&(v||b)&&(s.current=S),!S)return!0;var A=s.current||S;return sP(A,j,y,A==="h"?v:b)},[]),c=u.useCallback(function(y){var j=y;if(!(!cl.length||cl[cl.length-1]!==l)){var w="deltaY"in j?hx(j):Ui(j),x=t.current.filter(function(S){return S.name===j.type&&(S.target===j.target||j.target===S.shadowParent)&&rP(S.delta,w)})[0];if(x&&x.should){j.cancelable&&j.preventDefault();return}if(!x){var v=(a.current.shards||[]).map(gx).filter(Boolean).filter(function(S){return S.contains(j.target)}),b=v.length>0?i(j,v[0]):!a.current.noIsolation;b&&j.cancelable&&j.preventDefault()}}},[]),d=u.useCallback(function(y,j,w,x){var v={name:y,delta:j,target:w,should:x,shadowParent:iP(w)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(b){return b!==v})},1)},[]),f=u.useCallback(function(y){n.current=Ui(y),s.current=void 0},[]),p=u.useCallback(function(y){d(y.type,hx(y),y.target,i(y,e.lockRef.current))},[]),m=u.useCallback(function(y){d(y.type,Ui(y),y.target,i(y,e.lockRef.current))},[]);u.useEffect(function(){return cl.push(l),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,il),document.addEventListener("touchmove",c,il),document.addEventListener("touchstart",f,il),function(){cl=cl.filter(function(y){return y!==l}),document.removeEventListener("wheel",c,il),document.removeEventListener("touchmove",c,il),document.removeEventListener("touchstart",f,il)}},[]);var g=e.removeScrollBar,h=e.inert;return u.createElement(u.Fragment,null,h?u.createElement(l,{styles:oP(o)}):null,g?u.createElement(YR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function iP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const cP=LR(nj,aP);var Pm=u.forwardRef(function(e,t){return u.createElement(Cu,Vs({},e,{ref:t,sideCar:cP}))});Pm.classNames=Cu.classNames;var uP=Object.defineProperty,Je=(e,t)=>uP(e,"name",{value:t,configurable:!0}),dP=[" ","Enter","ArrowUp","ArrowDown"],fP=[" ","Enter"],Kl="Select",[Eu,Ru,pP]=ym(Kl),[el,cA]=xo(Kl,[pP,zw]),Mm=zw(),[mP,yo]=el(Kl),[hP,gP]=el(Kl);function aj(e){const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:l,value:a,defaultValue:i,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:g,form:h,internal_do_not_use_render:y}=e,j=Mm(t),[w,x]=u.useState(null),[v,b]=u.useState(null),[S,k]=u.useState(!1),E=yu(d),[R,z]=Gl({prop:s,defaultProp:o??!1,onChange:l,caller:Kl}),[N,I]=Gl({prop:a,defaultProp:i,onChange:c,caller:Kl}),A=u.useRef(null),W=u.useRef(N);u.useEffect(()=>{const ge=h?w==null?void 0:w.ownerDocument.getElementById(h):w==null?void 0:w.form;if(ge instanceof HTMLFormElement){const Te=Je(()=>I(W.current),"reset");return ge.addEventListener("reset",Te),()=>ge.removeEventListener("reset",Te)}},[h,w,I]);const L=w?!!h||!!w.closest("form"):!0,[J,O]=u.useState(new Set),U=to(),F=Array.from(J).map(ge=>ge.props.value).join(";"),Z=u.useCallback(ge=>{O(Te=>new Set(Te).add(ge))},[]),D=u.useCallback(ge=>{O(Te=>{const re=new Set(Te);return re.delete(ge),re})},[]),be={required:g,trigger:w,onTriggerChange:x,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:U,value:N,onValueChange:I,open:R,onOpenChange:z,dir:E,triggerPointerDownPosRef:A,disabled:m,name:f,autoComplete:p,form:h,nativeOptions:J,nativeSelectKey:F,isFormControl:L};return r.jsx(dR,{...j,children:r.jsx(mP,{scope:t,...be,children:r.jsx(Eu.Provider,{scope:t,children:r.jsx(hP,{scope:t,onNativeOptionAdd:Z,onNativeOptionRemove:D,children:dj(y)?y(be):n})})})})}Je(aj,"SelectProvider");var xP=Je(e=>{const{__scopeSelect:t,children:n,...s}=e;return r.jsx(aj,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:o})=>r.jsxs(r.Fragment,{children:[n,o?r.jsx(GP,{__scopeSelect:t}):null]})})},"Select"),vP="SelectTrigger",yP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,disabled:o=!1,...l}=t,a=Mm(s),i=yo(vP,s),c=i.disabled||o,d=St(n,i.onTriggerChange),f=Ru(s),p=u.useRef("touch"),[m,g,h]=$m(j=>{const w=f().filter(b=>!b.disabled),x=w.find(b=>b.value===i.value),v=Im(w,j,x);v!==void 0&&i.onValueChange(v.value)}),y=Je(j=>{c||(i.onOpenChange(!0),h()),j&&(i.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})},"handleOpen");return r.jsx(fR,{asChild:!0,...a,children:r.jsx(dt.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":hi(i.value)?"":void 0,...l,ref:d,onClick:et(l.onClick,j=>{j.currentTarget.focus(),p.current!=="mouse"&&y(j)}),onPointerDown:et(l.onPointerDown,j=>{p.current=j.pointerType;const w=j.target;w.hasPointerCapture(j.pointerId)&&w.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(y(j),j.preventDefault())}),onKeyDown:et(l.onKeyDown,j=>{const w=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(w&&j.key===" ")&&dP.includes(j.key)&&(y(),j.preventDefault())})})})},"SelectTrigger")),wP="SelectValue",jP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,className:o,style:l,children:a,placeholder:i="",...c}=t,d=yo(wP,s),{onValueNodeHasChildrenChange:f}=d,p=a!==void 0,m=St(n,d.onValueNodeChange);Vt(()=>{f(p)},[f,p]);const g=hi(d.value);return r.jsx(dt.span,{...c,asChild:g?!1:c.asChild,ref:m,style:{pointerEvents:"none"},children:r.jsx(u.Fragment,{children:g?i:a},g?"placeholder":"value")})},"SelectValue")),bP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,children:o,...l}=t;return r.jsx(dt.span,{"aria-hidden":!0,...l,ref:n,children:o||"▼"})},"SelectIcon")),_P="SelectPortal",[kP,SP]=el(_P,{forceMount:void 0}),NP=Je(e=>{const{__scopeSelect:t,forceMount:n,...s}=e;return r.jsx(kP,{scope:e.__scopeSelect,forceMount:n,children:r.jsx(Uw,{asChild:!0,...s})})},"SelectPortal"),Go="SelectContent",CP=u.forwardRef(Je(function(t,n){const s=SP(Go,t.__scopeSelect),{forceMount:o=s.forceMount,...l}=t,a=yo(Go,t.__scopeSelect),[i,c]=u.useState();return Vt(()=>{c(new DocumentFragment)},[]),r.jsx(pi,{present:o||a.open,children:({present:d})=>d?r.jsx(PP,{...l,ref:n}):r.jsx(EP,{...l,fragment:i})})},"SelectContent")),EP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,children:o,fragment:l}=t;return l?Jo.createPortal(r.jsx(ij,{scope:s,children:r.jsx(Eu.Slot,{scope:s,children:r.jsx("div",{ref:n,children:o})})}),l):null},"SelectContentFragment")),_s=10,[ij,tl]=el(Go),RP=br("SelectContent.RemoveScroll"),PP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s}=t,{position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:a,onPointerDownOutside:i,side:c,sideOffset:d,align:f,alignOffset:p,arrowPadding:m,collisionBoundary:g,collisionPadding:h,sticky:y,hideWhenDetached:j,avoidCollisions:w,...x}=t,v=yo(Go,s),[b,S]=u.useState(null),[k,E]=u.useState(null),R=St(n,S),[z,N]=u.useState(null),[I,A]=u.useState(null),W=Ru(s),[L,J]=u.useState(!1),O=u.useRef(!1);u.useEffect(()=>{if(b)return Zw(b)},[b]),wu();const U=u.useCallback(de=>{const[me,...Ce]=W().map(H=>H.ref.current),[_e]=Ce.slice(-1),C=document.activeElement;for(const H of de)if(H===C||(H==null||H.scrollIntoView({block:"nearest"}),H===me&&k&&(k.scrollTop=0),H===_e&&k&&(k.scrollTop=k.scrollHeight),H==null||H.focus(),document.activeElement!==C))return},[W,k]),F=u.useCallback(()=>U([z,b]),[U,z,b]);u.useEffect(()=>{L&&F()},[L,F]);const{onOpenChange:Z,triggerPointerDownPosRef:D}=v;u.useEffect(()=>{if(b){let de={x:0,y:0};const me=Je(_e=>{var C,H;de={x:Math.abs(Math.round(_e.pageX)-(((C=D.current)==null?void 0:C.x)??0)),y:Math.abs(Math.round(_e.pageY)-(((H=D.current)==null?void 0:H.y)??0))}},"handlePointerMove"),Ce=Je(_e=>{de.x<=10&&de.y<=10?_e.preventDefault():_e.composedPath().includes(b)||Z(!1),document.removeEventListener("pointermove",me),D.current=null},"handlePointerUp");return D.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[b,Z,D]),u.useEffect(()=>{const de=Je(()=>Z(!1),"close");return window.addEventListener("blur",de),window.addEventListener("resize",de),()=>{window.removeEventListener("blur",de),window.removeEventListener("resize",de)}},[Z]);const[be,ge]=$m(de=>{const me=W().filter(C=>!C.disabled),Ce=me.find(C=>C.ref.current===document.activeElement),_e=Im(me,de,Ce);_e&&setTimeout(()=>{var C;return(C=_e.ref.current)==null?void 0:C.focus()})}),Te=u.useCallback((de,me,Ce)=>{const _e=!O.current&&!Ce;(v.value!==void 0&&v.value===me||_e)&&(N(de),_e&&(O.current=!0))},[v.value]),re=u.useCallback(()=>b==null?void 0:b.focus(),[b]),$e=u.useCallback((de,me,Ce)=>{const _e=!O.current&&!Ce;(v.value!==void 0&&v.value===me||_e)&&A(de)},[v.value]),he=o==="popper"?xx:MP,De=he===xx?{side:c,sideOffset:d,align:f,alignOffset:p,arrowPadding:m,collisionBoundary:g,collisionPadding:h,sticky:y,hideWhenDetached:j,avoidCollisions:w}:{};return r.jsx(ij,{scope:s,content:b,viewport:k,onViewportChange:E,itemRefCallback:Te,selectedItem:z,onItemLeave:re,itemTextRefCallback:$e,focusSelectedItem:F,selectedItemText:I,position:o,isPositioned:L,searchRef:be,children:r.jsx(Pm,{as:RP,allowPinchZoom:!0,children:r.jsx(vw,{asChild:!0,trapped:v.open,onMountAutoFocus:de=>{de.preventDefault()},onUnmountAutoFocus:et(l,de=>{var me;(me=v.trigger)==null||me.focus({preventScroll:!0}),de.preventDefault()}),children:r.jsx(mw,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:de=>de.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:r.jsx(he,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:de=>de.preventDefault(),...x,...De,onPlaced:()=>J(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:et(x.onKeyDown,de=>{const me=de.ctrlKey||de.altKey||de.metaKey;if(de.key==="Tab"&&de.preventDefault(),!me&&de.key.length===1&&ge(de.key),["ArrowUp","ArrowDown","Home","End"].includes(de.key)){let _e=W().filter(C=>!C.disabled).map(C=>C.ref.current);if(["ArrowUp","End"].includes(de.key)&&(_e=_e.slice().reverse()),["ArrowUp","ArrowDown"].includes(de.key)){const C=de.target,H=_e.indexOf(C);_e=_e.slice(H+1)}setTimeout(()=>U(_e)),de.preventDefault()}})})})})})})},"SelectContentImpl")),MP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,onPlaced:o,...l}=t,a=yo(Go,s),i=tl(Go,s),[c,d]=u.useState(null),[f,p]=u.useState(null),m=St(n,p),g=Ru(s),h=u.useRef(!1),y=u.useRef(!0),{viewport:j,selectedItem:w,selectedItemText:x,focusSelectedItem:v}=i,b=u.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&f&&j&&w&&x){const R=a.trigger.getBoundingClientRect(),z=f.getBoundingClientRect(),N=a.valueNode.getBoundingClientRect(),I=x.getBoundingClientRect();if(a.dir!=="rtl"){const C=I.left-z.left,H=N.left-C,pe=R.left-H,B=R.width+pe,te=Math.max(B,z.width),ie=window.innerWidth-_s,ze=Af(H,[_s,Math.max(_s,ie-te)]);c.style.minWidth=B+"px",c.style.left=ze+"px"}else{const C=z.right-I.right,H=window.innerWidth-N.right-C,pe=window.innerWidth-R.right-H,B=R.width+pe,te=Math.max(B,z.width),ie=window.innerWidth-_s,ze=Af(H,[_s,Math.max(_s,ie-te)]);c.style.minWidth=B+"px",c.style.right=ze+"px"}const A=g(),W=window.innerHeight-_s*2,L=j.scrollHeight,J=window.getComputedStyle(f),O=parseInt(J.borderTopWidth,10),U=parseInt(J.paddingTop,10),F=parseInt(J.borderBottomWidth,10),Z=parseInt(J.paddingBottom,10),D=O+U+L+Z+F,be=Math.min(w.offsetHeight*5,D),ge=window.getComputedStyle(j),Te=parseInt(ge.paddingTop,10),re=parseInt(ge.paddingBottom,10),$e=R.top+R.height/2-_s,he=W-$e,De=w.offsetHeight/2,de=w.offsetTop+De,me=O+U+de,Ce=D-me;if(me<=$e){const C=A.length>0&&w===A[A.length-1].ref.current;c.style.bottom="0px";const H=f.clientHeight-j.offsetTop-j.offsetHeight,pe=Math.max(he,De+(C?re:0)+H+F),B=me+pe;c.style.height=B+"px"}else{const C=A.length>0&&w===A[0].ref.current;c.style.top="0px";const pe=Math.max($e,O+j.offsetTop+(C?Te:0)+De)+Ce;c.style.height=pe+"px",j.scrollTop=me-$e+j.offsetTop}c.style.margin=`${_s}px 0`,c.style.minHeight=be+"px",c.style.maxHeight=W+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[g,a.trigger,a.valueNode,c,f,j,w,x,a.dir,o]);Vt(()=>b(),[b]);const[S,k]=u.useState();Vt(()=>{f&&k(window.getComputedStyle(f).zIndex)},[f]);const E=u.useCallback(R=>{R&&y.current===!0&&(b(),v==null||v(),y.current=!1)},[b,v]);return r.jsx(TP,{scope:s,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:E,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:r.jsx(dt.div,{...l,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})},"SelectItemAlignedPosition")),xx=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,align:o="start",collisionPadding:l=_s,...a}=t,i=Mm(s);return r.jsx(pR,{...i,...a,ref:n,align:o,collisionPadding:l,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[TP,Tm]=el(Go,{}),vx="SelectViewport",$P=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,nonce:o,...l}=t,a=tl(vx,s),i=Tm(vx,s),c=St(n,a.onViewportChange),d=u.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),r.jsx(Eu.Slot,{scope:s,children:r.jsx(dt.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:et(l.onScroll,f=>{const p=f.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&m){const h=Math.abs(d.current-p.scrollTop);if(h>0){const y=window.innerHeight-_s*2,j=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),x=Math.max(j,w);if(x<y){const v=x+h,b=Math.min(y,v),S=v-b;m.style.height=b+"px",m.style.bottom==="0px"&&(p.scrollTop=S>0?S:0,m.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})},"SelectViewport")),IP="SelectGroup",[uA,AP]=el(IP),OP="SelectLabel",LP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,...o}=t,l=AP(OP,s);return r.jsx(dt.div,{id:l.id,...o,ref:n})},"SelectLabel")),Gf="SelectItem",[DP,cj]=el(Gf),zP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,value:o,disabled:l=!1,textValue:a,...i}=t,c=yo(Gf,s),d=tl(Gf,s),f=c.value===o,[p,m]=u.useState(a??""),[g,h]=u.useState(!1),y=Ps(b=>{var S;return(S=d.itemRefCallback)==null?void 0:S.call(d,b,o,l)}),j=St(n,y),w=to(),x=u.useRef("touch"),v=Je(()=>{l||(c.onValueChange(o),c.onOpenChange(!1))},"handleSelect");return r.jsx(DP,{scope:s,value:o,disabled:l,textId:w,isSelected:f,onItemTextChange:u.useCallback(b=>{m(S=>S||((b==null?void 0:b.textContent)??"").trim())},[]),children:r.jsx(Eu.ItemSlot,{scope:s,value:o,disabled:l,textValue:p,children:r.jsx(dt.div,{role:"option","aria-labelledby":w,"data-highlighted":g?"":void 0,"aria-selected":f&&g,"data-state":f?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...i,ref:j,onFocus:et(i.onFocus,()=>h(!0)),onBlur:et(i.onBlur,()=>h(!1)),onClick:et(i.onClick,()=>{x.current!=="mouse"&&v()}),onPointerUp:et(i.onPointerUp,()=>{x.current==="mouse"&&v()}),onPointerDown:et(i.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:et(i.onPointerMove,b=>{var S;x.current=b.pointerType,l?(S=d.onItemLeave)==null||S.call(d):x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:et(i.onPointerLeave,b=>{var S;b.currentTarget===document.activeElement&&((S=d.onItemLeave)==null||S.call(d))}),onKeyDown:et(i.onKeyDown,b=>{var k;l||b.target!==b.currentTarget||((k=d.searchRef)==null?void 0:k.current)!==""&&b.key===" "||(fP.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})},"SelectItem")),Vi="SelectItemText",FP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,className:o,style:l,...a}=t,i=yo(Vi,s),c=tl(Vi,s),d=cj(Vi,s),f=gP(Vi,s),[p,m]=u.useState(null),g=Ps(v=>{var b;return(b=c.itemTextRefCallback)==null?void 0:b.call(c,v,d.value,d.disabled)}),h=St(n,m,d.onItemTextChange,g),y=p==null?void 0:p.textContent,j=u.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:y},d.value),[d.disabled,d.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=f;return Vt(()=>(w(j),()=>x(j)),[w,x,j]),r.jsxs(r.Fragment,{children:[r.jsx(dt.span,{id:d.textId,...a,ref:h}),d.isSelected&&i.valueNode&&!i.valueNodeHasChildren&&!hi(i.value)?Jo.createPortal(a.children,i.valueNode):null]})},"SelectItemText")),BP="SelectItemIndicator",HP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,...o}=t;return cj(BP,s).isSelected?r.jsx(dt.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),yx="SelectScrollUpButton",UP=u.forwardRef(Je(function(t,n){const s=tl(yx,t.__scopeSelect),o=Tm(yx,t.__scopeSelect),[l,a]=u.useState(!1),i=St(n,o.onScrollButtonChange);return Vt(()=>{if(s.viewport&&s.isPositioned){let c=function(){const f=d.scrollTop>0;a(f)};Je(c,"handleScroll");const d=s.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[s.viewport,s.isPositioned]),l?r.jsx(uj,{...t,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=s;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null},"SelectScrollUpButton")),wx="SelectScrollDownButton",VP=u.forwardRef(Je(function(t,n){const s=tl(wx,t.__scopeSelect),o=Tm(wx,t.__scopeSelect),[l,a]=u.useState(!1),i=St(n,o.onScrollButtonChange);return Vt(()=>{if(s.viewport&&s.isPositioned){let c=function(){const f=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<f;a(p)};Je(c,"handleScroll");const d=s.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[s.viewport,s.isPositioned]),l?r.jsx(uj,{...t,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=s;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null},"SelectScrollDownButton")),uj=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,onAutoScroll:o,...l}=t,a=tl("SelectScrollButton",s),i=u.useRef(null),c=Ru(s),d=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>d(),[d]),Vt(()=>{var p;const f=c().find(m=>m.ref.current===document.activeElement);(p=f==null?void 0:f.ref.current)==null||p.scrollIntoView({block:"nearest"})},[c]),r.jsx(dt.div,{"aria-hidden":!0,...l,ref:n,style:{flexShrink:0,...l.style},onPointerDown:et(l.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(o,50))}),onPointerMove:et(l.onPointerMove,()=>{var f;(f=a.onItemLeave)==null||f.call(a),i.current===null&&(i.current=window.setInterval(o,50))}),onPointerLeave:et(l.onPointerLeave,()=>{d()})})},"SelectScrollButtonImpl")),WP=u.forwardRef(Je(function(t,n){const{__scopeSelect:s,...o}=t;return r.jsx(dt.div,{"aria-hidden":!0,...o,ref:n})},"SelectSeparator")),qP="SelectBubbleInput",GP=u.forwardRef(Je(function({__scopeSelect:t,...n},s){const o=yo(qP,t),{value:l,onValueChange:a,required:i,disabled:c,name:d,autoComplete:f,form:p}=o,{nativeOptions:m,nativeSelectKey:g}=o,h=u.useRef(null),y=St(s,h),j=l??"",w=Xw(j),x=Array.from(m).some(v=>(v.props.value??"")==="");return u.useEffect(()=>{const v=h.current;if(!v)return;const b=window.HTMLSelectElement.prototype,k=Object.getOwnPropertyDescriptor(b,"value").set;if(w!==j&&k){const E=new Event("change",{bubbles:!0});k.call(v,j),v.dispatchEvent(E)}},[w,j]),r.jsxs(dt.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:d,autoComplete:f,disabled:c,form:p,onChange:v=>a(v.target.value),...n,style:{...kR,...n.style},ref:y,defaultValue:j,children:[hi(l)&&!x?r.jsx("option",{value:""}):null,Array.from(m)]},g)},"SelectBubbleInput"));function dj(e){return typeof e=="function"}Je(dj,"isFunction");function hi(e){return e===""||e===void 0}Je(hi,"shouldShowPlaceholder");function $m(e){const t=Ps(e),n=u.useRef(""),s=u.useRef(0),o=u.useCallback(a=>{const i=n.current+a;t(i),Je(function c(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>c(""),1e3))},"updateSearch")(i)},[t]),l=u.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,l]}Je($m,"useTypeaheadSearch");function Im(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let a=fj(e,Math.max(l,0));o.length===1&&(a=a.filter(d=>d!==n));const c=a.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}Je(Im,"findNextItem");function fj(e,t){return e.map((n,s)=>e[(t+s)%e.length])}Je(fj,"wrapArray");const Ht=xP,Ot=u.forwardRef((e,t)=>r.jsx(jP,{ref:t,"data-slot":"select-value",...e}));Ot.displayName="SelectValue";const Lt=u.forwardRef(({className:e,size:t="default",children:n,...s},o)=>r.jsxs(yP,{ref:o,"data-slot":"select-trigger","data-size":t,className:Ke("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s,children:[n,r.jsx(bP,{asChild:!0,children:r.jsx(ql,{className:"size-4 opacity-50"})})]}));Lt.displayName="SelectTrigger";const Dt=u.forwardRef(({className:e,children:t,position:n="popper",...s},o)=>r.jsx(NP,{children:r.jsxs(CP,{ref:o,"data-slot":"select-content",className:Ke("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(pj,{}),r.jsx($P,{className:Ke("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),r.jsx(mj,{})]})}));Dt.displayName="SelectContent";const KP=u.forwardRef(({className:e,...t},n)=>r.jsx(LP,{ref:n,"data-slot":"select-label",className:Ke("text-muted-foreground px-2 py-1.5 text-xs",e),...t}));KP.displayName="SelectLabel";const Le=u.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(zP,{ref:s,"data-slot":"select-item",className:Ke("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:r.jsx(HP,{children:r.jsx(dr,{className:"size-4"})})}),r.jsx(FP,{children:t})]}));Le.displayName="SelectItem";const QP=u.forwardRef(({className:e,...t},n)=>r.jsx(WP,{ref:n,"data-slot":"select-separator",className:Ke("bg-border pointer-events-none -mx-1 my-1 h-px",e),...t}));QP.displayName="SelectSeparator";const pj=u.forwardRef(({className:e,...t},n)=>r.jsx(UP,{ref:n,"data-slot":"select-scroll-up-button",className:Ke("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Uc,{className:"size-4"})}));pj.displayName="SelectScrollUpButton";const mj=u.forwardRef(({className:e,...t},n)=>r.jsx(VP,{ref:n,"data-slot":"select-scroll-down-button",className:Ke("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(ql,{className:"size-4"})}));mj.displayName="SelectScrollDownButton";function hj({open:e,query:t,items:n,onSelect:s,onClose:o,onDisabled:l}){const[a,i]=u.useState(0),c=u.useRef(null),d=(n||[]).filter(m=>m.dis||!t||(m.key||"").toLowerCase().includes(t.toLowerCase())),f=d.filter(m=>!m.dis);u.useEffect(()=>{const m=d.findIndex(g=>!g.dis);i(m>=0?m:0)},[t,e]),u.useEffect(()=>{c.current&&c.current.scrollIntoView({block:"nearest"})},[a,d]);function p(m,g){var h;if(!f.length)return m;for(let y=1;y<=d.length;y++){const j=(m+g*y+d.length)%d.length;if(!((h=d[j])!=null&&h.dis))return j}return m}return u.useEffect(()=>{if(!e)return;function m(g){if(!g.isComposing){if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),o();return}if(f.length){if(g.key==="ArrowDown")g.preventDefault(),g.stopPropagation(),i(h=>p(h,1));else if(g.key==="ArrowUp")g.preventDefault(),g.stopPropagation(),i(h=>p(h,-1));else if(g.key==="Enter"){g.preventDefault(),g.stopPropagation();const h=d[a];if(!h)return;h.dis?l==null||l(h):s(h)}}}}return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[e,d,f,a,s,o,l]),e?r.jsx("div",{className:"sess-slashmenu",children:d.length===0?r.jsx("div",{className:"sess-slash-empty",children:"无匹配项"}):d.map((m,g)=>r.jsxs("button",{type:"button",ref:g===a?c:void 0,className:"sess-slash-item"+(g===a?" on":"")+(m.dis?" dis":""),onMouseEnter:()=>i(g),onClick:()=>{m.dis?l==null||l(m):s(m)},children:[r.jsx("span",{className:"sess-slash-key",children:m.key||m.label}),r.jsx("span",{className:"sess-slash-desc",children:m.desc}),m.type==="cmd"&&r.jsx("span",{className:"sess-slash-tag",children:"命令"}),m.type==="skill"&&r.jsx("span",{className:"sess-slash-tag",children:"skill"})]},m.key))}):null}const jx=`
452
+
453
+ `;function gj(e){return!e||!e.msgId?!1:e.state==="queued"||e.state==="pending"}function YP(e,t){const n=(t||[]).map(l=>l==null?"":String(l)).filter(l=>l.trim()!==""),s=e==null?"":String(e);if(!n.length)return s;const o=n.join(jx);return s.trim()?s.replace(/\s+$/,"")+jx+o:o}function XP(e,t){return e?t?"已取消排队,原文已放回输入框":`已取消 ${e} 条排队消息,原文已放回输入框`:"消息已不在排队中(可能已开始发送)"}const Kc=[{value:"manual",label:"逐条确认",desc:"每个工具操作都需要你手动确认"},{value:"yolo",label:"自动通过",desc:"自动批准工具操作,但遇到关键问题仍会询问"},{value:"auto",label:"完全自主",desc:"完全自主运行,智能体自己做决定,不再询问"}];function Wi(e){const t=+e||0;return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"k":String(t)}function JP({value:e,onChange:t,atts:n,onRemoveAtt:s,uploading:o,inputLocked:l,caps:a,meta:i,onSend:c,onStop:d,stopDisabled:f,chatRunning:p,taskRunning:m,queuedN:g,board:h,sending:y,permMode:j,modelSel:w,modelOpts:x,onSetModel:v,onSetPermission:b,effortSel:S,effortOpts:k,onSetEffort:E,queueRows:R,injecting:z,onInject:N,cancelling:I,onCancelQueuedRow:A,onCancelQueue:W,answerPending:L,deliveringAnswer:J,onDeliverAnswer:O,slashOpen:U,slashQuery:F,slashItems:Z,onSlashSelect:D,onSlashClose:be,onSlashDisabled:ge,onPasteFiles:Te,onDropFiles:re,onUploadFiles:$e,taRef:he}){const De=u.useRef(null),de=h&&!!(a!=null&&a.profile),me=h&&!!(a!=null&&a.permission),Ce=!!(a!=null&&a.profile)&&!!((k==null?void 0:k.options)||[]).length,_e=Kc.find(ce=>ce.value===j)||null,C=_e?_e.label:"权限",H=S||(i==null?void 0:i.sessionEffort)||"",pe=((k==null?void 0:k.options)||[]).find(ce=>ce.value===H)||null,B=k!=null&&k.defaultEffort?((k.options||[]).find(ce=>ce.value===k.defaultEffort)||{}).label||k.defaultEffort:"",te=(pe==null?void 0:pe.label)||(B?`默认(${B})`:"默认"),ie=w||(i==null?void 0:i.sessionModel)||(x==null?void 0:x.default)||"默认模型",ze=ie==="默认模型"?"__default__":ie,Ee=i==null?void 0:i.ctx,mt=Ee&&+Ee.max>0?Math.min(100,Math.max(0,Math.round(+Ee.used/+Ee.max*100))):0,ot=2*Math.PI*7,Fe=(n||[]).filter(ce=>e.includes(ce.md)),Ze=(i==null?void 0:i.queue_state)||"",rt=!!(i!=null&&i.project_busy),nt=!!Ze&&Ze!=="idle"||rt||p||(g||0)>0,Y=x2(Ze,{found:!!(i!=null&&i.found),board:!!h,canQueue:!!a.queue,chatRunning:p,projectBusy:rt}),qe=(g||0)>0||p&&(h||!(a.queue&&m)),vt=(g||0)>0&&!p?"取消排队":"停止",Zt=vt==="取消排队"&&!!W,zt=!!f&&vt==="停止";return r.jsxs("div",{className:"sess-composer",children:[L&&r.jsx("div",{className:"sess-queue",children:r.jsxs("div",{className:"sess-queue-row",title:"答案已提交,等项目空闲送达",children:[r.jsx("span",{className:"sess-queue-tag on",children:"待送达"}),r.jsx("span",{className:"sess-queue-text",children:"已作答,等待送达(项目忙,空闲后自动送达)"}),r.jsxs(V,{size:"sm",variant:"outline",className:"sess-queue-btn",disabled:J,title:"立即送达:不等项目空闲,立即把答案交给等待中的会话",onClick:O,children:[r.jsx(Nl,{className:"h-3 w-3"})," 立即送达"]})]})}),R.length>0&&r.jsx("div",{className:"sess-queue",children:R.map(ce=>{const $t=a.steer&&ce.msgId&&ce.state!=="running",pn=!!A&&gj(ce);return r.jsxs("div",{className:"sess-queue-row",title:ce.text,children:[r.jsx("span",{className:"sess-queue-tag"+(ce.state==="server"?" on":""),children:ce.state==="server"?"服务端排队":ce.state==="running"?"发送中":"排队中"}),r.jsxs("span",{className:"sess-queue-text",children:[ce.text.slice(0,60),ce.text.length>60?"…":""]}),$t&&r.jsxs(V,{size:"sm",variant:"outline",className:"sess-queue-btn",disabled:z===ce.key,title:"立即注入:不等队列,直接投递到会话当前上下文",onClick:()=>N(ce),children:[r.jsx(Nl,{className:"h-3 w-3"})," 立即注入"]}),pn&&r.jsxs(V,{size:"sm",variant:"outline",className:"sess-queue-btn",disabled:I===ce.key,title:"取消这条排队消息:撤销排队,并把原文放回输入框",onClick:()=>A(ce),children:[r.jsx(Ys,{className:"h-3 w-3"})," 取消"]})]},ce.key)})}),Fe.length>0&&r.jsx("div",{className:"sess-attachrow",children:Fe.map((ce,$t)=>r.jsxs("span",{className:"sess-chip",title:ce.name,children:[(ce.mime||"").startsWith("image/")&&ce.url?r.jsx("img",{src:ce.url,alt:ce.name}):r.jsx(X0,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sess-chip-name",children:ce.name}),r.jsx("button",{type:"button",className:"sess-chip-x",title:"移除附件",onClick:()=>s(ce.md),children:r.jsx(Ys,{className:"h-3 w-3"})})]},ce.md+$t))}),r.jsxs("div",{className:"sess-slashwrap",children:[r.jsx(hj,{open:U,query:F,items:Z,onSelect:D,onClose:be,onDisabled:ge}),r.jsx("textarea",{ref:he,className:"sess-ta",rows:1,value:e,onChange:ce=>t(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&!ce.shiftKey&&!ce.nativeEvent.isComposing&&(ce.preventDefault(),c())},onPaste:Te,onDrop:re,placeholder:Y,disabled:l})]}),r.jsxs("div",{className:"sess-bottombar",children:[r.jsx("input",{ref:De,type:"file",multiple:!0,className:"hidden",onChange:ce=>{$e(ce.target.files),ce.target.value=""}}),r.jsx(V,{variant:"ghost",size:"icon",className:"sess-attach",title:"添加附件(粘贴/拖入亦可)",disabled:o||l,onClick:()=>{var ce;return(ce=De.current)==null?void 0:ce.click()},children:r.jsx(Lo,{className:"h-4 w-4"})}),me?r.jsxs(Ht,{value:j||void 0,onValueChange:b,disabled:!j,children:[r.jsx(Lt,{size:"sm",className:"h-8 max-w-[130px] px-2 text-xs gap-1",title:_e?`权限:${_e.label}(${_e.desc})`:"权限模式读取中…",children:r.jsx(Ot,{className:"sess-ctl-value",placeholder:"权限",children:C})}),r.jsx(Dt,{children:Kc.map(ce=>r.jsx(Le,{value:ce.value,title:ce.desc,children:r.jsxs("span",{className:"sess-perm-item",children:[r.jsx("span",{className:"sess-perm-label",children:ce.label}),r.jsx("span",{className:"sess-perm-desc",children:ce.desc})]})},ce.value))})]}):r.jsx("span",{className:"sess-chip",title:"权限模式(会话级)",children:C}),de?r.jsxs(Ht,{value:ze,onValueChange:v,children:[r.jsx(Lt,{size:"sm",className:"h-8 max-w-[180px] px-2 text-xs gap-1",title:"切换会话模型(即时生效)",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[ze==="__default__"&&r.jsx(Le,{value:"__default__",disabled:!0,children:"默认模型"}),ze!=="__default__"&&!((x==null?void 0:x.models)||[]).some(ce=>ce.name===ze)&&r.jsx(Le,{value:ze,children:ze}),((x==null?void 0:x.models)||[]).map(ce=>r.jsx(Le,{value:ce.name,children:ce.display_name||ce.name},ce.name))]})]}):r.jsx("span",{className:"sess-chip",title:"当前会话模型",children:(i==null?void 0:i.sessionModel)||"默认模型"}),Ce?r.jsxs(Ht,{value:H||"__default__",onValueChange:E,children:[r.jsx(Lt,{size:"sm",className:"h-8 max-w-[130px] px-2 text-xs gap-1",title:"切换会话思考等级(即时生效)",children:r.jsx(Ot,{className:"sess-ctl-value",placeholder:"思考等级",children:te})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__default__",disabled:!0,children:B?`默认(${B})`:"默认"}),H&&!pe&&r.jsx(Le,{value:H,children:H}),((k==null?void 0:k.options)||[]).map(ce=>r.jsx(Le,{value:ce.value,title:ce.title,children:ce.label},ce.value))]})]}):r.jsx("span",{className:"sess-chip",title:"思考等级(会话级)",children:te}),r.jsxs("svg",{className:"sess-ring",viewBox:"0 0 18 18",width:"18",height:"18",title:Ee?`上下文 ${Wi(Ee.used)} / ${Wi(Ee.max)}(${mt}%)`:"暂无上下文用量数据",children:[r.jsx("title",{children:Ee?`上下文 ${Wi(Ee.used)} / ${Wi(Ee.max)}(${mt}%)`:"暂无上下文用量数据"}),r.jsx("circle",{cx:"9",cy:"9",r:"7",fill:"none",stroke:"var(--border)",strokeWidth:"2"}),mt>0&&r.jsx("circle",{cx:"9",cy:"9",r:"7",fill:"none",stroke:"var(--run)",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${mt/100*ot} ${ot}`,transform:"rotate(-90 9 9)"}),r.jsx("text",{x:"9",y:"9",dominantBaseline:"central",textAnchor:"middle",children:mt})]}),r.jsx("span",{style:{flex:1}}),qe&&r.jsxs(V,{variant:"outline",size:"sm",title:Zt?"取消排队:撤销本会话全部排队消息,并把原文放回输入框(不打断当前轮次)":"停止当前对话(打断当前轮次)",onClick:Zt?W:d,disabled:Zt?I==="__all__":zt,children:[r.jsx(mm,{})," ",vt]}),r.jsxs(V,{size:"sm",onClick:c,disabled:!e.trim()||y||l,children:[r.jsx(Tf,{})," ",nt?"排队":"发送"]})]})]})}const _d=["off","minimal","low","medium","high","xhigh","max"];function Kf(e){return e||""}function ZP(e,t){const n=(t||"").trim();return n&&(e.find(s=>s.name===n)||e.find(s=>s.name.endsWith("/"+n)))||null}function bx(e){return(e&&e.efforts||[]).map(t=>t.id).filter(Boolean)}function xj(e,t){const n=e&&e.models||[],s=ZP(n,t);let o=bx(s);if(!o.length){const i=[];for(const c of n)for(const d of bx(c))i.includes(d)||i.push(d);o=i}const l=o.length>0;return l||(o=_d.slice()),{options:_d.filter(i=>o.includes(i)).concat(o.filter(i=>!_d.includes(i))).map(i=>({value:i,label:Kf(i),title:`思考等级 ${i}`})),defaultEffort:s&&s.default_effort||"",fromCatalog:l}}function eM(e,t=""){return e?Kf(e):t?`默认(${Kf(t)})`:"默认"}var tM=Object.defineProperty,vs=(e,t)=>tM(e,"name",{value:t,configurable:!0}),Am="Dialog",[vj,dA]=xo(Am),[nM,Zs]=vj(Am),sM=vs(e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:l,modal:a=!0}=e,i=u.useRef(null),c=u.useRef(null),[d,f]=Gl({prop:s,defaultProp:o??!1,onChange:l,caller:Am}),[p,m]=u.useState(0),[g,h]=u.useState(0);return r.jsx(nM,{scope:t,triggerRef:i,contentRef:c,contentId:to(),titleId:to(),descriptionId:to(),titlePresent:p>0,descriptionPresent:g>0,setTitleCount:m,setDescriptionCount:h,open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(y=>!y),[f]),modal:a,children:n})},"Dialog"),yj="DialogPortal",[rM,wj]=vj(yj,{forceMount:void 0}),oM=vs(e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,l=Zs(yj,t);return r.jsx(rM,{scope:t,forceMount:n,children:u.Children.map(s,a=>r.jsx(pi,{present:n||l.open,children:r.jsx(Uw,{asChild:!0,container:o,children:a})}))})},"DialogPortal"),Qf="DialogOverlay",lM=u.forwardRef(vs(function(t,n){const s=wj(Qf,t.__scopeDialog),{forceMount:o=s.forceMount,...l}=t,a=Zs(Qf,t.__scopeDialog);return a.modal?r.jsx(pi,{present:o||a.open,children:r.jsx(iM,{...l,ref:n})}):null},"DialogOverlay")),aM=br("DialogOverlay.RemoveScroll"),iM=u.forwardRef(vs(function(t,n){const{__scopeDialog:s,...o}=t,l=Zs(Qf,s),a=hw(),i=St(n,a);return r.jsx(Pm,{as:aM,allowPinchZoom:!0,shards:[l.contentRef],children:r.jsx(dt.div,{"data-state":Om(l.open),...o,ref:i,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),ni="DialogContent",cM=u.forwardRef(vs(function(t,n){const s=wj(ni,t.__scopeDialog),{forceMount:o=s.forceMount,...l}=t,a=Zs(ni,t.__scopeDialog);return r.jsx(pi,{present:o||a.open,children:a.modal?r.jsx(uM,{...l,ref:n}):r.jsx(dM,{...l,ref:n})})},"DialogContent")),uM=u.forwardRef(vs(function(t,n){const s=Zs(ni,t.__scopeDialog),o=u.useRef(null),l=St(n,s.contentRef,o);return u.useEffect(()=>{const a=o.current;if(a)return Zw(a)},[]),r.jsx(jj,{...t,ref:l,trapFocus:s.open,disableOutsidePointerEvents:s.open,onCloseAutoFocus:et(t.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=s.triggerRef.current)==null||i.focus()}),onPointerDownOutside:et(t.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:et(t.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),dM=u.forwardRef(vs(function(t,n){const s=Zs(ni,t.__scopeDialog),o=u.useRef(!1),l=u.useRef(!1);return r.jsx(jj,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,c;(i=t.onCloseAutoFocus)==null||i.call(t,a),a.defaultPrevented||(o.current||(c=s.triggerRef.current)==null||c.focus(),a.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:a=>{var d,f;(d=t.onInteractOutside)==null||d.call(t,a),a.defaultPrevented||(o.current=!0,a.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const i=a.target;((f=s.triggerRef.current)==null?void 0:f.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&l.current&&a.preventDefault()}})},"DialogContentNonModal")),jj=u.forwardRef(vs(function(t,n){const{__scopeDialog:s,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:a,...i}=t,c=Zs(ni,s);return wu(),r.jsx(r.Fragment,{children:r.jsx(vw,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:l,onUnmountAutoFocus:a,children:r.jsx(mw,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionPresent?c.descriptionId:void 0,"aria-labelledby":c.titlePresent?c.titleId:void 0,"data-state":Om(c.open),...i,ref:n,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})},"DialogContentImpl")),fM="DialogTitle",pM=u.forwardRef(vs(function(t,n){const{__scopeDialog:s,...o}=t,l=Zs(fM,s),{setTitleCount:a}=l;return Vt(()=>(a(i=>i+1),()=>a(i=>i-1)),[a]),r.jsx(dt.h2,{id:l.titleId,...o,ref:n})},"DialogTitle")),mM="DialogDescription",hM=u.forwardRef(vs(function(t,n){const{__scopeDialog:s,...o}=t,l=Zs(mM,s),{setDescriptionCount:a}=l;return Vt(()=>(a(i=>i+1),()=>a(i=>i-1)),[a]),r.jsx(dt.p,{id:l.descriptionId,...o,ref:n})},"DialogDescription")),gM="DialogClose",xM=u.forwardRef(vs(function(t,n){const{__scopeDialog:s,...o}=t,l=Zs(gM,s);return r.jsx(dt.button,{type:"button",...o,ref:n,onClick:et(t.onClick,()=>l.onOpenChange(!1))})},"DialogClose"));function Om(e){return e?"open":"closed"}vs(Om,"getState");const on=sM,vM=oM,bj=u.forwardRef(({className:e,...t},n)=>r.jsx(lM,{ref:n,"data-slot":"dialog-overlay",className:Ke("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));bj.displayName="DialogOverlay";const Qt=u.forwardRef(({className:e,children:t,showCloseButton:n=!0,...s},o)=>r.jsxs(vM,{"data-slot":"dialog-portal",children:[r.jsx(bj,{}),r.jsxs(cM,{ref:o,"data-slot":"dialog-content",className:Ke("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed z-50 grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...s,children:[t,n&&r.jsxs(xM,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[r.jsx(Ys,{}),r.jsx("span",{className:"sr-only",children:"关闭"})]})]})]}));Qt.displayName="DialogContent";const Yt=u.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-slot":"dialog-header",className:Ke("flex flex-col gap-2 text-center sm:text-left",e),...t}));Yt.displayName="DialogHeader";const Nn=u.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,"data-slot":"dialog-footer",className:Ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t}));Nn.displayName="DialogFooter";const Xt=u.forwardRef(({className:e,...t},n)=>r.jsx(pM,{ref:n,"data-slot":"dialog-title",className:Ke("text-lg leading-none font-semibold",e),...t}));Xt.displayName="DialogTitle";const yM=u.forwardRef(({className:e,...t},n)=>r.jsx(hM,{ref:n,"data-slot":"dialog-description",className:Ke("text-muted-foreground text-sm",e),...t}));yM.displayName="DialogDescription";const wM=/\.(md|markdown)$/i;function _x(e){const t=+e||0;return t<1024?t+" B":t<1024*1024?(t/1024).toFixed(1)+" KB":(t/1024/1024).toFixed(1)+" MB"}function jM(e){const t=new Date((+e||0)*1e3);return isNaN(t.getTime())?"":t.toLocaleString()}function bM({pid:e,path:t,roots:n=null,onClose:s}){const[o,l]=u.useState([t]),a=o[o.length-1],[i,c]=u.useState({loading:!0});u.useEffect(()=>{let g=!0;return c({loading:!0}),Pt.filePreview(e,a).then(h=>{g&&c({data:h})}).catch(h=>{g&&c({error:h.message||"读取失败"})}),()=>{g=!1}},[e,a]);const d=u.useCallback(g=>{const h=g.target&&g.target.closest?g.target.closest("a.md-path"):null,y=h&&h.getAttribute("data-path");y&&(g.preventDefault(),l(j=>j[j.length-1]===y?j:[...j,y]))},[]),f=i.data,p=Pt.fileRawUrl(e,a),m=u.useCallback(()=>{var h;const g=f&&f.path||a;(h=navigator.clipboard)==null||h.writeText(g).then(()=>M("已复制路径"),()=>M("复制失败,请手动选择"))},[f,a]);return r.jsx(on,{open:!0,onOpenChange:g=>{g||s()},children:r.jsxs(Qt,{className:"modal fv-modal w-[66vw] h-[78vh] sm:max-w-none flex flex-col gap-2 p-4 overflow-hidden",showCloseButton:!1,children:[r.jsxs(Yt,{className:"text-left fv-head",children:[r.jsxs("div",{className:"fv-titlebar",children:[o.length>1&&r.jsx("button",{type:"button",className:"fv-act",title:"返回上一个文件",onClick:()=>l(g=>g.slice(0,-1)),children:r.jsx(im,{className:"fv-act-i"})}),r.jsx(Xt,{className:"fv-title",title:f&&f.path||a,children:f&&f.rel||a}),r.jsx("button",{type:"button",className:"fv-act",title:"复制完整路径",onClick:m,children:r.jsx(cm,{className:"fv-act-i"})}),r.jsx("a",{className:"fv-act",href:p,target:"_blank",rel:"noreferrer",title:"在新标签页打开原文(文本按纯文本展示;二进制下载)",children:r.jsx(um,{className:"fv-act-i"})}),r.jsx("button",{type:"button",className:"fv-act",title:"关闭(Esc)",onClick:s,children:r.jsx(Ys,{className:"fv-act-i"})})]}),f&&r.jsxs("div",{className:"fv-meta",children:[_x(f.size)," · ",jM(f.mtime),f.root==="work"?" · 工作目录":" · 项目目录",f.truncated?" · 仅显示前 256KB":""]})]}),r.jsx("div",{className:"fv-body",children:i.loading?r.jsx("div",{className:"fv-hint",children:"读取中…"}):i.error?r.jsxs("div",{className:"fv-hint err",children:[r.jsx(hm,{className:"fv-hint-i"}),r.jsx("span",{children:i.error})]}):f.binary?r.jsxs("div",{className:"fv-hint",children:[r.jsx(sC,{className:"fv-hint-i"}),r.jsxs("span",{children:["二进制文件(",_x(f.size),"),无法预览。",r.jsx("a",{className:"md-path",href:p,target:"_blank",rel:"noreferrer",children:"下载"})]})]}):wM.test(a)?r.jsx("div",{className:"md-body",onClick:d,dangerouslySetInnerHTML:{__html:Vo(io(f.text,e,{roots:n}),{pathLinks:!0})}}):r.jsx("pre",{className:"fv-pre",children:f.text})})]})})}function _j({open:e,info:t,busy:n,disabledReason:s,onHandoff:o,onPass:l,onClose:a}){const i=t||{},c=Number(i.dirty_count||0);return r.jsx(on,{open:!!e,onOpenChange:d=>!d&&a&&a(),children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{children:r.jsx(Xt,{children:"通过前:worktree 改动还没回流主分支"})}),r.jsxs("p",{className:"hint",children:["该卡片在独立 worktree 中开发,改动在分支 ",r.jsx("span",{className:"font-mono",children:i.branch||"—"})," 上, 主分支 ",r.jsx("span",{className:"font-mono",children:i.target||"—"})," 还不知道这些改动。"]}),r.jsxs("p",{className:"hint",children:["待合并提交:",r.jsx("b",{children:i.ahead||0})," 个",i.behind?r.jsxs(r.Fragment,{children:["(主分支领先 ",i.behind," 个提交,需先同步)"]}):null]}),c>0&&r.jsxs("p",{className:"hint",children:["工作树有 ",c," 处未提交改动,交给 agent 时会先提交它们。"]}),r.jsx("p",{className:"hint",children:"「交给 agent 合并」= 平台把合并指令发给卡片主会话并让卡片回开发队列排队: agent 先同步主分支最新代码,再尽量快进(不能快进才生成合并提交)回流,冲突由它解决; 干完这轮卡片自动回「待审核」,那时再点「通过」即完成。"}),i.path&&r.jsxs("p",{className:"hint break-all",children:["工作树:",r.jsx("span",{className:"font-mono",children:i.path})]}),s&&r.jsx("p",{className:"hint",children:s}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",disabled:n,onClick:a,children:"取消"}),r.jsx(V,{variant:"outline",disabled:n,onClick:l,children:"仅通过(不合并)"}),r.jsx(V,{disabled:n||!!s,title:s||void 0,onClick:o,children:n?"提交中…":"交给 agent 合并"})]})]})})}function kj(e,t){const s=e.slice(0,t).match(/(?:^|\s)(\/[^\s]*)$/);return s?{start:t-s[1].length,text:s[1]}:null}const _M="外部会话:本会话由 dsh GUI 直接运行(不是平台启动的),平台的停止/中断对它无效;你仍可发消息,消息按平台队列投递。";function kM(e){return e===!1?_M:""}function SM(e){return e!==!1}const NM="ask_user_question",Qc={pending:"等待回答…",error:"未作答(已中断)"};function Sj(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}function CM(e){return String(e&&e.name||"").toLowerCase()===NM}function EM(e){const t=Sj(e);return(t&&Array.isArray(t.questions)?t.questions:[]).filter(s=>s&&typeof s=="object").map(s=>({id:String(s.id==null?"":s.id),header:String(s.header==null?"":s.header),multiSelect:!!s.multi_select,question:String(s.question==null?"":s.question),options:(Array.isArray(s.options)?s.options:[]).filter(o=>o&&typeof o=="object"&&o.label!=null).map(o=>String(o.label))}))}function RM(e,t=!1){const n=String(e??"").trim();if(t||n.startsWith("Error:"))return{kind:"error",text:""};if(!n)return{kind:"pending",text:""};const s=Sj(n);if(!s||!Array.isArray(s.answers))return n.startsWith("{")||n.startsWith("[")?{kind:"pending",text:""}:{kind:"answer",text:n};const o=[];for(const a of s.answers){if(!a||typeof a!="object")continue;const i=(Array.isArray(a.selected)?a.selected:[]).map(d=>String(d)).filter(d=>d.trim()),c=String(a.custom==null?"":a.custom).trim();i.length&&c?o.push(i.join("、")+";"+c):i.length?o.push(i.join("、")):c&&o.push(c)}const l=o.join(";").trim();return l?{kind:"answer",text:l}:{kind:"pending",text:""}}function PM(e){const t=Array.isArray(e)?e:[],n=new Map;for(const o of t)o&&o.kind==="tool_result"&&o.call_id&&n.set(o.call_id,o);const s=[];for(const o of t)if(o){if(o.kind==="user"){const l=String(o.text||"").trim();l&&s.push({key:"u:"+o.seq,seq:o.seq,kind:"user",text:l,ansSeq:null,state:"user",ask:[]})}else if(o.kind==="tool_call"&&CM(o)){const l=o.call_id?n.get(o.call_id):null,a=RM(l&&l.text,!!(l&&l.is_error));s.push({key:"a:"+o.seq,seq:o.seq,kind:"ask",text:a.text,ansSeq:l?l.seq:null,state:l?a.kind==="answer"?"answered":a.kind:"pending",ask:EM(o.args)})}}return s}function MM(e){return e?e.kind!=="ask"||e.state==="answered"?e.text||"":Qc[e.state]||Qc.pending:""}function TM(e){if(!e||e.kind!=="ask")return e&&e.text||"";const t=(e.ask||[]).map(o=>(o.header?o.header+":":"")+(o.question||"")).filter(Boolean),n=t.length?"agent 提问:"+t.join(" / "):"agent 提问",s=e.state==="answered"?"回答:"+e.text:Qc[e.state]||Qc.pending;return n+`
454
+ `+s}const $M=["think","tool_call","tool_result"],IM=60;function AM(e){return!!e&&$M.includes(e.kind)}function OM(e){const t=[],n=new Map,s=e||[];let o=[];const l=()=>{if(o.length){if(o.length>=2){const a=t.length;t.push({key:"r"+o[0].seq,seq:o[0].seq,proc:!0,items:o});for(const i of o)n.set(i.seq,a)}else{const a=t.length;t.push({key:"r"+o[0].seq,seq:o[0].seq,proc:!1,items:o}),n.set(o[0].seq,a)}o=[]}};for(const a of s)if(AM(a))o.push(a);else{l();const i=t.length;t.push({key:"r"+a.seq,seq:a.seq,proc:!1,items:[a]}),n.set(a.seq,i)}return l(),{rows:t,rowIndexOf:n}}function LM(e){const t=[],n=new Map;for(const s of e){const o=String(s||"").trim()||"工具";n.has(o)||(n.set(o,0),t.push(o)),n.set(o,n.get(o)+1)}return t.map(s=>n.get(s)>1?`${s} ×${n.get(s)}`:s)}function DM(e){const t=e||[],n=t.filter(m=>m.kind==="tool_call"),s=t.filter(m=>m.kind==="think"&&String(m.text||"").trim()).length,o=t.filter(m=>m.kind==="tool_result"),l=o.filter(m=>m.is_error).length,a=n.length?n:o,i=LM(a.map(m=>m.name)),c=[];let d=0;for(const m of i){const g=(c.length?2:0)+m.length;if(c.length&&d+g>IM){c.push("…");break}c.push(m),d+=g}const f=c.join(", "),p=[];return n.length?p.push(`工具 ${n.length} 次${f?` · ${f}`:""}`):f&&p.push(f),s&&p.push(`思考 ${s} 段`),l&&p.push(`错误 ${l} 次`),{text:p.join(" · "),calls:n.length,thinks:s,errors:l}}const zM="touchstone:host-probe",FM="touchstone:host-caps",BM="touchstone:open-session";let si=null,kx=!1;const Yf=new Set;function HM(){return si}function UM(e){return Yf.add(e),()=>{Yf.delete(e)}}function VM(e){si=e;for(const t of[...Yf])try{t(si)}catch{}}function Nj(){return typeof window<"u"&&!!window.parent&&window.parent!==window}function Cj(e){if(!si||!si.openSession||!e||!Nj())return!1;try{return window.parent.postMessage({type:BM,sid:String(e)},window.location.origin),!0}catch{return!1}}function WM(){if(!(kx||typeof window>"u")&&(kx=!0,window.addEventListener("message",e=>{if(e.origin!==window.location.origin)return;const t=e.data||{};t.type===FM&&VM(t.caps||{})}),!!Nj()))try{window.parent.postMessage({type:zM},window.location.origin)}catch{}}function Ej(){return u.useSyncExternalStore(UM,HM,()=>null)}function Ol(e){const t=+e||0;return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"k":String(t)}function Xf(e){const t=+e||0;return t<1e3?"":t<6e4?(t/1e3).toFixed(1)+"s":Math.floor(t/6e4)+"分"+Math.round(t%6e4/1e3)+"s"}function qM(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e||""}}const GM={family:"该智能体暂不支持会话查看",no_session:"会话尚未生成(任务首轮执行后才有会话)",missing:"未找到会话文件(可能已被清理)"},KM=10,Sx=56,Nx=10,ha=60,QM=240,YM=60;function kd(e,t){let n=0,s=e.length-2;if(s<0||t<=0)return 0;for(;n<s;){const o=n+s+1>>1;e[o]<=t?n=o:s=o-1}return n}const Rj=u.memo(function({e:t,wrap:n,flash:s,taskId:o,agent:l,pid:a,roots:i,boardPid:c,boardSid:d,expand:f,rwState:p,copied:m,onCopy:g,onRewind:h,onOpenPath:y}){const j=u.useCallback(v=>{const b=v.target&&v.target.closest?v.target.closest("a.md-path"):null,S=b&&b.getAttribute("data-path");!S||!y||(v.preventDefault(),y(S))},[y]),w=u.useRef(null);u.useEffect(()=>{f&&w.current&&(w.current.open=!0)},[f]);const x=(()=>{if(t.kind==="user"){const v=io(t.text,a,{roots:i}),b=!!(t.text||"").trim();return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"sess-msg user",children:r.jsxs("div",{className:"bubble",children:[v&&r.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:Vo(v)}}),(t.images||[]).map((S,k)=>{const E=S.media?o?Ve.sessionMediaUrl(o,l,S.media):c&&d?Re.sessionMediaUrl(c,d,l,S.media):"":"";return E?r.jsx("a",{href:E,target:"_blank",rel:"noreferrer",children:r.jsx("img",{className:"sess-img",src:E,alt:"图片",onError:R=>{R.currentTarget.closest("a").replaceWith("[图片]")}})},k):r.jsx("span",{className:"sess-img-ph",children:"[图片]"},k)})]})}),(p||b)&&r.jsxs("div",{className:"sess-actrow",children:[p&&r.jsx("button",{type:"button",className:"sess-act rw"+(p==="on"?"":" off"),disabled:p!=="on",title:p==="busy"?"会话运行中或有排队消息,稍后再试":p==="running"?"回退中…":"回退到该提问之前(撤销该提问及其后对话,不回退文件改动)",onClick:()=>h(t),children:r.jsx(Sl,{className:"sess-act-i"})}),b&&r.jsx("button",{type:"button",className:"sess-act cp",title:m?"已复制":"复制该提问",onClick:()=>g(t),children:m?r.jsx(dr,{className:"sess-act-i"}):r.jsx(cm,{className:"sess-act-i"})})]})]})}if(t.kind==="assistant"){const v=io(t.text,a,{roots:i});return r.jsx("div",{className:"sess-msg assistant",children:r.jsx("div",{className:"md-body",onClick:j,dangerouslySetInnerHTML:{__html:Vo(v,{pathLinks:!0})}})})}if(t.kind==="think")return t.text?r.jsxs("details",{className:"sess-msg think",children:[r.jsx("summary",{children:"思考过程"}),r.jsx("div",{className:"think-text",children:t.text})]}):null;if(t.kind==="tool_call")return r.jsxs("details",{className:"sess-msg tool",ref:w,children:[r.jsxs("summary",{children:[r.jsx(gm,{className:"inline h-3 w-3"})," ",t.name||"工具调用"]}),r.jsx("pre",{children:qM(t.args)})]});if(t.kind==="tool_result")return r.jsxs("details",{className:"sess-msg tool result"+(t.is_error?" err":""),ref:w,children:[r.jsxs("summary",{children:[t.is_error?"错误":"结果",t.name?` · ${t.name}`:"","(",String(t.text||"").trim().length," 字符",t.truncated?" · 已截断":"",")"]}),r.jsx("pre",{children:String(t.text||"").trim()})]});if(t.kind==="usage"){const v=[];return t.input&&v.push("↑"+Ol(t.input)),t.output&&v.push("↓"+Ol(t.output)),t.cache_read&&v.push("缓存 "+Ol(t.cache_read)),t.duration_ms&&Xf(t.duration_ms)&&v.push(Xf(t.duration_ms)),v.length?r.jsx("div",{className:"sess-usage",children:v.join(" · ")}):null}if(t.kind==="divider")return r.jsx("div",{className:"sess-divider",children:t.text});if(t.kind==="error"){const v=[t.text,t.code?`[${t.code}]`:"",t.retryable?"可重试":""].filter(Boolean).join(" · ");return r.jsx("div",{className:"sess-msg error",children:r.jsxs("div",{className:"sess-errbox",children:[r.jsx(hm,{className:"sess-errbox-i"}),r.jsxs("div",{children:[r.jsx("div",{className:"sess-errbox-t",children:"模型请求失败,本轮对话已中断"}),v&&r.jsx("div",{className:"sess-errbox-d",children:v})]})]})})}return null})();return x?n?r.jsx("div",{className:"sess-entry"+(s?" flash":""),"data-seq":t.seq,children:x}):x:null}),XM=u.memo(function({row:t,flash:n,expandSeqs:s,taskId:o,agent:l,pid:a,roots:i,boardPid:c,boardSid:d,onOpenPath:f}){const p=u.useRef(null),m=!!s&&t.items.some(h=>s.has(h.seq));u.useEffect(()=>{m&&p.current&&(p.current.open=!0)},[m]);const g=DM(t.items);return r.jsx("div",{className:"sess-entry"+(n?" flash":""),"data-seq":t.seq,children:r.jsxs("details",{className:"sess-msg proc"+(g.errors?" has-err":""),ref:p,children:[r.jsxs("summary",{children:[r.jsx(gm,{className:"inline h-3 w-3"})," ",g.text]}),r.jsx("div",{className:"sess-proc-body",children:t.items.map(h=>r.jsx(Rj,{e:h,taskId:o,agent:l,pid:a,roots:i,boardPid:c,boardSid:d,onOpenPath:f,expand:!!s&&s.has(h.seq)},h.seq))})]})})}),JM=u.memo(function({entries:t,metaNull:n,found:s,reason:o,taskId:l,agent:a,pid:i,roots:c,boardPid:d,boardSid:f,flashSeq:p,expandSeqs:m,chatRunning:g,exitCode:h,boxRef:y,atBottomRef:j,onScroll:w,jumpSeq:x,onJumpHandled:v,rwEnabled:b,rwBusy:S,rewindingMid:k,copiedSeq:E,onCopy:R,onRewind:z,onSwitchSession:N,onOpenPath:I}){const{rows:A,rowIndexOf:W}=u.useMemo(()=>OM(t),[t]),L=A.length,J=u.useRef(new Map),O=u.useRef(new Set),U=u.useRef(null),[F,Z]=u.useState(0),[D,be]=u.useState(null),ge=u.useRef(!0),Te=u.useRef(0),re=u.useRef(null),$e=u.useRef(0),he=u.useRef(!1),De=u.useRef(null),de=u.useMemo(()=>{const C=new Float64Array(L+1),H=J.current;let pe=0;for(const te of H.values())pe+=te;const B=H.size?pe/H.size:Sx;for(let te=0;te<L;te++)C[te+1]=C[te]+(H.get(A[te].seq)||B);return C},[A,L,F]),[me,Ce]=D??[Math.max(0,L-ha),L],_e=u.useCallback(()=>{const C=y.current;C&&(w(),ge.current=C.scrollHeight-C.scrollTop-C.clientHeight<YM,!Te.current&&(Te.current=requestAnimationFrame(()=>{Te.current=0;const H=y.current;H&&be(pe=>{const[B,te]=pe??[Math.max(0,L-ha),L];if(ge.current)return te===L?pe:[Math.max(0,L-ha),L];const ie=Math.max(0,kd(de,H.scrollTop)-Nx),ze=Math.min(L,kd(de,H.scrollTop+H.clientHeight)+1+Nx);return ie===B&&ze===te?pe:[ie,Math.max(ie+1,ze)]})})))},[y,w,L,de]);return u.useEffect(()=>()=>{cancelAnimationFrame(Te.current),cancelAnimationFrame($e.current)},[]),u.useLayoutEffect(()=>{if(!L){J.current.size&&(J.current=new Map),De.current=null,be(null);return}be(C=>{const[H,pe]=C??[Math.max(0,L-ha),L];return j.current?[L-H>QM?Math.max(0,L-ha):Math.min(H,L-1),L]:[Math.min(H,L-1),Math.min(pe,L)]})},[L,j]),u.useEffect(()=>{if(x==null)return;const C=W.get(x);if(C==null){v(x);return}ge.current=!1,re.current={row:A[C].seq,seq:x},be([Math.max(0,C-5),Math.min(L,C+25)])},[x,A,W,L,v]),u.useEffect(()=>{if(typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>Z(H=>H+1));return U.current=C,y.current&&C.observe(y.current),()=>{C.disconnect(),U.current=null,O.current=new Set}},[y]),u.useLayoutEffect(()=>{const C=y.current;if(!C)return;const H=J.current;let pe=!1,B=0;const te=kd(de,C.scrollTop),ie=C.querySelectorAll(".sess-entry[data-seq]");for(let Fe=0;Fe<ie.length;Fe++){const Ze=ie[Fe],rt=+Ze.dataset.seq,ct=Ze.offsetHeight+KM,nt=H.get(rt);nt!==ct&&(H.set(rt,ct),pe=!0,me+Fe<te&&(B+=ct-(nt??Sx)))}B&&!ge.current&&!he.current&&(C.scrollTop+=B);const ze=De.current,Ee=!ze||C.scrollHeight!==ze.sh||C.clientHeight<ze.ch;De.current={sh:C.scrollHeight,ch:C.clientHeight},ge.current&&j.current&&Ee&&(C.scrollTop=C.scrollHeight);const mt=U.current;if(mt){const Fe=new Set;for(let Ze=0;Ze<ie.length;Ze++){const rt=ie[Ze];Fe.add(rt),O.current.has(rt)||(mt.observe(rt),O.current.add(rt))}for(const Ze of O.current)Fe.has(Ze)||(mt.unobserve(Ze),O.current.delete(Ze))}const ot=re.current;if(ot!=null){const Fe=C.querySelector(`[data-seq="${ot.row}"]`);if(Fe){Fe.scrollIntoView({block:"start"}),re.current=null,cancelAnimationFrame($e.current),he.current=!0;let Ze=20,rt=0;const ct=()=>{const nt=y.current,Y=nt&&nt.querySelector(`[data-seq="${ot.row}"]`);if(!Y||!nt){he.current=!1,$e.current=0;return}const qe=Math.round(Y.getBoundingClientRect().top-nt.getBoundingClientRect().top);rt=qe===0?rt+1:0,qe!==0&&Y.scrollIntoView({block:"start"}),--Ze>0&&rt<6?$e.current=requestAnimationFrame(ct):(he.current=!1,$e.current=0)};$e.current=requestAnimationFrame(ct),v(ot.seq)}}pe&&Z(Fe=>Fe+1)}),r.jsxs("div",{className:"sess-body scroll",ref:y,onScroll:_e,children:[n?r.jsx("div",{className:"sess-empty",children:"加载中…"}):s?L?r.jsxs(r.Fragment,{children:[me>0&&r.jsx("div",{className:"sess-pad",style:{height:de[me]}}),A.slice(me,Ce).map(C=>{const H=p!=null&&C.items.some(te=>te.seq===p);if(C.proc)return r.jsx(XM,{row:C,flash:H,expandSeqs:m,taskId:l,agent:a,pid:i,roots:c,boardPid:d,boardSid:f,onOpenPath:I},C.key);const pe=C.items[0],B=!b||!pe.mid?"":k===pe.mid?"running":S?"busy":"on";return r.jsx(Rj,{e:pe,wrap:!0,taskId:l,agent:a,pid:i,roots:c,boardPid:d,boardSid:f,flash:H,expand:!!m&&m.has(pe.seq),rwState:B,copied:E===pe.seq,onCopy:R,onRewind:z,onOpenPath:I},C.key)}),Ce<L&&r.jsx("div",{className:"sess-pad",style:{height:de[L]-de[Ce]}})]}):r.jsx("div",{className:"sess-empty",children:"会话暂无内容"}):r.jsx("div",{className:"sess-empty",children:GM[o]||"会话不可用"}),g&&r.jsxs("div",{className:"sess-running",children:[r.jsx("span",{className:"sess-pulse"}),"工作中…"]}),!g&&h!=null&&h!==0&&r.jsxs("div",{className:"sess-chaterr",children:[r.jsx(qN,{className:"inline h-3 w-3"})," 对话进程异常结束(exit=",h,")"]})]})}),ZM=u.memo(function({withQBar:t,qbarOpen:n,questions:s,flashSeq:o,onJump:l}){return!t||!n?null:r.jsxs("aside",{className:"sess-qbar",children:[r.jsxs("div",{className:"sess-qbar-t",children:["提问索引 ",r.jsx("span",{className:"sess-qbar-n",children:s.length})]}),r.jsxs("div",{className:"sess-qbar-list",children:[s.length===0&&r.jsx("div",{className:"sess-qbar-empty",children:"暂无提问"}),s.map((a,i)=>{const c=MM(a).replace(/\s+/g," "),d=a.kind==="ask";return r.jsxs("button",{type:"button",className:"sess-qitem"+(d?" ask":"")+(d&&a.state!=="answered"?" pend":"")+(o===a.seq?" on":""),onClick:()=>l(a),title:TM(a),children:[r.jsx("span",{className:"sess-qitem-i",children:i+1}),r.jsxs("span",{className:"sess-qitem-t",children:[c.slice(0,60),c.length>60?"…":""]})]},a.key)})]})]})}),eT=u.memo(function({data:t,answer:n}){const[s,o]=u.useState({}),[l,a]=u.useState(!1),[i,c]=u.useState(0),[d,f]=u.useState(!1),p=t==null?void 0:t.qid,m=t==null?void 0:t.approval_id;if(u.useEffect(()=>{o({}),c(0),f(!1)},[p,m]),!(t!=null&&t.pending))return null;const g=t.questions&&t.questions.length?t.questions:[{id:t.wire||"q_0",question:t.question,header:t.header,body:t.body,options:t.options||[],multi_select:t.multi_select,allow_other:t.allow_other,other_label:t.other_label,other_description:t.other_description}],h=g.length>1,y=L=>s[L]||{sel:[],other:"",useOther:!1},j=(L,J)=>o(O=>({...O,[L]:{...O[L]||{sel:[],other:"",useOther:!1},...J}}));async function w(L){a(!0);try{await n(L)}finally{a(!1)}}function x(L,J){const O=y(L.id);L.multi_select?j(L.id,{sel:O.sel.includes(J)?O.sel.filter(U=>U!==J):[...O.sel,J]}):j(L.id,{sel:[J],useOther:!1})}function v(L){j(L.id,L.multi_select?{useOther:!0}:{useOther:!0,sel:[]})}function b(L,J){j(L.id,L.multi_select?{other:J,useOther:!0}:{other:J,useOther:!0,sel:[]})}function S(L){const J=y(L.id),O=(J.other||"").trim();return L.multi_select?J.sel.length&&O?{wire:L.id,kind:"multi_with_other",option_ids:J.sel,text:O}:J.sel.length?{wire:L.id,kind:"multi",option_ids:J.sel}:O?{wire:L.id,kind:"other",text:O}:null:J.sel.length?{wire:L.id,kind:"single",option_id:J.sel[0]}:O?{wire:L.id,kind:"other",text:O}:null}const k=g.map(S),E=!l&&k.every(Boolean);function R(){if(E)return w({qid:p,answers:k})}const z=k.filter(Boolean).length,N=Math.min(Math.max(i,0),g.length-1),I=g[N],A=y(I.id),W=I.options||[];return t.kind==="approval"?d?r.jsxs("button",{type:"button",className:"sess-interaction-bar",title:"展开",onClick:()=>f(!1),children:[r.jsxs("span",{className:"sess-interaction-bar-t",children:["🛡 agent 请求审批:",t.action||t.tool||"工具调用"]}),r.jsx(Uc,{className:"h-3.5 w-3.5"})]}):r.jsxs("div",{className:"sess-interaction",children:[r.jsxs("div",{className:"sess-interaction-head",children:[r.jsxs("div",{className:"sess-interaction-q",children:["🛡 agent 请求审批:",t.action||t.tool||"工具调用"]}),r.jsx("button",{type:"button",className:"sess-interaction-min",title:"最小化",onClick:()=>f(!0),children:r.jsx(ql,{className:"h-3.5 w-3.5"})})]}),t.input&&r.jsx("pre",{className:"sess-interaction-pre",children:t.input}),r.jsxs("div",{className:"sess-interaction-opts",children:[r.jsx(V,{size:"sm",disabled:l,onClick:()=>w({approval_id:m,decision:"approved"}),children:"批准"}),r.jsx(V,{size:"sm",variant:"outline",disabled:l,onClick:()=>w({approval_id:m,decision:"approved",scope:"session"}),children:"本会话内批准"}),r.jsx(V,{size:"sm",variant:"outline",disabled:l,onClick:()=>w({approval_id:m,decision:"rejected"}),children:"拒绝"})]})]}):d?r.jsxs("button",{type:"button",className:"sess-interaction-bar",title:"展开",onClick:()=>f(!1),children:[r.jsxs("span",{className:"sess-interaction-bar-t",children:["🤔 agent 等待你的回答",h?` · 已答 ${z}/${g.length}`:""]}),r.jsx(Uc,{className:"h-3.5 w-3.5"})]}):r.jsxs("div",{className:"sess-interaction",children:[r.jsxs("div",{className:"sess-interaction-head",children:[r.jsxs("div",{className:"sess-interaction-q",children:["🤔 ",h?`问题 ${N+1}/${g.length}`:"agent 等待你的回答",I.header?`(${I.header})`:"",":",I.question||"(详情见会话记录)"]}),r.jsx("button",{type:"button",className:"sess-interaction-min",title:"最小化",onClick:()=>f(!0),children:r.jsx(ql,{className:"h-3.5 w-3.5"})})]}),I.body&&r.jsx("div",{className:"sess-interaction-body",children:I.body}),t.answerable&&r.jsxs("div",{className:"sess-interaction-list",children:[W.map((L,J)=>r.jsxs("label",{className:"sess-iopt"+(A.sel.includes(L.id)?" on":""),children:[r.jsx("input",{type:I.multi_select?"checkbox":"radio",checked:A.sel.includes(L.id),disabled:l,onChange:()=>x(I,L.id)}),r.jsx("span",{className:"sess-iopt-key",children:J+1}),r.jsxs("span",{className:"sess-iopt-text",children:[r.jsx("span",{className:"sess-iopt-label",children:L.label}),L.description&&r.jsx("span",{className:"sess-iopt-desc",children:L.description})]})]},L.id)),I.allow_other&&r.jsxs("label",{className:"sess-iopt"+(A.useOther?" on":""),children:[r.jsx("input",{type:I.multi_select?"checkbox":"radio",checked:A.useOther,disabled:l,onChange:()=>v(I)}),r.jsx("span",{className:"sess-iopt-key",children:W.length+1}),r.jsxs("span",{className:"sess-iopt-text",children:[r.jsx("span",{className:"sess-iopt-label",children:I.other_label||"其他…"}),I.other_description&&r.jsx("span",{className:"sess-iopt-desc",children:I.other_description}),r.jsx("input",{className:"sess-iopt-input",type:"text",value:A.other,placeholder:I.other_label||"其他…",disabled:l,onFocus:()=>v(I),onChange:L=>b(I,L.target.value)})]})]})]}),(t.answerable||h)&&r.jsxs("div",{className:"sess-interaction-foot",children:[h?r.jsxs("div",{className:"sess-inav",children:[r.jsx("button",{type:"button",className:"sess-inav-btn",disabled:N===0,onClick:()=>c(N-1),children:"‹ 上一题"}),g.map((L,J)=>r.jsx("button",{type:"button",className:"sess-inav-dot"+(J===N?" on":"")+(k[J]?" done":""),title:`第 ${J+1} 题${k[J]?"(已答)":"(未答)"}`,onClick:()=>c(J),children:J+1},L.id)),r.jsx("button",{type:"button",className:"sess-inav-btn",disabled:N===g.length-1,onClick:()=>c(N+1),children:"下一题 ›"})]}):r.jsx("span",{className:"sess-interaction-hint",children:I.multi_select?"可多选,选好后点「提交」":"选择后点「提交」"}),t.answerable&&r.jsx(V,{size:"sm",disabled:!E,title:!l&&!E?"还有题目未作答":void 0,onClick:R,children:"提交"})]})]})});function Jf({task:e,board:t,withQBar:n=!0,onUnitState:s,onCardColumn:o,onPassed:l}){var th,nh,sh,rh,oh,lh;const a=e==null?void 0:e.id,i=t==null?void 0:t.sid,c=t==null?void 0:t.projectId,d=t==null?void 0:t.cid,[f,p]=u.useState(null),[m,g]=u.useState([]),[h,y]=u.useState({running:!1}),[j,w]=u.useState("main"),[x,v]=u.useState(!1),[b,S]=u.useState(""),[k,E]=u.useState(!1),[R,z]=u.useState(""),[N,I]=u.useState(""),[A,W]=u.useState(!1),[L,J]=u.useState(null),[O,U]=u.useState(!1),[F,Z]=u.useState(!1),[D,be]=u.useState(null),[ge,Te]=u.useState(""),re=u.useRef(null),[$e,he]=u.useState(!1),[De,de]=u.useState([]),[me,Ce]=u.useState([]),[_e,C]=u.useState(""),[H,pe]=u.useState(()=>new Set),[B,te]=u.useState(null),[ie,ze]=u.useState(null),[Ee,mt]=u.useState({models:[],default:""}),[ot,Fe]=u.useState(null),Ze=_n($=>$.projects),[rt,ct]=u.useState(-1),[nt,Y]=u.useState(!1),[qe,vt]=u.useState([]),[Zt,zt]=u.useState(!0),[ce,$t]=u.useState(null),[pn,ys]=u.useState(null),[P,Q]=u.useState(()=>new Set),ee=u.useRef(null),le=u.useRef(null),ue=u.useRef(!0),oe=u.useRef(-1),Ie=u.useRef(""),Ue=u.useRef(""),Qe=u.useRef(null),Xe=u.useRef(null),jt=u.useRef(null),en=u.useRef(null),ln=u.useRef([1,0]),lt=!!t&&!!(f!=null&&f.running),mn=["running","queued"].includes(e==null?void 0:e.status)||lt,tn=!!(h!=null&&h.running),bt=(f==null?void 0:f.capabilities)||{},Nt=Ej(),Wt=i||(f==null?void 0:f.session_id)||"",Ct=kM(f==null?void 0:f.owned),Pn=!SM(f==null?void 0:f.owned),Cr=!(f!=null&&f.found),ss=(h==null?void 0:h.queued)||0,er=((th=f==null?void 0:f.unit_state)==null?void 0:th.state)||"",rs=(f==null?void 0:f.queue_state)||"",Ts=((nh=f==null?void 0:f.unit_state)==null?void 0:nh.pos)||0,Er=((sh=f==null?void 0:f.unit_state)==null?void 0:sh.total)||0,$s=u.useMemo(()=>rs?{kind:rs,pos:Ts,total:Er}:null,[rs,Ts,Er]);u.useEffect(()=>{s&&s($s)},[$s,s]);const tr=t&&(f==null?void 0:f.card_column)||"";u.useEffect(()=>{o&&o(tr)},[tr,o]);const sl=!!(t&&(f==null?void 0:f.queue_state)==="answer_pending"),rl=!!bt.rewind,os=mn||tn||er==="running"||ss>0||(((rh=f==null?void 0:f.queue)==null?void 0:rh.length)||0)>0||k;u.useEffect(()=>()=>clearTimeout(re.current),[]);const an=t?t.projectId:e==null?void 0:e.project_id,It=Ze.find($=>$.id===an),Rr=u.useMemo(()=>fi(Ze,an),[Ze,an]);u.useEffect(()=>{if(!(It!=null&&It.agent_path)||!an)return;let $=!1;return vt(G=>G.filter(fe=>fe.type!=="skill")),Pt.agentSkills(It.agent_path,It.project_dir||It.work_dir||"").then(G=>{if($)return;const fe=Array.isArray(G)?G:(G==null?void 0:G.skills)||[];vt(ae=>[...ae.filter(Me=>Me.type!=="skill"),...fe.map(Me=>({key:Me.name||Me.id,label:Me.name||Me.id,desc:(Me.description||Me.summary||"").slice(0,40),type:"skill"}))])}).catch(()=>{}),()=>{$=!0}},[It==null?void 0:It.agent_path,an]);const Pr=[{key:"/stop",desc:"停止当前对话",type:"cmd",on:()=>!!bt.chat,run:Mr},{key:"/compact",desc:"压缩会话历史",type:"cmd",on:()=>!!t&&!!bt.compact,run:async()=>{await Re.compact(c,d,i)}},{key:"/new",desc:"创建新会话",type:"cmd",dis:!0},{key:"/clear",desc:"清空并新建会话",type:"cmd",dis:!0},{key:"/plan",desc:"切换计划模式 开/关",type:"cmd",dis:!0},{key:"/swarm",desc:"切换 swarm 模式;/swarm <任务> 直接在 swarm 下执行",type:"cmd",dis:!0},{key:"/goal",desc:"创建/控制目标:/goal <目标>、/goal pause|resume|cancel",type:"cmd",dis:!0},{key:"/btw",desc:"侧边聊天:/btw <问题> 向 fork 的侧边聊天提问",type:"cmd",dis:!0},{key:"/undo",desc:"撤销上一条消息",type:"cmd",dis:!0}],nr=Pr.filter($=>$.dis||$.on()),T=u.useMemo(()=>kj(b,rt>=0?rt:b.length),[b,rt]),q=T!=null&&!nt,ye=T?T.text.slice(1):"";u.useEffect(()=>{if(!a||t)return;let $=!1;p(null),g([]),y({running:!1}),Ce([]),v(!1),oe.current=-1,Ie.current="";function G(Me){Me.addEventListener("meta",Oe=>{if($)return;const ut=JSON.parse(Oe.data);if(ut.session_id&&Ie.current&&ut.session_id!==Ie.current&&(oe.current=-1,g([])),ut.session_id&&(Ie.current=ut.session_id),ut.found&&ut.total<oe.current+1){ae();return}p(ut)}),Me.addEventListener("entries",Oe=>{if($)return;const ut=JSON.parse(Oe.data);if(ut.total<oe.current+1){ae();return}const pt=(ut.entries||[]).filter(at=>at.seq>oe.current);pt.length&&(oe.current=pt[pt.length-1].seq,g(at=>[...at,...pt]),Ce(at=>at.filter(as=>!pt.some(As=>As.kind==="user"&&(As.text||"").includes(as.text.slice(0,50))))))}),Me.addEventListener("chat",Oe=>{$||y(JSON.parse(Oe.data))}),Me.onopen=()=>{$||v(!0)},Me.onerror=()=>{$||v(!1)}}function fe(){const Me=Ve.sessionStream(a,j);Qe.current=Me,G(Me)}function ae(){oe.current=-1,g([]),Qe.current&&(Qe.current.close(),Qe.current=null),fe()}return fe(),()=>{$=!0,Qe.current&&(Qe.current.close(),Qe.current=null)}},[a,j]),u.useEffect(()=>{if(!i)return;let $=!1;p(null),g([]),y({running:!1}),Ce([]),v(!1),oe.current=-1;let G=null,fe=setInterval(Me,2e3);const ae=()=>{jt.current||(jt.current=setTimeout(()=>{jt.current=null,Me()},150))};Xe.current=Oe=>{if(!(!Oe||G)){clearInterval(fe),fe=setInterval(Me,6e4);try{G=Re.sessionStream(c,i),G.addEventListener("hello",ae),G.addEventListener("refresh",ae)}catch{G=null}}};async function Me(){try{const Oe=await Re.sessionMessages(c,i,oe.current+1,j);if($)return;if(Oe.found&&Oe.total<oe.current+1){oe.current=-1,g([]);return}const ut=(Oe.entries||[]).filter(pt=>pt.seq>oe.current);ut.length&&(oe.current=ut[ut.length-1].seq,g(pt=>[...pt,...ut]),Ce(pt=>pt.filter(at=>!ut.some(as=>as.kind==="user"&&(as.text||"").includes(at.text.slice(0,50)))))),p(pt=>({found:Oe.found,reason:Oe.reason,agents:Oe.agents,agent:Oe.agent,total:Oe.total,totals:Oe.totals,session_id:i,capabilities:Oe.capabilities,running:Oe.running,interaction:Oe.interaction,owned:Oe.owned,family:Oe.family,ctx:Oe.ctx,permission:Oe.permission,sessionModel:Oe.sessionModel,sessionEffort:Oe.sessionEffort,unit_state:Oe.unit_state,queue_state:Oe.queue_state,project_busy:Oe.project_busy,card_column:Oe.card_column,answer_pending:Oe.answer_pending,card_worktree:Oe.card_worktree,queue:Oe.queue==null?pt==null?void 0:pt.queue:Oe.queue})),y(Oe.chat||{running:!1}),v(!0)}catch{$||v(!1)}}return Me(),()=>{$=!0,Xe.current=null,clearInterval(fe),jt.current&&(clearTimeout(jt.current),jt.current=null);try{G==null||G.close()}catch{}}},[i,c,j]),u.useEffect(()=>{var $,G;(G=Xe.current)==null||G.call(Xe,!!(($=f==null?void 0:f.capabilities)!=null&&$.events))},[(oh=f==null?void 0:f.capabilities)==null?void 0:oh.events,i]),u.useEffect(()=>{Ue.current=i},[i]);const xe=u.useRef(new Set);u.useEffect(()=>{const $=((h==null?void 0:h.msgs)||[]).filter(G=>G.state==="error");if($.length)for(const G of $)xe.current.has(G.id)||(xe.current.add(G.id),M(`消息发送失败:${G.error||"未知原因"}`),G.id&&Ce(fe=>fe.filter(ae=>ae.id!==G.id)))},[h]),u.useEffect(()=>{if(te(null),ze(null),Fe(null),!i)return;let $=!1;return It!=null&&It.agent_path?Pt.agentModels(It.agent_path).then(G=>{$||mt(G||{models:[],default:""})}).catch(()=>{$||mt({models:[],default:""})}):mt({models:[],default:""}),()=>{$=!0}},[i,It==null?void 0:It.agent_path]),u.useEffect(()=>{(f==null?void 0:f.permission)!=null&&te(f.permission),f!=null&&f.sessionModel&&ze(f.sessionModel),f!=null&&f.sessionEffort&&Fe(f.sessionEffort)},[f==null?void 0:f.permission,f==null?void 0:f.sessionModel,f==null?void 0:f.sessionEffort]);const Be=u.useMemo(()=>xj(Ee,ie||(f==null?void 0:f.sessionModel)||(Ee==null?void 0:Ee.default)||""),[Ee,ie,f==null?void 0:f.sessionModel]),ke=u.useCallback(()=>{const $=le.current;ue.current=$?$.scrollHeight-$.scrollTop-$.clientHeight<60:!0},[]),Et=u.useMemo(()=>{const $=[],G=[],fe=ae=>G.some(Me=>Me&&ae&&Me.slice(0,40)===ae.slice(0,40));for(const ae of(f==null?void 0:f.queue)||[])ae!=null&&ae.text&&($.push({key:"k"+ae.id,text:ae.text,msgId:"",state:"server"}),G.push(ae.text));for(const ae of(h==null?void 0:h.msgs)||[])ae.state==="error"||!ae.text||fe(ae.text)||H.has(ae.id)||($.push({key:"m"+ae.id,text:ae.text,msgId:ae.id,state:ae.state}),G.push(ae.text));for(const ae of me)!ae.text||fe(ae.text)||ae.id&&H.has(ae.id)||($.push({key:"p"+(ae.id||ae.ts),text:ae.text,msgId:ae.id||"",state:"pending"}),G.push(ae.text));return $},[f==null?void 0:f.queue,h,me,H]),ht=u.useRef(new Set);u.useEffect(()=>{const $=new Set(((h==null?void 0:h.msgs)||[]).map(G=>G.id).filter(Boolean));for(const G of $)ht.current.add(G);Ce(G=>{const fe=G.filter(ae=>!(ae.id&&ht.current.has(ae.id)&&!$.has(ae.id)));return fe.length===G.length?G:fe}),pe(G=>{if(!G.size)return G;const fe=new Set([...G].filter(ae=>$.has(ae)));return fe.size===G.size?G:fe})},[h]);const _t=u.useMemo(()=>PM(m),[m]),K=u.useCallback($=>{const G=$&&typeof $=="object"?$:{seq:$,kind:"user"};Q(G.kind==="ask"?new Set([G.seq,G.ansSeq].filter(fe=>fe!=null)):new Set),ys(G.seq)},[]),ft=u.useCallback($=>{ys(null),$t($),clearTimeout(ee.current),ee.current=setTimeout(()=>$t(null),1600)},[]);function Ft(){const $=en.current;if(!$)return;const G=$.value.split(`
455
+ `).length,fe=$.value.length,[ae,Me]=ln.current;G===ae&&Math.abs(fe-Me)<40||(ln.current=[G,fe],$.style.height="auto",$.style.height=Math.min($.scrollHeight,320)+"px")}async function yn($){const G=Array.from($||[]);if(!G.length||$e)return;const fe=t?t.projectId:e==null?void 0:e.project_id;if(fe)for(const ae of G){if(ae.size>10*1024*1024){M(`附件过大(>10MB):${ae.name}`);continue}if(await vm(ae)){M(`已跳过占位图(极小尺寸):${ae.name}(剪贴板里不是有效截图,请重新截图或改用「+」选文件)`);continue}he(!0);try{const Me=await new Promise((at,as)=>{const As=new FileReader;As.onload=()=>at(String(As.result||"").split(",")[1]||""),As.onerror=()=>as(new Error("文件读取失败")),As.readAsDataURL(ae)}),Oe=await Re.uploadMedia(fe,{name:ae.name,mime:ae.type||"application/octet-stream",data:Me}),ut=(ae.type||"").startsWith("image/")?`![${ae.name}](${Oe.abs||Oe.url})`:`[${ae.name}](${Oe.abs||Oe.url})`;de(at=>[...at,{md:ut,url:xm(Oe.url),abs:Oe.abs,name:ae.name,mime:ae.type}]);const pt=en.current;if(pt&&document.activeElement===pt&&pt.selectionStart!=null){const at=pt.selectionStart,as=pt.selectionEnd;S(As=>As.slice(0,at)+ut+As.slice(as)),requestAnimationFrame(()=>{pt.selectionStart=pt.selectionEnd=at+ut.length,ct(at+ut.length)})}else S(at=>(at?at+`
456
+ `:"")+ut+`
457
+ `),ct(-1);Ft(),M(`已添加附件:${ae.name}`)}catch(Me){M(Me.message||"附件上传失败")}finally{he(!1)}}}function ws($){var ae;const fe=Array.from(((ae=$.clipboardData)==null?void 0:ae.items)||[]).filter(Me=>Me.kind==="file").map(Me=>Me.getAsFile()).filter(Boolean);fe.length&&($.preventDefault(),yn(fe))}function ol($){var fe;const G=Array.from(((fe=$.dataTransfer)==null?void 0:fe.files)||[]);G.length&&($.preventDefault(),yn(G))}async function js(){const $=b.trim();if(!(!$||k||Cr)){if(/^\/[\w-]+$/.test($)){const G=Pr.find(fe=>fe.key===$);if(G){if(G.dis||!(G.on&&G.on())){M(`当前环境不支持 ${$}`);return}S(""),ct(0),requestAnimationFrame(Ft);try{if(await G.run()===!1)return;M(`已执行 ${$}`)}catch(fe){M(fe.message||`指令执行失败:${$}`)}return}}E(!0);try{if(t){const G=await Re.addComment(c,d,$),fe=await Re.sendComment(c,d,G.id,!1);fe!=null&&fe.queued&&Ce(ae=>[...ae,{text:$,ts:Date.now(),id:fe.msg_id||""}])}else{const G=await Ve.sessionChat(a,$);G!=null&&G.queued&&Ce(fe=>[...fe,{text:$,ts:Date.now(),id:G.msg_id||""}])}S(""),ue.current=!0,requestAnimationFrame(Ft)}catch(G){M(G.message)}finally{E(!1)}}}async function Mr(){try{if(t){const $=await Re.stopCard(c,d);if($&&$.stopped===!1)return M("该会话未在运行或无法停止"),!1}else await Ve.sessionChatStop(a);return Ce([]),!0}catch($){return M($.message),!1}}async function Mn($){if(!$||$===B)return;const G=i;try{if(await Re.setSessionProfile(c,G,{permission_mode:$}),G!==Ue.current)return;te($),M(`权限已切换:${(Kc.find(fe=>fe.value===$)||{}).label||$}`)}catch(fe){G===Ue.current&&M(fe.message)}}async function ls($){const G=i;try{if(await Re.setSessionProfile(c,G,{model:$}),G!==Ue.current)return;ze($),M(`模型已切换:${$}`)}catch(fe){G===Ue.current&&M(fe.message)}}async function _($){if(!$||$==="__default__"||$===ot)return;const G=i;try{if(t?await Re.setSessionProfile(c,G,{reasoning_effort:$}):await Ve.sessionProfile(a,{reasoning_effort:$}),G&&G!==Ue.current)return;Fe($),M(`思考等级已切换:${eM($)}`)}catch(fe){(!G||G===Ue.current)&&M(fe.message)}}async function se($){try{const G=t?await Re.answerInteraction(c,d,$):await Ve.answerInteraction(a,$);M(G&&G.queued?"已提交答案:项目忙,等待空闲后自动送达":"已回答")}catch(G){M(G.message)}}async function Se($){if($!=null&&$.msgId){I($.key);try{t?await Re.injectSessionMsg(c,i,$.msgId):await Ve.sessionChatInject(a,$.msgId),M("已注入当前上下文"),Ce(G=>G.filter(fe=>fe.id!==$.msgId))}catch(G){M(G.message)}finally{I("")}}}async function Pe($){const G=($&&$.length?$:Et).filter(gj);if(!G.length){M("没有可取消的排队消息");return}const fe=!!($&&$.length===1),ae=fe?G[0].key:"__all__";C(ae);try{const Me=fe?G[0].msgId:"",Oe=t?await Re.cancelQueue(c,d,Me):await Ve.sessionChatCancelQueue(a,Me),ut=Oe&&Oe.msgs||[],pt=ut.map(at=>at.id).filter(Boolean);pt.length&&(pe(at=>new Set([...at,...pt])),Ce(at=>at.filter(as=>!pt.includes(as.id))),S(at=>YP(at,ut.map(as=>as.text))),ct(-1),Y(!0),requestAnimationFrame(()=>{var at;Ft(),(at=en.current)==null||at.focus()})),M(XP(ut.length,fe))}catch(Me){M(Me.message)}finally{C("")}}async function He(){Z(!0);try{await Re.deliverAnswer(c,d),M("已送达答案")}catch($){M($.message)}finally{Z(!1)}}async function We(){W(!0);try{if(t&&(f!=null&&f.card_worktree)){let $=null;try{$=await Re.worktreePreview(c,d)}catch{$=null}if($&&$.merge&&$.merge.ahead>0){J($.merge);return}}await Re.moveCard(c,d,"done"),M("已通过,卡片移入「已完成」"),l&&l()}catch($){M($.message)}finally{W(!1)}}async function hn(){U(!0);try{await Re.mergeWorktree(c,d),J(null),M("已交给 agent 合并:卡片回到开发队列排队,完成后自动回「待审核」")}catch($){M($.message)}finally{U(!1)}}async function Bt(){J(null),W(!0);try{await Re.moveCard(c,d,"done",void 0,null,!0),M("已通过,卡片移入「已完成」"),l&&l()}catch($){M($.message)}finally{W(!1)}}const wo=u.useCallback($=>z($||""),[]);function jo($){var ae;const G=($==null?void 0:$.text)||"";if(!G.trim())return;const fe=(ae=navigator.clipboard)==null?void 0:ae.writeText(G);fe&&fe.catch&&fe.catch(()=>M("复制失败:浏览器未授予剪贴板权限")),be($.seq),clearTimeout(re.current),re.current=setTimeout(()=>be(null),1400)}async function sr($){const G=($==null?void 0:$.mid)||"";if(!G||ge)return;const fe=m.filter(Me=>Me.kind==="user"&&Me.seq>=$.seq).length,ae=($.text||"").trim().replace(/\s+/g," ").slice(0,60);if(window.confirm(`回退到该提问之前?
458
+
459
+ 将撤销该提问及其后共 ${fe} 轮对话:
460
+ ${ae}${ae.length>=60?"…":""}
461
+
462
+ 只回退对话上下文,不回退文件改动;此操作不可撤销。`)){Te(G);try{const Me=t?await Re.rewindSession(c,i,G):await Ve.sessionRewind(a,G);Me!=null&&Me.new_session_id&&!Me.rebound?(M(`已回退 ${fe} 轮对话:历史已复制为新会话,正在切换`),onSwitchSession==null||onSwitchSession(Me.new_session_id)):M(`已回退 ${fe} 轮对话,原提问已回填输入框`),S($.text||""),g(Oe=>Oe.filter(ut=>ut.seq<$.seq)),oe.current=$.seq-1,Ft()}catch(Me){M(`回退失败:${(Me==null?void 0:Me.message)||"未知原因"}`)}finally{Te("")}}}function bo($){S(G=>G.replace($,""))}u.useEffect(()=>{const $=en.current;if(!$)return;const G=()=>ct($.selectionStart??0),fe=()=>{ct($.selectionStart??0),Y(!1)};return $.addEventListener("keyup",G),$.addEventListener("click",fe),()=>{$.removeEventListener("keyup",G),$.removeEventListener("click",fe)}},[bt.chat]);function _o($){var G;S($),ct(((G=en.current)==null?void 0:G.selectionStart)??$.length),Y(!1),Ft()}function Is($){if(!T)return;const G=$.type==="skill"?`使用 skill「${$.label}」`:$.key;Y(!0),S(ae=>ae.slice(0,T.start)+G+ae.slice(T.start+T.text.length));const fe=T.start+G.length;ct(fe),requestAnimationFrame(()=>{const ae=en.current;ae&&(ae.selectionStart=ae.selectionEnd=fe)}),Ft()}function Tr($){M(`当前环境不支持 ${$.key}`)}const oa=(f==null?void 0:f.agents)||[],$r=f==null?void 0:f.totals,eh=$r&&(f!=null&&f.found)?[`共 ${f.total} 条`,$r.input?`↑${Ol($r.input)}`:"",$r.output?`↓${Ol($r.output)}`:"",$r.cache_read?`缓存 ${Ol($r.cache_read)}`:"",Xf($r.duration_ms)].filter(Boolean).join(" · "):"";return r.jsxs("div",{className:"sess-view",children:[r.jsxs("div",{className:"sess-wrap",children:[r.jsx(ZM,{withQBar:n,qbarOpen:Zt,questions:_t,flashSeq:ce,onJump:K}),r.jsxs("div",{className:"sess-main",children:[r.jsxs("div",{className:"sess-sub",children:[n&&r.jsx("button",{type:"button",className:"sess-qbar-toggle",title:Zt?"收起提问索引":"展开提问索引",onClick:()=>zt($=>!$),children:r.jsx(pC,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"sess-conn"+(x?" on":""),title:x?"SSE 已连接(实时更新)":"连接中断,自动重连中…"}),(f==null?void 0:f.session_id)&&r.jsx("span",{className:"sess-chip mono",title:f.session_id,children:f.session_id.replace(/^session_/,"").slice(0,8)}),(f==null?void 0:f.model)&&r.jsx("span",{className:"sess-chip",children:f.model}),oa.length>1&&r.jsx("span",{className:"sess-agents",children:oa.map($=>r.jsxs("button",{type:"button",className:"sess-agent"+(((f==null?void 0:f.agent)||j)===$.id?" on":""),onClick:()=>w($.id),children:[$.id,$.type==="sub"?" (子)":""]},$.id))}),r.jsx("span",{style:{flex:1}}),!!(Nt!=null&&Nt.openSession)&&r.jsx(V,{size:"sm",variant:"ghost",className:"sess-open-dsh",title:Wt?"在 dsh 界面打开当前会话":"尚无会话",disabled:!Wt,onClick:()=>Cj(Wt),children:r.jsx(um,{className:"h-3.5 w-3.5"})}),t&&["doing","review"].includes(t.column)&&r.jsxs(V,{size:"sm",variant:"outline",className:"sess-pass",disabled:A,title:"通过:卡片移入「已完成」",onClick:We,children:[r.jsx(dr,{className:"h-3.5 w-3.5"})," 通过"]}),eh&&r.jsx("span",{className:"sess-totals",title:"输入 / 输出 / 缓存读取 / 总耗时",children:eh})]}),Ct&&r.jsxs("div",{className:"mb-2 flex items-start gap-2 rounded-md border border-border bg-secondary/60 px-3 py-2 text-xs leading-relaxed text-muted-foreground",children:[r.jsx(hm,{className:"mt-0.5 h-3.5 w-3.5 flex-none text-primary"}),r.jsx("span",{children:Ct})]}),r.jsx(JM,{entries:m,metaNull:!f,found:!!(f!=null&&f.found),reason:f==null?void 0:f.reason,taskId:a,agent:(f==null?void 0:f.agent)||j,pid:t?c:an,roots:Rr,boardPid:t?c:"",boardSid:t?i:"",flashSeq:ce,expandSeqs:P,chatRunning:tn,exitCode:h==null?void 0:h.exit_code,boxRef:le,atBottomRef:ue,onScroll:ke,jumpSeq:pn,onJumpHandled:ft,rwEnabled:rl,rwBusy:os,rewindingMid:ge,copiedSeq:D,onCopy:jo,onRewind:sr,onOpenPath:wo}),((lh=f==null?void 0:f.interaction)==null?void 0:lh.pending)&&r.jsx(eT,{data:f.interaction,answer:se}),bt.chat&&r.jsx(JP,{value:b,onChange:_o,atts:De,onRemoveAtt:bo,uploading:$e,inputLocked:Cr,caps:bt,meta:f,onSend:js,onStop:Mr,stopDisabled:Pn,chatRunning:tn,taskRunning:mn,queuedN:ss,board:t,sending:k,permMode:B,modelSel:ie,modelOpts:Ee,onSetModel:ls,onSetPermission:Mn,effortSel:ot,effortOpts:Be,onSetEffort:_,queueRows:Et,injecting:N,onInject:Se,cancelling:_e,onCancelQueuedRow:$=>Pe([$]),onCancelQueue:()=>Pe([]),answerPending:sl,deliveringAnswer:F,onDeliverAnswer:He,slashOpen:q,slashQuery:ye,slashItems:[...nr,...qe],onSlashSelect:Is,onSlashClose:()=>Y(!0),onSlashDisabled:Tr,onPasteFiles:ws,onDropFiles:ol,onUploadFiles:yn,taRef:en})]})]}),R&&(t?c:an)&&r.jsx(bM,{pid:t?c:an,path:R,roots:Rr,onClose:()=>z("")}),r.jsx(_j,{open:!!L,info:L,busy:O,disabledReason:f!=null&&f.running||h!=null&&h.running?"会话运行中:等这一轮跑完,或先点「停止」再交接":"",onHandoff:hn,onPass:Bt,onClose:()=>!O&&J(null)})]})}const tT={todo:"待开发",doing:"正在开发",blocked:"阻塞",review:"待审核",done:"已完成"};function nT({column:e}){const t=tT[e];return t?r.jsx("span",{className:"sess-colstate",title:"卡片当前所在列(看板队列)",children:t}):null}const sT={running:"该会话所属任务/卡片正在运行",starting:"卡片已交平台启动,等待会话证实运行(启动中)",answer_pending:"答案已被平台收下,等项目空闲送达",interaction_pending:"agent 向用户提问挂起,等待作答",server_queued:"消息已在 agent 服务端队列排队",foreign_busy:"项目被外部同步会话占用,等其结束后按队列补位"};function rT({state:e}){if(!e||!e.kind)return null;const t=e.kind,n=e.pos||0,s=e.total||0;if(t==="idle")return r.jsxs("span",{className:"sess-qstate",title:"不在统一队列中(既未排队也无运行中的单元)",children:[r.jsx("span",{className:"dot"}),"空闲"]});const o=(t==="queued_serial"||t==="answer_pending")&&n>0,l=$f[t]||t,a=o?`统一队列排队中:本项目前面还有 ${Math.max(0,n-1)} 个单元(本项目排队 ${s} 个)`:sT[t]||"";return r.jsxs("span",{className:sw(t,"sess"),title:a,children:[r.jsx("span",{className:"dot"}),l,o?` · 第 ${n} 位`:""]})}function Yc({task:e,board:t,onClose:n,onSwitchSession:s}){const o=!!e||!!t,{rzOn:l,rzStyle:a,rzStart:i,rzDragStart:c,rzReset:d}=fr("ts.sessW"),[f,p]=u.useState(null),[m,g]=u.useState("");return u.useEffect(()=>{o||(p(null),g(""))},[o]),r.jsx(on,{open:o,onOpenChange:h=>{h||n()},children:r.jsxs(Qt,{className:"modal modal-rz sess-modal w-[75vw] h-[90vh] sm:max-w-[94vw] grid-rows-[auto_minmax(0,1fr)]"+(l?" rz-drag":""),style:{...a,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:i,reset:d}),r.jsx(Yt,{className:"text-left",children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsxs(Xt,{className:"cursor-move select-none text-sm",onMouseDown:c,children:["会话 · ",(e==null?void 0:e.name)||(t==null?void 0:t.title)||(t==null?void 0:t.sid)]}),r.jsx(nT,{column:m}),r.jsx(rT,{state:f})]})}),e&&r.jsx(Jf,{task:e,onUnitState:p}),t&&r.jsx(Jf,{board:t,onUnitState:p,onCardColumn:g,onPassed:n,onSwitchSession:s})]})})}const hs=u.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{ref:n,"data-slot":"textarea",className:Ke("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t}));hs.displayName="Textarea";function Lm({className:e,...t}){return r.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:r.jsx("table",{"data-slot":"table",className:Ke("w-full caption-bottom text-sm",e),...t})})}function Dm({className:e,...t}){return r.jsx("thead",{"data-slot":"table-header",className:Ke("[&_tr]:border-b",e),...t})}function zm({className:e,...t}){return r.jsx("tbody",{"data-slot":"table-body",className:Ke("[&_tr:last-child]:border-0",e),...t})}function Do({className:e,...t}){return r.jsx("tr",{"data-slot":"table-row",className:Ke("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function In({className:e,...t}){return r.jsx("th",{"data-slot":"table-head",className:Ke("text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function kn({className:e,...t}){return r.jsx("td",{"data-slot":"table-cell",className:Ke("p-2 align-middle whitespace-nowrap",e),...t})}const oT={rounds:"达到轮数后自动停止(每轮由 agent 执行一次内置测试流程)",bugs:"案例库新增 bug_report 数达到后自动停止",deadline:"到达截止时间后结束本轮并停止(日历点选日期与时间)",duration:"运行达到设定时长后停止(每轮结束后检查;一轮进行中不打断)"},Cx=["stopped","failed","interrupted"],Ex={name:"",task_type:"normal",brief:"",end_stage:"report",auto_fix:!1,retest:"不复测",stop_type:"rounds",stop_value:1,deadline_date:"",deadline_time:"23:59",dur_value:30,dur_unit:"min",extra:"",date_from:"",date_to:""};function lT(e){return e.stop_type==="deadline"?e.deadline_date?{value:e.deadline_date+"T"+(e.deadline_time||"23:59")}:{err:"请选择截止日期"}:e.stop_type==="duration"?!e.dur_value||e.dur_value<=0?{err:"请填写时长"}:{value:String(Math.round(e.dur_value*{min:60,hour:3600,day:86400}[e.dur_unit]))}:e.stop_value?{value:String(e.stop_value)}:{err:"请填写停止条件"}}function aT(e){const t={stop_type:e.stop_type||"rounds",stop_value:1,deadline_date:"",deadline_time:"23:59",dur_value:30,dur_unit:"min"};if(t.stop_type==="deadline"){const[n,s]=String(e.stop_value||"").split("T");t.deadline_date=n||"",t.deadline_time=s||"23:59"}else if(t.stop_type==="duration"){const n=+e.stop_value||0;n%86400===0&&n?(t.dur_value=n/86400,t.dur_unit="day"):n%3600===0&&n?(t.dur_value=n/3600,t.dur_unit="hour"):(t.dur_value=Math.max(1,Math.round(n/60)),t.dur_unit="min")}return t}const Rx={normal:"探索",fix:"修复",retest_bug:"复测",script_retest:"脚本复测",stress:"压测",regression:"回归",pipeline:"后段",reject:"修例"},Zf=[{v:"gen_case",label:"测试用例生成"},{v:"execute",label:"测试"},{v:"report",label:"生成报告"},{v:"analyze",label:"报告分析"},{v:"fix",label:"问题修复"},{v:"deploy",label:"重新部署"},{v:"retest",label:"复测"}],qi={normal:Zf,regression:Zf.filter(e=>e.v!=="gen_case")},Sd=e=>(Zf.find(t=>t.v===e)||{}).label||"",iT={rounds:"执行轮数",bugs:"累计新 bug",deadline:"截止时间",duration:"持续时长"},cT={queued:0,running:1,done:2,stopped:3,failed:4,interrupted:5},uT=[{k:"name",label:"任务"},{k:"status",label:"状态"},{k:"round",label:"轮次",cls:"num"},{k:"bugs",label:"新bug",cls:"num"},{k:"created",label:"创建"},{k:"ended",label:"结束"}];function dT(e){const t=e.stop_value||"";return e.stop_type==="rounds"?`执行 ${t} 轮`:e.stop_type==="bugs"?`累计新 bug ≥ ${t}`:e.stop_type==="deadline"?`截止 ${String(t).replace("T"," ")}`:e.stop_type==="duration"?`持续 ${fT(t)}`:e.stop_type}function fT(e){const t=+e;return!t||t<=0?String(e||""):t%86400===0?t/86400+" 天":t%3600===0?t/3600+" 小时":t%60===0?t/60+" 分钟":t+" 秒"}function pT({onCreated:e}={}){const t=_n(),n=t.currentProject,[s,o]=u.useState(Ex),[l,a]=u.useState(!1),[i,c]=u.useState(null),[d,f]=u.useState(!1),[p,m]=u.useState(""),[g,h]=u.useState(null),[y,j]=u.useState(1),[w,x]=u.useState(null),[v,b]=u.useState(null),[S,k]=u.useState([]),[E,R]=u.useState(null),z=t.tasks.find(C=>C.id===E)||null,{rzOn:N,rzStyle:I,rzStart:A,rzDragStart:W,rzReset:L}=fr(),[J,O]=u.useState(""),U=t.tasks.filter(C=>C.project_id===(n==null?void 0:n.id)),F=u.useMemo(()=>{const C=J.trim().toLowerCase();return C?U.filter(H=>(H.name||"").toLowerCase().includes(C)||(H.session_title||"").toLowerCase().includes(C)||(H.session_id||"").toLowerCase().includes(C)):U},[U,J]),Z=u.useMemo(()=>{if(!g)return F;const C=H=>{switch(g){case"status":return cT[H.status]??99;case"round":return H.current_round??0;case"bugs":return H.new_bugs??0;case"created":return H.created_at||"";case"ended":return H.ended_at||"";default:return H.name||""}};return[...U].sort((H,pe)=>{const B=C(H),te=C(pe);return B===te?0:B===""||B==null?1:te===""||te==null?-1:B<te?-y:y})},[F,g,y]);function D(C){g!==C?(h(C),j(1)):y===1?j(-1):(h(null),j(1))}async function be(){try{await t.updateProject(n.id,{guide_text:p}),f(!1),M("项目提示词已保存")}catch(C){M(C.message)}}async function ge(){if(!i&&s.task_type==="regression"&&!s.extra.trim()){M("请填写重跑指令");return}if(!i&&s.task_type==="retest_bug"&&!s.date_from&&!s.date_to){M("复测任务需填写提交日期范围");return}if(s.date_from&&s.date_to&&s.date_from>s.date_to){M("日期范围不正确:起始晚于结束");return}const C=!i&&s.task_type==="stress"?{value:"1"}:lT(s);if(C.err){M(C.err);return}const H={name:s.name,task_type:s.task_type,brief:s.brief.trim(),end_stage:s.end_stage||void 0,auto_fix:s.auto_fix,retest:s.retest,stop_type:s.stop_type,stop_value:C.value,extra:s.extra.trim(),date_from:s.date_from||void 0,date_to:s.date_to||void 0};try{i?(await Ve.continue(i.id,H),M("已入队,接着原会话续跑")):(await Ve.create(n.id,H),M("任务已入队"),s.task_type==="stress"&&(e==null||e("stress"))),o({...s,name:"",brief:"",extra:""}),a(!1),c(null),await t.loadTasks()}catch(pe){M(pe.message)}}async function Te(C){if(window.confirm(`确认删除任务「${C.name}」?
463
+ 轮次记录一并删除(日志文件保留在磁盘),该操作不可恢复。`))try{await Ve.remove(C.id),M("任务已删除"),w===C.id&&_e(),E===C.id&&R(null),await t.loadTasks()}catch(H){M(H.message)}}async function re(C,H){try{await Ve[H](C),M(H==="stop"?"已请求停止":"已清空轮次重启入队(从第一轮重跑)"),await t.loadTasks(),w===C&&await he(C)}catch(pe){M(pe.message)}}async function $e(C){if(w===C){_e();return}try{const H=await Ve.get(C);b(H),x(C),await De(C)}catch(H){M(H.message)}}async function he(C){try{b(await Ve.get(C)),await De(C)}catch(H){M(H.message)}}async function De(C){k(await Ve.rounds(C))}function de(C,H){window.open(`/log?task=${C}&round=${H}`,"_blank")}function me(){o({...Ex}),c(null),a(!0)}function Ce(C){const H=aT(C);o({name:C.name,task_type:C.task_type||"normal",brief:"",end_stage:C.end_stage||"",auto_fix:!!C.auto_fix,retest:C.retest||"不复测",stop_type:H.stop_type,stop_value:H.stop_value,deadline_date:H.deadline_date,deadline_time:H.deadline_time,dur_value:H.dur_value,dur_unit:H.dur_unit,extra:C.extra||""}),c(C),a(!0)}function _e(){x(null),b(null),k([])}return r.jsxs("div",{className:"tasks-tab scroll",children:[n&&r.jsxs("div",{className:"card",children:[r.jsx("h3",{children:"项目信息"}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"项目目录"}),r.jsx("span",{className:"v",children:n.project_dir})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"智能体"}),r.jsx("span",{className:"v",children:(n.agent_path||"").startsWith("dsh-plugin:")?`dsh(插件·进程内) ${n.agent_path.slice(11)}`:n.agent_path||"(未设置)"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"模型"}),r.jsx("span",{className:"v",children:n.model||"(智能体默认)"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"工作目录"}),r.jsx("span",{className:"v",children:n.work_dir})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"环境标签"}),r.jsx("span",{className:"v",children:n.env_label||"(未设置)"})]}),r.jsxs("div",{className:"guide-block",children:[r.jsxs("div",{className:"guide-head",children:[r.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"项目附加提示词"}),r.jsx("span",{className:"hint",children:"编辑后保存;内容会加入每个任务的提示词"}),r.jsx("span",{className:"spacer"}),d?r.jsxs(r.Fragment,{children:[r.jsxs(V,{size:"sm",onClick:be,children:[r.jsx($C,{})," 保存"]}),r.jsxs(V,{variant:"outline",size:"sm",onClick:()=>f(!1),children:[r.jsx(Ys,{})," 取消"]})]}):r.jsxs(V,{variant:"outline",size:"sm",onClick:()=>{m(n.guide_text||""),f(!0)},children:[r.jsx(pm,{})," 编辑"]})]}),d?r.jsx(hs,{value:p,onChange:C=>m(C.target.value),rows:4,placeholder:"填写如何理解项目、如何写 git commit message、如何部署项目的 skill 或相关信息…"}):r.jsx("div",{className:"guide-read"+(n.guide_text?"":" empty"),children:n.guide_text||"未填写项目附加提示词。点击「编辑」填写如何理解项目、如何写 git commit message、如何部署项目的 skill 或相关信息;内容会加入每个任务的提示词。"})]})]}),n&&r.jsxs("div",{className:"card",children:[r.jsxs("h3",{className:"card-title-row",children:["任务列表",r.jsx("span",{className:"spacer"}),r.jsx(Ae,{className:"h-8 w-[240px]",placeholder:"搜索任务名称 / session id",value:J,onChange:C=>O(C.target.value)}),r.jsxs(V,{size:"sm",className:"ml-2",onClick:me,children:[r.jsx(Lo,{})," 新建任务"]})]}),U.length?F.length?r.jsxs("div",{className:"tl",children:[r.jsxs("div",{className:"tl-head tl-grid",children:[uT.map(C=>r.jsxs("span",{className:"th-sort"+(C.cls?" "+C.cls:"")+(g===C.k?" on":""),onClick:()=>D(C.k),title:"点击排序:升序 → 降序 → 还原",children:[C.label,g===C.k&&(y===1?r.jsx(Uc,{className:"inline h-3 w-3"}):r.jsx(ql,{className:"inline h-3 w-3"}))]},C.k)),r.jsx("span",{className:"tl-ops",children:"操作"})]}),Z.map(C=>r.jsxs("div",{children:[r.jsxs("div",{className:"tl-row tl-grid"+(w===C.id?" open":""),onClick:()=>$e(C.id),title:w===C.id?"收起详情":"点击查看详情",children:[r.jsxs("div",{className:"tl-name",children:[C.name,C.task_type!=="normal"&&r.jsx("span",{className:"badge st-running",style:{verticalAlign:-2},children:Rx[C.task_type]||C.task_type}),C.task_type==="fix"&&(C.auto_commit||C.auto_deploy||C.auto_retest)&&r.jsxs("span",{className:"badge st-stopped",style:{verticalAlign:-2},children:[C.auto_commit?"自动提交":"",C.auto_commit&&C.auto_deploy?"/":"",C.auto_deploy?"自动部署":"",C.auto_deploy&&C.auto_retest?"/":"",C.auto_retest?"自动复测":""]}),C.error&&r.jsx("div",{className:"tl-err",children:C.error})]}),r.jsx("div",{children:r.jsxs("span",{className:"badge st-"+C.status,children:[r.jsx("span",{className:"dot"}),hr[C.status]||C.status]})}),r.jsx("div",{className:"mono num",children:C.current_round}),r.jsx("div",{className:"mono num",children:C.new_bugs}),r.jsx("div",{className:"mono",children:is(C.created_at)}),r.jsx("div",{className:"mono",children:is(C.ended_at)}),r.jsxs("div",{className:"tl-ops",children:[r.jsx(V,{variant:"outline",size:"sm",className:"px-2",title:"会话(查看原始对话内容,可直接在会话中继续对话)",onClick:H=>{H.stopPropagation(),R(C.id)},children:r.jsx(_C,{})}),(C.status==="running"||C.status==="queued")&&r.jsxs(V,{variant:"outline",size:"sm",onClick:H=>{H.stopPropagation(),re(C.id,"stop")},children:[r.jsx(mm,{})," 停止"]}),C.task_type!=="stress"&&["stopped","failed","interrupted","done"].includes(C.status)&&r.jsxs(V,{variant:"outline",size:"sm",title:"继续:修改参数后接着当前会话续跑(不新建会话、不清空轮次)",onClick:H=>{H.stopPropagation(),Ce(C)},children:[r.jsx(HC,{})," 继续"]}),(Cx.includes(C.status)||C.task_type==="stress"&&C.status==="done")&&r.jsxs(V,{variant:"outline",size:"sm",onClick:H=>{H.stopPropagation(),re(C.id,"restart")},children:[r.jsx(Mf,{})," 重启"]}),C.status!=="running"&&r.jsx(V,{variant:"outline",size:"sm",className:"px-2",title:"删除任务(轮次记录一并删除,不可恢复)",onClick:H=>{H.stopPropagation(),Te(C)},children:r.jsx(Qs,{})})]})]}),w===C.id&&v&&r.jsxs("div",{className:"tl-detail",children:[r.jsxs("div",{className:"tl-detail-head",children:[r.jsx("b",{children:"任务详情"}),r.jsxs("span",{className:"dim",children:["「",v.name,"」"]}),r.jsx("span",{className:"spacer"}),r.jsxs(V,{variant:"outline",size:"sm",className:"h-6 px-2 text-[calc(11px*var(--fs))]",onClick:()=>he(C.id),children:[r.jsx(Za,{})," 刷新"]}),r.jsxs(V,{variant:"outline",size:"sm",className:"h-6 px-2 text-[calc(11px*var(--fs))]",onClick:_e,children:[r.jsx(Ys,{})," 收起"]})]}),r.jsxs("div",{className:"detail-grid",children:[r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"状态"}),r.jsx("span",{className:"v",children:r.jsxs("span",{className:"badge st-"+v.status,children:[r.jsx("span",{className:"dot"}),hr[v.status]||v.status]})})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"任务类型"}),r.jsx("span",{className:"v",children:Rx[v.task_type]||v.task_type})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"阶段范围"}),r.jsx("span",{className:"v",children:v.start_stage?`${Sd(v.start_stage)} → ${Sd(v.end_stage)||v.end_stage}`:"(按类型默认)"})]}),v.task_type==="pipeline"&&r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"前段任务"}),r.jsxs("span",{className:"v",children:["#",(()=>{try{return JSON.parse(v.payload||"{}").parent_task_id||"?"}catch{return"?"}})()]})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"停止条件"}),r.jsxs("span",{className:"v",children:[iT[v.stop_type]||v.stop_type," · ",dT(v)]})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"自动修复"}),r.jsx("span",{className:"v",children:v.auto_fix?"开":"关"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"复测"}),r.jsx("span",{className:"v",children:v.retest||"不复测"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"模型"}),r.jsx("span",{className:"v",children:v.model||"(默认)"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"权限"}),r.jsx("span",{className:"v",children:v.permission||"(CLI 默认)"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"自动提交"}),r.jsx("span",{className:"v",children:v.auto_commit?"开":"关"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"自动部署"}),r.jsx("span",{className:"v",children:v.auto_deploy?"开":"关"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"自动复测"}),r.jsx("span",{className:"v",children:v.auto_retest?"开":"关"})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"会话 ID"}),r.jsx("span",{className:"v",children:v.session_id||"(首轮后生成)"})]}),v.session_title&&r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"会话标题"}),r.jsx("span",{className:"v",children:v.session_title})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"创建时间"}),r.jsx("span",{className:"v",children:is(v.created_at)})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"开始时间"}),r.jsx("span",{className:"v",children:is(v.started_at)})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"结束时间"}),r.jsx("span",{className:"v",children:is(v.ended_at)})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"当前轮次"}),r.jsx("span",{className:"v",children:v.current_round})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"新增案例"}),r.jsxs("span",{className:"v",style:{color:"var(--pass)"},children:["+",v.new_cases??0]})]}),r.jsxs("div",{className:"kv",children:[r.jsx("span",{className:"k",children:"新增 bug"}),r.jsx("span",{className:"v",children:v.new_bugs})]})]}),v.error&&r.jsxs("div",{className:"detail-err",children:["错误:",v.error]}),v.extra&&r.jsxs("div",{className:"kv",style:{marginTop:8},children:[r.jsx("span",{className:"k",children:"其他要求"}),r.jsx("span",{className:"v",style:{fontFamily:"inherit",color:"var(--muted)",whiteSpace:"pre-wrap"},children:v.extra})]}),(Cx.includes(v.status)||v.task_type==="stress"&&v.status==="done")&&r.jsx("div",{className:"form-row",style:{marginTop:8},children:r.jsxs(V,{variant:"outline",size:"sm",onClick:()=>re(v.id,"restart"),children:[r.jsx(Mf,{})," 重启任务(清空轮次,从第一轮重跑)"]})}),r.jsxs(Lm,{className:"mt-2.5 text-xs",children:[r.jsx(Dm,{children:r.jsxs(Do,{className:"hover:bg-transparent",children:[r.jsx(In,{className:"px-2",children:"轮次"}),r.jsx(In,{className:"px-2",children:"状态"}),r.jsx(In,{className:"px-2",children:"退出码"}),r.jsx(In,{className:"px-2",children:"开始"}),r.jsx(In,{className:"px-2",children:"结束"}),r.jsx(In,{className:"px-2",children:"日志"})]})}),r.jsxs(zm,{children:[S.map(H=>r.jsxs(Do,{className:"cursor-pointer",title:"新标签页查看日志",onClick:()=>de(v.id,H.round_no),children:[r.jsx(kn,{className:"px-2",children:H.round_no}),r.jsx(kn,{className:"px-2",children:H.status}),r.jsx(kn,{className:"px-2 font-mono",children:H.exit_code==null?"—":H.exit_code}),r.jsx(kn,{className:"px-2 font-mono text-xs",children:is(H.started_at)}),r.jsx(kn,{className:"px-2 font-mono text-xs",children:is(H.ended_at)}),r.jsx(kn,{className:"px-2 text-[var(--star-text)]",children:"查看日志"})]},H.round_no)),!S.length&&r.jsx(Do,{children:r.jsx(kn,{colSpan:6,className:"px-2 text-muted-foreground",children:"尚未执行轮次"})})]})]})]})]},C.id))]}):r.jsxs("div",{className:"hint",children:["没有匹配「",J.trim(),"」的任务"]}):r.jsx("div",{className:"hint",children:"暂无任务,点击右上角「新建任务」创建"})]}),n&&r.jsx(on,{open:l,onOpenChange:C=>{a(C),C||c(null)},children:r.jsxs(Qt,{className:"modal modal-rz"+(N?" rz-drag":""),style:{...I,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:A,reset:L}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:W,children:i?`继续任务「${i.name}」`:"新建任务"})}),i&&r.jsx("div",{className:"hint",style:{textAlign:"left",margin:"0 0 8px"},children:"接着当前会话继续执行(不新建会话、历史轮次保留);停止条件中的轮数/bug 数指「再跑/再增」的数量"}),r.jsxs("div",{className:"modal-scroll overflow-y-auto",children:[r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"任务名称"}),r.jsx(Ae,{value:s.name,onChange:C=>o({...s,name:C.target.value.trim()}),placeholder:"留空自动命名"})]}),!i&&r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"任务类型"}),r.jsxs(Ht,{value:s.task_type,onValueChange:C=>o(H=>{const pe={...H,task_type:C},B=qi[C];return B&&!B.some(te=>te.v===pe.end_stage)&&(pe.end_stage="report"),pe}),children:[r.jsx(Lt,{size:"sm",className:"min-w-[120px]",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"normal",children:"探索"}),r.jsx(Le,{value:"regression",children:"回归"}),r.jsx(Le,{value:"retest_bug",children:"复测(按提交范围)"}),r.jsx(Le,{value:"stress",children:"压力测试"})]})]})]}),!i&&(s.task_type==="retest_bug"||s.task_type==="normal")&&r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"提交日期范围"}),r.jsx(Ae,{type:"date",className:"h-8 w-auto",value:s.date_from,onChange:C=>o({...s,date_from:C.target.value})}),r.jsx("span",{className:"hint",children:"至"}),r.jsx(Ae,{type:"date",className:"h-8 w-auto",value:s.date_to,onChange:C=>o({...s,date_to:C.target.value})}),r.jsx("span",{className:"hint",children:s.task_type==="retest_bug"?"LLM 分析范围内提交影响的用例并执行复测(必填)":"本轮优先设计/执行与该范围提交相关的用例(选填)"})]}),!i&&qi[s.task_type]&&r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"任务终点"}),r.jsxs(Ht,{value:s.end_stage,onValueChange:C=>o({...s,end_stage:C}),children:[r.jsx(Lt,{size:"sm",className:"min-w-[120px]",children:r.jsx(Ot,{})}),r.jsx(Dt,{children:qi[s.task_type].map(C=>r.jsx(Le,{value:C.v,children:C.label},C.v))})]}),r.jsx("span",{className:"hint",children:"任务执行到该阶段为止;终点在「生成报告」之后会自动追加一个后段任务"})]}),i&&qi[s.task_type]&&r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"任务终点"}),r.jsx("span",{className:"hint",children:Sd(s.end_stage)||"(按类型默认)"})]}),s.task_type==="stress"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"hint",style:{textAlign:"left",margin:"0 0 8px"},children:"压测任务固定两步:第 1 轮 agent 生成压测场景 → 平台自动发压并出报告;生命周期:测试 → 生成报告。不支持「继续」,重启=重跑。"}),r.jsxs("div",{className:"form-col",children:[r.jsx(st,{className:"text-xs text-muted-foreground",style:{marginBottom:2},children:"压测说明(目标服务地址、关注接口、并发/时长期望)"}),r.jsx(hs,{value:s.brief,onChange:C=>o({...s,brief:C.target.value}),rows:4,placeholder:"例如:目标 http://127.0.0.1:8080,压 /api/order 下单与 /api/order/123 查询,按 10→50→100 并发各 1 分钟"})]})]}),!i&&(s.task_type==="normal"||s.task_type==="regression")&&r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"测试任务行为:测试中发现的 bug 由 agent 自动修复代码",children:"自动修复 bug"}),r.jsx("input",{type:"checkbox",checked:s.auto_fix,onChange:C=>o({...s,auto_fix:C.target.checked})}),r.jsx("label",{style:{marginLeft:14},children:"复测"}),r.jsxs(Ht,{value:s.retest,onValueChange:C=>o({...s,retest:C}),children:[r.jsx(Lt,{size:"sm",className:"min-w-[130px]",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"不复测",children:"不复测"}),r.jsx(Le,{value:"全部失败用例",children:"全部失败用例"}),r.jsx(Le,{value:"指定范围复测",children:"指定范围复测"})]})]})]}),s.task_type!=="stress"&&r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"停止条件"}),r.jsxs(Ht,{value:s.stop_type,onValueChange:C=>o({...s,stop_type:C}),children:[r.jsx(Lt,{size:"sm",className:"min-w-[120px]",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"rounds",children:"执行轮数"}),r.jsx(Le,{value:"bugs",children:"累计新 bug 数"}),r.jsx(Le,{value:"deadline",children:"截止时间"}),r.jsx(Le,{value:"duration",children:"持续时长"})]})]}),(s.stop_type==="rounds"||s.stop_type==="bugs")&&r.jsx(Ae,{type:"number",min:"1",className:"h-8 w-[90px]",value:s.stop_value,onChange:C=>o({...s,stop_value:C.target.value===""?"":+C.target.value})}),s.stop_type==="deadline"&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Ae,{type:"date",className:"h-8 w-auto",value:s.deadline_date,onChange:C=>o({...s,deadline_date:C.target.value})}),r.jsx(Ae,{type:"time",className:"h-8 w-[110px]",value:s.deadline_time,onChange:C=>o({...s,deadline_time:C.target.value})})]}),s.stop_type==="duration"&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Ae,{type:"number",min:"1",className:"h-8 w-[90px]",value:s.dur_value,onChange:C=>o({...s,dur_value:C.target.value===""?"":+C.target.value})}),r.jsxs(Ht,{value:s.dur_unit,onValueChange:C=>o({...s,dur_unit:C}),children:[r.jsx(Lt,{size:"sm",className:"min-w-[70px]",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"min",children:"分钟"}),r.jsx(Le,{value:"hour",children:"小时"}),r.jsx(Le,{value:"day",children:"天"})]})]})]}),r.jsx("span",{className:"hint",children:oT[s.stop_type]||""})]}),r.jsxs("div",{className:"form-col",children:[r.jsx(st,{className:"text-xs text-muted-foreground",style:{marginBottom:2},children:!i&&s.task_type==="regression"?"重跑指令(必填:描述要重跑的范围,如模块 / 用例 ID / 变更说明)":"其他要求(选填,原样传给 agent)"}),r.jsx(hs,{value:s.extra,onChange:C=>o({...s,extra:C.target.value}),rows:3,placeholder:!i&&s.task_type==="regression"?"例如:重跑登录模块全部用例;或:本次变更涉及订单接口,重跑 ORD-003、ORD-004":"自由填写,例如:本轮优先测试订单模块;只读代码,不要提出修复方案;执行前先阅读 src/X 目录……"})]})]}),r.jsxs(Nn,{className:"flex-none",children:[r.jsx(V,{variant:"outline",onClick:()=>{a(!1),c(null)},children:"取消"}),r.jsx(V,{onClick:ge,children:i?"继续执行":"开始任务"})]})]})}),z&&r.jsx(Yc,{task:z,onClose:()=>R(null)})]})}let Lr=null,Gi=null,Ki=null;function Qi(e,t){if(e==null||t==null||e===t)return t;try{return JSON.stringify(t)===JSON.stringify(e)?e:t}catch{return t}}function Px(e,t){const n=Bs.getState();t({project:e.project||n.project,live:Qi(n.live,e.live),library:Qi(n.library,e.library),bugs:Qi(n.bugs,e.bugs||[]),rounds:Qi(n.rounds,e.rounds||[]),updatedAt:e.generated_at||""})}const Bs=rm((e,t)=>({connected:!1,project:null,live:null,library:null,bugs:[],rounds:[],updatedAt:"",connect:async n=>{Lr&&Ki===n||(t().disconnect(),Ki=n,Lr=Mg.stream(n),Lr.onopen=()=>e({connected:!0}),Lr.onerror=()=>e({connected:!1}),Lr.onmessage=s=>{try{const o=JSON.parse(s.data);if(o.error)return;Px(o,e)}catch{}},Gi=setInterval(()=>t().fetchSnapshot(),3e4),await t().fetchSnapshot())},fetchSnapshot:async()=>{try{const n=await Mg.state(Ki);n&&!n.error&&Px(n,e)}catch{}},disconnect:()=>{Lr&&(Lr.close(),Lr=null),Gi&&(clearInterval(Gi),Gi=null),Ki=null,e({connected:!1})}}));function ep(e){return/已拒绝/.test(e)?"reject":/复测通过/.test(e)?"pass":/已修复/.test(e)?"fix":/已分析/.test(e)||/修复方案/.test(e)?"run":/待分析/.test(e)||/复测未通过/.test(e)?"retest":"pending"}const Mx=[["retest","R","复测"],["angle","1","角度"],["scan","2","盘点"],["generate","3","生成"],["review","4","判重"],["execute","5","执行"],["cluster","6","聚类"],["analyze","7","分析"],["fix","7b","修复"],["wrapup","8","收尾"]],mT={通过:"pass",失败:"fail",需要复测:"retest",跳过:"skip",未执行:"pending"},hT={round_start:["轮次","ev-round"],phase:["阶段","ev-phase"],proposal:["提案",""],reject:["拒绝","ev-reject"],case_start:["开始",""],case_pass:["通过","ev-pass"],case_fail:["失败","ev-fail"],case_skip:["跳过",""],bug_new:["新Bug","ev-bug"],bug_append:["补证据","ev-bug"],analyze_done:["分析","ev-fix"],fix_done:["修复","ev-fix"],note:["备注",""]},gT={all:null,fail:e=>e.type==="case_fail"||e.type==="bug_new",case:e=>e.type.startsWith("case_"),phase:e=>e.type==="phase"||e.type==="round_start",bug:e=>e.type==="bug_new"||e.type==="bug_append"||e.type==="analyze_done"||e.type==="fix_done"},xT={all:"全部",fail:"失败",case:"用例",phase:"阶段",bug:"Bug"},vT=["all","fail","case","phase","bug"],ka=["status","module","trend","bug","funnel"],yT={status:{title:"案例库状态"},module:{title:"模块通过率"},trend:{title:"轮次趋势"},bug:{title:"Bug 统计"},funnel:{title:"产出漏斗"}},Tx=[["pending","待处理","var(--dim)"],["run","已出方案","var(--run)"],["retest","待分析/复测未过","var(--retest)"],["fix","已修复","var(--fix)"],["pass","复测通过","var(--pass)"],["reject","已拒绝","var(--dim)"]],Pj="ts.chartSlots";function wT(){try{const e=JSON.parse(localStorage.getItem(Pj)||"null");if(Array.isArray(e)&&e.length===3&&e.every(t=>ka.includes(t))&&new Set(e).size===3)return e}catch{}return["status","module","trend"]}const Co={tree:"ts.treeW",side:"ts.sideW",chartsH:"ts.chartsH",c1:"ts.c1w",c2:"ts.c2w"},zs={tree:"tree",side:"side",chartsH:"chartsH",c1:"c1",c2:"c2"},gt=e=>String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),Nd=e=>mT[e]||"pending",jT=e=>{const t=new Date(String(e).replace(" ","T"));return isNaN(t)?null:t},bT=e=>{const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),s=Math.floor(t%3600/60);return(n?n+"h":"")+(s?s+"m":"")+t%60+"s"},Yi=(e,t,n)=>Math.max(t,Math.min(n,e));function _T({project:e}){var ys;const t=e==null?void 0:e.id,n=Bs(P=>P.connected),s=Bs(P=>P.live),o=Bs(P=>P.library),l=Bs(P=>P.bugs),a=Bs(P=>P.rounds),i=Bs(P=>P.updatedAt),c=u.useRef(null),d=u.useRef(null),f=u.useRef(null),p=u.useRef(null),m=u.useRef(null),[g,h]=u.useState(null),[y,j]=u.useState("all"),[w,x]=u.useState(!0),[v,b]=u.useState(wT);function S(P,Q){b(ee=>{const le=new Set(ee.filter((Ie,Ue)=>Ue!==P));let ue=ee[P];do ue=ka[(ka.indexOf(ue)+Q+ka.length)%ka.length];while(le.has(ue));const oe=[...ee];return oe[P]=ue,localStorage.setItem(Pj,JSON.stringify(oe)),oe})}const[k,E]=u.useState(()=>new Set),[R,z]=u.useState(""),N=u.useRef({}),I=u.useRef(null),A=u.useRef(null),W=u.useRef(0),L=u.useRef(""),J=u.useRef("all"),O=u.useRef(!1),U=!!(s&&s.phase&&s.phase!=="done"&&s.phase!=="idle"),F=Mx.findIndex(P=>P[0]===(s==null?void 0:s.phase)),Z=(s==null?void 0:s.phase)==="done",D=s?s.phase==="done"?{cls:"done",text:"本轮运行已结束"}:{cls:"running",text:s.phase_label||s.phase||"运行中"}:{cls:"idle",text:"空闲(未在运行)"},be=(()=>{const P=s==null?void 0:s.stop_condition;return P!=null&&P.label?"停止条件: "+P.label+(P.new_bugs!=null?" · 新Bug "+P.new_bugs:"")+(P.target_bugs!=null?"/"+P.target_bugs:""):""})(),ge=n?"":"down";function Te(P){let Q=P.cases.length;for(const ee of P.children)Q+=Te(ee);return Q}const re=(ys=s==null?void 0:s.current_case)==null?void 0:ys.id,$e=u.useMemo(()=>{const P=o;if(!P)return{__html:""};function Q(le){let ue="";for(const oe of le.cases){N.current[oe.id]=oe;const Ie=re===oe.id,Ue=Nd(oe.status);ue+=`<div class="case${g===oe.id?" selected":""}${Ie?" running":""}" data-id="${oe.id}" title="${gt(oe.point||oe.name)}"><span class="dot ${Ie?"":Ue}"></span><span class="cid">${oe.id}</span><span class="cname">${gt(oe.name)}</span></div>`}for(const oe of le.children){const Ie=k.has(oe.path)?"":" open";ue+=`<details data-path="${gt(oe.path)}"${Ie}><summary><span class="arrow">▶</span><span>${gt(oe.name)}</span><span class="fcount">${Te(oe)}</span>${oe.desc?`<span class="fdesc">${gt(oe.desc)}</span>`:""}</summary><div class="folder-body">${Q(oe)}</div></details>`}return ue}return{__html:P.tree.children.length||P.tree.cases.length?Q(P.tree):'<div class="empty">案例库为空——运行测试任务生成用例后在此展示。</div>'}},[o,k,g,re]);function he(P){const Q=[];for(const ee of P.children)Q.push(ee.path),Q.push(...he(ee));return Q}function De(){E(new Set)}function de(){const P=o;P&&E(new Set(he(P.tree)))}function me(P){const Q=P.target.closest(".case");if(!Q)return;const ee=Q.dataset.id;h(le=>{const ue=le===ee?null:ee;return ue?localStorage.setItem("ts_monitor_pick",JSON.stringify({proj:t,id:ue})):localStorage.removeItem("ts_monitor_pick"),ue})}u.useEffect(()=>{const P=d.current;if(!P)return;const Q=ee=>{const le=ee.target;le.tagName==="DETAILS"&&le.dataset.path&&E(ue=>{const oe=new Set(ue);return le.open?oe.delete(le.dataset.path):oe.add(le.dataset.path),oe})};return P.addEventListener("toggle",Q),()=>P.removeEventListener("toggle",Q)},[]);function Ce(P){return!P.request&&!P.response?"":'<details class="payload"><summary>请求 / 返回</summary>'+(P.request?`<div class="plabel">请求</div><pre>${gt(P.request)}</pre>`:"")+(P.response?`<div class="plabel">返回</div><pre>${gt(P.response)}</pre>`:"")+"</details>"}function _e(P){const Q=hT[P.type]||["事件",""];return`<div class="ev ${Q[1]}"><span class="ts">${gt(P.ts||"")}</span><span class="badge">${Q[0]}</span>`+(P.case_id?`<span class="cid">${P.case_id}</span>`:"")+`<span class="msg">${gt(P.message||"")}</span>${Ce(P)}</div>`}function C(){return'<div id="feed-empty">'+(s?"(当前筛选下暂无事件)":"当前没有运行中的测试。<br>在会话中开启实时监控后,运行期间的事件会实时出现在这里。")+"</div>"}function H(){const P=(s==null?void 0:s.events)||[],Q=gT[y],ee=Q?P.filter(Q):P,le=ee.length?JSON.stringify(ee[0]):"",ue=f.current;ue&&(y!==J.current||le!==L.current||ee.length<W.current?(J.current=y,L.current=le,ue.innerHTML=ee.length?ee.map(_e).join(""):C(),W.current=ee.length):ee.length>W.current&&(W.current===0&&(ue.innerHTML=""),ue.insertAdjacentHTML("beforeend",ee.slice(W.current).map(_e).join("")),W.current=ee.length),w&&(ue.scrollTop=ue.scrollHeight))}u.useEffect(()=>{H(),$t()},[y,o,s,a]);function pe(P){const Q={pass:0,fail:0,retest:0,pending:0,total:0};return function ee(le){for(const ue of le.cases){let oe=Nd(ue.status);oe==="skip"&&(oe="pending"),Q[oe]=(Q[oe]||0)+1,Q.total++}for(const ue of le.children)ee(ue)}(P),Q}const B=u.useMemo(()=>{const P=o==null?void 0:o.stats;if(!P)return{sub:"",body:""};const Q=P.total,ee=Q?Math.round(P.passed/Q*100):0,le=[["通过",P.passed,"var(--pass)"],["失败",P.failed,"var(--fail)"],["需复测",P.retest,"var(--retest)"],["未执行",P.pending+P.skipped,"var(--dim)"]];let ue=0;const oe=le.filter(Ie=>Ie[1]>0).map(Ie=>{const Ue=Q?Ie[1]/Q*100:0,Qe=Math.max(0,Ue-1.5),Xe=`<circle cx="21" cy="21" r="15.915" fill="none" stroke="${Ie[2]}" stroke-width="6" pathLength="100" stroke-linecap="round" stroke-dasharray="${Qe} ${100-Qe}" stroke-dashoffset="${25-ue}"/>`;return ue+=Ue,Xe}).join("");return{sub:`通过率 <b class="hl-pass">${ee}%</b>`,body:'<div class="cbody">'+(Q?`<svg viewBox="0 0 42 42" class="donut">${oe}<text x="21" y="19.5" class="dnum" text-anchor="middle">${Q}</text><text x="21" y="26" class="dsub" text-anchor="middle">用例</text></svg><div class="dlegend">${le.map(Ie=>`<div class="li"><span class="sw" style="background:${Ie[2]}"></span>${Ie[0]}<span class="lm">${Ie[1]}</span><span class="pct">${Q?Math.round(Ie[1]/Q*100):0}%</span></div>`).join("")}</div>`:'<div class="empty">案例库为空</div>')+"</div>"}},[o]),te=u.useMemo(()=>{const P=o;if(!P)return{sub:"",body:""};let Q=P.tree;for(;Q.children.length===1&&!Q.cases.length&&Q.children[0].children.length;)Q=Q.children[0];const ee=Q.children.map(le=>({name:le.name,a:pe(le)})).filter(le=>le.a.total>0);return Q.cases.length&&ee.push({name:"(根目录)",a:pe({cases:Q.cases,children:[]})}),ee.sort((le,ue)=>ue.a.total-le.a.total),{sub:`${ee.length} 个分类`,body:'<div class="cbody">'+(ee.length?`<div class="mbars">${ee.map(le=>{const ue=le.a.total,oe=ue?Math.round(le.a.pass/ue*100):0,Ie=(Ue,Qe)=>le.a[Ue]?`<div class="seg ${Qe}" style="width:${le.a[Ue]/ue*100}%"></div>`:"";return`<div class="mbar-row"><span class="mbar-label" title="${gt(le.name)}">${gt(le.name)}</span><div class="mbar-track"><div class="mbar-inner">${Ie("pass","pass")}${Ie("fail","fail")}${Ie("retest","retest")}${Ie("pending","pending")}</div></div><span class="mbar-num" title="通过/总数"><b class="hl-pass">${le.a.pass}</b><em>/${ue}</em><i class="pctn">${oe}%</i></span></div>`}).join("")}</div>`:'<div class="empty">案例库为空</div>')+'</div><div class="mlegend"><span><span class="sw" style="background:var(--pass)"></span>通过</span><span><span class="sw" style="background:var(--fail)"></span>失败</span><span><span class="sw" style="background:var(--retest)"></span>需复测</span><span><span class="sw" style="background:var(--dim)"></span>未执行</span></div>'}},[o]),ie=u.useMemo(()=>{const P=a||[];if(!P.length)return{sub:"",body:'<div class="cbody"><div class="empty">暂无轮次记录</div></div>'};const Q=340,ee=126,le=30,ue=20,oe=22,Ie=Math.max(1,...P.map(lt=>lt.passed+lt.failed)),Ue=(Q-oe)/P.length,Qe=Math.min(34,Ue*.52),Xe=ee-ue,jt=ee-le-ue;let en="";for(let lt=0;lt<=2;lt++){const mn=Xe-jt*(lt/2);en+=`<line x1="${oe}" y1="${mn}" x2="${Q-2}" y2="${mn}" class="t-grid"/>`,en+=`<text x="${oe-5}" y="${mn+2.5}" class="t-ytick" text-anchor="end">${Math.round(Ie*lt/2)}</text>`}let ln="";return P.forEach((lt,mn)=>{const tn=Math.round(oe+mn*Ue+(Ue-Qe)/2),bt=Math.round(oe+mn*Ue+Ue/2),Nt=Math.round(lt.passed/Ie*jt),Wt=Math.round(lt.failed/Ie*jt);Nt&&(ln+=`<rect x="${tn}" y="${Xe-Nt}" width="${Qe}" height="${Nt}" fill="url(#grad-pass)" rx="2"><title>第 ${lt.round} 轮 通过 ${lt.passed}</title></rect>`),Wt&&(ln+=`<rect x="${tn}" y="${Xe-Nt-Wt}" width="${Qe}" height="${Wt}" fill="url(#grad-fail)" rx="2"><title>第 ${lt.round} 轮 失败 ${lt.failed}</title></rect>`);const Ct=lt.passed+lt.failed,Pn=Xe-Nt-Wt;lt.new_bugs>0&&(ln+=`<text x="${bt}" y="${Pn-16}" class="t-bug" text-anchor="middle">+${lt.new_bugs}bug</text>`),Ct>0&&(ln+=`<text x="${bt}" y="${Pn-6}" class="t-val" text-anchor="middle">${Ct}</text>`),ln+=`<text x="${bt}" y="${ee-5}" class="t-lab" text-anchor="middle">R${lt.round}</text>`}),{sub:"绿通过 / 红失败 · 黄字=新建Bug",body:`<div class="cbody"><svg viewBox="0 0 ${Q} ${ee}" class="trend" preserveAspectRatio="xMidYMid meet"><defs><linearGradient id="grad-pass" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="var(--grad-pass-1)"/><stop offset="1" stop-color="var(--grad-pass-2)"/></linearGradient><linearGradient id="grad-fail" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="var(--grad-fail-1)"/><stop offset="1" stop-color="var(--grad-fail-2)"/></linearGradient></defs><line x1="${oe}" y1="${Xe}" x2="${Q-2}" y2="${Xe}" class="t-axis"/>${en}${ln}</svg></div>`}},[a]),ze=u.useMemo(()=>{const P=l||[];if(!P.length)return{sub:"",body:'<div class="cbody"><div class="empty">暂无 bug 报告</div></div>'};const Q={};for(const ue of P){const oe=ep(ue.status);Q[oe]=(Q[oe]||0)+1}const ee=Math.max(1,...Tx.map(ue=>Q[ue[0]]||0)),le=Tx.filter(ue=>Q[ue[0]]>0).map(([ue,oe,Ie])=>`<div class="mbar-row"><span class="mbar-label" title="${oe}">${oe}</span><div class="mbar-track"><div class="bbar" style="width:${Q[ue]/ee*100}%;background:${Ie}"></div></div><span class="mbar-num"><b>${Q[ue]}</b><i class="pctn">${Math.round(Q[ue]/P.length*100)}%</i></span></div>`).join("");return{sub:`共 <b>${P.length}</b> 个`,body:`<div class="cbody"><div class="mbars">${le}</div></div>`}},[l]),Ee=u.useMemo(()=>{var Ie;const P=s==null?void 0:s.stats;if(!P||P.proposed==null&&P.accepted==null&&P.executed==null)return{sub:"",body:'<div class="cbody"><div class="empty">暂无运行统计</div></div>'};const Q=[["提案",P.proposed],["入库",P.accepted],["执行",P.executed],["通过",P.passed]],ee=Math.max(1,...Q.map(Ue=>Ue[1]||0));let le=null;const ue=Q.map(([Ue,Qe])=>{const Xe=le!=null&&le>0&&Qe!=null?Math.round(Qe/le*100)+"%":"—";return le=Qe,`<div class="frow"><span class="fl">${Ue}</span><div class="ftrack"><div class="fbar" style="width:${Qe?Math.round(Qe/ee*100):0}%"></div></div><span class="fr">${Qe??"—"} · ${Xe}</span></div>`}).join("");let oe="";if((Ie=s==null?void 0:s.options)!=null&&Ie.auto_fix&&P.fixed!=null){const Ue=Math.max(1,P.failed||0);oe=`<div class="frow fixbar"><span class="fl">已修复</span><div class="ftrack"><div class="fbar" style="width:${Math.round((P.fixed||0)/Ue*100)}%"></div></div><span class="fr">${P.fixed} / ${P.failed??0}</span></div>`}return{sub:P.rejected>0?`拒绝 <b>${P.rejected}</b>`:"",body:`<div class="cbody"><div class="funnel">${ue}${oe}</div></div>`}},[s]),mt={status:B,module:te,trend:ie,bug:ze,funnel:Ee},ot=u.useMemo(()=>{const P=o==null?void 0:o.stats;return P?{__html:`<span class="chip"><span class="dot pass"></span><b>${P.passed}</b></span><span class="chip"><span class="dot fail"></span><b>${P.failed}</b></span><span class="chip"><span class="dot retest"></span><b>${P.retest}</b></span><span class="chip"><span class="dot pending"></span><b>${P.pending+P.skipped}</b></span><span class="chip">共 <b>${P.total}</b></span>`}:null},[o]);function Fe(P){const Q=(s==null?void 0:s.events)||[];for(let ee=Q.length-1;ee>=0;ee--){const le=Q[ee];if(le.case_id===P&&(le.request||le.response))return le}return null}const Ze=u.useMemo(()=>{var Xe,jt;const P=s,Q=g||((Xe=P==null?void 0:P.current_case)==null?void 0:Xe.id),ee=Q?N.current[Q]:null,le=!!(P&&((jt=P.current_case)==null?void 0:jt.id)===Q&&P.phase!=="done"),ue=Q?Fe(Q):null;if(!Q)return{__html:'<h3>用例详情</h3><div class="empty">点击左侧用例查看详情;运行中默认显示当前用例。</div>'};const oe=ee||P&&P.current_case,Ie=le?"执行中":ee?ee.status:"",Ue=ee&&ee.bug_report&&ee.bug_report!=="无"?ee.bug_report:"";let Qe="<h3>用例详情"+(g?"":"(当前执行)")+`</h3><div class="kv"><span class="k">ID</span><span class="v mono">${gt(Q)}</span></div><div class="kv"><span class="k">名称</span><span class="v">${gt(ee?ee.name:oe&&oe.name||"")}</span></div>`+(ee&&ee.point?`<div class="kv"><span class="k">测试点</span><span class="v">${gt(ee.point)}</span></div>`:"")+`<div class="kv"><span class="k">状态</span><span class="v"><span class="badge-st ${le?"run":Nd(Ie)}">${gt(Ie||"—")}</span></span></div>`+(ee&&ee.fail_reason?`<div class="kv"><span class="k">失败原因</span><span class="v">${gt(ee.fail_reason)}</span></div>`:"")+(ee&&ee.summary?`<div class="kv"><span class="k">结果摘要</span><span class="v">${gt(ee.summary)}</span></div>`:"")+(ee&&ee.last_run?`<div class="kv"><span class="k">最近执行</span><span class="v mono">${gt(ee.last_run)}</span></div>`:"")+(Ue?`<div class="kv"><span class="k">bug_report</span><span class="v mono">${gt(Ue)}</span></div>`:"");return ue&&(Qe+=`<div class="plabel">请求</div><pre>${gt(ue.request||"(无记录)")}</pre><div class="plabel">返回</div><pre>${gt(ue.response||"(无记录)")}</pre>`),{__html:Qe}},[g,s]),rt=u.useMemo(()=>{var Q;const P=s==null?void 0:s.stats;return{__html:P?`本轮: 提案 <b>${P.proposed??"—"}</b> · 入库 <b>${P.accepted??"—"}</b> · 拒绝 <b>${P.rejected??"—"}</b> · 已执行 <b>${P.executed??"—"}</b> · 通过 <b style="color:var(--pass)">${P.passed??0}</b> · 失败 <b style="color:var(--fail)">${P.failed??0}</b> · 跳过 <b>${P.skipped??0}</b> · 新建Bug <b style="color:var(--fail)">${P.new_bug_reports??0}</b>`+(P.fixed!=null&&((Q=s==null?void 0:s.options)!=null&&Q.auto_fix)?` · 已修复 <b style="color:var(--fix)">${P.fixed}</b>`:""):"案例库统计见左侧。"}},[s]),ct=u.useMemo(()=>{var ee;const P=(ee=s==null?void 0:s.priorities)==null?void 0:ee.levels;return!Array.isArray(P)||!P.length?null:{__html:'<div class="prio-title">测试进度(按功能分级)</div>'+P.map(le=>{const ue=Array.isArray(le.domains)?le.domains:[],oe=ue.length,Ie=ue.filter(Xe=>Xe.status==="已覆盖").length,Ue=oe?Math.round(Ie/oe*100):0,Qe=ue.map(Xe=>`<span class="pchip${Xe.status==="已覆盖"?" ok":""}" title="${gt(Xe.name)}:${gt(Xe.status||"未覆盖")}">${gt(Xe.name)}</span>`).join("");return`<div class="prio-row"><span class="prio-level">${gt(le.level||"")}</span><span class="prio-label">${gt(le.label||"")}</span><span class="prio-track"><span class="prio-in" style="width:${Ue}%"></span></span><span class="prio-num">${Ie}<em>/${oe}</em></span><span class="prio-chips">${Qe}</span></div>`}).join("")}},[s]),nt={tree:300,side:370,chartsH:176,chartRatio:[1,1.15,1.35]},Y=.22;function qe(){const P=getComputedStyle(p.current),Q=parseFloat(P.getPropertyValue("--c1-fr"))||nt.chartRatio[0],ee=parseFloat(P.getPropertyValue("--c2-fr"))||nt.chartRatio[1],le=parseFloat(P.getPropertyValue("--c3-fr"))||nt.chartRatio[2],ue=Q+ee+le;return[Q/ue,ee/ue,le/ue]}function vt(P){const Q=p.current;Q.style.setProperty("--c1-fr",P[0]+"fr"),Q.style.setProperty("--c2-fr",P[1]+"fr"),Q.style.setProperty("--c3-fr",P[2]+"fr")}function Zt(P,Q){if(P.button!==0||P.detail>1)return;const ee=c.current.querySelector(".m-main"),le=p.current;if(!ee||!le)return;const ue=()=>Q==="tree"?parseInt(getComputedStyle(ee).getPropertyValue("--tree-w"),10)||nt.tree:Q==="side"?parseInt(getComputedStyle(ee).getPropertyValue("--side-w"),10)||nt.side:Q==="chartsH"?le.getBoundingClientRect().height||nt.chartsH:0,oe=tn=>{Q==="tree"?ee.style.setProperty("--tree-w",Yi(tn,180,600)+"px"):Q==="side"?ee.style.setProperty("--side-w",Yi(tn,260,720)+"px"):Q==="chartsH"&&(le.style.height=Yi(tn,150,520)+"px")},Ie=ue(),Ue=Q==="chartsH"?P.clientY:P.clientX,Qe=Q==="side",Xe=Q==="chartsH",jt=Q==="c1"||Q==="c2",en=jt?qe():null,ln=P.currentTarget;ln.classList.add("drag"),document.body.classList.add(Xe?"resizing-y":"resizing-x");const lt=tn=>{let bt=(Xe?tn.clientY:tn.clientX)-Ue;if(Qe&&(bt=-bt),jt){const Nt=[...en],Wt=Q==="c1"?0:1,Ct=[0,1,2].filter(Ts=>Ts!==Wt),Pn=le.getBoundingClientRect().width,Cr=bt/Math.max(1,Pn);let ss=Nt[Wt]+Cr;ss=Yi(ss,Y,1-2*Y);const er=1-ss,rs=1-Nt[Wt];rs>1e-4&&(Nt[Wt]=ss,Nt[Ct[0]]=Nt[Ct[0]]/rs*er,Nt[Ct[1]]=Nt[Ct[1]]/rs*er),vt(Nt)}else oe(Ie+bt)},mn=()=>{ln.classList.remove("drag"),document.body.classList.remove("resizing-x","resizing-y"),document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",mn),jt?localStorage.setItem(Co.c1,JSON.stringify(qe())):localStorage.setItem(Co[Q],String(Math.round(ue())))};document.addEventListener("mousemove",lt),document.addEventListener("mouseup",mn)}function zt(P){const Q=c.current.querySelector(".m-main"),ee=p.current;P==="tree"?Q.style.removeProperty("--tree-w"):P==="side"?Q.style.removeProperty("--side-w"):P==="chartsH"?ee.style.height="":(ee.style.removeProperty("--c1-fr"),ee.style.removeProperty("--c2-fr"),ee.style.removeProperty("--c3-fr")),localStorage.removeItem(Co[P])}function ce(){const P=c.current.querySelector(".m-main"),Q=p.current;if(!(!P||!Q))try{const ee=+localStorage.getItem(Co.tree);ee>0&&P.style.setProperty("--tree-w",ee+"px");const le=+localStorage.getItem(Co.side);le>0&&P.style.setProperty("--side-w",le+"px");const ue=+localStorage.getItem(Co.chartsH);ue>0&&(Q.style.height=ue+"px");const oe=JSON.parse(localStorage.getItem(Co.c1)||"null");Array.isArray(oe)&&oe.length===3&&vt(oe)}catch{}}function $t(){if(!O.current)try{const P=JSON.parse(localStorage.getItem("ts_monitor_pick")||"null");P&&P.proj===t&&N.current[P.id]&&(h(P.id),O.current=!0)}catch{}}function pn(){const P=Bs.getState().live;A.current=(P==null?void 0:P.live_mtime)!=null?Date.now()/1e3-P.live_mtime:null,I.current&&m.current&&(m.current.textContent="已运行 "+bT(Date.now()-I.current.getTime()));const Q=P&&P.phase&&P.phase!=="done"&&P.phase!=="idle";A.current!=null&&Q&&A.current>30?z("状态文件 "+Math.round(A.current)+"s 未更新"):z("")}return u.useEffect(()=>{ce();const P=setInterval(pn,1e3);return()=>clearInterval(P)},[]),u.useEffect(()=>{t&&Bs.getState().connect(t)},[t]),u.useEffect(()=>()=>{Bs.getState().disconnect()},[]),u.useEffect(()=>{I.current==null&&(s!=null&&s.run_started_at)&&(I.current=jT(s.run_started_at))},[s]),r.jsxs("div",{className:"monitor-tab",ref:c,children:[r.jsxs("header",{className:"m-head",children:[r.jsxs("div",{className:"logo",children:[r.jsx("span",{className:"pulse"+(U?" on":"")}),"Free-Style 测试监控",r.jsxs("span",{style:{color:"var(--dim)"},children:[" · ",e==null?void 0:e.name]})]}),r.jsx("span",{className:"pill "+D.cls,children:D.text}),(s==null?void 0:s.round)!=null&&r.jsx("span",{className:"pill mono",children:"第 "+s.round+" 轮"}),I.current&&r.jsx("span",{className:"pill mono",ref:m}),be&&r.jsx("span",{className:"pill",children:be}),(s==null?void 0:s.options)&&r.jsx("span",{className:"pill",children:"自动修复: "+(s.options.auto_fix?"开":"关")}),(s==null?void 0:s.options)&&r.jsx("span",{className:"pill",children:"复测: "+(s.options.retest||"不复测")}),r.jsx("div",{className:"spacer"}),R&&r.jsx("span",{className:"pill warn",children:R}),r.jsx("span",{className:ge,title:"与监控服务器的连接状态"})]}),r.jsx("nav",{className:"phases",children:Mx.map((P,Q)=>r.jsxs("span",{className:"step"+(Z||Q<F?" done":"")+(!Z&&Q===F?" active":""),children:[r.jsx("span",{className:"no",children:P[1]}),P[2]]},P[0]))}),r.jsxs("div",{className:"m-main",children:[r.jsxs("aside",{className:"tree-panel",children:[r.jsxs("div",{className:"panel-head",children:["案例库 ",r.jsx("span",{className:"lib-stats",dangerouslySetInnerHTML:ot||void 0}),r.jsx("div",{className:"spacer"}),r.jsxs("div",{className:"tree-tools",children:[r.jsx("span",{className:"tbtn",onClick:De,children:"全部展开"}),r.jsx("span",{className:"tbtn",onClick:de,children:"全部折叠"})]})]}),r.jsx("div",{className:"panel-body",ref:d,onClick:me,dangerouslySetInnerHTML:$e})]}),r.jsx("div",{className:"vsplit",onMouseDown:P=>Zt(P,zs.tree),onDoubleClick:()=>zt(zs.tree)}),r.jsxs("section",{className:"feed-panel",children:[r.jsx("div",{className:"charts",ref:p,children:v.map((P,Q)=>{const ee=mt[P];return r.jsxs(u.Fragment,{children:[Q>0&&r.jsx("div",{className:"vsplit",onMouseDown:le=>Zt(le,Q===1?zs.c1:zs.c2),onDoubleClick:()=>zt(Q===1?zs.c1:zs.c2)}),r.jsxs("div",{className:"chart",children:[r.jsxs("h4",{children:[r.jsx("span",{className:"t",children:yT[P].title}),r.jsx("span",{className:"sub",dangerouslySetInnerHTML:{__html:ee.sub||""}}),r.jsxs("span",{className:"bswitch",children:[r.jsx("span",{className:"swbtn",title:"上一张图",onClick:()=>S(Q,-1),children:"‹"}),r.jsx("span",{className:"swbtn",title:"下一张图",onClick:()=>S(Q,1),children:"›"})]})]}),r.jsx("div",{className:"cwrap",dangerouslySetInnerHTML:{__html:ee.body}})]})]},P)})}),r.jsx("div",{className:"hsplit",onMouseDown:P=>Zt(P,zs.chartsH),onDoubleClick:()=>zt(zs.chartsH)}),r.jsxs("div",{className:"panel-head",children:["实时事件流",r.jsx("div",{className:"feed-tools",children:vT.map(P=>r.jsx("span",{className:"chip fchip"+(y===P?" on":""),"data-f":P,onClick:()=>j(P),children:xT[P]},P))}),r.jsx("div",{className:"spacer"}),r.jsxs("label",{className:"chip fchip on",style:{cursor:"pointer"},children:[r.jsx("input",{type:"checkbox",checked:w,onChange:P=>x(P.target.checked),style:{verticalAlign:-1}})," 自动滚动"]})]}),r.jsx("div",{className:"feed",ref:f})]}),r.jsx("div",{className:"vsplit",onMouseDown:P=>Zt(P,zs.side),onDoubleClick:()=>zt(zs.side)}),r.jsx("aside",{className:"side-panel",dangerouslySetInnerHTML:Ze})]}),ct&&r.jsx("section",{className:"prio-bar",dangerouslySetInnerHTML:ct}),r.jsxs("footer",{className:"statusbar",children:[r.jsx("span",{dangerouslySetInnerHTML:rt}),r.jsx("div",{className:"spacer"}),r.jsx("span",{children:"数据更新于 "+(i||"—")})]})]})}const kT=e=>/复测通过|已拒绝/.test(e||"");function ST(e){return e==="running"?"run":e==="done"?"pass":e==="failed"?"retest":"pending"}function NT(e){return e==="通过"?"pass":e==="失败"?"retest":e==="需要复测"?"run":"pending"}const CT=(e,t,n)=>Math.max(t,Math.min(n,e));function ET({project:e}){const t=e==null?void 0:e.id,n=_n(),s=n.bugs,o=u.useRef(null),[l,a]=u.useState(null),i=u.useRef(null),[c,d]=u.useState(null),[f,p]=u.useState("report"),m=u.useRef("report"),[g,h]=u.useState(null),[y,j]=u.useState(null),[w,x]=u.useState(null),[v,b]=u.useState({auto_commit:!1}),[S,k]=u.useState(!1),[E,R]=u.useState(""),[z,N]=u.useState("fix"),[I,A]=u.useState(!1),[W,L]=u.useState(""),[J,O]=u.useState(!1),[U,F]=u.useState("retest_only"),Z=[{v:"analyze",label:"报告分析"},{v:"fix",label:"问题修复"},{v:"deploy",label:"重新部署"},{v:"retest",label:"复测"}],D=[{v:"retest_only",label:"仅复测(现状行为,不部署)"},{v:"deploy_retest",label:"重新部署 → 复测"},{v:"deploy_only",label:"仅重新部署(不复测)"}],be=u.useRef({auto_commit:!1}),ge=u.useRef(null),Te=u.useRef(!1),re=u.useMemo(()=>fi([e],t),[e,t]),$e=u.useMemo(()=>c?{__html:Vo(io(c.content,t,{roots:re}))}:null,[c,t,re]),he=(y==null?void 0:y.status)==="running",De=(y==null?void 0:y.status)==="queued",de=(w==null?void 0:w.status)==="running",me=(w==null?void 0:w.status)==="queued",Ce=w?`任务「${w==null?void 0:w.name}」 ${hr[w==null?void 0:w.status]||(w==null?void 0:w.status)} · 轮次 ${w==null?void 0:w.current_round} · 会话 ${(w==null?void 0:w.session_id)||"(首轮后生成)"}`+((w==null?void 0:w.task_type)==="fix"?` · ${w!=null&&w.auto_commit?"自动提交":"不提交"}/${w!=null&&w.auto_deploy?"自动部署":"不部署"}/${w!=null&&w.auto_retest?"自动复测":"不复测"}`:""):"尚无修复/修例任务";function _e(){!l||!t||localStorage.setItem("ts_cur_bug",JSON.stringify({proj:t,dir:l,stab:m.current}))}async function C(Y){a(Y),i.current=Y,p("report"),m.current="report",h(null),ge.current=null,j(null),x(null),b({auto_commit:!1}),be.current={auto_commit:!1},await H(Y)}async function H(Y=l){if(!(!Y||!t))try{const qe=await Cf.get(t,Y);d(qe),await B(),_e()}catch(qe){M(qe.message)}}function pe(Y){p(Y),m.current=Y,_e()}async function B(){const Y=i.current;if(!(!Y||!t))try{const vt=(await Ve.list(t)).filter($t=>($t.task_type==="fix"||$t.task_type==="reject")&&(()=>{try{return JSON.parse($t.payload||"{}").bug_dir===Y}catch{return!1}})()),Zt=vt[0]||null,zt=vt.find($t=>$t.task_type==="fix")||null;x(Zt);const ce=zt?zt.id:null;j(zt),h(ce),ge.current=ce,zt&&b($t=>({auto_commit:be.current.auto_commit?$t.auto_commit:!!zt.auto_commit}))}catch{}}u.useEffect(()=>{if(f!=="fix")return;const Y=setInterval(()=>{B().catch(()=>{})},2e3);return()=>clearInterval(Y)},[f,l,t]),u.useEffect(()=>{const Y=setInterval(()=>{l&&H().catch(()=>{})},5e3);return()=>clearInterval(Y)},[l,t]);function te(){if(!l){M("请先选择 bug 报告");return}F("retest_only"),O(!0)}async function ie(){try{await Ve.create(t,{task_type:"retest_bug",bug_dir:l,retest_scope:U}),M("复测任务已入队,可在「任务」标签页查看"),O(!1),await n.loadTasks(),await B()}catch(Y){M(Y.message)}}function ze(){if(!l){M("请先选择 bug 报告");return}R((y==null?void 0:y.extra)||""),N((y==null?void 0:y.end_stage)||"fix"),k(!0)}async function Ee(){const Y=E.trim();try{if(!g)await Ve.create(t,{task_type:"fix",bug_dir:l,end_stage:z,auto_commit:v.auto_commit,extra:Y}),M("修复任务已入队");else{if(he||De){M("任务运行中,请先停止再修复");return}await Ve.update(g,{extra:Y,auto_commit:v.auto_commit,start_stage:"analyze",end_stage:z}),await Ve.restart(g),M("修复任务已重启入队")}k(!1),R(""),await n.loadTasks(),await B(),pe("fix")}catch(qe){M(qe.message)}}async function mt(){const Y=W.trim();if(!Y){M("请填写拒绝理由");return}try{await Cf.reject(t,l,Y),M("已标记拒绝,修例任务已入队"),A(!1),L(""),await n.loadTasks(),await H(),pe("fix")}catch(qe){M(qe.message)}}async function ot(Y,qe){if(b(vt=>({...vt,[Y]:qe})),be.current={...be.current,[Y]:!0},!!ge.current)try{await Ve.update(ge.current,{[Y]:qe}),be.current={...be.current,[Y]:!1},M("已保存,下次向 agent 发送指令时生效"),await B()}catch(vt){M(vt.message)}}async function Fe(){if(w)try{await Ve.stop(w.id),M("已请求停止"),setTimeout(()=>B().catch(()=>{}),800)}catch(Y){M(Y.message)}}async function Ze(){if(!w){M("尚无修复/修例任务");return}if(de||me){M("任务运行中,请先停止再重启");return}try{await Ve.restart(w.id),M("任务已重启入队"),await B()}catch(Y){M(Y.message)}}function rt(Y){if(Y.button!==0||Y.detail>1)return;const qe=o.current,vt=parseInt(getComputedStyle(qe).getPropertyValue("--bugw"),10)||400,Zt=Y.clientX;Y.currentTarget.classList.add("drag"),document.body.classList.add("resizing-x");const zt=$t=>qe.style.setProperty("--bugw",CT(vt+($t.clientX-Zt),260,760)+"px"),ce=()=>{Y.currentTarget.classList.remove("drag"),document.body.classList.remove("resizing-x"),document.removeEventListener("mousemove",zt),document.removeEventListener("mouseup",ce),localStorage.setItem("ts.bugw",getComputedStyle(qe).getPropertyValue("--bugw"))};document.addEventListener("mousemove",zt),document.addEventListener("mouseup",ce)}function ct(){o.current.style.removeProperty("--bugw"),localStorage.removeItem("ts.bugw")}u.useEffect(()=>{try{const Y=+localStorage.getItem("ts.bugw");Y>0&&o.current.style.setProperty("--bugw",Y+"px")}catch{}},[]),u.useEffect(()=>{if(Te.current||!t||!s.length)return;if(i.current){Te.current=!0;return}let Y=null;try{Y=JSON.parse(localStorage.getItem("ts_cur_bug")||"null")}catch{}Y&&Y.proj===t&&s.some(qe=>qe.dir===Y.dir)&&(Te.current=!0,C(Y.dir).then(()=>{const qe=Y.stab==="fix"?"fix":"report";p(qe),m.current=qe}))},[t,s]);const nt=r.jsxs("div",{className:"fix-opts",children:[r.jsxs("label",{style:{display:"flex",gap:5,alignItems:"center",cursor:"pointer",color:"var(--text)"},children:[r.jsx("input",{type:"checkbox",checked:v.auto_commit,onChange:Y=>ot("auto_commit",Y.target.checked)}),"自动提交(修复完成后 git commit,不 push)"]}),r.jsx("span",{className:"hint",children:"部署/复测是否执行由「修复」弹窗中的任务终点决定(终点≥重新部署即部署、终点=复测即任务内复测)"})]});return r.jsxs("div",{className:"bugs-tab",children:[e&&r.jsxs("div",{className:"bugwrap",ref:o,children:[r.jsxs("div",{className:"bug-left",children:[r.jsxs("div",{className:"bug-head",children:["Bug 报告 ",r.jsx("span",{className:"dim",children:s.length?"共 "+s.length:""})]}),r.jsxs("div",{className:"bug-list scroll",children:[!s.length&&r.jsx("div",{className:"hint",style:{padding:12},children:"暂无 bug 报告"}),s.map(Y=>r.jsxs("div",{className:"bugitem"+(l===Y.dir?" sel":"")+(kT(Y.status)?" history":""),title:/已拒绝/.test(Y.status||"")?"已被拒绝的报告":/复测通过/.test(Y.status||"")?"复测通过的历史报告":void 0,onClick:()=>C(Y.dir),children:[r.jsx("div",{className:"bt",children:Y.title}),r.jsxs("div",{className:"bmeta",children:[r.jsx("span",{className:"bug-status "+ep(Y.status),children:Y.status||"—"}),Y.last_task&&r.jsxs("span",{className:"bug-status "+ST(Y.last_task.status),children:[Y.last_task.name," · ",hr[Y.last_task.status]||Y.last_task.status]}),r.jsxs("span",{children:[Y.cases.length," 用例"]})]})]},Y.dir))]})]}),r.jsx("div",{className:"vsplit bug-split",onMouseDown:rt,onDoubleClick:ct}),r.jsx("div",{className:"bug-right",children:c?r.jsxs("div",{className:"bug-content scroll"+(f==="fix"?" fix-mode":""),children:[r.jsxs("div",{className:"head",children:[r.jsx("h3",{children:c.title}),r.jsx("span",{className:"bug-status "+ep(c.status),children:c.status||"—"})]}),r.jsxs("div",{className:"mut",children:["bug_report/",c.dir,c.last_task&&r.jsxs(r.Fragment,{children:[" · 最近任务「",c.last_task.name,"」:",hr[c.last_task.status]||c.last_task.status]}),"· ",r.jsxs(V,{variant:"ghost",size:"sm",className:"inline-flex h-5 px-1.5 text-[calc(11px*var(--fs))]",onClick:()=>H(),children:[r.jsx(Za,{})," 刷新"]})]}),r.jsxs("div",{className:"sub-tabs",children:[r.jsx("span",{className:"sub-tab"+(f==="report"?" on":""),onClick:()=>pe("report"),children:"报告"}),r.jsx("span",{className:"sub-tab"+(f==="fix"?" on":""),onClick:()=>pe("fix"),children:"对话"})]}),f==="report"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"ops",children:[!/已拒绝/.test(c.status||"")&&r.jsxs(V,{variant:"outline",size:"sm",onClick:te,children:[r.jsx(_a,{})," 复测"]}),!["复测通过","已修复"].some(Y=>(c.status||"").includes(Y))&&r.jsxs(V,{size:"sm",onClick:ze,children:[r.jsx(gm,{})," 修复"]}),!/已拒绝/.test(c.status||"")&&r.jsxs(V,{variant:"outline",size:"sm",onClick:()=>{L(""),A(!0)},children:[r.jsx(LN,{})," 拒绝"]}),r.jsx("span",{className:"hint",children:"复测/修复/拒绝都会创建任务(固定一轮)执行; 复测后若关联用例全部通过,bug 状态自动改为「已修复」; 拒绝会标记「已拒绝」并按理由修正关联用例; 修复/修例过程在「对话」标签页实时查看"})]}),nt,r.jsxs("div",{className:"sec-title",children:["关联用例(",c.cases.length,")"]}),c.cases.length?r.jsxs(Lm,{className:"text-xs",children:[r.jsx(Dm,{children:r.jsxs(Do,{className:"hover:bg-transparent",children:[r.jsx(In,{className:"px-2",children:"ID"}),r.jsx(In,{className:"px-2",children:"名称"}),r.jsx(In,{className:"px-2",children:"状态"}),r.jsx(In,{className:"px-2",children:"最近执行"})]})}),r.jsx(zm,{children:c.cases.map(Y=>r.jsxs(Do,{children:[r.jsx(kn,{className:"px-2 font-mono text-xs",children:Y.id}),r.jsx(kn,{className:"px-2",children:Y.name}),r.jsx(kn,{className:"px-2",children:r.jsx("span",{className:"bug-status "+NT(Y.status),children:Y.status||"—"})}),r.jsx(kn,{className:"px-2 font-mono text-xs",children:is(Y.last_run)})]},Y.id))})]}):r.jsx("div",{className:"hint",children:"未解析到关联用例"}),r.jsx("div",{className:"sec-title",children:"完整内容(bug_report.md)"}),r.jsx("div",{className:"md-body",dangerouslySetInnerHTML:$e})]}):r.jsxs("div",{className:"fix-panel",children:[r.jsxs("div",{className:"fix-controls",children:[w&&(de||me)&&r.jsxs(V,{size:"sm",variant:"outline",onClick:Fe,children:[r.jsx(mm,{})," 停止"]}),w&&["stopped","failed","done","interrupted"].includes(w==null?void 0:w.status)&&r.jsxs(V,{size:"sm",variant:"outline",onClick:Ze,children:[r.jsx(Mf,{})," 重启任务"]}),r.jsx("span",{className:"hint fix-status",children:Ce})]}),w?r.jsx(Jf,{task:w,withQBar:!1}):r.jsx("div",{className:"sess-empty",style:{flex:1},children:"尚无修复/修例会话。在「报告」标签页点击「修复」或「拒绝」创建任务后,对话会在这里实时展示。"})]})]}):r.jsx("div",{className:"bug-empty",children:"← 选择左侧 bug 报告查看详情;修复 / 复测会创建任务并放入「任务」标签页执行"})})]}),r.jsx(on,{open:S,onOpenChange:k,children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{className:"text-left",children:r.jsxs(Xt,{className:"text-sm",children:["修复「",c==null?void 0:c.title,"」"]})}),r.jsxs("div",{className:"form-col",children:[r.jsx("label",{children:"修改意见(可选)"}),r.jsx(hs,{rows:4,value:E,onChange:Y=>R(Y.target.value),placeholder:"例如:只修第 3 节指出的空指针判断,不要动缓存层;留空则按报告推荐方案修复"})]}),r.jsxs("div",{className:"form-col",children:[r.jsx("label",{children:"任务终点"}),r.jsxs(Ht,{value:z,onValueChange:N,children:[r.jsx(Lt,{size:"sm",className:"min-w-[160px]",children:r.jsx(Ot,{})}),r.jsx(Dt,{children:Z.map(Y=>r.jsx(Le,{value:Y.v,children:Y.label},Y.v))})]}),r.jsx("span",{className:"hint",style:{textAlign:"left"},children:"起点=报告分析;终点≥重新部署时自动部署、终点=复测时任务内复测(复测通过自动标记已修复)"})]}),r.jsx(Nn,{className:"flex-none",children:r.jsx(V,{onClick:Ee,children:g?"重启修复":"开始修复"})})]})}),r.jsx(on,{open:I,onOpenChange:A,children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{className:"text-left",children:r.jsxs(Xt,{className:"text-sm",children:["拒绝「",c==null?void 0:c.title,"」"]})}),r.jsxs("div",{className:"form-col",children:[r.jsx("label",{children:"拒绝理由(必填)"}),r.jsx(hs,{rows:4,value:W,onChange:Y=>L(Y.target.value),placeholder:"例如:误报——MCP 超时是环境抖动,不是协议实现问题"}),r.jsx("span",{className:"hint",style:{textAlign:"left"},children:"确认后报告标记为「已拒绝」并调暗沉底;平台将创建修例任务:按理由修正关联用例, 并把教训记入案例库 PITFALLS.md,后续生成用例时避开同类误报"})]}),r.jsx(Nn,{className:"flex-none",children:r.jsx(V,{variant:"destructive",onClick:mt,children:"确认拒绝"})})]})}),r.jsx(on,{open:J,onOpenChange:O,children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{className:"text-left",children:r.jsxs(Xt,{className:"text-sm",children:["复测「",c==null?void 0:c.title,"」"]})}),r.jsxs("div",{className:"form-col",children:[r.jsx("label",{children:"任务范围"}),r.jsxs(Ht,{value:U,onValueChange:F,children:[r.jsx(Lt,{size:"sm",className:"min-w-[220px]",children:r.jsx(Ot,{})}),r.jsx(Dt,{children:D.map(Y=>r.jsx(Le,{value:Y.v,children:Y.label},Y.v))})]}),r.jsx("span",{className:"hint",style:{textAlign:"left"},children:"仅复测且关联用例全部已固化 verify.py 时走平台脚本复测;范围含重新部署时由 agent 先按项目部署说明部署再复测"})]}),r.jsx(Nn,{className:"flex-none",children:r.jsx(V,{onClick:ie,children:"开始复测"})})]})})]})}const RT=new Set(["done"]);function PT(e){return!!(e!=null&&e.unread)&&!RT.has(e.column)}const tp=60*1e3,np=60*tp,sp=24*np,MT=7*sp,Po=e=>String(e).padStart(2,"0");function rp(e){return typeof e=="number"&&Number.isFinite(e)}function TT(e,t=Date.now()){if(!rp(e)||!rp(t))return"";const n=t-e;if(n<tp)return"刚刚";if(n<np)return`${Math.floor(n/tp)} 分钟前`;if(n<sp)return`${Math.floor(n/np)} 小时前`;if(n<MT)return`${Math.floor(n/sp)} 天前`;const s=new Date(e),o=new Date(t),l=`${Po(s.getMonth()+1)}-${Po(s.getDate())}`;return s.getFullYear()===o.getFullYear()?l:`${s.getFullYear()}-${l}`}function $T(e){if(!rp(e))return"";const t=new Date(e);return`${t.getFullYear()}-${Po(t.getMonth()+1)}-${Po(t.getDate())} ${Po(t.getHours())}:${Po(t.getMinutes())}:${Po(t.getSeconds())}`}function IT(e,t=Date.now()){return TT(e==null?void 0:e.updated_at_ts,t)}function AT(e){const t=$T(e==null?void 0:e.updated_at_ts);return t?`最后更新:${t}`:""}function Mj(e){const t=e&&e.session_rename;return t?t.ok===!1?`卡名已改;DSH 会话名未同步:${t.error||"未知原因"}`:t.accepted_title?`DSH 侧标题被截断为「${t.accepted_title}」(卡面保留原文)`:"":""}const OT=1;function $x(e){const t=e&&typeof e.querySelectorAll=="function"?Array.from(e.querySelectorAll(".board-card-ops")):[];if(!t.length)return{total:0,compacted:0};t.forEach(l=>l.classList.remove("is-compact"));const n=e.classList&&typeof e.classList.add=="function";n&&e.classList.add("board-ops-measure");const s=t.map(l=>l.scrollWidth-l.clientWidth);let o=0;return t.forEach((l,a)=>{const i=s[a]>OT;l.classList.toggle("is-compact",i),i&&(o+=1)}),n&&e.classList.remove("board-ops-measure"),{total:t.length,compacted:o}}function Xc({options:e=[],value:t,onChange:n,placeholder:s="搜索…",emptyHint:o="无匹配项",className:l,inputClassName:a}){const[i,c]=u.useState(!1),[d,f]=u.useState(""),[p,m]=u.useState(0),g=u.useRef(null),h=u.useRef(null),y=e.find(S=>S.value===t)||null,j=d.trim().toLowerCase(),w=j?e.filter(S=>((S.search||"")+" "+S.label).toLowerCase().includes(j)):e;u.useEffect(()=>{if(!i)return;const S=k=>{var E;(E=g.current)!=null&&E.contains(k.target)||c(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),u.useEffect(()=>{m(0)},[d,i]);function x(){var S;if(i){c(!1);return}f(""),c(!0),(S=h.current)==null||S.focus()}function v(S){n(S.value),c(!1),f("")}function b(S){if(!i&&(S.key==="ArrowDown"||S.key==="Enter")&&S.preventDefault(),!i){S.key==="ArrowDown"&&x();return}if(S.key==="Escape"){c(!1),f("");return}if(S.key==="ArrowDown"){S.preventDefault(),m(k=>Math.min(k+1,w.length-1));return}if(S.key==="ArrowUp"){S.preventDefault(),m(k=>Math.max(k-1,0));return}if(S.key==="Enter"){S.preventDefault(),w[p]&&v(w[p]);return}}return r.jsxs("div",{ref:g,className:Ke("relative",l),children:[r.jsx(Ae,{ref:h,className:Ke("pr-8",a),value:i?d:y?y.label:"",placeholder:s,onChange:S=>{c(!0),f(S.target.value)},onFocus:()=>{i||c(!0)},onKeyDown:b,title:y?y.label:void 0}),r.jsx("button",{type:"button",tabIndex:-1,className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-5 w-5 items-center justify-center rounded hover:bg-accent",onClick:()=>x(),children:r.jsx(ql,{className:Ke("size-4 opacity-50 transition-transform",i&&"rotate-180")})}),i&&r.jsxs("div",{className:`absolute left-0 right-0 top-full z-50 mt-1 max-h-56 overflow-y-auto
464
+ rounded-md border bg-popover text-popover-foreground p-1 shadow-md`,children:[w.length===0&&r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:o}),w.map((S,k)=>r.jsx("div",{className:Ke("flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm select-none",S.value===t&&"bg-accent text-accent-foreground",S.value!==t&&(k===p?"bg-accent/60 text-accent-foreground":"hover:bg-accent")),onMouseEnter:()=>m(k),onClick:()=>v(S),children:r.jsx("span",{className:"flex-1 truncate",children:S.label})},S.value))]})]})}const LT=10*1024*1024;function DT({project:e,card:t,comments:n,onClose:s,reload:o}){const l=e.id,[a,i]=u.useState(!1),[c,d]=u.useState(t.title+`
465
+ `+(t.description||"")),[f,p]=u.useState(""),[m,g]=u.useState(""),[h,y]=u.useState(""),[j,w]=u.useState(!1),[x,v]=u.useState(!1),[b,S]=u.useState(null),[k,E]=u.useState(!1),[R,z]=u.useState(!1),N=u.useRef(null),{rzOn:I,rzStyle:A,rzStart:W,rzDragStart:L,rzReset:J}=fr("ts.boardW",!1);u.useEffect(()=>{a||d(t.title+`
466
+ `+(t.description||""))},[t.title,t.description,a]),u.useEffect(()=>{i(!1),p(""),g(""),y(""),S(null)},[t.id]);const O=u.useMemo(()=>fi([e],l),[e,l]),U=u.useMemo(()=>({__html:Vo(io(t.description||"*(无描述)*",l,{roots:O}))}),[t.description,l,O]),[F,Z]=u.useState([]),[D,be]=u.useState(null),[ge,Te]=u.useState({}),[re,$e]=u.useState([]);u.useEffect(()=>{Re.get(l).then(B=>{Z(B.cards||[]),be(B.capabilities||null),Te(B.session_titles||{})}).catch(()=>{}),Re.listSessions(l).then(B=>$e(B.sessions||[])).catch(()=>{})},[l,t.id,t.updated_at]);async function he(B){try{const te=await Re.updateCard(l,t.id,B),ie=Mj(te);ie&&M(ie),await o()}catch(te){M(te.message)}}async function De(){const B=c.indexOf(`
467
+ `),te=(B<0?c:c.slice(0,B)).trim()||"未命名",ie=B<0?"":c.slice(B+1);await he({title:te.slice(0,200),description:ie}),i(!1)}async function de(B){p(B),await he({scheduled_at:B?new Date(B).getTime():0})}async function me(B){const te=h.trim();if(te)try{const ie=await Re.addComment(l,t.id,te);y(""),B&&await Re.sendComment(l,t.id,ie.id),await o()}catch(ie){M(ie.message),await o()}}async function Ce(B){const te=Array.from(B||[]);if(!(!te.length||k))for(const ie of te){if(ie.size>LT){M(`附件过大(>10MB):${ie.name}`);continue}if(await vm(ie)){M(`已跳过占位图(极小尺寸):${ie.name}(剪贴板里不是有效截图,请重新截图或改用「+」选文件)`);continue}E(!0);try{const ze=await new Promise((nt,Y)=>{const qe=new FileReader;qe.onload=()=>nt(String(qe.result||"").split(",")[1]||""),qe.onerror=()=>Y(new Error("文件读取失败")),qe.readAsDataURL(ie)}),Ee=await Re.uploadMedia(l,{name:ie.name,mime:ie.type||"application/octet-stream",data:ze}),mt=(ie.type||"").startsWith("image/")?`![${ie.name}](${Ee.url})`:`[${ie.name}](${Ee.url})`,ot=N.current,Fe=!!ot&&document.activeElement===ot,Ze=Fe?ot.selectionStart??ot.value.length:-1,rt=Fe?(ot.value||"").indexOf(`
468
+ `):-1,ct=Fe&&rt>=0&&Ze>rt;d(nt=>ct?nt.slice(0,Ze)+mt+nt.slice(ot.selectionEnd??Ze):(nt?nt+`
469
+ `:"")+mt+`
470
+ `),M(ct||!Fe?`已粘贴附件:${ie.name}`:`标题不支持图片,已附加到描述区:${ie.name}`)}catch(ze){M(ze.message||"附件上传失败")}finally{E(!1)}}}function _e(B){var ze;const ie=Array.from(((ze=B.clipboardData)==null?void 0:ze.items)||[]).filter(Ee=>Ee.kind==="file").map(Ee=>Ee.getAsFile()).filter(Boolean);ie.length&&(B.preventDefault(),Ce(ie))}function C(B){var ie;const te=Array.from(((ie=B.dataTransfer)==null?void 0:ie.files)||[]);te.length&&(B.preventDefault(),Ce(te))}async function H(){if(!(R||!window.confirm(`确认清理该独立 worktree?
471
+
472
+ ${t.worktree}
473
+
474
+ 仅在工作树无未提交改动且会话未运行时才能清理(分支保留,不自动删除)。`))){z(!0);try{await Re.removeWorktree(l,t.id),M("已清理 worktree"),await o()}catch(te){M(te.message)}finally{z(!1)}}}const pe=D?!D.chat:!0;return r.jsx(on,{open:!0,onOpenChange:B=>{B||s()},children:r.jsxs(Qt,{className:"modal modal-rz board-detail-modal w-[52vw] h-auto max-h-[90vh] sm:max-w-[94vw] overflow-y-auto"+(I?" rz-drag":""),style:{...A,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:W,reset:J}),r.jsx(Yt,{className:"text-left",children:r.jsxs(Xt,{className:"cursor-move select-none text-sm break-words",onMouseDown:L,children:["#",t.id," ",t.title||"未命名"]})}),r.jsxs("div",{className:"board-detail",children:[r.jsxs("div",{className:"board-sec",children:[r.jsxs("div",{className:"board-sec-t",children:["📝 标题 / 描述",!a&&r.jsx(V,{size:"sm",variant:"ghost",onClick:()=>i(!0),children:"✏ 编辑"})]}),a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"hint",children:"第一行为标题,其余为描述;支持粘贴/拖入图片与文件(存为附件,10MB 内);Ctrl+Enter 保存"}),r.jsx(hs,{ref:N,rows:10,value:c,onChange:B=>d(B.target.value),onPaste:_e,onDrop:C,onKeyDown:B=>{B.key==="Enter"&&B.ctrlKey&&(B.preventDefault(),k||De())},placeholder:"第一行为标题(空则显示「未命名」),其余为描述…"}),r.jsxs("div",{className:"mt-1 flex gap-2",children:[r.jsx(V,{size:"sm",onClick:De,disabled:k,children:k?"附件上传中…":"保存"}),r.jsx(V,{size:"sm",variant:"outline",onClick:()=>{i(!1),d(t.title+`
475
+ `+(t.description||""))},children:"取消"})]})]}):r.jsx("div",{className:"md-body",dangerouslySetInnerHTML:U})]}),t.column==="todo"&&r.jsxs("div",{className:"board-sec",children:[r.jsx("div",{className:"board-sec-t",children:"⏰ 定时开工"}),r.jsx(Ae,{type:"datetime-local",value:f||(t.scheduled_at?zT(t.scheduled_at):""),onChange:B=>de(B.target.value)}),r.jsx("div",{className:"hint",children:"到点自动进入「正在开发」(受串行门禁约束)"})]}),t.worktree&&r.jsxs("div",{className:"board-sec",children:[r.jsxs("div",{className:"board-sec-t",children:["🌿 独立 worktree",r.jsx(V,{size:"sm",variant:"ghost",disabled:R,title:"删除该独立工作树目录(会话运行中或工作树有未提交改动时会被后端拒绝)",onClick:H,children:R?"清理中…":"清理 worktree"})]}),r.jsxs("div",{className:"hint break-all",title:t.worktree,children:[r.jsx("span",{className:"font-mono",children:t.worktree}),"(分支 ts/card-",t.id,")"]})]}),r.jsxs("div",{className:"board-sec",children:[r.jsx("div",{className:"board-sec-t",children:"💬 相关会话"}),(t.sessions||[]).map(B=>r.jsxs("div",{className:"flex items-center gap-1 py-0.5 text-xs cursor-pointer hover:bg-accent/40 rounded px-1 -mx-1",title:`点击查看会话 ${B}`,onClick:()=>S(B),children:[r.jsx("span",{className:"flex-1 min-w-0 truncate",children:ge[B]||r.jsx("span",{className:"font-mono",children:B})}),ge[B]&&r.jsx("span",{className:"font-mono text-muted-foreground",children:B.slice(0,8)}),B===t.session_id&&r.jsx("span",{className:"bug-status pass",children:"主"}),r.jsx(V,{size:"sm",variant:"ghost",title:"复制 id",onClick:te=>{var ie;te.stopPropagation(),(ie=navigator.clipboard)==null||ie.writeText(B),M("已复制")},children:r.jsx(cm,{})}),B!==t.session_id&&r.jsx(V,{size:"sm",variant:"ghost",title:"设为主会话",onClick:te=>{te.stopPropagation(),he({session_id:B})},children:"设主"}),r.jsx(V,{size:"sm",variant:"ghost",title:"解绑",onClick:te=>{te.stopPropagation(),he({unbind_session:B})},children:"✂"}),(D==null?void 0:D.compact)&&r.jsx(V,{size:"sm",variant:"ghost",title:"compact 压缩会话上下文",onClick:async te=>{te.stopPropagation();try{await Re.compact(l,t.id,B),M("compact 已触发")}catch(ie){M(ie.message)}},children:r.jsx(zC,{})}),(D==null?void 0:D.fork)&&r.jsx(V,{size:"sm",variant:"ghost",disabled:j,title:"压缩并新建:压缩会话内容并新建会话(新会话只含压缩摘要、无历史轮次,原会话保留)",onClick:async te=>{if(te.stopPropagation(),!j){w(!0);try{const ie=await Re.forkCompact(l,t.id,B);M("已新建会话并注入压缩内容"),await he({bind_session:ie.new_sid})}catch(ie){M(ie.message)}finally{w(!1)}}},children:j?"压缩中…":r.jsx(YN,{})}),(D==null?void 0:D.fork)&&r.jsx(V,{size:"sm",variant:"ghost",disabled:x,title:"fork 会话:完整复制为新会话(历史/上下文全量保留)并加入卡片会话列表(不改变主会话,需要时点「设主」)",onClick:async te=>{if(te.stopPropagation(),!x){v(!0);try{const ie=await Re.forkSession(l,t.id,B);M("已 fork 新会话并加入卡片会话列表"),await he({bind_session:ie.new_sid})}catch(ie){M(ie.message)}finally{v(!1)}}},children:x?"fork 中…":r.jsx(cC,{})}),r.jsx(V,{size:"sm",variant:"ghost",title:"查看会话",onClick:te=>{te.stopPropagation(),S(B)},children:"🔍"})]},B)),r.jsxs("div",{className:"mt-1 flex gap-1",children:[r.jsx(Xc,{className:"flex-1",placeholder:"搜索或选择已有会话…",emptyHint:"工作区暂无会话",options:re.map(B=>({value:B.sid,label:`${B.title||B.sid.slice(0,12)}(${new Date(B.mtime*1e3).toLocaleString()})`+(B.bound?" [已绑定]":"")+(B.archived?" [已归档]":""),search:B.sid})),value:m,onChange:g}),r.jsx(V,{size:"sm",variant:"outline",disabled:!m.trim(),onClick:async()=>{await he({bind_session:m.trim()}),g("")},children:"绑定"})]})]}),r.jsxs("div",{className:"board-sec",children:[r.jsx("div",{className:"board-sec-t",children:"🔗 父任务依赖"}),r.jsx(Xc,{placeholder:"选择父任务卡片…",emptyHint:"没有匹配的卡片",options:[{value:"",label:"(无依赖)"}].concat(F.filter(B=>B.id!==t.id).map(B=>({value:String(B.id),label:`#${B.id} ${B.title||"未命名"}(${B.column})`,search:B.title||""}))),value:t.parent_card_id?String(t.parent_card_id):"",onChange:B=>he({parent_card_id:B?+B:null})}),F.filter(B=>B.id!==t.id).length===0&&r.jsx("div",{className:"hint",children:"暂无其他卡片可作为父任务"})]}),r.jsxs("div",{className:"board-sec",children:[r.jsx("div",{className:"board-sec-t",children:"💭 评论"}),(n||[]).map(B=>r.jsxs("div",{className:"py-1 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"text-muted-foreground",children:B.created_at}),B.sent&&r.jsx("span",{className:"bug-status pass",children:"✓ 已投递"}),r.jsx("span",{className:"flex-1"}),!B.sent&&!pe&&r.jsx(V,{size:"sm",variant:"ghost",title:"投递到主会话",onClick:async()=>{try{await Re.sendComment(l,t.id,B.id),await o()}catch(te){M(te.message)}},children:r.jsx(Tf,{})}),r.jsx(V,{size:"sm",variant:"ghost",title:"删除",onClick:async()=>{try{await Re.removeComment(l,t.id,B.id),await o()}catch(te){M(te.message)}},children:r.jsx(Qs,{})})]}),r.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:Vo(io(B.text,l,{roots:O}))}})]},B.id)),r.jsx(hs,{rows:3,placeholder:pe?"评论(dsh 不支持投递,仅保存)":"评论(Ctrl+Enter 保存)",value:h,onChange:B=>y(B.target.value),onKeyDown:B=>{B.key==="Enter"&&B.ctrlKey&&me(!1)}}),r.jsxs("div",{className:"mt-1 flex gap-2",children:[r.jsx(V,{size:"sm",variant:"outline",onClick:()=>me(!1),children:"保存"}),!pe&&r.jsxs(V,{size:"sm",onClick:()=>me(!0),disabled:!t.session_id,title:t.session_id?"":"尚无会话,请先开始开发",children:[r.jsx(Tf,{})," 保存并投递"]})]})]})]}),r.jsx(Yc,{board:b?{projectId:l,sid:b,cid:t.id,column:t.column,title:t.title}:null,onSwitchSession:S,onClose:()=>S(null)})]})})}function zT(e){const t=new Date(e),n=s=>String(s).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}const FT={todo:"待开发",doing:"正在开发",blocked:"阻塞",review:"待审核",done:"已完成"};function BT({project:e,onClose:t,onChanged:n}){const s=e==null?void 0:e.id,[o,l]=u.useState([]),[a,i]=u.useState(!1);async function c(){try{const m=await Re.trashList(s);l(m.cards||[])}catch(m){M(m.message)}}u.useEffect(()=>{c()},[s]);async function d(m){try{await Re.restoreCard(s,m.id),M(`已还原「${m.title||"未命名"}」`),await c(),n==null||n()}catch(g){M(g.message)}}async function f(m){if(window.confirm(`彻底删除「${m.title||"未命名"}」?评论一并删除,不可恢复。`))try{await Re.purgeCard(s,m.id),await c(),n==null||n()}catch(g){M(g.message)}}async function p(){if(!a&&window.confirm(`清空回收站共 ${o.length} 张卡片?全部彻底删除,不可恢复。`)){i(!0);try{await Re.emptyTrash(s),l([]),M("回收站已清空"),n==null||n()}catch(m){M(m.message)}finally{i(!1)}}}return r.jsx(on,{open:!0,onOpenChange:m=>!m&&t(),children:r.jsxs(Qt,{className:"modal board-trash-modal w-[52vw] max-h-[85vh] overflow-y-auto sm:max-w-[94vw]",children:[r.jsx(Yt,{className:"text-left",children:r.jsxs(Xt,{className:"text-sm",children:["回收站(",o.length,")"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:"删除的卡片仅移入回收站,可还原;这里的彻底删除不可恢复"}),r.jsxs(V,{size:"sm",variant:"outline",disabled:!o.length||a,onClick:p,children:[r.jsx(Qs,{})," 清空回收站"]})]}),o.length===0?r.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:"回收站是空的"}):r.jsx("div",{className:"flex flex-col gap-2",children:o.map(m=>{var g;return r.jsxs("div",{className:"flex items-start gap-2 rounded border border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm break-words",children:m.title||"未命名"}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1 text-xs text-muted-foreground",children:[r.jsx("span",{className:"bug-status pending",children:FT[m.column]||m.column}),m.jira_key&&r.jsx("span",{className:"bug-status pending",children:m.jira_key}),r.jsxs("span",{children:["删除于 ",((g=m.trashed_at)==null?void 0:g.replace("T"," "))||""]})]})]}),r.jsxs(V,{size:"sm",variant:"outline",title:"还原(回原列原位置)",onClick:()=>d(m),children:[r.jsx(Sl,{})," 还原"]}),r.jsx(V,{size:"sm",variant:"ghost",title:"彻底删除(不可恢复)",onClick:()=>f(m),children:r.jsx(Qs,{})})]},m.id)})}),r.jsx(Nn,{children:r.jsx(V,{variant:"outline",onClick:t,children:"关闭"})})]})})}const Cd=4,Xi=8;function HT({trigger:e,items:t=[],align:n="end"}){const[s,o]=u.useState(!1),[l,a]=u.useState(null),i=u.useRef(null),c=u.useRef(null);function d(f=!1){var p,m;o(!1),a(null),f&&((m=(p=i.current)==null?void 0:p.querySelector("button"))==null||m.focus())}return u.useEffect(()=>{if(!s)return;const f=g=>{var h,y;(h=c.current)!=null&&h.contains(g.target)||(y=i.current)!=null&&y.contains(g.target)||d()},p=g=>{g.key==="Escape"&&d(!0)},m=()=>d();return document.addEventListener("mousedown",f),document.addEventListener("keydown",p),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",p),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[s]),u.useLayoutEffect(()=>{var y,j,w,x;if(!s)return;const f=(y=i.current)==null?void 0:y.getBoundingClientRect();if(!f)return;const p=((j=c.current)==null?void 0:j.offsetWidth)||0,m=((w=c.current)==null?void 0:w.offsetHeight)||0;let g=n==="start"?f.left:f.right-p;g=Math.max(Xi,Math.min(g,window.innerWidth-p-Xi));let h=f.bottom+Cd;m&&h+m>window.innerHeight-Xi&&f.top-Cd-m>=Xi&&(h=f.top-Cd-m),a({left:g,top:h}),(x=c.current)==null||x.focus()},[s,n]),r.jsxs(r.Fragment,{children:[r.jsx("span",{ref:i,className:"inline-flex",onClick:()=>s?d():o(!0),children:e}),s&&Jo.createPortal(r.jsxs("div",{ref:c,role:"menu",tabIndex:-1,style:{position:"fixed",left:l?l.left:-9999,top:l?l.top:-9999,visibility:l?"visible":"hidden"},className:"z-50 min-w-[176px] rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none",children:[t.length===0&&r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"无可选项"}),t.map(f=>r.jsx("div",{title:f.disabled?f.title:void 0,children:r.jsxs("button",{type:"button",role:"menuitem",disabled:!!f.disabled,"aria-disabled":f.disabled||void 0,title:f.disabled?void 0:f.title,className:Ke("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm select-none",f.disabled?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent hover:text-accent-foreground"),onClick:()=>{var p;f.disabled||(d(),(p=f.onSelect)==null||p.call(f))},children:[f.icon&&r.jsx("span",{className:"shrink-0",children:f.icon}),r.jsx("span",{className:"flex-1 truncate",children:f.label})]})},f.key))]}),document.body)]})}function or({icon:e,iconNarrow:t,label:n,className:s="",...o}){return r.jsxs(V,{size:"sm",className:`board-opbtn ${s}`.trim(),"aria-label":n,title:n,...o,children:[r.jsx("span",{className:"board-opwide",children:r.jsx(e,{})}),r.jsx("span",{className:"board-opicon",children:r.jsx(t,{})}),r.jsx("span",{className:"board-oplabel",children:n})]})}function ga({className:e="",...t}){return r.jsx(V,{size:"sm",className:`board-opbtn ${e}`.trim(),...t})}const UT=6,VT=10*1024*1024,WT={normal:"探索",fix:"修复",retest_bug:"复测",script_retest:"脚本复测",stress:"压测",regression:"回归",pipeline:"后段",reject:"修例"},qT=new Set(["doing","review","done"]),GT={running:"run",queued:"pending",done:"pass"},KT=[["all","全部"],["dev","仅开发"],["test","仅测试"]],QT=[{key:"todo",label:"待开发"},{key:"doing",label:"正在开发"},{key:"blocked",label:"阻塞"},{key:"review",label:"待审核"},{key:"done",label:"已完成"}],Ix=[["manual","手动"],["created_desc","创建新→旧"],["updated_desc","更新新→旧"],["title","标题"]],YT=e=>e==="done"?[["entered_desc","进入新→旧"],...Ix]:Ix,XT={serial:"串行",parallel:"并行"},Ax=e=>e.queue_state==="running"||e.queue_state==="starting",Ox=e=>!e.answer_pending&&(!!e.running||e.queue_state==="starting"),Ji=e=>e.block_kind==="queue"&&!e.answer_pending;function JT({project:e}){var It,Rr,Pr,nr;const t=e==null?void 0:e.id,n=Ej(),[s,o]=u.useState(null),[l,a]=u.useState(null),[i,c]=u.useState(null),[d,f]=u.useState(""),[p,m]=u.useState({}),[g,h]=u.useState(null),[y,j]=u.useState(null),[w,x]=u.useState(""),[v,b]=u.useState(null),[S,k]=u.useState({}),[E,R]=u.useState(null),z=u.useRef({}),[N,I]=u.useState(null),[A,W]=u.useState(!1),[L,J]=u.useState(!1),[O,U]=u.useState(!1),[F,Z]=u.useState(null),[D,be]=u.useState(null),[ge,Te]=u.useState(""),re=u.useRef(null),[$e,he]=u.useState(null),De=u.useRef(null),de=u.useRef(!1),me=u.useRef([]),Ce=u.useRef(null),_e=u.useRef(null),C=u.useRef(null),H=u.useRef(null),pe=u.useRef(null),B=u.useRef(null),te=u.useRef(null),ie=u.useRef(null),ze=u.useRef(null);async function Ee(){var T;if(t&&!((T=De.current)!=null&&T.on))try{_e.current=Fe(),o(await Re.get(t))}catch(q){M(q.message)}}u.useEffect(()=>{o(null),a(null),Z(null),f(""),h(null),R(null),k({}),z.current={},Ee(),kl.get(t).then(xe=>{var Be;return m(((Be=xe.prefs)==null?void 0:Be.board_filters)||{})}).catch(()=>{});let T=null;const q=()=>{C.current||(C.current=setTimeout(()=>{C.current=null,Ee()},300))};try{T=Re.stream(t),T.addEventListener("hello",q),T.addEventListener("refresh",q)}catch{}const ye=setInterval(Ee,6e4);return()=>{clearInterval(ye),C.current&&(clearTimeout(C.current),C.current=null);try{T==null||T.close()}catch{}}},[t]);function mt(T,q){m(ye=>{const xe={...ye,[T]:q};return kl.set(t,"board_filters",xe).catch(()=>{}),xe})}const ot=u.useMemo(()=>(s==null?void 0:s.cards)||[],[s]);me.current=ot,Ce.current=s;function Fe(){const T=new Map;return document.querySelectorAll(".board-card[data-card-id]").forEach(q=>{T.set(q.dataset.cardId,q.getBoundingClientRect())}),T}u.useLayoutEffect(()=>{const T=_e.current;if(_e.current=null,!!T)for(const[q,ye]of T){const xe=document.querySelector(`[data-card-id="${q}"]`);if(!xe)continue;const Be=xe.getBoundingClientRect(),ke=ye.left-Be.left,Et=ye.top-Be.top;!ke&&!Et||(xe.style.transition="none",xe.style.transform=`translate(${ke}px, ${Et}px)`,xe.getBoundingClientRect(),xe.style.transition="transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1)",xe.style.transform="")}}),u.useLayoutEffect(()=>{const T=ie.current;T&&($x(T),!ze.current&&typeof ResizeObserver<"u"&&(ze.current=new ResizeObserver(()=>{ie.current&&$x(ie.current)}),ze.current.observe(T)))}),u.useEffect(()=>()=>{var T;(T=ze.current)==null||T.disconnect(),ze.current=null},[]);const Ze=ot.find(T=>T.id===l)||null,rt=T=>((s==null?void 0:s.comments)||[]).filter(q=>q.card_id===T);function ct(T,q,ye,xe){const Be=T.find(ft=>ft.id===q);if(!Be)return T;const ke=T.filter(ft=>ft.id!==q),Et=ke.filter(ft=>ft.column===ye),ht=Et[Math.min(Math.max(xe,0),Et.length)],_t={...Be,column:ye};if(!ht)return[...ke,_t];const K=ke.findIndex(ft=>ft.id===ht.id);return[...ke.slice(0,K),_t,...ke.slice(K)]}function nt(T,q,ye=1/0){o(xe=>xe&&{...xe,cards:ct(xe.cards,T.id,q,ye)})}async function Y(T,q,ye,xe=null,Be=!1){try{const ke=await Re.moveCard(t,T.id,q,ye,xe,Be);if(ke.blocked==="parent-not-done"){await Ee(),b({cardId:T.id,action:"move",column:q});return}if(ke.merge_pending){await Ee(),I({card:T,info:ke.merge_pending});return}await Ee()}catch(ke){M(ke.message),await Ee()}}async function qe(T,q){try{await Re.reorderCard(t,T,q),await Ee()}catch(ye){M(ye.message),await Ee()}}async function vt(T,q,ye,xe=!1){_e.current=Fe(),nt(T,q),await Y(T,q,ye,null,xe)}async function Zt(T){if(T.worktree){let q=null;try{q=await Re.worktreePreview(t,T.id)}catch{q=null}if(q&&q.merge&&q.merge.ahead>0){I({card:T,info:q.merge});return}}await vt(T,"done")}async function zt(){const T=N;if(T){W(!0);try{await Re.mergeWorktree(t,T.card.id),I(null),M("已交给 agent 合并:卡片回到开发队列排队,完成后自动回「待审核」"),await Ee()}catch(q){M(q.message)}finally{W(!1)}}}async function ce(){const T=N;T&&(I(null),await vt(T.card,"done",void 0,!0))}async function $t(T,q){try{await Re.updateSettings(t,{sort:{[T]:q}}),await Ee()}catch(ye){M(ye.message)}}async function pn(T,q,ye,xe){var Be;try{const ke=await Re.startCard(t,T.id,q,ye,xe);if(ke.blocked==="parent-not-done"){b({cardId:T.id,action:"start",worktree:!!xe});return}xe?M("已在独立 worktree 中开始"):((Be=ke.card)==null?void 0:Be.column)==="blocked"&&M("已加入统一队列排队"),await Ee()}catch(ke){M(ke.message)}}async function ys(T){let q;try{q=await Re.worktreePreview(t,T)}catch{q={supported:!1,reason:"无法获取 worktree 预览(后端未重启或接口不可用)"}}return z.current={...z.current,[T]:q},k(z.current),q}function P(T){if(T.session_id)return"该卡片已有主会话,不能切换到独立 worktree";const q=S[T.id];return q&&q.supported===!1?q.reason||"当前项目不支持独立 worktree":""}async function Q(T){R({card:T,preview:z.current[T.id]||null});const q=await ys(T.id);q&&R(ye=>ye&&ye.card.id===T.id?{...ye,preview:q}:ye)}async function ee(T){try{await Re.deliverAnswer(t,T.id),M("已送达答案"),await Ee()}catch(q){M(q.message)}}async function le(T){try{await Re.stopCard(t,T.id),await Ee()}catch(q){M(q.message)}}async function ue(T){try{await Re.removeCard(t,T.id),a(null),M("已移入回收站(可从回收站还原)"),await Ee()}catch(q){M(q.message)}}const oe=u.useRef(pn);oe.current=pn;function Ie(T){re.current=T.id,be(T.id),Te(T.title)}function Ue(){re.current=null,be(null)}async function Qe(T){if(re.current!==T.id)return;const q=ge.trim();if(re.current=null,be(null),!(!q||q===T.title))try{const ye=await Re.updateCard(t,T.id,{title:q}),xe=Mj(ye);xe&&M(xe),await Ee()}catch(ye){M(ye.message)}}const Xe=u.useRef(ss);Xe.current=ss;const jt=u.useRef(er);jt.current=er;const en=u.useRef(rs);en.current=rs;const ln=u.useRef(Er);ln.current=Er;const lt=u.useRef(Y);lt.current=Y;const mn=u.useRef(qe);mn.current=qe;const tn=u.useRef(Ct);tn.current=Ct;const bt=u.useRef(null),Nt=u.useCallback((T,q)=>{T.button===0&&(T.target.closest("button, a, input, textarea, select")||(De.current={id:q.id,sx:T.clientX,sy:T.clientY,on:!1},de.current=!1,window.addEventListener("pointermove",Ts),window.addEventListener("pointerup",$s)))},[]);function Wt(T,q,ye){var ht,_t;const xe=(_t=(ht=document.elementFromPoint(T,q))==null?void 0:ht.closest)==null?void 0:_t.call(ht,".board-col");if(!xe)return null;const Be=xe.dataset.col,ke=[...xe.querySelectorAll(".board-card")].filter(K=>K.dataset.cardId!==String(ye));let Et=ke.length;for(let K=0;K<ke.length;K++){const ft=ke[K].getBoundingClientRect();if(q<ft.top+ft.height/2){Et=K;break}}return{col:Be,index:Et,domIds:ke.map(K=>K.dataset.cardId)}}function Ct(T){var q,ye,xe;return((xe=(ye=(q=Ce.current)==null?void 0:q.settings)==null?void 0:ye.sort)==null?void 0:xe[T])||(T==="done"?"entered_desc":"manual")}function Pn(T,q){const ye=Ct(q);if(ye==="manual")return T;const xe=[...T];return ye==="created_desc"?xe.sort((Be,ke)=>(ke.created_at||"").localeCompare(Be.created_at||"")):ye==="updated_desc"?xe.sort((Be,ke)=>(ke.updated_at||"").localeCompare(Be.updated_at||"")):ye==="title"?xe.sort((Be,ke)=>(Be.title||"").localeCompare(ke.title||"","zh")):ye==="entered_desc"&&xe.sort((Be,ke)=>(ke.done_at||"").localeCompare(Be.done_at||"")),xe}function Cr(T){const q=d.trim().toLowerCase();return q?(T.title||"").toLowerCase().includes(q)||(T.description||"").toLowerCase().includes(q)||(T.jira_key||"").toLowerCase().includes(q):!0}function ss(T,q){var Et;const ye=me.current.find(ht=>ht.id===T);te.current=(ye==null?void 0:ye.column)||null,H.current=((Et=Ce.current)==null?void 0:Et.cards)||null,pe.current=null;const xe=document.querySelector(`[data-card-id="${T}"]`);if(!xe)return;const Be=xe.getBoundingClientRect(),ke=xe.cloneNode(!0);ke.className=ke.className.replace(" drag-gap","")+" board-ghost",Object.assign(ke.style,{position:"fixed",left:Be.left+"px",top:Be.top+"px",width:Be.width+"px",margin:"0",zIndex:999,pointerEvents:"none",opacity:"0.95",transform:"scale(1.04) rotate(1.5deg)",boxShadow:"var(--shadow-ghost)",transition:"none"}),document.body.appendChild(ke),B.current={el:ke,dx:q.clientX-Be.left,dy:q.clientY-Be.top},bt.current=ht=>{ht.key==="Escape"&&(de.current=!0,De.current=null,ln.current(T,-1,-1))},window.addEventListener("keydown",bt.current)}function er(T){const q=B.current;q&&(q.el.style.left=T.clientX-q.dx+"px",q.el.style.top=T.clientY-q.dy+"px")}function rs(T,q){const ye=pe.current;if(ye&&ye.col===q.col&&ye.index===q.index)return;const xe=q.col===T.column;xe&&q.col!=="doing"&&Ct(q.col)!=="manual"||(pe.current=q,c(q.col),_e.current=Fe(),nt(T,q.col,!xe&&Ct(q.col)!=="manual"?1/0:q.index))}const Ts=u.useRef(T=>{const q=De.current;if(!q)return;if(!q.on){if(Math.hypot(T.clientX-q.sx,T.clientY-q.sy)<UT)return;q.on=!0,Xe.current(q.id,T),he(q.id)}jt.current(T);const ye=me.current.find(Be=>Be.id===q.id);if(!ye)return;const xe=Wt(T.clientX,T.clientY,q.id);xe&&en.current(ye,xe)}).current;function Er(T,q,ye){var Ft,yn,ws,ol,js,Mr;const xe=B.current;B.current=null;const Be=xe?xe.el.getBoundingClientRect():null;xe==null||xe.el.remove();const ke=Wt(q,ye,T),Et=Fe();Be&&Et.set(String(T),Be),_e.current=Et;const ht=H.current;H.current=null,pe.current=null,he(null),c(null);const _t=(((Ft=Ce.current)==null?void 0:Ft.cards)||[]).find(Mn=>Mn.id===T);if(!_t){Ee();return}const K=te.current;if(te.current=null,!ke){ht&&o(Mn=>Mn&&{...Mn,cards:ht});return}if(ke.col==="doing"&&K!=="doing"){ht&&o(Mn=>Mn&&{...Mn,cards:ht}),oe.current(_t);return}if(ke.col===K){if(ke.col==="doing"){const ls=new Map((((yn=Ce.current)==null?void 0:yn.cards)||[]).map(He=>[String(He.id),He])),_=(ke.domIds||[]).map(He=>ls.get(He)).filter(Boolean),se=_[ke.index]??null,Se=se?Ox(se)?"prefix":Ji(se)?"waiting":"none":"waiting";let Pe=null;if(Ji(_t)&&Se==="prefix"?Pe="force":Ox(_t)&&Se==="waiting"&&_.slice(0,ke.index).filter(Ji).length>0?Pe="stop":Ji(_t)&&Se==="waiting"&&(Pe="reorder"),Pe==="force"&&!window.confirm("强制运行:立即启动该卡片(落哪算哪)?")&&(Pe=null),Pe==="stop"&&!window.confirm("停止当前任务?停止后卡片进入待审核。")&&(Pe=null),!Pe){ht&&o(He=>He&&{...He,cards:ht});return}lt.current(_t,"doing",void 0,(se==null?void 0:se.id)??null);return}if(tn.current(ke.col)!=="manual")return;const Mn=(((ws=Ce.current)==null?void 0:ws.cards)||[]).filter(ls=>ls.column===ke.col&&ls.id!==T);mn.current(T,((ol=Mn[ke.index])==null?void 0:ol.id)??null);return}let ft=null;tn.current(ke.col)==="manual"&&(ft=((Mr=(((js=Ce.current)==null?void 0:js.cards)||[]).filter(ls=>ls.column===ke.col&&ls.id!==T)[ke.index])==null?void 0:Mr.id)??null),lt.current(_t,ke.col,void 0,ft)}const $s=u.useRef(T=>{const q=De.current;De.current=null,window.removeEventListener("pointermove",Ts),window.removeEventListener("pointerup",$s),bt.current&&(window.removeEventListener("keydown",bt.current),bt.current=null),!(!q||!q.on)&&(de.current=!0,ln.current(q.id,T.clientX,T.clientY))}).current;function tr(T){if(de.current){de.current=!1;return}rl(T)}function sl(T){T.unread&&(o(q=>q&&{...q,cards:q.cards.map(ye=>ye.id===T.id?{...ye,unread:!1}:ye)}),Re.markViewed(t,T.id).catch(()=>{}))}function rl(T){a(T.id),sl(T)}if(!t)return null;const os=!!(e!=null&&e.archived),an=!(e!=null&&e.agent_path);return r.jsxs("div",{className:"board-tab",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1.5",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"开发看板"}),r.jsx("span",{className:"bug-status pending",children:XT[(It=s==null?void 0:s.settings)==null?void 0:It.mode]||"串行"}),r.jsx("span",{className:"flex-1"}),r.jsx(Ae,{className:"board-search",placeholder:"搜索卡片(标题/描述/Jira)",value:d,onChange:T=>f(T.target.value)}),r.jsxs(V,{size:"sm",variant:"outline",onClick:()=>J(!0),children:[r.jsx(tw,{})," 设置"]}),r.jsxs(V,{size:"sm",variant:"outline",title:"回收站(删除的卡片可还原)",onClick:()=>U(!0),children:[r.jsx(Qs,{})," 回收站"]})]}),r.jsx("div",{className:"board-cols",ref:ie,children:QT.map(T=>{const q=p[T.key]||"all",ye=qT.has(T.key)&&q!=="dev"?((s==null?void 0:s.active_tasks)||[]).filter(K=>(K.column||"doing")===T.key):[],xe=q!=="test"?ot.filter(K=>K.column===T.key&&Cr(K)):[],Be=T.key==="doing"?xe:Pn(xe,T.key),ke=T.key==="doing"?Be.filter(Ax):[],Et=T.key==="doing"?Be.filter(K=>!Ax(K)):[],ht=T.key==="doing"?[...ke,...Et]:Be,_t=ke.length>0&&Et.length>0?ke.length:-1;return r.jsxs("div",{"data-col":T.key,className:"board-col"+(i===T.key?" dragover":""),children:[r.jsxs("div",{className:"board-col-head",children:[r.jsx("span",{className:"board-col-label",children:T.label}),r.jsx("span",{className:"board-col-count",children:Be.length}),r.jsx("select",{className:"board-col-sort",title:"列表过滤:开发任务=卡片,测试任务=平台测试任务",value:q,onChange:K=>mt(T.key,K.target.value),children:KT.map(([K,ft])=>r.jsx("option",{value:K,children:ft},K))}),T.key!=="doing"&&r.jsx("select",{className:"board-col-sort",title:"列内排序方案",value:Ct(T.key),onChange:K=>$t(T.key,K.target.value),children:YT(T.key).map(([K,ft])=>r.jsx("option",{value:K,children:ft},K))})]}),r.jsxs("div",{className:"board-col-body",children:[ye.map(K=>r.jsxs("div",{className:"board-task"+(K.session_id?" has-session":""),title:K.session_id?"测试任务 · 点击查看会话":"测试任务(尚无会话)",onClick:()=>{K.session_id&&h(K)},children:[r.jsx("div",{className:"board-card-title",style:{cursor:"default"},onClick:ft=>ft.stopPropagation(),children:K.name}),r.jsxs("div",{className:"board-card-badges",children:[r.jsxs("span",{className:"board-card-id",title:"测试任务 id",children:["任务 #",K.id]}),r.jsxs("span",{className:"bug-status "+(GT[K.status]||"retest"),children:["测试·",hr[K.status]||K.status]}),r.jsx("span",{className:"bug-status pending",children:WT[K.task_type]||K.task_type}),K.current_round>0&&r.jsxs("span",{className:"bug-status pending",children:["轮 ",K.current_round]})]}),K.error&&r.jsx("div",{className:"board-card-err",children:K.error})]},"task-"+K.id)),ht.map((K,ft)=>r.jsxs(u.Fragment,{children:[ft===_t&&r.jsx("div",{className:"board-runzone",children:r.jsx("span",{children:"等待区 · 按队列顺序"})}),r.jsxs("div",{"data-card-id":K.id,className:`board-card col-${K.column}`+($e===K.id?" drag-gap":""),onPointerDown:Ft=>Nt(Ft,K),onClick:()=>tr(K),children:[r.jsx(t$,{card:K,editing:D===K.id,editTitle:ge,onStartEdit:Ie,onSaveTitle:Qe,onEditChange:Te,onCancelEdit:Ue}),r.jsxs("div",{className:"board-card-badges",children:[PT(K)&&r.jsx("span",{className:"board-card-new",title:"状态有更新,打开卡片或点卡片上的按钮后标记消失",children:"有更新"}),r.jsxs("span",{className:"board-card-id",title:"卡片 id",children:["#",K.id]}),!!$f[K.queue_state]&&r.jsx("span",{className:sw(K.queue_state),children:$f[K.queue_state]}),K.worktree?r.jsx("span",{className:"bug-status pending",title:K.worktree,children:"🌿 worktree"}):null,K.scheduled_at?r.jsxs("span",{className:"bug-status pending",children:["⏰ ",new Date(K.scheduled_at).toLocaleString()]}):null,K.parent_card_id?r.jsxs("span",{className:"bug-status pending",children:["🔗 依赖 #",K.parent_card_id]}):null,K.block_kind==="interaction"&&r.jsxs("span",{className:"bug-status interaction",title:"agent 等待用户回答,回复后自动恢复",children:["🤔 ",K.block_text||"等待回答"]}),K.block_kind==="manual"&&r.jsx("span",{className:"bug-status retest",children:K.block_text||"手动阻塞"}),K.origin==="sync"&&r.jsx("span",{className:"bug-status pending",children:"同步"}),K.jira_key&&r.jsx("span",{className:"bug-status pending",children:K.jira_key}),r.jsx(e$,{card:K})]}),K.last_error&&r.jsx("div",{className:"board-card-err",children:K.last_error}),r.jsxs("div",{className:"board-card-ops",onClick:Ft=>{Ft.target.closest("button")&&(Ft.stopPropagation(),sl(K))},children:[K.column==="todo"&&r.jsxs("div",{className:"board-split",children:[r.jsx(or,{icon:_a,iconNarrow:_a,label:"开始",variant:"outline",disabled:os||an,title:os?"项目已归档":an?"未配置智能体":"开始",onClick:()=>pn(K)}),r.jsx(HT,{align:"end",trigger:r.jsx(ga,{variant:"outline",disabled:os||an,title:os?"项目已归档":an?"未配置智能体":"更多开始方式",onClick:()=>ys(K.id)}),items:[{key:"queue",label:"开始(入队排队)",onSelect:()=>pn(K)},{key:"worktree",label:"🌿 在新 worktree 中开始",disabled:!!P(K),title:P(K)||void 0,onSelect:()=>Q(K)}]})]}),K.column==="doing"&&!K.running&&K.block_kind!=="queue"&&r.jsx(or,{icon:Bg,iconNarrow:Bg,label:"待审核",variant:"outline",onClick:()=>vt(K,"review")}),K.column==="blocked"&&r.jsx(or,{icon:_a,iconNarrow:_a,label:"重试",variant:"outline",disabled:os||an,onClick:()=>pn(K)}),K.answer_pending&&r.jsx(or,{icon:Nl,iconNarrow:Nl,label:"送达",variant:"ghost",title:"不等项目空闲,立即把答案送达等待中的会话",onClick:()=>ee(K)}),K.block_kind==="queue"&&!K.answer_pending&&r.jsx(or,{icon:Nl,iconNarrow:Nl,label:"强制",variant:"ghost",title:"跳过队列立即开始(用户自担风险)",disabled:os||an,onClick:async()=>{window.confirm("强制开始将跳过队列立即执行,可能与在跑任务冲突,继续?")&&await pn(K,void 0,!0)}}),K.block_kind==="queue"&&r.jsx(or,{icon:Ys,iconNarrow:Ys,label:"停止",variant:"ghost",title:"取消排队并移入待审核",onClick:()=>le(K)}),K.column==="review"&&r.jsxs(r.Fragment,{children:[r.jsx(or,{icon:dr,iconNarrow:dr,label:"通过",variant:"outline",onClick:()=>Zt(K)}),r.jsx(or,{icon:Sl,iconNarrow:Sl,label:"打回",variant:"outline",onClick:()=>{j(K),x("")}})]}),K.column==="done"&&r.jsx(or,{icon:Sl,iconNarrow:Sl,label:"重开",variant:"outline",onClick:()=>vt(K,"todo")}),r.jsx(ga,{variant:"ghost",title:"打开卡片详情",onClick:()=>rl(K),children:r.jsx(xC,{})}),r.jsx(ga,{variant:"ghost",title:K.session_id?"进入主会话":"尚无会话",disabled:!K.session_id,onClick:()=>Z({sid:K.session_id,cid:K.id,column:K.column,title:K.title||"未命名"}),children:r.jsx(jC,{})}),!!(n!=null&&n.openSession)&&r.jsx(ga,{variant:"ghost",title:K.session_id?"在 dsh 界面打开该卡片主会话":"尚无会话",disabled:!K.session_id,onClick:()=>Cj(K.session_id),children:r.jsx(um,{})}),r.jsx(ga,{variant:"ghost",title:"删除卡片",onClick:()=>ue(K),children:r.jsx(Qs,{})})]})]})]},K.id))]}),T.key==="todo"&&r.jsx(n$,{disabled:os,project:e,onAdd:async(K,ft,Ft)=>{let yn=null;try{yn=await Re.createCard(t,{title:K,description:ft})}catch(ws){M(ws.message);return}if(Ft&&(yn!=null&&yn.id))try{await Re.startCard(t,yn.id),M("已进入开发队列排队")}catch(ws){M(ws.message)}await Ee()}})]},T.key)})}),Ze&&r.jsx(DT,{project:e,card:Ze,comments:rt(Ze.id),onClose:()=>a(null),reload:Ee}),F&&r.jsx(Yc,{board:{projectId:t,...F},onClose:()=>Z(null),onSwitchSession:T=>Z(q=>q&&{...q,sid:T})}),g&&r.jsx(Yc,{task:g,onClose:()=>h(null)}),r.jsx(on,{open:!!y,onOpenChange:T=>!T&&j(null),children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{children:r.jsxs(Xt,{children:["打回「",y==null?void 0:y.title,"」"]})}),r.jsx(hs,{rows:4,placeholder:"修改意见(将随会话续发改进)",value:w,onChange:T=>x(T.target.value)}),r.jsx(Nn,{children:r.jsx(V,{onClick:async()=>{const T=y;j(null),await pn(T,w)},children:"确认打回"})})]})}),r.jsx(on,{open:!!v,onOpenChange:T=>!T&&b(null),children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{children:r.jsx(Xt,{children:"父任务尚未完成"})}),r.jsx("p",{className:"hint",children:"该卡片有未完成的父任务依赖。建议先完成父任务,或在详情面板解除依赖后再开始。"}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",onClick:()=>b(null),children:"取消"}),(v==null?void 0:v.action)==="start"&&r.jsx(V,{onClick:async()=>{const T=v;b(null),await pn(ot.find(q=>q.id===T.cardId),void 0,!0,T.worktree)},children:"强制开始(自担风险)"})]})]})}),r.jsx(on,{open:!!E,onOpenChange:T=>!T&&R(null),children:r.jsxs(Qt,{className:"modal",children:[r.jsx(Yt,{children:r.jsx(Xt,{children:"在新 worktree 中开始"})}),r.jsx("p",{className:"hint",children:"将为该卡片新建独立 git worktree,会话在独立工作树中执行,主仓库不受影响。"}),((Rr=E==null?void 0:E.preview)==null?void 0:Rr.path)&&r.jsxs("p",{className:"hint break-all",children:["路径:",r.jsx("span",{className:"font-mono",children:E.preview.path})]}),((Pr=E==null?void 0:E.preview)==null?void 0:Pr.branch)&&r.jsxs("p",{className:"hint",children:["分支:",r.jsx("span",{className:"font-mono",children:E.preview.branch})]}),r.jsx("p",{className:"hint font-semibold",children:"该卡将立即执行,不与项目队列互斥,可能与项目内其他任务并发。"}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",onClick:()=>R(null),children:"取消"}),r.jsx(V,{onClick:async()=>{const T=E;R(null),await pn(T.card,void 0,!1,!0)},children:"开始"})]})]})}),r.jsx(_j,{open:!!N,info:N==null?void 0:N.info,busy:A,disabledReason:(nr=N==null?void 0:N.card)!=null&&nr.running?"会话运行中:等这一轮跑完,或先点「停止」再交接":"",onHandoff:zt,onPass:ce,onClose:()=>!A&&I(null)}),r.jsx(s$,{open:L,onClose:()=>J(!1),projectId:t,settings:s==null?void 0:s.settings,reload:Ee}),O&&r.jsx(BT,{project:e,onClose:()=>U(!1),onChanged:()=>Ee()})]})}const ZT=240;function e$({card:e}){const t=IT(e);return t?r.jsxs("span",{className:"board-card-time",title:AT(e),children:["🕒 ",t]}):null}function t$({card:e,editing:t,editTitle:n,onStartEdit:s,onSaveTitle:o,onEditChange:l,onCancelEdit:a}){const i=u.useRef(null),c=u.useRef(null),[d,f]=u.useState(5);u.useLayoutEffect(()=>{const m=i.current;if(!m)return;const g=()=>{const h=parseFloat(getComputedStyle(m).lineHeight)||19.5;f(Math.max(0,6-Math.round(m.getBoundingClientRect().height/h)))};if(g(),typeof ResizeObserver<"u"){const h=new ResizeObserver(g);return h.observe(m),()=>h.disconnect()}},[e.title,t]);const p=u.useCallback(()=>{const m=c.current;if(!m)return;m.style.height="auto";const g=m.scrollHeight+(m.offsetHeight-m.clientHeight);m.style.height=Math.min(g,ZT)+"px"},[]);return u.useLayoutEffect(()=>{t&&p()},[t,p]),t?r.jsxs(r.Fragment,{children:[r.jsx(hs,{ref:c,rows:1,value:n,autoFocus:!0,className:"board-card-title-input min-h-0 resize-none px-1 py-0 text-[calc(13px*var(--fs))] font-semibold leading-[1.5] break-all",onClick:m=>m.stopPropagation(),onChange:m=>{l(m.target.value),p()},onKeyDown:m=>{m.key==="Enter"&&!m.nativeEvent.isComposing?(m.preventDefault(),o(e)):m.key==="Escape"&&a()},onBlur:()=>o(e)}),e.description&&d>0&&r.jsx("div",{className:"board-card-desc",style:{WebkitLineClamp:d},children:e.description})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:i,className:"board-card-title",title:"单击编辑标题",onClick:m=>{m.stopPropagation(),s(e)},children:e.title||r.jsx("span",{className:"board-card-title-empty",children:"未命名"})}),e.description&&d>0&&r.jsx("div",{className:"board-card-desc",style:{WebkitLineClamp:d},children:e.description})]})}function n$({disabled:e,onAdd:t,project:n}){const[s,o]=u.useState(""),[l,a]=u.useState([]),[i,c]=u.useState(!1),d=u.useRef(null),[f,p]=u.useState(-1),[m,g]=u.useState(!1),[h,y]=u.useState([]);u.useEffect(()=>{if(!(n!=null&&n.agent_path)){y([]);return}let N=!1;return Pt.agentSkills(n.agent_path,n.project_dir||n.work_dir||"").then(I=>{if(N)return;const A=Array.isArray(I)?I:(I==null?void 0:I.skills)||[];y(A.map(W=>({key:W.name||W.id,label:W.name||W.id,desc:(W.description||W.summary||"").slice(0,40),type:"skill"})))}).catch(()=>{}),()=>{N=!0}},[n==null?void 0:n.id,n==null?void 0:n.agent_path,n==null?void 0:n.project_dir,n==null?void 0:n.work_dir]);function j(){const N=d.current;N&&(N.style.height="auto",N.style.height=Math.min(N.scrollHeight,120)+"px")}async function w(N){const I=Array.from(N||[]);if(!I.length||i)return;const A=n==null?void 0:n.id;if(A)for(const W of I){if(W.size>VT){M(`附件过大(>10MB):${W.name}`);continue}if(await vm(W)){M(`已跳过占位图(极小尺寸):${W.name}(剪贴板里不是有效截图,请重新截图或改用「+」选文件)`);continue}c(!0);try{const L=await new Promise((U,F)=>{const Z=new FileReader;Z.onload=()=>U(String(Z.result||"").split(",")[1]||""),Z.onerror=()=>F(new Error("文件读取失败")),Z.readAsDataURL(W)}),J=await Re.uploadMedia(A,{name:W.name,mime:W.type||"application/octet-stream",data:L}),O=(W.type||"").startsWith("image/")?`![${W.name}](${J.abs||J.url})`:`[${W.name}](${J.abs||J.url})`;a(U=>[...U,{md:O,url:xm(J.url),name:W.name,mime:W.type}]),M(`已添加附件:${W.name}`)}catch(L){M(L.message||"附件上传失败")}finally{c(!1)}}}function x(N){var A;const I=Array.from(((A=N.clipboardData)==null?void 0:A.items)||[]).filter(W=>W.kind==="file").map(W=>W.getAsFile()).filter(Boolean);I.length&&(N.preventDefault(),w(I))}function v(N){var A;const I=Array.from(((A=N.dataTransfer)==null?void 0:A.files)||[]);I.length&&(N.preventDefault(),w(I))}function b(N){a(I=>I.filter(A=>A.md!==N))}u.useEffect(()=>{const N=d.current;if(!N)return;const I=()=>p(N.selectionStart??0),A=()=>{p(N.selectionStart??0),g(!1)};return N.addEventListener("keyup",I),N.addEventListener("click",A),()=>{N.removeEventListener("keyup",I),N.removeEventListener("click",A)}},[]);const S=u.useMemo(()=>kj(s,f>=0?f:s.length),[s,f]),k=S!=null&&!m,E=S?S.text.slice(1):"";function R(N){if(!S)return;const I=`使用 skill「${N.label}」`;g(!0),o(W=>W.slice(0,S.start)+I+W.slice(S.start+S.text.length));const A=S.start+I.length;p(A),requestAnimationFrame(()=>{const W=d.current;W&&(W.selectionStart=W.selectionEnd=A),j()})}async function z(N=!1){if(i)return;const I=s.indexOf(`
476
+ `),A=(I<0?s:s.slice(0,I)).trim(),W=(I<0?"":s.slice(I+1)).trim(),L=l.map(O=>O.md).join(`
477
+
478
+ `),J=[W,L].filter(Boolean).join(`
479
+
480
+ `);o(""),a([]),requestAnimationFrame(j),await t(A,J,N)}return r.jsxs("div",{className:"board-add",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[(l.length>0||i)&&r.jsxs("div",{className:"sess-attachrow",children:[i&&r.jsx("span",{className:"sess-chip",children:"附件上传中…"}),l.map((N,I)=>r.jsxs("span",{className:"sess-chip",title:N.name,children:[(N.mime||"").startsWith("image/")&&N.url?r.jsx("img",{src:N.url,alt:N.name}):r.jsx(X0,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sess-chip-name",children:N.name}),r.jsx("button",{type:"button",className:"sess-chip-x",title:"移除附件",onClick:()=>b(N.md),children:r.jsx(Ys,{className:"h-3 w-3"})})]},N.md+I))]}),r.jsxs("div",{className:"sess-slashwrap",children:[r.jsx(hj,{open:k,query:E,items:h,onSelect:R,onClose:()=>g(!0)}),r.jsx(hs,{ref:d,rows:1,style:{minHeight:36},className:"resize-none",placeholder:"添加任务…(Enter 落待开发 / Ctrl+Enter 直接排队;可粘贴图片,可留空)",value:s,disabled:e,onChange:N=>{o(N.target.value),p(N.target.selectionStart??N.target.value.length),g(!1),j()},onPaste:x,onDrop:v,onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&!N.nativeEvent.isComposing&&(N.preventDefault(),z(N.ctrlKey))}})]})]}),r.jsx(V,{size:"sm",variant:"outline",disabled:e||i,onClick:()=>z(),children:r.jsx(Lo,{})})]})}function s$({open:e,onClose:t,projectId:n,settings:s,reload:o}){const[l,a]=u.useState("serial"),[i,c]=u.useState({url:"",user:"",token:""}),[d,f]=u.useState(!1),[p,m]=u.useState(!1),g=u.useRef(!1);u.useEffect(()=>{e&&!g.current&&s&&(g.current=!0,a(s.mode||"serial"),c(s.jira||{url:"",user:"",token:""})),e||(g.current=!1)},[e]);async function h(x){a(x);try{await Re.updateSettings(n,{mode:x}),await o()}catch(v){M(v.message)}}async function y(){try{await Re.updateSettings(n,{jira:i}),M("Jira 配置已保存"),await o()}catch(x){M(x.message)}}async function j(){f(!0);try{const x=await Re.jiraTest(n,i);M(x.ok?`连接成功:${x.name}`:`连接失败:${x.error}`)}catch(x){M(x.message)}finally{f(!1)}}async function w(){m(!0);try{const x=await Re.jiraImport(n);M(`导入完成:新增 ${x.added},跳过 ${x.skipped}`),await o()}catch(x){M(x.message)}finally{m(!1)}}return r.jsx(on,{open:e,onOpenChange:x=>!x&&t(),children:r.jsxs(Qt,{className:"modal w-[560px] sm:max-w-[92vw]",children:[r.jsx(Yt,{children:r.jsx(Xt,{children:"看板设置"})}),r.jsxs("div",{className:"board-sec",children:[r.jsx("div",{className:"board-sec-t",children:"ℹ 并行模式"}),[["serial","串行:同时只跑一个任务"],["parallel","并行:最多 5 个并行(队列窗口)"]].map(([x,v])=>r.jsxs("label",{className:"flex items-center gap-2 py-1 text-sm",children:[r.jsx("input",{type:"radio",name:"board-mode",checked:l===x,onChange:()=>h(x)}),v]},x))]}),r.jsxs("div",{className:"board-sec",children:[r.jsx("div",{className:"board-sec-t",children:"🐛 Jira"}),r.jsxs("div",{className:"form-col gap-2",children:[r.jsx(Ae,{placeholder:"Jira 地址(如 https://xx.atlassian.net)",value:i.url,onChange:x=>c({...i,url:x.target.value})}),r.jsx(Ae,{placeholder:"用户名(邮箱)",value:i.user,onChange:x=>c({...i,user:x.target.value})}),r.jsx(Ae,{placeholder:"API token",type:"password",value:i.token,onChange:x=>c({...i,token:x.target.value})})]}),r.jsxs("div",{className:"mt-2 flex gap-2",children:[r.jsx(V,{size:"sm",variant:"outline",onClick:y,children:"保存配置"}),r.jsx(V,{size:"sm",variant:"outline",disabled:d,onClick:j,children:"测试连接"}),r.jsx(V,{size:"sm",disabled:p,onClick:w,children:"导入我的待办"})]}),r.jsx("div",{className:"hint mt-1",children:"导入 = 拉取「指派给我且未解决」的前 50 条建卡(按 key 去重);凭据存服务端"})]})]})})}const r$=/^(\d{1,2}(?:\.\d{1,2})*)[.)、]?\s+/,o$=/^([^::]{1,24})[::]\s*(.*)$/;function Tj(e){return e.ownerDocument.createTreeWalker(e,4).nextNode()}function l$(e){const t=e.querySelector("h1");if(!t)return{title:"",meta:[]};const n=t.textContent.trim();t.remove();const s=e.firstElementChild;if(!s||s.tagName!=="UL")return{title:n,meta:[]};const o=[];for(const a of[...s.children]){const i=Tj(a);if(!i)return{title:n,meta:[]};const c=i.data.match(o$);if(!c)return{title:n,meta:[]};o.push([i,c])}if(o.length<2)return{title:n,meta:[]};const l=o.map(([a,i])=>(a.data=i[2],{k:i[1].trim(),v:a.parentElement.innerHTML}));return s.remove(),{title:n,meta:l}}function $j(e,t){const n=t||{},s=String(e||""),o=Vo(s);if(typeof DOMParser>"u")return{html:o,title:"",meta:[],outline:[]};const l=new DOMParser().parseFromString("<body>"+o+"</body>","text/html"),a=l.body;for(const f of[...a.querySelectorAll("table")]){const p=l.createElement("div");p.className="md-table-wrap",f.replaceWith(p),p.appendChild(f)}let i="",c=[];if(n.extractHeader){const f=l$(a);i=f.title,c=f.meta}const d=[];return a.querySelectorAll("h1, h2, h3, h4").forEach((f,p)=>{const m="md-h-"+p;f.id=m;let g="";const h=Tj(f);if(h){const j=h.data.match(r$);j&&(g=j[1],h.data=h.data.slice(j[0].length))}const y=f.textContent.trim();if(g){const j=l.createElement("span");j.className="md-sec-no",j.textContent=g,f.insertBefore(j,f.firstChild)}d.push({id:m,level:Number(f.tagName.slice(1)),no:g,text:y})}),{html:a.innerHTML,title:i,meta:c,outline:d}}const a$={script:"自定义脚本(run.py)",scenario:"声明式场景(scenario.json)",legacy_scenario:"存量场景(旧布局 load/scenario_<id>.json)"};function Ed({title:e,note:t,children:n}){return r.jsxs("details",{className:"lp-fold",children:[r.jsxs("summary",{children:[r.jsx("span",{className:"lp-fold-t",children:e}),t&&r.jsx("span",{className:"lp-fold-n",children:t})]}),r.jsx("div",{className:"lp-fold-body",children:n})]})}function i$({task:e}){var w,x;const[t,n]=u.useState(null),[s,o]=u.useState(""),[l,a]=u.useState(""),i=u.useRef(null);u.useEffect(()=>{if(!(e!=null&&e.id))return;let v=!1;return o(""),Ve.loadCase(e.id).then(b=>{v||n(b)}).catch(b=>{v||o(b.message)}),()=>{v=!0}},[e==null?void 0:e.id,e==null?void 0:e.status]);const c=_n(v=>v.projects),d=e==null?void 0:e.project_id,f=u.useMemo(()=>fi(c,d),[c,d]),p=u.useMemo(()=>$j(io((t==null?void 0:t.plan_md)||"",d,{roots:f}),{extractHeader:!0}),[t==null?void 0:t.plan_md,d,f]);u.useEffect(()=>{const v=i.current,b=p.outline;if(!v||!b.length){a("");return}const S=b.map(I=>v.querySelector("#"+I.id)).filter(Boolean);if(!S.length){a("");return}let k=v.parentElement;for(;k&&k!==document.body&&!(/(auto|scroll)/.test(getComputedStyle(k).overflowY)&&k.scrollHeight>k.clientHeight+20);)k=k.parentElement;let E=0;const R=()=>{E=0;const I=(k?k.getBoundingClientRect().top:0)+120;let A=S[0];for(const W of S)if(W.getBoundingClientRect().top<=I)A=W;else break;a(A.id)},z=()=>{E||(E=requestAnimationFrame(R))};R();const N=k||window;return N.addEventListener("scroll",z,{passive:!0}),window.addEventListener("resize",z),()=>{E&&cancelAnimationFrame(E),N.removeEventListener("scroll",z),window.removeEventListener("resize",z)}},[p]);function m(v){var k,E,R;const b=(k=i.current)==null?void 0:k.querySelector("#"+v);if(!b)return;const S=(R=(E=window.matchMedia)==null?void 0:E.call(window,"(prefers-reduced-motion: reduce)"))==null?void 0:R.matches;b.scrollIntoView({block:"start",behavior:S?"auto":"smooth"}),a(v)}if(s)return r.jsxs("div",{className:"hint",children:["方案读取失败:",s]});if(!t)return r.jsx("div",{className:"hint",children:"正在读取方案包…"});const g=t.charts?JSON.stringify(t.charts,null,2):"",h=(p.outline||[]).filter(v=>v.level>=2&&v.level<=3),y=p.title||(e==null?void 0:e.name)||`任务 #${e==null?void 0:e.id}`,j=t.plan_found&&(t.plan_md||"").length>400&&!p.outline.length&&!/<(ul|ol|table)[ >]/.test(p.html);return r.jsxs("div",{className:"lp-plan",children:[j&&r.jsx("div",{className:"hint lp-warn",children:"这份方案正文没有 markdown 结构(无标题 / 列表 / 表格)——页面只渲染 Markdown, 纯文本方案会挤成一整段;建议让 agent 按《方案文档模板》重写 plan.md。"}),r.jsxs("div",{className:"lp-doc"+(h.length>=3?" has-rail":""),children:[h.length>=3&&r.jsxs("nav",{className:"lp-doc-rail","aria-label":"方案目录",children:[r.jsx("div",{className:"lp-doc-rail-t",children:"目录"}),r.jsx("ol",{children:h.map(v=>r.jsx("li",{className:v.level>2?"sub":"",children:r.jsxs("a",{href:"#"+v.id,className:l===v.id?"on":"",onClick:b=>{b.preventDefault(),m(v.id)},children:[r.jsx("span",{className:"no",children:v.no||"·"}),r.jsx("span",{className:"t",children:v.text})]})},v.id))})]}),r.jsxs("article",{className:"lp-doc-main",children:[r.jsxs("header",{className:"lp-doc-head",children:[r.jsxs("div",{className:"lp-doc-eyebrow",children:[r.jsxs("span",{className:"lp-doc-kind",children:["压测方案 · #",e==null?void 0:e.id]}),r.jsxs("span",{className:"lp-doc-chips",children:[r.jsx("span",{className:"lp-chip"+(t.found?" on":" off"),children:t.found?a$[t.driver]||t.driver:"未找到执行载体"}),r.jsx("span",{className:"lp-chip",children:(x=(w=t.charts)==null?void 0:w.panels)!=null&&x.length?`面板 ${t.charts.panels.length} 个`:"默认面板"}),t.has_html&&r.jsx("span",{className:"lp-chip",children:"自定义视图 ✓"})]})]}),r.jsx("h1",{className:"lp-doc-title",children:y}),p.meta.length>0&&r.jsx("dl",{className:"lp-doc-meta",children:p.meta.map((v,b)=>r.jsxs("div",{className:"lp-doc-meta-row",children:[r.jsx("dt",{children:v.k}),r.jsx("dd",{dangerouslySetInnerHTML:{__html:v.v}})]},b))})]}),t.plan_found?r.jsx("div",{className:"lp-doc-body md-body",ref:i,dangerouslySetInnerHTML:{__html:p.html}}):r.jsx("div",{className:"lp-doc-body",ref:i,children:r.jsxs("div",{className:"lp-empty-state",children:[r.jsx("div",{className:"lp-empty-t",children:"本任务未生成方案文档"}),r.jsxs("p",{children:[r.jsx("code",{children:"plan.md"})," 由压测第 1 轮的 agent 产出,用来回答「压谁、压多狠、 看什么、怎么算通过」。它缺失不影响发压执行,但发压前就没有可复核的书面方案—— 可在方案包目录 ",r.jsxs("code",{children:["load/task_",e==null?void 0:e.id,"/"]})," 下补一份 Markdown 方案。"]})]})})]})]}),!t.found&&r.jsxs("div",{className:"hint lp-warn",children:["本任务的方案包缺失(需在 <案例库根>/load/task_",e==null?void 0:e.id,"/ 下生成 run.py 或 scenario.json);发压轮会因此失败。"]}),t.charts_error&&r.jsxs("div",{className:"hint lp-warn",children:["图表声明不合法,面板已回退默认:",t.charts_error]}),r.jsxs("div",{className:"lp-doc-appendix",children:[t.script_text&&r.jsx(Ed,{title:"执行载体源码",note:t.script_name,children:r.jsx("pre",{className:"lp-code",children:t.script_text})}),g&&r.jsx(Ed,{title:"图表声明",note:"charts.json",children:r.jsx("pre",{className:"lp-code",children:g})}),r.jsx(Ed,{title:"指标口径速查",note:"写脚本 / 声明图表时对照",children:r.jsxs("ul",{className:"lp-tips",children:[r.jsxs("li",{children:[r.jsx("code",{children:"gauge"}),":瞬时值(rps / lat.p50·p90·p95·p99 / err.rate / conc)"]}),r.jsxs("li",{children:[r.jsx("code",{children:"counter"}),":单调递增累计值(req.total / 业务计数),面板按窗口增量或速率画"]}),r.jsxs("li",{children:[r.jsx("code",{children:"labels"}),":维度字典(如 ",r.jsx("code",{children:'{"status":"已成交"}'}),"), 同一 metric 靠它区分序列;",r.jsx("code",{children:"groupBy"})," 指定的就是这里的键"]}),r.jsxs("li",{children:[r.jsx("code",{children:"summary"}),":收尾 KPI 行,供单值卡与报告使用"]})]})})]})]})}const c$={running:"进行中",done:"成功",failed:"失败",stopped:"已停止",interrupted:"被中断",unknown:"历史(未登记)"};function u$(e,t){const n=((e==null?void 0:e.started_at)||"").slice(5,16)||((e==null?void 0:e.run_key)||"").replace("_"," ");return`${e!=null&&e.registered?`运行 #${t+1}`:"历史报告"} · ${n} · ${c$[e==null?void 0:e.status]||(e==null?void 0:e.status)||"未知"}`}const d$=1200;function f$(e,t){const n=Object.keys(t||{}).sort();return e+"|"+n.map(s=>`${s}=${t[s]}`).join(",")}function Lx(e=d$){const t=new Map;return{add(n){if(!n||typeof n.metric!="string")return!1;const s=Number(n.value);if(!Number.isFinite(s))return!1;const o=Number(n.ts),l=f$(n.metric,n.labels);let a=t.get(l);return a||(a={key:l,metric:n.metric,labels:n.labels||{},type:n.type==="counter"?"counter":"gauge",points:[]},t.set(l,a)),a.points.push([Number.isFinite(o)?o:Date.now()/1e3,s]),a.points.length>e&&a.points.shift(),!0},list(){return[...t.values()]},size(){return t.size},clear(){t.clear()}}}function p$(e,t){if(!t)return!0;const n=e||{};return Object.entries(t).every(([s,o])=>String(n[s])===String(o))}function Fm(e,t,n){const s=e.list().filter(l=>l.metric===t);if(!s.length)return null;if(n)return s.find(l=>p$(l.labels,n))||null;const o=s.find(l=>!Object.keys(l.labels).length);return o||s.sort((l,a)=>l.key.localeCompare(a.key))[0]}function m$(e,t){return e.list().filter(n=>n.metric===t&&Object.keys(n.labels).length)}function Pu(e,t={}){const n=Number(t.scale)||1,s=e.points;if(e.type!=="counter")return s.map(([l,a])=>[l,a*n]);const o=[];for(let l=1;l<s.length;l+=1){const a=s[l][0]-s[l-1][0];if(a<=0)continue;const i=s[l][1]-s[l-1][1];o.push([s[l][0],(t.rate?i/a:i)*n])}return o}function Bm(e,t,n="last"){if(!e.length||t<=0)return e.slice();const s=new Map;return e.forEach(([o,l])=>{const a=Math.floor(o/t)*t,i=s.get(a);i?(i.sum+=l,i.n+=1,i.last=l):s.set(a,{t:a,sum:l,n:1,last:l})}),[...s.entries()].sort((o,l)=>o[0]-l[0]).map(([o,l])=>n==="avg"?[o,l.sum/l.n]:n==="sum"?[o,l.sum]:[o,l.last])}function h$(e,t=600){if(e.length<=t)return e;const n=e.length/t,s=[];for(let l=0;l<t;l+=1)s.push(e[Math.floor(l*n)]);const o=e[e.length-1];return s[s.length-1]!==o&&s.push(o),s}function Ij(e,t,n){const s=[];return e.list().filter(o=>o.metric===t).forEach(o=>{var a;if(!o.points.length)return;const l=n?(a=o.labels)==null?void 0:a[n]:Object.values(o.labels||{})[0]??"全部";s.push({label:String(l??"全部"),value:o.points[o.points.length-1][1],labels:o.labels||{}})}),s.sort((o,l)=>l.value-o.value)}function g$(e,t="last",n=1){if(!e||!e.points.length)return null;const s=e.points.map(([,l])=>l);let o;return t==="avg"?o=s.reduce((l,a)=>l+a,0)/s.length:t==="max"?o=Math.max(...s):t==="min"?o=Math.min(...s):t==="sum"?o=s.reduce((l,a)=>l+a,0):o=s[s.length-1],o*(Number(n)||1)}function Ko(e,t){if(e==null||!Number.isFinite(e))return"—";if(t!=null&&t!=="")return Number(e).toFixed(Number(t));const n=Math.abs(e);return n>=1e3?Math.round(e).toLocaleString("en-US"):n>=10?e.toFixed(1):n>=1?e.toFixed(2):n===0?"0":e.toFixed(3)}function Hm(e){let t=1/0,n=-1/0;return e.forEach(s=>s.forEach(([o])=>{o<t&&(t=o),o>n&&(n=o)})),n>t?n-t:0}function Um(e,t=600){return!e||e<=0?1:Math.max(1,Math.ceil(e/t))}const Xn=["var(--run)","var(--retest)","var(--fail)","var(--pass)","var(--fix)","var(--seq-4)","var(--seq-5)","var(--seq-6)"],so=640,ro=150,Gt={l:48,r:10,t:10,b:18},op=600,x$=40;function oo({text:e="暂无数据(本轮尚未产生该指标)"}){return r.jsx("div",{className:"lp-empty hint",children:e})}function Aj(e,t,n,s){const o=t-e,l=s-n;return{x:a=>Gt.l+(o>0?(a-e)/o:.5)*(so-Gt.l-Gt.r),y:a=>ro-Gt.b-(l>0?(a-n)/l:.5)*(ro-Gt.t-Gt.b)}}function Vm({scale:e,vmin:t,vmax:n}){const s=[t,(t+n)/2,n];return r.jsx("g",{children:s.map((o,l)=>r.jsxs("g",{children:[r.jsx("line",{x1:Gt.l,x2:so-Gt.r,y1:e.y(o),y2:e.y(o),stroke:"var(--border)",strokeWidth:"0.5",strokeDasharray:"3 3"}),r.jsx("text",{x:Gt.l-4,y:e.y(o)+3,textAnchor:"end",style:{fontSize:9,fill:"var(--dim)"},children:Ko(o)})]},l))})}function v$({panel:e,store:t}){const n=(e.series||[]).map((p,m)=>{const g=Fm(t,p.metric,p.match),h=g?Pu(g,{scale:p.scale,rate:g.type==="counter"}):[],y=Um(Hm([h]),op);return{label:p.label||p.metric,color:Xn[m%Xn.length],points:h$(Bm(h,y,g&&g.type==="gauge"?"last":"sum"),op),suffix:g&&g.type==="counter"?"/s":""}}),s=n.flatMap(p=>p.points);if(!s.length)return r.jsx(oo,{});const o=s.map(p=>p[0]),l=s.map(p=>p[1]),[a,i]=[Math.min(...o),Math.max(...o)],c=Math.max(...l,0),d=Math.min(...l,0),f=Aj(a,i,d,c);return r.jsxs("div",{children:[r.jsxs("svg",{viewBox:`0 0 ${so} ${ro}`,className:"lp-svg",children:[r.jsx(Vm,{scale:f,vmin:d,vmax:c}),n.map(p=>r.jsx("polyline",{fill:"none",strokeWidth:"1.6",stroke:p.color,points:p.points.map(([m,g])=>`${f.x(m)},${f.y(g)}`).join(" ")},p.label))]}),r.jsx("div",{className:"lp-legend",children:n.map(p=>r.jsxs("span",{children:[r.jsx("i",{style:{background:p.color}}),p.label,p.suffix]},p.label))})]})}function y$({panel:e,store:t}){if(e.by==="label"||!e.by&&e.groupBy){const p=Ij(t,e.metric,e.groupBy);if(!p.length)return r.jsx(oo,{});const m=Math.max(...p.map(g=>g.value),1);return r.jsx("div",{className:"lp-bars",children:p.map((g,h)=>r.jsxs("div",{className:"lp-bar-row",children:[r.jsx("span",{className:"lb",title:g.label,children:g.label}),r.jsx("span",{className:"lt",children:r.jsx("i",{style:{width:`${g.value/m*100}%`,background:Xn[h%Xn.length]}})}),r.jsx("span",{className:"lv",children:Ko(g.value,e.precision)})]},g.label))})}const n=Fm(t,e.metric);if(!n)return r.jsx(oo,{});const s=n.type==="counter",o=Pu(n,{scale:e.scale,rate:s}),l=Um(Hm([o]),op/4),a=Bm(o,l,s?"sum":"avg");if(!a.length)return r.jsx(oo,{});const i=a.map(p=>p[0]),c=a.map(p=>p[1]),d=Aj(Math.min(...i),Math.max(...i),0,Math.max(...c,1)),f=Math.max(1,(so-Gt.l-Gt.r)/a.length*.7);return r.jsxs("svg",{viewBox:`0 0 ${so} ${ro}`,className:"lp-svg",children:[r.jsx(Vm,{scale:d,vmin:0,vmax:Math.max(...c,1)}),a.map(([p,m])=>r.jsx("rect",{x:d.x(p)-f/2,y:d.y(m),width:f,height:ro-Gt.b-d.y(m),fill:Xn[0],opacity:"0.85"},p))]})}function w$({panel:e,store:t}){const s=m$(t,e.metric).map(h=>{var y;return{label:String(((y=h.labels)==null?void 0:y[e.groupBy])??Object.values(h.labels)[0]??"?"),type:h.type,points:Pu(h,{rate:!1})}}).filter(h=>h.points.length);if(!s.length)return r.jsx(oo,{});const o=Hm(s.map(h=>h.points)),l=Math.max(Um(o,x$),1),a=new Map;s.forEach(h=>{Bm(h.points,l,h.type==="counter"?"sum":"avg").forEach(([y,j])=>{a.has(y)||a.set(y,{}),a.get(y)[h.label]=j})});const i=[...a.keys()].sort((h,y)=>h-y),c=i.map(h=>Object.values(a.get(h)).reduce((y,j)=>y+j,0)),d=Math.max(...c,1),f=s.map(h=>h.label),p=Math.max(1,(so-Gt.l-Gt.r)/i.length*.7),m=h=>Gt.l+(h-i[0])/Math.max(i[i.length-1]-i[0],1)*(so-Gt.l-Gt.r),g=h=>ro-Gt.b-h/d*(ro-Gt.t-Gt.b);return r.jsxs("div",{children:[r.jsxs("svg",{viewBox:`0 0 ${so} ${ro}`,className:"lp-svg",children:[r.jsx(Vm,{scale:{x:m,y:g},vmin:0,vmax:d}),i.map(h=>{let y=0;return r.jsx("g",{children:f.map((j,w)=>{const x=a.get(h)[j]||0,v=g(y);y+=x;const b=g(y);return x>0?r.jsx("rect",{x:m(h)-p/2,y:b,width:p,height:v-b,fill:Xn[w%Xn.length],opacity:"0.9"},j):null})},h)})]}),r.jsx("div",{className:"lp-legend",children:f.map((h,y)=>r.jsxs("span",{children:[r.jsx("i",{style:{background:Xn[y%Xn.length]}}),h]},h))})]})}function j$({panel:e,store:t}){const n=Ij(t,e.metric,e.groupBy),s=n.reduce((i,c)=>i+Math.max(c.value,0),0);if(!n.length||s<=0)return r.jsx(oo,{});const o=52,l=2*Math.PI*o;let a=0;return r.jsxs("div",{className:"lp-donut",children:[r.jsxs("svg",{viewBox:"0 0 140 140",className:"lp-donut-svg",children:[r.jsx("circle",{cx:"70",cy:"70",r:o,fill:"none",stroke:"var(--border)",strokeWidth:"18"}),n.map((i,c)=>{const d=Math.max(i.value,0)/s,f=`${d*l} ${l}`,p=-a*l;return a+=d,r.jsx("circle",{cx:"70",cy:"70",r:o,fill:"none",stroke:Xn[c%Xn.length],strokeWidth:"18",strokeDasharray:f,strokeDashoffset:p,transform:"rotate(-90 70 70)"},i.label)}),r.jsx("text",{x:"70",y:"74",textAnchor:"middle",style:{fontSize:15,fill:"var(--foreground)"},children:Ko(s)})]}),r.jsx("div",{className:"lp-legend col",children:n.map((i,c)=>r.jsxs("span",{children:[r.jsx("i",{style:{background:Xn[c%Xn.length]}}),i.label," ",r.jsx("b",{children:Ko(i.value)}),r.jsxs("em",{children:[(i.value/s*100).toFixed(1),"%"]})]},i.label))})]})}function b$({panel:e,store:t}){const n=(e.stats||[]).map(s=>{const o=Fm(t,s.metric,s.match);return{...s,value:g$(o,s.agg,s.scale)}});return r.jsx("div",{className:"lp-stats",children:n.map(s=>r.jsxs("div",{className:"lp-stat",children:[r.jsx("div",{className:"k",children:s.label||s.metric}),r.jsxs("div",{className:"v",children:[Ko(s.value,s.precision),s.unit?r.jsx("span",{className:"u",children:s.unit}):null]})]},s.metric+(s.label||"")))})}function _$({panel:e,store:t}){const n=t.list().filter(a=>a.metric===e.metric);if(!n.length)return r.jsx(oo,{});const s=e.groupBy||null,o=n.map(a=>{var p;const i=a.points.length?a.points[a.points.length-1][1]:null,c=Pu(a,{rate:a.type==="counter"}),d=c.length?c[c.length-1][1]:null,f=s?(p=a.labels)==null?void 0:p[s]:Object.values(a.labels||{}).join(" / ")||"全部";return{dim:String(f??"全部"),labels:a.labels||{},last:i,rate:d,type:a.type}}),l=o.some(a=>a.type==="counter");return r.jsx("div",{className:"lp-table-wrap",children:r.jsxs("table",{className:"lp-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:s||"维度"}),r.jsx("th",{style:{textAlign:"right"},children:"最新值"}),l&&r.jsx("th",{style:{textAlign:"right"},children:"速率 /s"})]})}),r.jsx("tbody",{children:o.map(a=>r.jsxs("tr",{children:[r.jsx("td",{title:JSON.stringify(a.labels),children:a.dim}),r.jsx("td",{style:{textAlign:"right"},children:Ko(a.last)}),l&&r.jsx("td",{style:{textAlign:"right"},children:Ko(a.rate)})]},a.dim+JSON.stringify(a.labels)))})]})})}function k$({panel:e,store:t}){const n={panel:e,store:t};return e.type==="line"?r.jsx(v$,{...n}):e.type==="bar"?r.jsx(y$,{...n}):e.type==="stacked_bar"?r.jsx(w$,{...n}):e.type==="donut"?r.jsx(j$,{...n}):e.type==="stat"?r.jsx(b$,{...n}):e.type==="table"?r.jsx(_$,{...n}):r.jsx(oo,{text:`未支持的面板类型:${e.type}`})}const S$=2e3,N$=40;function C$({task:e,store:t}){const n=u.useRef(null),s=e==null?void 0:e.id;function o(){const l=n.current&&n.current.contentWindow;if(!l)return;const a=t.list().slice(0,N$).map(i=>({metric:i.metric,labels:i.labels,type:i.type,points:i.points.slice(-300)}));l.postMessage({type:"ts.metrics",task:s,series:a},"*")}return u.useEffect(()=>{if(!s)return;const l=setInterval(o,S$);return()=>clearInterval(l)},[s,t]),s?r.jsxs("section",{className:"lp-panel full lp-hatch",children:[r.jsxs("div",{className:"lp-panel-head",children:[r.jsx("h4",{children:"自定义视图(panel.html)"}),r.jsx("span",{className:"hint",children:"沙箱 iframe:读不到站点数据,只能消费 postMessage 推入的指标"})]}),r.jsx("iframe",{ref:n,sandbox:"allow-scripts",title:"自定义压测视图",className:"lp-hatch-frame",src:Ve.loadCustomHtmlUrl(s),onLoad:o})]}):null}const E$=1e3,R$=2e4,P$=20;function Oj({task:e,run:t="",live:n}){const[s,o]=u.useState(null),[l,a]=u.useState(""),[i,c]=u.useState(!1),[d,f]=u.useState(!0),[p,m]=u.useState(""),[,g]=u.useState(0),h=u.useRef(Lx()),y=e==null?void 0:e.id,j=n===void 0?(e==null?void 0:e.status)==="running"&&!t:!!n;u.useEffect(()=>{if(!y)return;let x=!1;return f(!0),m(""),Ve.loadCase(y).then(v=>{x||(o(v.charts||null),a(v.charts_error||""),c(!!v.has_html),f(!1))}).catch(v=>{x||(m(v.message),f(!1))}),()=>{x=!0}},[y,j]),u.useEffect(()=>{if(!y||!s)return;h.current=Lx(),g(b=>b+1);let x=!1;const v=()=>{x||g(b=>b+1)};if(j){const b=Ve.loadStream(y,t),S=setInterval(v,E$);return b.onmessage=k=>{try{const E=JSON.parse(k.data);if(E.done){b.close(),clearInterval(S),v();return}h.current.add(E)}catch{}},()=>{x=!0,b.close(),clearInterval(S)}}return(async()=>{let b=0;for(let S=0;S<P$;S+=1){const k=await Ve.loadMetrics(y,b,R$,t);if(x)return;const E=k.samples||[];if(E.forEach(R=>h.current.add(R)),!E.length||k.next<=b)break;b=k.next}v()})().catch(b=>{x||m(b.message)}),()=>{x=!0}},[y,j,s,t]);const w=(s==null?void 0:s.panels)||[];return r.jsxs("div",{className:"lp-dash",children:[l&&r.jsxs("div",{className:"hint lp-warn",children:["图表声明不合法,已回退默认面板:",l]}),p&&r.jsxs("div",{className:"hint lp-warn",children:["指标加载失败:",p]}),d&&!w.length?r.jsx("div",{className:"hint",children:"正在读取方案包…"}):r.jsx("div",{className:"lp-grid",children:w.map(x=>r.jsxs("section",{className:"lp-panel "+(x.width==="full"?"full":"half"),children:[r.jsxs("div",{className:"lp-panel-head",children:[r.jsx("h4",{children:x.title}),x.hint&&r.jsx("span",{className:"hint",children:x.hint})]}),r.jsx(k$,{panel:x,store:h.current})]},x.id))}),i&&r.jsx(C$,{task:e,store:h.current})]})}const M$=5e3,T$=2e3;function $$(e){return e.startsWith("### PROMPT")?"lp-prompt":e.startsWith("### CMD")?"lp-cmd":e.startsWith("### PID")?"lp-dim":/### 轮次\s*\d+\s*(开始|结束)/.test(e)?"lp-round":/STRESS_DONE|ROUND_DONE|LOAD 总请求/.test(e)?"lp-done":/Exception|Traceback|error|ERR|失败|超时|exit=-?\d+/.test(e)?"lp-err":e.startsWith("{")?"lp-json":""}function I$({task:e}){const[t,n]=u.useState([]),[s,o]=u.useState(""),[l,a]=u.useState(0),[i,c]=u.useState(""),[d,f]=u.useState(null),p=u.useRef(null),m=u.useRef(!0),g=e==null?void 0:e.id,h=(e==null?void 0:e.status)==="running",y=e==null?void 0:e.ended_at;u.useEffect(()=>{if(!g)return;let N=!1;return Ve.loadRuns(g).then(I=>{if(N)return;const A=I.runs||[];n(A),o(W=>A.some(L=>L.run_key===W)?W:A.length?A[0].run_key:"")}).catch(()=>{N||n([])}),()=>{N=!0}},[g,h,y,l]);const j=t.findIndex(N=>N.run_key===s),w=j>=0?t[j]:t[0]||null,x=(w==null?void 0:w.run_key)||"",v=(w==null?void 0:w.status)==="running",b=(w==null?void 0:w.round_no)||0;u.useEffect(()=>{if(!g||!b){c("");return}let N=!1;const I=async()=>{const W=p.current;m.current=W?W.scrollHeight-W.scrollTop-W.clientHeight<60:!0;try{const L=await Ve.log(g,b,M$);N||c(J=>J===L.log?J:L.log)}catch{N||c("")}};I();const A=setInterval(I,T$);return()=>{N=!0,clearInterval(A)}},[g,b,l]),u.useEffect(()=>{const N=p.current;N&&m.current&&(N.scrollTop=N.scrollHeight)},[i]),u.useEffect(()=>{if(!g||v){f(null);return}let N=!1;return Ve.loadReport(g,x).then(I=>{N||f(I)}).catch(()=>{N||f(null)}),()=>{N=!0}},[g,x,v,y,l]);const S=u.useMemo(()=>i?i.split(`
481
+ `):[],[i]),k=_n(N=>N.projects),E=e==null?void 0:e.project_id,R=u.useMemo(()=>fi(k,E),[k,E]),z=u.useMemo(()=>d!=null&&d.found?$j(io(d.md,E,{roots:R})).html:"",[d,E,R]);return r.jsxs("div",{className:"lp-log",children:[r.jsxs("section",{className:"lp-panel full",children:[r.jsxs("div",{className:"lp-panel-head",children:[r.jsx("h4",{children:"运行"}),r.jsx("span",{className:"hint",children:"每次发压是一次运行(报告 / 曲线 / 日志都按运行切分)"}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx("button",{type:"button",className:"lp-chip",title:"刷新运行列表",onClick:()=>a(N=>N+1),children:"↻ 刷新"}),t.length>0&&r.jsxs(Ht,{value:x,onValueChange:o,children:[r.jsx(Lt,{size:"sm",className:"h-7 min-w-[220px] text-xs",children:r.jsx(Ot,{})}),r.jsx(Dt,{children:t.map((N,I)=>r.jsx(Le,{value:N.run_key,children:u$(N,I)},N.run_key))})]})]})]}),!t.length&&r.jsx("div",{className:"hint",children:h?"发压中…(运行列表稍后自动刷新)":"暂无运行记录(发压结束后生成报告与曲线)"}),w&&!w.has_metrics&&r.jsx("div",{className:"hint lp-warn",children:"该运行为存量报告(无曲线数据);可查看下方报告。"})]}),(!w||w.has_metrics)&&r.jsx(Oj,{task:e,run:x,live:v}),r.jsxs("section",{className:"lp-panel full",children:[r.jsxs("div",{className:"lp-panel-head",children:[r.jsx("h4",{children:"运行日志"}),w&&r.jsx("span",{className:"hint",children:w.registered?`第 ${w.round_no} 轮(发压)`:"存量运行无独立日志"})]}),r.jsx("div",{className:"log lp-logbox",ref:p,children:S.length?S.map((N,I)=>r.jsx("div",{className:"log-line "+$$(N),children:N||" "},I)):r.jsx("div",{className:"hint",children:b?"该运行暂无日志":"该运行没有独立日志文件"})})]}),r.jsxs("section",{className:"lp-panel full",children:[r.jsxs("div",{className:"lp-panel-head",children:[r.jsx("h4",{children:"压测报告"}),(d==null?void 0:d.found)&&r.jsxs("span",{className:"hint",children:[d.file,d.run_key?`(运行键 ${d.run_key})`:""]}),(d==null?void 0:d.found)&&r.jsx("button",{type:"button",className:"lp-chip ml-auto",title:"复制报告文件名",onClick:()=>{var N;(N=navigator.clipboard)==null||N.writeText(d.file||""),M("已复制报告文件名")},children:"复制文件名"})]}),d!=null&&d.found?r.jsx("div",{className:"lp-report",children:r.jsx("div",{className:"md-body",dangerouslySetInnerHTML:{__html:z}})}):r.jsx("div",{className:"hint",children:v?"发压中,结束后生成报告":w?"该运行暂无报告":"暂无压测报告(发压结束或被停止后生成)"})]})]})}var A$=Object.defineProperty,Wm=(e,t)=>A$(e,"name",{value:t,configurable:!0}),Rd=!1;function Lj(){const[e,t]=u.useState(Rd);return u.useEffect(()=>{Rd||(Rd=!0,t(!0))},[]),e}Wm(Lj,"useIsHydrated");var Dj=Qo[" useSyncExternalStore ".trim().toString()];function zj(){return()=>{}}Wm(zj,"subscribe");function Fj(){return Dj(zj,()=>!0,()=>!1)}Wm(Fj,"useIsHydratedModern");var O$=typeof Dj=="function"?Fj:Lj,L$=Object.defineProperty,nl=(e,t)=>L$(e,"name",{value:t,configurable:!0}),Pd="rovingFocusGroup.onEntryFocus",D$={bubbles:!1,cancelable:!0},Mu="RovingFocusGroup",[lp,Bj,z$]=ym(Mu),[F$,Hj]=xo(Mu,[z$]),[B$,H$]=F$(Mu),U$=u.forwardRef(nl(function(t,n){return r.jsx(lp.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(lp.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(V$,{...t,ref:n})})})},"RovingFocusGroup")),V$=u.forwardRef(nl(function(t,n){const{__scopeRovingFocusGroup:s,orientation:o,loop:l=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...m}=t,g=u.useRef(null),h=St(n,g),y=yu(a),[j,w]=Gl({prop:i,defaultProp:c??null,onChange:d,caller:Mu}),[x,v]=u.useState(!1),b=Ps(f),S=Bj(s),k=u.useRef(!1),[E,R]=u.useState(0);return u.useEffect(()=>{const z=g.current;if(z)return z.addEventListener(Pd,b),()=>z.removeEventListener(Pd,b)},[b]),r.jsx(B$,{scope:s,orientation:o,dir:y,loop:l,currentTabStopId:j,onItemFocus:u.useCallback(z=>w(z),[w]),onItemShiftTab:u.useCallback(()=>v(!0),[]),onFocusableItemAdd:u.useCallback(()=>R(z=>z+1),[]),onFocusableItemRemove:u.useCallback(()=>R(z=>z-1),[]),children:r.jsx(dt.div,{tabIndex:x||E===0?-1:0,"data-orientation":o,...m,ref:h,style:{outline:"none",...t.style},onMouseDown:et(t.onMouseDown,()=>{k.current=!0}),onFocus:et(t.onFocus,z=>{const N=!k.current;if(z.target===z.currentTarget&&N&&!x){const I=new CustomEvent(Pd,D$);if(z.currentTarget.dispatchEvent(I),!I.defaultPrevented){const A=S().filter(U=>U.focusable),W=A.find(U=>U.active),L=A.find(U=>U.id===j),O=[W,L,...A].filter(Boolean).map(U=>U.ref.current);qm(O,p)}}k.current=!1}),onBlur:et(t.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),W$="RovingFocusGroupItem",q$=u.forwardRef(nl(function(t,n){const{__scopeRovingFocusGroup:s,focusable:o=!0,active:l=!1,tabStopId:a,children:i,...c}=t,d=to(),f=a||d,p=H$(W$,s),m=p.currentTabStopId===f,g=Bj(s),{onFocusableItemAdd:h,onFocusableItemRemove:y,currentTabStopId:j}=p,w=O$();return Vt(()=>{if(!(!w||!o))return h(),()=>y()},[w,o,h,y]),u.useEffect(()=>{if(!(w||!o))return h(),()=>y()},[w,o,h,y]),r.jsx(lp.ItemSlot,{scope:s,id:f,focusable:o,active:l,children:r.jsx(dt.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:et(t.onMouseDown,x=>{o?p.onItemFocus(f):x.preventDefault()}),onFocus:et(t.onFocus,()=>p.onItemFocus(f)),onKeyDown:et(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){p.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const v=Vj(x,p.orientation,p.dir);if(v!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=g().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")S.reverse();else if(v==="prev"||v==="next"){v==="prev"&&S.reverse();const k=S.indexOf(x.currentTarget);S=p.loop?Wj(S,k+1):S.slice(k+1)}setTimeout(()=>qm(S))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:j!=null}):i})})},"RovingFocusGroupItem")),G$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Uj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}nl(Uj,"getDirectionAwareKey");function Vj(e,t,n){const s=Uj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return G$[s]}nl(Vj,"getFocusIntent");function qm(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}nl(qm,"focusFirst");function Wj(e,t){return e.map((n,s)=>e[(t+s)%e.length])}nl(Wj,"wrapArray");var K$=U$,Q$=q$,Y$=Object.defineProperty,ra=(e,t)=>Y$(e,"name",{value:t,configurable:!0}),Gm="Tabs",[X$,fA]=xo(Gm,[Hj]),qj=Hj(),[J$,Km]=X$(Gm),Z$=u.forwardRef(ra(function(t,n){const{__scopeTabs:s,value:o,onValueChange:l,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:d="automatic",...f}=t,p=yu(c),[m,g]=Gl({prop:o,onChange:l,defaultProp:a??"",caller:Gm});return r.jsx(J$,{scope:s,baseId:to(),value:m,onValueChange:g,orientation:i,dir:p,activationMode:d,children:r.jsx(dt.div,{dir:p,"data-orientation":i,...f,ref:n})})},"Tabs")),eI="TabsList",tI=u.forwardRef(ra(function(t,n){const{__scopeTabs:s,loop:o=!0,...l}=t,a=Km(eI,s),i=qj(s);return r.jsx(K$,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:o,children:r.jsx(dt.div,{role:"tablist","aria-orientation":a.orientation,...l,ref:n})})},"TabsList")),nI="TabsTrigger",sI=u.forwardRef(ra(function(t,n){const{__scopeTabs:s,value:o,disabled:l=!1,...a}=t,i=Km(nI,s),c=qj(s),d=Qm(i.baseId,o),f=Ym(i.baseId,o),p=o===i.value;return r.jsx(Q$,{asChild:!0,...c,focusable:!l,active:p,children:r.jsx(dt.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:d,...a,ref:n,onMouseDown:et(t.onMouseDown,m=>{!l&&m.button===0&&m.ctrlKey===!1?i.onValueChange(o):m.preventDefault()}),onKeyDown:et(t.onKeyDown,m=>{l||m.target!==m.currentTarget||[" ","Enter"].includes(m.key)&&i.onValueChange(o)}),onFocus:et(t.onFocus,()=>{const m=i.activationMode!=="manual";!p&&!l&&m&&i.onValueChange(o)})})})},"TabsTrigger")),rI="TabsContent",oI=u.forwardRef(ra(function(t,n){const{__scopeTabs:s,value:o,forceMount:l,children:a,...i}=t,c=Km(rI,s),d=Qm(c.baseId,o),f=Ym(c.baseId,o),p=o===c.value,m=u.useRef(p);return u.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),r.jsx(pi,{present:l||p,children:({present:g})=>r.jsx(dt.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!g,id:f,tabIndex:0,...i,ref:n,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})},"TabsContent"));function Qm(e,t){return`${e}-trigger-${t}`}ra(Qm,"makeTriggerId");function Ym(e,t){return`${e}-content-${t}`}ra(Ym,"makeContentId");var lI=Z$,aI=tI,iI=sI,cI=oI;const Gj=lI,Xm=u.forwardRef(({className:e,...t},n)=>r.jsx(aI,{ref:n,"data-slot":"tabs-list",className:Ke("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t}));Xm.displayName="TabsList";const Jc=u.forwardRef(({className:e,...t},n)=>r.jsx(iI,{ref:n,"data-slot":"tabs-trigger",className:Ke("data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t}));Jc.displayName="TabsTrigger";const Hr=u.forwardRef(({className:e,...t},n)=>r.jsx(cI,{ref:n,"data-slot":"tabs-content",className:Ke("flex-1 outline-none",e),...t}));Hr.displayName="TabsContent";const uI=["done","failed","stopped","interrupted"];function dI(){const e=_n(),t=e.currentProject,n=u.useMemo(()=>e.tasks.filter(k=>k.project_id===(t==null?void 0:t.id)&&k.task_type==="stress").sort((k,E)=>(E.created_at||"").localeCompare(k.created_at||"")),[e.tasks,t==null?void 0:t.id]),[s,o]=u.useState(null),[l,a]=u.useState("plan"),[i,c]=u.useState({}),d=u.useRef({}),[f,p]=u.useState([]),[m,g]=u.useState(""),h=n.find(k=>k.id===s)||null,y=h==null?void 0:h.status,j=uI.includes(y),w=y==="running"||y==="queued",x=f.filter(k=>k.registered).length;u.useEffect(()=>{if(!s){p([]);return}let k=!1;return Ve.loadRuns(s).then(E=>{k||p(E.runs||[])}).catch(()=>{k||p([])}),()=>{k=!0}},[s,y,m]);async function v(k){if(h){g(k);try{k==="rerun"?await Ve.loadRerun(h.id):k==="stop"?await Ve.stop(h.id):k==="diagnose"?await Ve.loadDiagnose(h.id):k==="restart"&&await Ve.restart(h.id),M({rerun:"已入队复压(同一方案再压一次),等待执行",stop:"已请求停止",diagnose:"已把运行现场发给 agent(项目忙时排队)",restart:"已清空运行记录并重启(从第 1 轮重跑)"}[k])}catch(E){M(E.message)}finally{g("")}}}function b(){window.confirm(`用现有方案包再压一次「${h.name}」?
482
+ (跳过 agent 出方案,直接发压并生成新一份报告/曲线)`)&&v("rerun")}function S(){window.confirm(`重启「${h.name}」将清空全部运行记录,从第 1 轮重跑(agent 重新出方案)。
483
+ 历史报告文件仍留在 load/report/ 目录。继续?`)&&v("restart")}return u.useEffect(()=>{if(!n.length){o(null);return}n.some(k=>k.id===s)||o(n[0].id)},[n,s]),u.useEffect(()=>{const k=n.filter(E=>{const R=`${E.id}:${E.status}`;return!d.current[R]});k.length&&(k.forEach(E=>{d.current[`${E.id}:${E.status}`]=!0}),Promise.all(k.map(E=>Ve.loadCaseMeta(E.id).then(R=>[E.id,R]).catch(()=>[E.id,null]))).then(E=>{c(R=>{const z={...R};return E.forEach(([N,I])=>{I&&(z[N]=I)}),z})}))},[n]),r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("aside",{className:"flex w-[300px] flex-none flex-col border-r border-border",children:[r.jsxs("div",{className:"flex-none px-3 pt-3 pb-1 font-mono text-[calc(10px*var(--fs))] uppercase tracking-[0.14em] text-muted-foreground",children:["压测任务(",n.length,")"]}),r.jsxs("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto p-2",children:[n.map(k=>{const E=i[k.id];return r.jsxs("button",{type:"button",className:"load-item"+(s===k.id?" on":""),onClick:()=>o(k.id),children:[r.jsx("div",{className:"truncate text-[calc(13px*var(--fs))] font-semibold",title:k.name,children:k.name}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[calc(11px*var(--fs))] text-muted-foreground",children:[r.jsxs("span",{className:"badge st-"+k.status,children:[r.jsx("span",{className:"dot"}),hr[k.status]||k.status]}),r.jsxs("span",{children:["轮 ",k.current_round]}),r.jsx("span",{className:"ml-auto",children:is(k.created_at)})]}),E&&r.jsxs("div",{className:"lp-marks",children:[E.plan_found&&r.jsx("span",{className:"lp-chip sm",children:"方案 ✓"}),E.driver==="script"&&r.jsx("span",{className:"lp-chip sm",children:"脚本"}),E.driver==="scenario"&&r.jsx("span",{className:"lp-chip sm",children:"场景"}),E.driver==="legacy_scenario"&&r.jsx("span",{className:"lp-chip sm",children:"存量场景"}),!E.found&&r.jsx("span",{className:"lp-chip sm off",children:"无方案"}),E.has_html&&r.jsx("span",{className:"lp-chip sm",children:"自定义视图"})]}),k.error&&r.jsx("div",{className:"mt-1 truncate text-[calc(11px*var(--fs))]",style:{color:"var(--fail)"},title:k.error,children:k.error})]},k.id)}),!n.length&&r.jsx("div",{className:"p-2 text-xs leading-relaxed text-muted-foreground",children:"暂无压测任务。在「测试任务」页新建类型为「压力测试」的任务(填写压测说明)后,会自动显示在这里。"})]})]}),r.jsx("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:h?r.jsxs(Gj,{value:l,onValueChange:a,className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex flex-none flex-wrap items-center gap-2 px-4 pt-3",children:[r.jsx("h3",{className:"m-0 font-serif text-[calc(15px*var(--fs))] font-semibold",children:h.name}),r.jsxs("span",{className:"badge st-"+h.status,children:[r.jsx("span",{className:"dot"}),hr[h.status]||h.status]}),r.jsxs("span",{className:"lp-chip sm",children:["已跑 ",x," 次"]}),r.jsxs(Xm,{className:"ml-2 h-8",children:[r.jsx(Jc,{value:"plan",className:"px-3",children:"压测方案"}),r.jsx(Jc,{value:"log",className:"px-3",children:"压测日志"})]}),r.jsxs("span",{className:"ml-auto font-mono text-[calc(11px*var(--fs))] text-muted-foreground",children:["创建 ",is(h.created_at),h.started_at?` · 开始 ${is(h.started_at)}`:"",h.ended_at?` · 结束 ${is(h.ended_at)}`:""]})]}),r.jsxs("div",{className:"flex flex-none flex-wrap items-center gap-2 px-4 pt-2",children:[r.jsx(V,{size:"sm",variant:"outline",disabled:!j||!!m,title:"跳过 agent,用现有方案包再压一次(生成新一份报告与曲线)",onClick:b,children:"复压"}),w&&r.jsx(V,{size:"sm",variant:"outline",disabled:!!m,title:"停止当前运行(先落 stop 文件,宽限 10s 后杀进程树)",onClick:()=>v("stop"),children:"停止"}),r.jsx(V,{size:"sm",variant:"outline",disabled:!h.session_id||w||!!m,title:h.session_id?"把最近一次运行的现场(退出码/指标摘要/日志尾)发给该任务的 agent 会话":"会话尚未生成(首轮执行后才有)",onClick:()=>v("diagnose"),children:"诊断"}),r.jsx(V,{size:"sm",variant:"outline",disabled:!j||!!m,title:"清空运行记录,从第 1 轮重跑(agent 重新出方案)——与「复压」不同",onClick:S,children:"重启(换方案)"}),m&&r.jsx("span",{className:"hint",children:"处理中…"}),!j&&w&&r.jsx("span",{className:"hint",children:"运行中:结束后可复压 / 诊断 / 重启"})]}),h.error&&r.jsxs("div",{className:"px-4 pt-1 text-xs",style:{color:"var(--fail)"},children:["错误:",h.error]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[r.jsx(Hr,{value:"plan",children:r.jsx(i$,{task:h})}),r.jsx(Hr,{value:"log",children:r.jsx(I$,{task:h})})]})]}):r.jsx("div",{className:"mt-16 text-center text-sm text-muted-foreground",children:"← 从左侧选择一个压测任务查看方案与指标"})})]})}const fI={project_dir:"项目目录",work_dir:"工作目录"},Kj=[{key:"board",label:"开发看板"},{key:"tasks",label:"测试任务"},{key:"stress",label:"压测面板"},{key:"monitor",label:"监控面板"},{key:"bugs",label:"Bug 报告"}],xc=Kj.map(e=>e.key),Dx=Object.fromEntries(Kj.map(e=>[e.key,e.label]));function ul(e){const t=(Array.isArray(e==null?void 0:e.order)?e.order:[]).filter(s=>xc.includes(s));for(const s of xc)t.includes(s)||t.push(s);const n=(Array.isArray(e==null?void 0:e.hidden)?e.hidden:[]).filter(s=>xc.includes(s));return{order:t,hidden:n}}function zx(e){const t=(e||"").split(/[\\/]+/).filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!/^[A-Za-z]:$/.test(t[n]))return t[n];return""}const ap="ts.sidebarW",Qj=180,Yj=480,Xj=230;function pI(){const e=parseInt(localStorage.getItem(ap),10);return Number.isFinite(e)?Math.min(Yj,Math.max(Qj,e)):Xj}function Fx(){var Mr,Mn,ls;const e=ea(),t=Zn(),n=_n(),[s,o]=u.useState(localStorage.getItem("ts_cur_tab")||"board"),[l,a]=u.useState(null),[i,c]=u.useState(!1),[d,f]=u.useState(null),p=u.useRef(null);p.current=l;const m=u.useRef(!1),g=u.useRef(null),[h,y]=u.useState(!1),[j,w]=u.useState(!1),[x,v]=u.useState(null),[b,S]=u.useState([]),[k,E]=u.useState(!1),[R,z]=u.useState([]),[N,I]=u.useState(null),[A,W]=u.useState(!1),[L,J]=u.useState(!1),[O,U]=u.useState({name:"",project_dir:"",agent_path:"",work_dir:"",env_label:"",guide_text:"",model:"",reasoning_effort:"",permission_mode:"",skill_understand:"",skill_deploy:"",skill_commit:"",skill_test:"",skill_cases:""}),[F,Z]=u.useState({models:[],default:""}),[D,be]=u.useState([]),[ge,Te]=u.useState(!1),[re,$e]=u.useState(null),[he,De]=u.useState(!1),[de,me]=u.useState("project_dir"),[Ce,_e]=u.useState(!1),[C,H]=u.useState(""),[pe,B]=u.useState(!1),[te,ie]=u.useState(null),[ze,Ee]=u.useState(""),{rzOn:mt,rzStyle:ot,rzStart:Fe,rzDragStart:Ze,rzReset:rt}=fr(),{rzOn:ct,rzStyle:nt,rzDragStart:Y}=fr(),{rzOn:qe,rzStyle:vt,rzDragStart:Zt,rzReset:zt}=fr(),{rzOn:ce,rzStyle:$t,rzDragStart:pn,rzReset:ys}=fr(),P=u.useRef(null),[Q,ee]=u.useState([]),le=u.useRef([]);le.current=Q;const[ue,oe]=u.useState(null),Ie=u.useRef(!1),Ue=u.useRef(null),[Qe,Xe]=u.useState(pI),jt=u.useRef(Qe);jt.current=Qe;function en(_){const se=le.current;if(!se.length)return _;const Se=new Map(se.map((Pe,He)=>[Pe,He]));return[..._].sort((Pe,He)=>(Se.has(Pe.id)?Se.get(Pe.id):1/0)-(Se.has(He.id)?Se.get(He.id):1/0))}function ln(_){const se=_n.getState().projects.map(Bt=>Bt.id),Se=le.current.filter(Bt=>se.includes(Bt)),Pe=[...Se,...se.filter(Bt=>!Se.includes(Bt))],He=new Set(_),We=[];let hn=0;for(const Bt of Pe)We.push(He.has(Bt)?_[hn++]:Bt);return le.current=We,ee(We),We}function lt(_,se){if(_.button!==0||_.target.closest("button"))return;const Se={id:se,sx:_.clientX,sy:_.clientY,on:!1};Ue.current=Se;const Pe=We=>{var sr,bo,_o,Is;if(!Ue.current)return;if(!Se.on){if(Math.hypot(We.clientX-Se.sx,We.clientY-Se.sy)<6)return;Se.on=!0,Ie.current=!0,oe(Se.id),document.body.classList.add("projlist-dragging")}const hn=+((Is=(_o=(bo=(sr=document.elementFromPoint(We.clientX,We.clientY))==null?void 0:sr.closest)==null?void 0:bo.call(sr,"[data-proj-id]"))==null?void 0:_o.dataset)==null?void 0:Is.projId);if(!hn||hn===Se.id)return;const Bt=en(_n.getState().projects).filter(Tr=>!!Tr.archived===A).map(Tr=>Tr.id),wo=Bt.indexOf(Se.id),jo=Bt.indexOf(hn);wo<0||jo<0||(Bt.splice(jo,0,...Bt.splice(wo,1)),ln(Bt))},He=()=>{window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",He),document.body.classList.remove("projlist-dragging"),Ue.current=null,oe(null),Se.on&&kl.set(0,"proj_order",{order:le.current}).catch(()=>{})};window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",He)}u.useEffect(()=>{let _=!1;return kl.get(0).then(se=>{var Pe,He;if(_)return;const Se=(Array.isArray((He=(Pe=se.prefs)==null?void 0:Pe.proj_order)==null?void 0:He.order)?se.prefs.proj_order.order:[]).map(Number).filter(Number.isFinite);Se.length&&ee(Se)}).catch(()=>{}),()=>{_=!0}},[]);function mn(_){if(_.button!==0)return;_.preventDefault();const se=_.clientX,Se=jt.current;document.body.classList.add("resizing-x");const Pe=We=>Xe(Math.min(Yj,Math.max(Qj,Se+We.clientX-se))),He=()=>{window.removeEventListener("mousemove",Pe),window.removeEventListener("mouseup",He),document.body.classList.remove("resizing-x");try{localStorage.setItem(ap,String(jt.current))}catch{}};window.addEventListener("mousemove",Pe),window.addEventListener("mouseup",He)}function tn(){Xe(Xj);try{localStorage.removeItem(ap)}catch{}}function bt(_){if(m.current){m.current=!1;return}o(_),localStorage.setItem("ts_cur_tab",_)}function Nt(_){return _.order.filter(se=>!_.hidden.includes(se))}function Wt(_){var Se;a(_);const se=(Se=n.currentProject)==null?void 0:Se.id;se&&kl.set(se,"tabs",_).catch(()=>{})}u.useEffect(()=>{var Se;const _=(Se=n.currentProject)==null?void 0:Se.id;if(!_)return;let se=!1;return kl.get(_).then(Pe=>{var He;se||a(ul((He=Pe.prefs)==null?void 0:He.tabs))}).catch(()=>{}),c(!1),()=>{se=!0}},[(Mr=n.currentProject)==null?void 0:Mr.id]);const Ct=l||ul(null),Pn=Nt(Ct);u.useEffect(()=>{Pn.length&&!Pn.includes(s)&&(o(Pn[0]),localStorage.setItem("ts_cur_tab",Pn[0]))},[l]);function Cr(_,se){if(_.button!==0)return;const Se={key:se,sx:_.clientX,on:!1};g.current=Se;const Pe=We=>{var Bt,wo,jo,sr;if(!g.current)return;if(!Se.on){if(Math.hypot(We.clientX-Se.sx,We.clientY)<6)return;Se.on=!0,m.current=!0,f(Se.key),document.body.classList.add("tabbar-dragging")}const hn=(sr=(jo=(wo=(Bt=document.elementFromPoint(We.clientX,We.clientY))==null?void 0:Bt.closest)==null?void 0:wo.call(Bt,"[data-tab-key]"))==null?void 0:jo.dataset)==null?void 0:sr.tabKey;!hn||hn===Se.key||a(bo=>{const _o=ul(bo),Is=[..._o.order],Tr=Is.indexOf(Se.key),oa=Is.indexOf(hn);return Tr<0||oa<0?bo:(Is.splice(oa,0,...Is.splice(Tr,1)),{..._o,order:Is})})},He=()=>{if(window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",He),document.body.classList.remove("tabbar-dragging"),g.current=null,f(null),Se.on){const We=ul(p.current);Wt(We)}};window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",He)}function ss(_){const se=ul(l),Se={...se,hidden:[...se.hidden,_]};Wt(Se);const Pe=Nt(Se);(s===_||!Pe.includes(s))&&Pe.length&&(o(Pe[0]),localStorage.setItem("ts_cur_tab",Pe[0]))}function er(_){const se=ul(l);Wt({...se,hidden:se.hidden.filter(Se=>Se!==_)}),o(_),localStorage.setItem("ts_cur_tab",_)}function rs(_){n.selectProject(_),localStorage.setItem("ts_cur_project",_)}async function Ts(){try{S(await Pt.agents())}catch{S([])}}async function Er(_){try{const se=await Pt.agentModels(_);Z(se);const Se=new Set((se.models||[]).map(Pe=>Pe.name));Se.size&&U(Pe=>Pe.model&&!Se.has(Pe.model)?{...Pe,model:""}:Pe)}catch{Z({models:[],default:""})}}async function $s(_,se){try{const Pe=(await Pt.agentSkills(_,se)).skills||[];if(be(Pe),Pe.length){const He=new Set(Pe.map(We=>We.name));U(We=>({...We,skill_understand:He.has(We.skill_understand)?We.skill_understand:"",skill_deploy:He.has(We.skill_deploy)?We.skill_deploy:"",skill_commit:He.has(We.skill_commit)?We.skill_commit:"",skill_test:He.has(We.skill_test)?We.skill_test:"",skill_cases:He.has(We.skill_cases)?We.skill_cases:""}))}}catch{be([])}}function tr(_){v(_?_.id:null),U({name:(_==null?void 0:_.name)||"",project_dir:(_==null?void 0:_.project_dir)||"",agent_path:(_==null?void 0:_.agent_path)||"",work_dir:(_==null?void 0:_.work_dir)||"",env_label:(_==null?void 0:_.env_label)||"",guide_text:(_==null?void 0:_.guide_text)||"",model:(_==null?void 0:_.model)||"",reasoning_effort:(_==null?void 0:_.reasoning_effort)||"",permission_mode:(_==null?void 0:_.permission_mode)||"",skill_understand:(_==null?void 0:_.skill_understand)||"",skill_deploy:(_==null?void 0:_.skill_deploy)||"",skill_commit:(_==null?void 0:_.skill_commit)||"",skill_test:(_==null?void 0:_.skill_test)||"",skill_cases:(_==null?void 0:_.skill_cases)||""}),rt(),y(!0),Ts(),Er((_==null?void 0:_.agent_path)||""),$s((_==null?void 0:_.agent_path)||"",(_==null?void 0:_.project_dir)||"")}async function sl(){const _={...O};if(_.name||(_.name=zx(_.project_dir)),!_.name){M("请填写项目名称");return}try{const se=await Pt.dupCheck({project_dir:_.project_dir||"",work_dir:_.work_dir||"",exclude:x});if(se.length){z(se),I(_),E(!0);return}await os(_)}catch(se){M(se.message)}}async function rl(){if(E(!1),N){const _=N;I(null),await os(_)}}async function os(_){try{const se=_n.getState();if(x)await se.updateProject(x,_);else{const Se=await se.createProject(_);await _n.getState().selectProject(Se.id)}y(!1),M(x?"已保存":"项目已创建")}catch(se){M(se.message)}}async function an(_,se){try{await _n.getState().archiveProject(_.id,se),M(se?"项目已归档":"项目已恢复")}catch(Se){M(Se.message)}}function It(_){const se={...O,project_dir:_};O.name.trim()||(se.name=zx(_)),U(se)}function Rr(_){me(_),Te(!0),_e(!1),H(""),Pr(O[_])}async function Pr(_){De(!0);try{$e(await Pt.fsBrowse(_))}catch(se){M(se.message)}finally{De(!1)}}function nr(_){_e(!1),H(""),Pr(_)}async function T(){const _=C.trim();if(_){B(!0);try{const se=await Pt.fsMkdir((re==null?void 0:re.path)||"",_);M(`已新建文件夹:${(se==null?void 0:se.name)||_}`),nr((se==null?void 0:se.path)||(re==null?void 0:re.path)||"")}catch(se){M(se.message)}finally{B(!1)}}}function q(){re!=null&&re.path&&(de==="project_dir"&&It(re.path),de==="project_dir"?$s(O.agent_path,re.path):U({...O,[de]:re.path}),Te(!1))}function ye(_){ie(_),Ee(""),ys()}async function xe(){if(te)try{await _n.getState().deleteProject(te.id,{confirm_name:ze}),M("项目已删除;案例文件与 bug 报告文件已保留,请自行手动清理"),ie(null)}catch(_){M(_.message)}}async function Be(){await t.logout(),e("/login")}u.useEffect(()=>(n.loadProjects().finally(()=>w(!0)),P.current=setInterval(()=>{const _=_n.getState();_.loadProjects().catch(()=>{}),_.currentProject&&(_.loadTasks().catch(()=>{}),_.loadBugs().catch(()=>{}))},5e3),()=>clearInterval(P.current)),[]);const ke=_n(_=>_.projects),Et=u.useRef(!1);u.useEffect(()=>{if(Et.current||!ke.length)return;Et.current=!0;const _=_n.getState(),se=+localStorage.getItem("ts_cur_project")||0,Se=_.projects.find(We=>!We.archived)||_.projects[0],Pe=_.projects.find(We=>We.id===se)?se:Se.id;_.selectProject(Pe);const He=localStorage.getItem("ts_cur_tab");xc.includes(He)&&o(He)},[ke]);const ht=en(n.projects).filter(_=>!!_.archived===A),_t=F.models||[],K=!!O.model&&_t.some(_=>_.name===O.model),ft=_t.length?F.default?"__default__":_t[0].name:"__default__",Ft=K?O.model:ft,yn=_t.find(_=>_.name===F.default),ws=yn?yn.display_name||yn.name:F.default||"智能体默认",ol=K?O.model:Ft==="__default__"?F.default:Ft,js=xj(F,ol);return r.jsxs("div",{className:"flex h-svh",children:[r.jsxs("aside",{style:{width:Qe+"px"},className:"flex flex-none flex-col border-r border-border bg-card",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-3 font-serif font-semibold",children:[r.jsx(vu,{size:22}),r.jsx("span",{children:"Touchstone"})]}),r.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-1 font-mono text-[calc(10px*var(--fs))] uppercase tracking-[0.14em] text-muted-foreground",children:[r.jsx("span",{children:A?"已归档项目":"项目列表"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",title:"添加项目",className:"rounded p-0.5 hover:text-foreground",onClick:()=>tr(),children:r.jsx(Lo,{size:13})}),r.jsx("button",{type:"button",title:A?"返回项目列表":"查看已归档项目",className:"rounded p-0.5 hover:text-foreground",onClick:()=>W(_=>!_),children:A?r.jsx(dd,{size:13}):r.jsx(fd,{size:13})})]})]}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto p-2",children:[ht.map(_=>{var se,Se,Pe,He,We;return r.jsxs("div",{"data-proj-id":_.id,className:"proj-item cursor-pointer select-none rounded-lg border px-2.5 py-2 transition-colors "+(((se=n.currentProject)==null?void 0:se.id)===_.id?"border-primary/60 bg-accent":"border-transparent hover:bg-accent/60")+(_.archived?" opacity-60":"")+(ue===_.id?" proj-dragging":""),onPointerDown:hn=>lt(hn,_.id),onClick:()=>{if(Ie.current){Ie.current=!1;return}rs(_.id)},children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"flex-1 truncate text-sm font-semibold "+(((Se=n.currentProject)==null?void 0:Se.id)===_.id?"text-[var(--tab-active)]":""),children:_.name}),r.jsx("button",{type:"button",title:_.archived?"恢复项目":"归档项目",className:"flex-none rounded p-1 text-muted-foreground hover:text-foreground",onClick:hn=>{hn.stopPropagation(),an(_,!_.archived)},children:_.archived?r.jsx(dd,{size:13}):r.jsx(fd,{size:13})}),_.archived&&r.jsx("button",{type:"button",title:"删除项目",className:"flex-none rounded p-1 text-muted-foreground hover:text-[var(--fail, #dc2626)]",onClick:hn=>{hn.stopPropagation(),ye(_)},children:r.jsx(Qs,{size:13})})]}),r.jsx("div",{className:"truncate font-mono text-[calc(11px*var(--fs))] text-muted-foreground",children:_.project_dir}),r.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 font-mono text-[calc(10px*var(--fs))] text-muted-foreground",children:[r.jsxs("span",{children:["正在开发 ",r.jsx("b",{className:"font-semibold text-[var(--run)]",children:((Pe=_.board_counts)==null?void 0:Pe.doing)??0})]}),r.jsxs("span",{children:["阻塞 ",r.jsx("b",{className:"font-semibold text-[var(--fail)]",children:((He=_.board_counts)==null?void 0:He.blocked)??0})]}),r.jsxs("span",{children:["待审核 ",r.jsx("b",{className:"font-semibold text-[var(--retest)]",children:((We=_.board_counts)==null?void 0:We.review)??0})]})]})]},_.id)}),!ht.length&&r.jsx("div",{className:"p-2 text-xs text-muted-foreground",children:A?"暂无已归档项目":"暂无项目"})]}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-border px-2.5 py-2",children:[r.jsx("span",{className:"mr-auto truncate text-xs text-muted-foreground",children:t.username}),r.jsxs(V,{variant:"ghost",size:"sm",title:"站点设置",onClick:()=>e("/settings"),children:[r.jsx(tw,{})," 设置"]}),r.jsxs("div",{className:"sets-wrap",children:[r.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>J(_=>!_),children:[r.jsx(yC,{})," 菜单"]}),L&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"sets-mask",onClick:()=>J(!1)}),r.jsxs("div",{className:"sets-menu",children:[t.isAdmin&&r.jsxs("button",{type:"button",onClick:()=>{J(!1),e("/admin")},children:[r.jsx(LC,{})," 管理"]}),r.jsxs("button",{type:"button",className:"danger",onClick:Be,children:[r.jsx(fm,{})," 登出"]})]})]})]})]})]}),r.jsx("div",{className:"vsplit side-split",title:"拖动调整侧栏宽度,双击复位",onMouseDown:mn,onDoubleClick:tn}),r.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex flex-none items-center gap-3 border-b border-border bg-card px-4 py-2",children:[r.jsx("h2",{className:"m-0 truncate font-serif text-[calc(15px*var(--fs))] font-semibold",children:((Mn=n.currentProject)==null?void 0:Mn.name)||"— 未选择项目"}),((ls=n.currentProject)==null?void 0:ls.archived)&&r.jsx("span",{className:"flex-none rounded-full border border-border px-2 py-0.5 text-[calc(10px*var(--fs))] text-muted-foreground",children:"已归档"}),r.jsx("div",{className:"flex-1"}),r.jsxs(V,{size:"sm",onClick:()=>tr(),children:[r.jsx(Lo,{})," 添加项目"]}),n.currentProject&&r.jsxs(V,{size:"sm",variant:"outline",onClick:()=>tr(n.currentProject),children:[r.jsx(pm,{})," 编辑项目"]}),n.currentProject&&r.jsxs(V,{size:"sm",variant:"outline",title:"归档后从项目列表默认隐藏,可在侧栏「已归档项目」视图中恢复",onClick:()=>an(n.currentProject,!n.currentProject.archived),children:[n.currentProject.archived?r.jsx(dd,{}):r.jsx(fd,{}),n.currentProject.archived?"恢复项目":"归档项目"]})]}),r.jsx("hr",{className:"aurora-line"}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:n.currentProject?r.jsxs(Gj,{value:s,onValueChange:bt,className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex flex-none items-center border-b border-border pr-2",children:[r.jsxs(Xm,{className:"w-fit justify-start rounded-none border-none bg-transparent px-2 py-0",children:[Pn.map(_=>r.jsxs(Jc,{value:_,"data-tab-key":_,className:"tabbar-trigger pr-5 data-[state=active]:text-[var(--tab-active)]"+(d===_?" tabbar-dragging":""),onPointerDown:se=>Cr(se,_),children:[Dx[_],r.jsx("span",{className:"tabbar-hide",title:"隐藏此标签页(可点右侧按钮恢复)",onClick:se=>{se.stopPropagation(),ss(_)},onPointerDown:se=>se.stopPropagation(),children:r.jsx(Ys,{className:"size-2.5"})})]},_)),!Pn.length&&r.jsx("span",{className:"px-3 py-2 text-xs text-muted-foreground",children:"标签页已全部隐藏"})]}),r.jsx("div",{className:"ml-auto"}),r.jsxs("div",{className:"sets-wrap",children:[r.jsxs(V,{variant:"ghost",size:"sm",title:"显示/恢复隐藏的标签页",onClick:()=>c(_=>!_),children:[r.jsx(Hg,{}),Ct.hidden.length?`隐藏 ${Ct.hidden.length}`:"标签页"]}),i&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"sets-mask",onClick:()=>c(!1)}),r.jsxs("div",{className:"sets-menu drop-down",children:[!Ct.hidden.length&&r.jsxs("div",{className:"px-3 py-2 text-xs leading-relaxed text-muted-foreground",children:["没有隐藏的标签页。",r.jsx("br",{}),"把鼠标悬停到标签上点 × 即可隐藏。"]}),Ct.hidden.map(_=>r.jsxs("button",{type:"button",onClick:()=>er(_),children:[r.jsx(Hg,{})," ",Dx[_]]},_))]})]})]})]}),r.jsx(Hr,{value:"board",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(JT,{project:n.currentProject})}),r.jsx(Hr,{value:"tasks",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(pT,{onCreated:_=>{_==="stress"&&bt("stress")}})}),r.jsx(Hr,{value:"stress",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(dI,{})}),r.jsx(Hr,{value:"monitor",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(_T,{project:n.currentProject})}),r.jsx(Hr,{value:"bugs",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(ET,{project:n.currentProject})})]}):r.jsxs("div",{className:"mt-20 flex flex-col items-center gap-3 px-6 text-center text-sm text-muted-foreground",children:[j&&!n.projects.length?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-[calc(15px*var(--fs))] font-semibold text-foreground",children:"还没有项目"}),r.jsx("p",{className:"max-w-[560px] leading-relaxed",children:"创建一个项目:绑定被测代码目录与工作目录,案例库(free_style)与 Bug 报告(bug_report)会在工作目录下自动生成。"})]}):r.jsx("div",{children:"← 选择一个项目,或点击「添加项目」创建"}),r.jsxs(V,{size:"lg","data-empty-cta":"add-project",onClick:()=>tr(),children:[r.jsx(Lo,{})," 添加项目"]})]})})]}),r.jsx(on,{open:h,onOpenChange:y,children:r.jsxs(Qt,{className:"modal modal-rz"+(mt?" rz-drag":""),style:{...ot,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:Fe,reset:rt}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:Ze,children:x?"编辑项目":"添加项目"})}),r.jsxs("div",{className:"modal-scroll overflow-y-auto",children:[r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"项目名称"}),r.jsx(Ae,{value:O.name,onChange:_=>U({...O,name:_.target.value.trim()}),placeholder:"如 my-project"})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"项目目录"}),r.jsx(Ae,{value:O.project_dir,onChange:_=>It(_.target.value.trim()),onBlur:()=>$s(O.agent_path,O.project_dir),placeholder:"/path/to/your/project"}),r.jsxs(V,{variant:"outline",size:"sm",onClick:()=>Rr("project_dir"),title:"浏览服务端目录并选择",children:[r.jsx(Ug,{})," 浏览"]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"智能体"}),r.jsxs(Ht,{value:O.agent_path||"__manual__",onValueChange:_=>{const se=_==="__manual__"||_==="__missing__"?"":_;U({...O,agent_path:se}),Er(se),$s(se,O.project_dir)},children:[r.jsx(Lt,{className:"min-w-[200px] flex-1",children:r.jsx(Ot,{placeholder:"手动填写路径"})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__manual__",children:"手动填写路径"}),b.map(_=>r.jsx(Le,{value:_.found?_.path:"__missing__",children:_.found?`${_.name} · ${_.version||_.path}`:`${_.name} 未找到`},_.path||_.name)),(()=>{const _=(O.agent_path||"").trim();return!_||b.some(se=>se.found&&se.path===_)?null:r.jsx(Le,{value:_,children:_.startsWith("dsh-plugin:")?`dsh(插件·进程内) ${_.slice(11)}`:`${_}(当前绑定)`})})()]})]}),r.jsxs(V,{variant:"outline",size:"sm",onClick:Ts,title:"重新扫描本机 CLI",children:[r.jsx(Za,{})," 扫描"]})]}),r.jsx("div",{className:"hint",style:{margin:"-4px 0 8px 110px"},children:"智能体只有「dsh(插件·进程内)」一个入口:无需额外参数,模型取自宿主 ~/.dsh/settings.yaml(也可在此显式指定);kimi/opencode/claude/hermes 旧族与 dsh CLI(裸 dsh 可执行)均已退场,存量旧绑定起跑会报「该智能体族已下线」,请改绑本入口"}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"当前智能体已配置的模型;保存后新创建的任务(含修复/复测)默认使用该模型,已建任务不受影响",children:"模型"}),_t.length?r.jsxs(Ht,{value:Ft,onValueChange:_=>U({...O,model:_==="__default__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1"+(K?"":" text-muted-foreground"),title:K?"":"尚未显式选择:暗色显示的是当前智能体的默认模型(留空即用默认)",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__default__",children:F.default?`默认(${ws})`:"默认(智能体默认)"}),_t.map(_=>r.jsx(Le,{value:_.name,children:_.display_name||_.name},_.name))]})]}):r.jsx(Ae,{className:"max-w-[240px]",placeholder:F.default?`默认(${ws})`:"默认(智能体默认)",value:O.model,onChange:_=>U({...O,model:_.target.value.trim()})})]}),r.jsx("div",{className:"hint",style:{margin:"-4px 0 8px 110px"},children:"留空用智能体默认模型;设置后从下一条任务开始生效"}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"项目内会话的默认思考等级(dsh reasoningEffort);留空用智能体默认档",children:"思考等级"}),r.jsxs(Ht,{value:O.reasoning_effort||"__default__",onValueChange:_=>U({...O,reasoning_effort:_==="__default__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1"+(O.reasoning_effort?"":" text-muted-foreground"),title:O.reasoning_effort?"":"尚未显式选择:暗色显示的是智能体默认档(留空即用默认)",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__default__",children:js.defaultEffort?`默认(${(js.options.find(_=>_.value===js.defaultEffort)||{}).label||js.defaultEffort})`:"默认(智能体默认)"}),O.reasoning_effort&&!js.options.some(_=>_.value===O.reasoning_effort)&&r.jsx(Le,{value:O.reasoning_effort,children:O.reasoning_effort}),js.options.map(_=>r.jsx(Le,{value:_.value,title:_.title,children:_.label},_.value))]})]})]}),r.jsx("div",{className:"hint",style:{margin:"-4px 0 8px 110px"},children:"思考等级:列表来自当前模型的可用档位;留空用智能体默认;设置后新起的会话(含任务与看板卡)按此档运行"}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"项目内看板卡片会话的默认权限档;留空用宿主默认(完全访问)",children:"权限"}),r.jsxs(Ht,{value:O.permission_mode||"__default__",onValueChange:_=>U({...O,permission_mode:_==="__default__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1"+(O.permission_mode?"":" text-muted-foreground"),title:O.permission_mode?"":"尚未显式选择:暗色显示的是宿主默认档(留空即用默认)",children:r.jsx(Ot,{})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__default__",children:"默认(宿主默认)"}),Kc.map(_=>r.jsx(Le,{value:_.value,title:_.desc,children:r.jsxs("span",{className:"sess-perm-item",children:[r.jsx("span",{className:"sess-perm-label",children:_.label}),r.jsx("span",{className:"sess-perm-desc",children:_.desc})]})},_.value))]})]})]}),r.jsx("div",{className:"hint",style:{margin:"-4px 0 8px 110px"},children:"权限:项目内新起的看板卡片会话按此档运行(逐条确认=平台接管审批代答);任务会话暂不支持权限档"}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"理解/分析项目时优先使用的 skill,注入每类任务首轮提示词",children:"理解项目"}),r.jsxs(Ht,{value:O.skill_understand||"__none__",onValueChange:_=>U({...O,skill_understand:_==="__none__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1",children:r.jsx(Ot,{placeholder:"不指定"})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__none__",children:"不指定"}),D.map(_=>r.jsxs(Le,{value:_.name,title:_.description,children:[_.name,_.description?` — ${_.description.slice(0,60)}`:""]},`u-${_.name}`))]})]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"修复任务自动部署=开时使用的 skill",children:"部署项目"}),r.jsxs(Ht,{value:O.skill_deploy||"__none__",onValueChange:_=>U({...O,skill_deploy:_==="__none__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1",children:r.jsx(Ot,{placeholder:"不指定"})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__none__",children:"不指定"}),D.map(_=>r.jsxs(Le,{value:_.name,title:_.description,children:[_.name,_.description?` — ${_.description.slice(0,60)}`:""]},`d-${_.name}`))]})]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"修复任务自动提交=开时使用的 skill",children:"提交项目"}),r.jsxs(Ht,{value:O.skill_commit||"__none__",onValueChange:_=>U({...O,skill_commit:_==="__none__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1",children:r.jsx(Ot,{placeholder:"不指定"})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__none__",children:"不指定"}),D.map(_=>r.jsxs(Le,{value:_.name,title:_.description,children:[_.name,_.description?` — ${_.description.slice(0,60)}`:""]},`c-${_.name}`))]})]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"测试本项目时优先使用的 skill,注入每类任务首轮提示词",children:"测试项目"}),r.jsxs(Ht,{value:O.skill_test||"__none__",onValueChange:_=>U({...O,skill_test:_==="__none__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1",children:r.jsx(Ot,{placeholder:"不指定"})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__none__",children:"不指定"}),D.map(_=>r.jsxs(Le,{value:_.name,title:_.description,children:[_.name,_.description?` — ${_.description.slice(0,60)}`:""]},`t-${_.name}`))]})]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{title:"生成用例时遵循的命名/结构/登记规范 skill,注入每类任务首轮提示词",children:"用例规范"}),r.jsxs(Ht,{value:O.skill_cases||"__none__",onValueChange:_=>U({...O,skill_cases:_==="__none__"?"":_}),children:[r.jsx(Lt,{className:"min-w-[200px] flex-1",children:r.jsx(Ot,{placeholder:"不指定"})}),r.jsxs(Dt,{children:[r.jsx(Le,{value:"__none__",children:"不指定"}),D.map(_=>r.jsxs(Le,{value:_.name,title:_.description,children:[_.name,_.description?` — ${_.description.slice(0,60)}`:""]},`cs-${_.name}`))]})]})]}),r.jsx("div",{className:"hint",style:{margin:"-4px 0 8px 110px"},children:"选项来自当前智能体可用的 skill(dsh 无 skill 机制恒为空);理解/测试项目/用例规范项注入每类任务首轮,部署/提交项仅注入修复任务的对应条款(自动提交/部署=开时)"}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"工作目录"}),r.jsx(Ae,{value:O.work_dir,onChange:_=>U({...O,work_dir:_.target.value.trim()}),placeholder:"默认 <项目目录>/.touchstone;其下自动生成案例库 free_style 与 bug 报告 bug_report"}),r.jsxs(V,{variant:"outline",size:"sm",onClick:()=>Rr("work_dir"),title:"浏览服务端目录并选择",children:[r.jsx(Ug,{})," 浏览"]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"环境标签"}),r.jsx(Ae,{value:O.env_label,onChange:_=>U({...O,env_label:_.target.value.trim()}),placeholder:"如 test4 / sitA1,测试、修复、部署针对的环境"})]}),r.jsxs("div",{className:"form-col",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"项目附加提示词"}),r.jsx(hs,{value:O.guide_text,onChange:_=>U({...O,guide_text:_.target.value}),rows:3,className:"min-h-0",placeholder:"填写如何理解项目 / 如何写 git commit message / 如何部署项目 等信息;内容会加入每个任务的提示词"})]})]}),r.jsxs(Nn,{className:"flex-none",children:[r.jsx(V,{variant:"outline",onClick:()=>y(!1),children:"取消"}),r.jsx(V,{onClick:sl,children:"保存"})]})]})}),r.jsx(on,{open:k,onOpenChange:E,children:r.jsxs(Qt,{className:"modal modal-rz"+(ct?" rz-drag":""),style:{...nt,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:Fe,reset:rt}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:Y,children:"目录重复提醒"})}),R.map((_,se)=>r.jsxs("div",{className:"dup-item",children:[r.jsx("b",{children:fI[_.field]||_.field})," ",_.value,r.jsxs("span",{className:"dup-owner",children:["被「",_.username," / ",_.project_name,"」使用"]})]},se)),r.jsx("div",{className:"hint",style:{textAlign:"left",margin:"6px 0 0"},children:"重复的目录可能与其他项目的案例库/报告互相干扰,确认仍要保存?"}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",onClick:()=>E(!1),children:"返回修改"}),r.jsx(V,{onClick:rl,children:"仍然保存"})]})]})}),r.jsx(on,{open:ge,onOpenChange:Te,children:r.jsxs(Qt,{className:"modal modal-rz modal-dir"+(qe?" rz-drag":""),style:{...vt,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:Fe,reset:zt}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:Zt,children:"选择目录"})}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:(re==null?void 0:re.path)||"",children:(re==null?void 0:re.path)||"(选择根目录)"}),r.jsxs(V,{variant:"outline",size:"sm",disabled:he||!(re!=null&&re.parent),onClick:()=>nr(re.parent),children:[r.jsx(AN,{})," 上级"]}),r.jsxs(V,{variant:"outline",size:"sm",disabled:he,onClick:()=>nr((re==null?void 0:re.path)||""),children:[r.jsx(Za,{})," 刷新"]}),r.jsxs(V,{variant:"outline",size:"sm",disabled:he||!(re!=null&&re.path),onClick:()=>{_e(!Ce),H("")},title:re!=null&&re.path?`在 ${re.path} 下新建文件夹`:"请先进入一个目录",children:[r.jsx(aC,{})," 新建文件夹"]})]}),Ce&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ae,{autoFocus:!0,value:C,disabled:pe,onChange:_=>H(_.target.value),onKeyDown:_=>{_.key==="Enter"&&T()},placeholder:"新文件夹名称(在当前目录下创建)"}),r.jsx(V,{size:"sm",disabled:pe||!C.trim(),onClick:T,children:pe?"创建中…":"创建"}),r.jsx(V,{variant:"outline",size:"sm",disabled:pe,onClick:()=>{_e(!1),H("")},children:"取消"})]}),r.jsxs("div",{className:"modal-scroll max-h-[50vh] min-h-[120px] overflow-y-auto rounded-md border border-border p-1",children:[he&&r.jsx("div",{className:"p-2 text-xs text-muted-foreground",children:"加载中…"}),!he&&!((re==null?void 0:re.dirs)||[]).length&&r.jsx("div",{className:"p-2 text-xs text-muted-foreground",children:"无子目录"}),!he&&((re==null?void 0:re.dirs)||[]).map(_=>r.jsx("button",{type:"button",className:"block w-full truncate rounded px-2 py-1 text-left font-mono text-sm hover:bg-accent",title:_.path,onClick:()=>nr(_.path),children:_.name},_.path))]}),r.jsxs(Nn,{className:"flex-none",children:[r.jsx(V,{variant:"outline",onClick:()=>Te(!1),children:"取消"}),r.jsx(V,{disabled:he||!(re!=null&&re.path),onClick:q,children:"选择此目录"})]})]})}),r.jsx(on,{open:!!te,onOpenChange:_=>{_||ie(null)},children:r.jsxs(Qt,{className:"modal modal-rz"+(ce?" rz-drag":""),style:{...$t,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:Fe,reset:ys}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:pn,children:"删除项目"})}),te&&r.jsxs("div",{className:"space-y-1 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"项目名称:"}),r.jsx("b",{children:te.name})]}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:te.project_dir}),r.jsxs("div",{className:"truncate font-mono text-xs text-muted-foreground",children:["工作目录:",te.work_dir]})]}),r.jsxs("div",{className:"form-row",children:[r.jsx("label",{children:"输入项目名称确认"}),r.jsx(Ae,{value:ze,onChange:_=>Ee(_.target.value),placeholder:(te==null?void 0:te.name)||""})]}),r.jsx("div",{className:"hint",style:{textAlign:"left",margin:"0"},children:"将删除项目及其全部任务与轮次记录,不可恢复。磁盘上的案例文件与 bug 报告文件不会删除,请自行手动清理。"}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",onClick:()=>ie(null),children:"取消"}),r.jsx(V,{variant:"destructive",disabled:!te||ze!==te.name,onClick:xe,children:"确定删除"})]})]})})]})}const mI=P0("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ql({className:e,variant:t,...n}){return r.jsx("span",{"data-slot":"badge",className:Ke(mI({variant:t}),e),...n})}function hI(){const e=ea(),t=Zn(),[n,s]=u.useState([]),[o,l]=u.useState(!1),[a,i]=u.useState({username:"",password:"",password2:""}),[c,d]=u.useState(""),[f,p]=u.useState(!1),[m,g]=u.useState({id:null,username:"",password:""}),[h,y]=u.useState(""),{rzOn:j,rzStyle:w,rzStart:x,rzDragStart:v,rzReset:b}=fr(),{rzOn:S,rzStyle:k,rzStart:E,rzDragStart:R,rzReset:z}=fr();async function N(){try{s(await qr.users())}catch(U){M(U.message)}}u.useEffect(()=>{if(!t.isAdmin){e("/app");return}N()},[]);function I(){i({username:"",password:"",password2:""}),d(""),z(),l(!0)}async function A(){if(d(""),a.password!==a.password2){d("两次输入的密码不一致");return}try{await qr.createUser({username:a.username,password:a.password}),l(!1),M("新增成功"),await N()}catch(U){d(U.message)}}function W(U){g({id:U.id,username:U.username,password:""}),y(""),p(!0)}async function L(){y("");try{const U={username:m.username};m.password&&(U.password=m.password),await qr.updateUser(m.id,U),p(!1),await N()}catch(U){y(U.message)}}async function J(U){if(window.confirm(`确认删除用户「${U.username}」?该操作不可恢复`))try{await qr.deleteUser(U.id),await N()}catch(F){M(F.message)}}async function O(){await t.logout(),e("/login")}return r.jsxs("div",{className:"flex h-svh flex-col",children:[r.jsxs("header",{className:"flex flex-none items-center gap-3 border-b border-border bg-card px-6 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2.5 font-semibold",children:[r.jsx("div",{className:"ts-logo ts-mark size-6 rounded-md text-[calc(11px*var(--fs))]",children:"TS"}),"后台管理 · 用户"]}),r.jsx("span",{className:"ml-auto text-sm text-muted-foreground",children:t.username}),r.jsxs(V,{variant:"ghost",size:"sm",onClick:O,children:[r.jsx(fm,{})," 登出"]})]}),r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"sets-page-side",children:[r.jsx("div",{className:"sets-page-nav"}),r.jsx("div",{className:"sets-page-foot",children:r.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>e("/app"),children:[r.jsx(im,{})," 返回项目"]})})]}),r.jsx("main",{className:"min-w-0 flex-1 space-y-5 overflow-y-auto px-6 py-5",children:r.jsxs(Cn,{className:"gap-0 py-0",children:[r.jsx(qn,{className:"border-b border-border/60 px-5 py-4",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(QC,{className:"size-4 text-[var(--star-text)]"})," 用户列表",r.jsxs("span",{className:"font-normal text-muted-foreground",children:[n.length," 人"]}),r.jsxs(V,{variant:"outline",size:"sm",className:"ml-auto",onClick:I,children:[r.jsx(Lo,{})," 新增用户"]})]})}),r.jsx(En,{className:"px-3 pb-3",children:n.length?r.jsxs(Lm,{children:[r.jsx(Dm,{children:r.jsxs(Do,{className:"hover:bg-transparent",children:[r.jsx(In,{className:"px-3",children:"ID"}),r.jsx(In,{className:"px-3",children:"用户名"}),r.jsx(In,{className:"px-3",children:"创建时间"}),r.jsx(In,{className:"px-3",children:"角色"}),r.jsx(In,{className:"px-3 text-right",children:"操作"})]})}),r.jsx(zm,{children:n.map(U=>r.jsxs(Do,{children:[r.jsx(kn,{className:"px-3 text-muted-foreground",children:U.id}),r.jsx(kn,{className:"px-3 font-medium",children:U.username}),r.jsx(kn,{className:"px-3 font-mono text-xs text-muted-foreground",children:U.created_at}),r.jsx(kn,{className:"px-3",children:U.is_admin?r.jsx(Ql,{variant:"outline",className:"border-[var(--admin-badge)] text-[var(--admin-badge)]",children:"管理员"}):r.jsx(Ql,{variant:"secondary",children:"普通用户"})}),r.jsx(kn,{className:"px-3",children:r.jsxs("div",{className:"flex justify-end gap-1.5",children:[r.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>W(U),children:[r.jsx(pm,{})," 编辑"]}),!U.is_admin&&r.jsxs(V,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>J(U),children:[r.jsx(Qs,{})," 删除"]})]})})]},U.id))})]}):r.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"暂无用户"})})]})})]}),r.jsx(on,{open:o,onOpenChange:l,children:r.jsxs(Qt,{className:"modal modal-rz"+(S?" rz-drag":""),style:{...k,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:E,reset:z}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:R,children:"新增用户"})}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"用户名"}),r.jsx(Ae,{value:a.username,onChange:U=>{i({...a,username:U.target.value.trim()}),d("")},placeholder:"2-32 位字母数字或 _ . -"})]}),r.jsxs("div",{className:"grid grid-cols-[1fr_1fr] gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"密码"}),r.jsx(Ae,{value:a.password,onChange:U=>i({...a,password:U.target.value}),type:"password",placeholder:"至少 6 位"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"确认"}),r.jsx(Ae,{value:a.password2,onChange:U=>i({...a,password2:U.target.value}),type:"password",placeholder:"至少 6 位"})]})]}),c&&r.jsx("div",{className:"text-sm text-destructive",children:c})]}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",onClick:()=>l(!1),children:"取消"}),r.jsx(V,{onClick:A,children:"新增用户"})]})]})}),r.jsx(on,{open:f,onOpenChange:p,children:r.jsxs(Qt,{className:"modal modal-rz"+(j?" rz-drag":""),style:{...w,marginTop:0},showCloseButton:!1,children:[r.jsx(pr,{start:x,reset:b}),r.jsx(Yt,{className:"text-left",children:r.jsx(Xt,{className:"cursor-move select-none text-sm",onMouseDown:v,children:"编辑用户"})}),r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"用户名"}),r.jsx(Ae,{value:m.username,onChange:U=>{g({...m,username:U.target.value.trim()}),y("")}})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"重置密码"}),r.jsx(Ae,{value:m.password,onChange:U=>g({...m,password:U.target.value}),type:"password",placeholder:"留空则不修改"})]}),h&&r.jsx("div",{className:"text-sm text-destructive",children:h})]}),r.jsxs(Nn,{children:[r.jsx(V,{variant:"outline",onClick:()=>p(!1),children:"取消"}),r.jsx(V,{onClick:L,children:"保存"})]})]})})]})}const Jj="data-ds-dark-theme",Zj="(prefers-color-scheme: dark)";function e1(e=window){try{const t=e==null?void 0:e.parent;return!t||t===e?null:t.document||null}catch{return null}}function t1(e){try{return!e||!e.body?null:e.body.hasAttribute(Jj)}catch{return null}}function gI(e=window){var t,n;try{return!!((n=(t=e==null?void 0:e.matchMedia)==null?void 0:t.call(e,Zj))!=null&&n.matches)}catch{return!1}}function n1(e=e1(),t=window){const n=t1(e);return n===null?gI(t):n}function xI(e,t=e1(),n=window){var a;const s=[],o=()=>{try{e(n1(t,n))}catch{}},l=t==null?void 0:t.body;if(l&&typeof MutationObserver<"u")try{const i=new MutationObserver(o);i.observe(l,{attributes:!0,attributeFilter:[Jj]}),s.push(()=>i.disconnect())}catch{}if(t1(t)===null)try{const i=(a=n==null?void 0:n.matchMedia)==null?void 0:a.call(n,Zj);if(i!=null&&i.addEventListener){const c=()=>o();i.addEventListener("change",c),s.push(()=>i.removeEventListener("change",c))}}catch{}return()=>{for(const i of s)try{i()}catch{}s.length=0}}const s1="ts_skin",qs="auto",vI="dsh-dark",Jm=[{id:"dsh-dark",label:"DSH 深色",preview:["#1b1b1c","#f9fafb"]},{id:"dsh-light",label:"DSH 浅色",preview:["#f9fafb","#0f1115"]},{id:"starlight",label:"星夜金",preview:["#141E36","#E8B86D"]},{id:"classic",label:"经典蓝",preview:["#151b23","#58a6ff"]}],yI=["#f9fafb","#151517"];function wI(){try{return window.self!==window.top}catch{return!0}}function r1(){return wI()?qs:vI}function o1(e){return e===qs||Jm.some(t=>t.id===e)}function jI(){const e=localStorage.getItem(s1);return o1(e)?e:r1()}function l1(e,t=n1()){return e!==qs?e:t?"dsh-dark":"dsh-light"}let xa=null;function a1(e){document.documentElement.dataset.skin=l1(e)}function bI(e){if(e===qs){if(xa)return;xa=xI(()=>a1(qs));return}xa&&(xa(),xa=null)}function i1(e){const t=o1(e)?e:r1();a1(t);try{localStorage.setItem(s1,t)}catch{}bI(t)}function c1(){return jI()}function _I(){i1(c1())}function kI(e){var t;return e===qs?"跟随 DSH":((t=Jm.find(n=>n.id===e))==null?void 0:t.label)||e}const u1="ts_fs",d1=[{value:.9,label:"小"},{value:1,label:"标准"},{value:1.15,label:"大"},{value:1.3,label:"特大"}];function f1(){const e=parseFloat(localStorage.getItem(u1));return d1.some(t=>t.value===e)?e:1}function p1(e){document.documentElement.style.setProperty("--fs",String(e));try{localStorage.setItem(u1,String(e))}catch{}}function SI(){p1(f1())}const m1="ts_bright",Zm=[{id:"normal",label:"原样",hint:"出厂取值"},{id:"dim",label:"偏暗",hint:"压一档(默认)"},{id:"dimmer",label:"更暗",hint:"再压一档"}],h1="dim";function g1(){const e=localStorage.getItem(m1);return Zm.some(t=>t.id===e)?e:h1}function x1(e){const t=Zm.some(n=>n.id===e)?e:h1;document.documentElement.dataset.bright=t;try{localStorage.setItem(m1,t)}catch{}}function NI(){x1(g1())}function CI(){const[e,t]=u.useState(null),[n,s]=u.useState({api_base:"",model:"",api_key:"",timeout_s:"",batch_size:""}),[o,l]=u.useState(null),[a,i]=u.useState(!1);async function c(){try{const g=await qr.ragGet();t(g),s({api_base:g.api_base||"",model:g.model||"",api_key:"",timeout_s:g.timeout_s!=null?String(g.timeout_s):"",batch_size:g.batch_size!=null?String(g.batch_size):""})}catch(g){M(g.message)}}u.useEffect(()=>{c()},[]);function d(){const g={api_base:n.api_base.trim(),model:n.model.trim()};return n.api_key&&(g.api_key=n.api_key),n.timeout_s.trim()&&(g.timeout_s=n.timeout_s.trim()),n.batch_size.trim()&&(g.batch_size=n.batch_size.trim()),g}async function f(){i(!0);try{await qr.ragSet(d()),M("RAG 配置已保存,立即生效"),await c()}catch(g){M(g.message)}finally{i(!1)}}async function p(){l(null),i(!0);try{l(await qr.ragTest(d()))}catch(g){M(g.message)}finally{i(!1)}}async function m(){if(window.confirm("确认停用 RAG 语义检索?将删除配置文件,检索回到纯词面模式"))try{await qr.ragSet({clear:!0}),M("已停用 RAG"),l(null),await c()}catch(g){M(g.message)}}return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(Y0,{className:"size-4 text-[var(--star-text)]"})," 案例库语义检索(RAG)",e&&(e.configured?r.jsx(Ql,{children:"已启用"}):r.jsx(Ql,{variant:"secondary",children:"未启用"}))]})}),r.jsxs(En,{className:"space-y-4 px-5",children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"走 OpenAI 兼容 /v1/embeddings 接口做嵌入,与内置 BM25 混合检索案例库; 未配置或调用失败时自动回落纯词面检索,不影响任务运行。保存后立即生效(无需重启); 更换模型后下次索引刷新自动全量重建。"}),r.jsxs("div",{className:"truncate font-mono text-[calc(11px*var(--fs))] text-muted-foreground",title:(e==null?void 0:e.config_path)||"",children:["配置文件:",(e==null?void 0:e.config_path)||"…"]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"API 地址(api_base,含 /v1,不含 /embeddings)"}),r.jsx(Ae,{value:n.api_base,onChange:g=>s({...n,api_base:g.target.value.trim()}),placeholder:"https://api.openai.com/v1"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"嵌入模型(model,非对话模型)"}),r.jsx(Ae,{value:n.model,onChange:g=>s({...n,model:g.target.value.trim()}),placeholder:"text-embedding-3-small"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"API Key(仅存服务端配置文件,不回显明文)"}),r.jsx(Ae,{type:"password",value:n.api_key,onChange:g=>s({...n,api_key:g.target.value}),placeholder:e!=null&&e.has_api_key?`已设置(${e.api_key_masked},留空保持不变)`:"sk-…"})]}),r.jsxs("div",{className:"grid grid-cols-[1fr_1fr] gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"请求超时(秒)"}),r.jsx(Ae,{value:n.timeout_s,onChange:g=>s({...n,timeout_s:g.target.value.trim()}),placeholder:`默认 ${(e==null?void 0:e.timeout_s)??30}`})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"嵌入批量大小"}),r.jsx(Ae,{value:n.batch_size,onChange:g=>s({...n,batch_size:g.target.value.trim()}),placeholder:`默认 ${(e==null?void 0:e.batch_size)??16}`})]})]}),o&&(o.ok?r.jsxs("div",{className:"text-sm text-[var(--ok-text)]",children:["连接成功:嵌入向量维度 ",o.dim]}):r.jsxs("div",{className:"text-sm text-destructive",children:["连接失败:",o.error]})),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(V,{variant:"outline",disabled:a,onClick:f,children:"保存配置"}),r.jsxs(V,{variant:"ghost",disabled:a,onClick:p,children:[r.jsx(EC,{})," 测试连接"]}),(e==null?void 0:e.configured)&&r.jsxs(V,{variant:"ghost",className:"text-destructive hover:text-destructive",disabled:a,onClick:m,children:[r.jsx(Qs,{})," 停用"]})]})]})]})}function EI(e,t={}){const n={enabled:!!(e&&e.enabled),events:e&&e.events||[]},s=(t&&t.webhook_url||"").trim();return s&&(n.webhook_url=s),t&&t.webhook_secret&&(n.webhook_secret=t.webhook_secret),n}function RI(e,t,n,s={}){const o=EI(n,s);return e?{kind:"all",body:o}:{kind:"one",pid:t,body:o}}function PI(e){const t=Number(e&&e.updated)||0,n=Number(e&&e.archived_skipped)||0;return n>0?`已应用到 ${t} 个项目(跳过 ${n} 个已归档)`:`已应用到 ${t} 个项目`}function Zc(e){const t=e&&e.push_enabled;return!(t===0||t===!1)}function MI(e,t){return{...e||{},push_enabled:t?1:0}}const TI=["base_url","app_id"];function $I(e){const t=e||{},n={enabled:!!t.enabled,push_enabled:Zc(t)};for(const s of TI)n[s]=(t[s]||"").trim();return n}function II(e){return Zc(e)?"当前:推送中(自动推送按各项目的推送绑定与事件勾选送达)":"当前:已停止(飞书不再收到自动推送;你在飞书发指令的查询与对话答复不受影响)"}function v1(e){const t=!!(e!=null&&e.supported),n=!!(e!=null&&e.enabled);return{supported:t,enabled:n,scanDisabled:!t||!n,writeDisabled:!n,refreshDisabled:!1}}function AI(e){const t=e==null?void 0:e.url;return typeof t=="string"?t:t&&typeof t=="object"&&typeof t.url=="string"?t.url:""}function OI(e){const{supported:t,enabled:n}=v1(e),s=[];return t||s.push({key:"unsupported",tone:"warn",text:n?"本机后端不具备「扫码创建应用」能力:扫码按钮不可用(这与「配置自动化被关掉」不是一回事)。仍可用「补齐应用配置」为已有应用补齐权限、事件订阅与回调,App ID / Secret 可在上方手工填写;或升级后端依赖后刷新本页重试扫码。":"本机后端不具备「扫码创建应用」能力:扫码按钮不可用(这与「配置自动化被关掉」不是一回事)。升级后端依赖后刷新本页可重试扫码。"}),n||s.push({key:"disabled",tone:"closed",text:"配置自动化已被 TS_FEISHU_PROVISION=0 关闭:可只跑自检,写操作不可用。"}),s}const LI=[["blocked_interaction","交互等待"],["task_failed","任务失败"],["card_review","卡片待审核"]];function DI(){var R,z;const[e,t]=u.useState(null),[n,s]=u.useState({webhook_url:"",secret:"",app_secret:""}),[o,l]=u.useState(!1),[a,i]=u.useState(!1),[c,d]=u.useState(null),[f,p]=u.useState([]),[m,g]=u.useState(!1);u.useEffect(()=>{h(),v()},[]);async function h(){try{t(await $n.feishuCfgGet())}catch(N){M(N.message)}}async function y(){var N,I;i(!0);try{const A=await $n.feishuReconnect();A!=null&&A.started?M("入站消息长连接已重连(用当前保存的应用凭据)"):(N=A==null?void 0:A.inbound)!=null&&N.configured?(I=A==null?void 0:A.inbound)!=null&&I.thread?M("旧连接未能停下,本次没有重连:稍后重试或重启站点"):M("重连未能建立连接:点下方「配置自检」查看原因"):M("还没配置自建应用凭据:先填 App ID/App Secret 并保存"),await h()}catch(A){M(A.message)}finally{i(!1)}}async function j(){var N;l(!0);try{const I=$I(e);n.webhook_url.trim()&&(I.default_webhook=n.webhook_url.trim()),n.secret&&(I.default_secret=n.secret),n.app_secret&&(I.app_secret=n.app_secret);const A=await $n.feishuCfgSet(I);s({webhook_url:"",secret:"",app_secret:""});const W=Object.hasOwn(I,"app_id")&&I.app_id!==((e==null?void 0:e.app_id)||""),L=A!=null&&A.inbound_started?"飞书配置已保存,入站消息长连接已启动":W?"飞书配置已保存;旧机器人私聊会收到「确认换用新应用」卡片,点一下完成切换(没收到就发「接入」重发)":"飞书配置已保存";A!=null&&A.verify&&!A.verify.ok?M(`${L};但凭据快检未通过:${A.verify.detail}`):(N=A==null?void 0:A.verify)!=null&&N.ok?M(`${L};${A.verify.detail}`):M(L),await h()}catch(I){M(I.message)}finally{l(!1)}}async function w(){try{await $n.feishuCfgSet({default_webhook:"",default_secret:""}),M("已清除默认 Webhook 与签名密钥"),await h()}catch(N){M(N.message)}}async function x(){const N=!m;if(g(N),N)try{p(await $n.feishuOutbox())}catch(I){M(I.message)}}async function v(){try{d(await $n.feishuGet())}catch(N){M(N.message)}}async function b(){try{const N=await $n.feishuBindcode();d(I=>({...I,code:N.code}))}catch(N){M(N.message)}}async function S(){try{const N=await $n.feishuGet();d(N),M(N.bound?"飞书账号已绑定":"尚未检测到绑定:确认已在飞书私聊机器人发送「绑定 <码>」,且本应用凭据已配置")}catch(N){M(N.message)}}async function k(){try{await $n.feishuUnbind(),M("已解绑飞书账号"),v()}catch(N){M(N.message)}}const E=!(e!=null&&e.app_id&&(e!=null&&e.has_app_secret));return r.jsxs(r.Fragment,{children:[r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(zN,{className:"size-4 text-[var(--star-text)]"})," 飞书机器人配置"]})}),r.jsxs(En,{className:"space-y-4 px-5",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",className:"mt-0.5",checked:Zc(e),onChange:N=>t(MI(e,N.target.checked))}),r.jsxs("span",{children:["推送总控:允许飞书接收自动推送",r.jsx("span",{className:"text-xs text-muted-foreground",children:"(关掉后飞书不再收到自动推送;你在飞书发指令的查询、会话对话的答复不受影响)"})]})]}),r.jsx("div",{className:"text-xs "+(Zc(e)?"text-muted-foreground":"text-[var(--star-text)]"),children:II(e)})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",checked:!!(e!=null&&e.enabled),onChange:N=>t({...e,enabled:N.target.checked})}),"启用飞书推送(默认 webhook 回落)"]}),r.jsx("div",{className:"hint",style:{textAlign:"left",margin:0},children:"只管「未单独设置推送绑定」的项目:它们回落下方默认 Webhook 并按默认事件推送; 已单独设置推送绑定的项目由那张卡里的开关说了算,不受本项影响。"})]}),r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"每个用户配置自己的飞书机器人:入站长连接按用户各自拉起,推送未绑定项目时 回落项目所有者的默认 webhook。凭据(App Secret/签名密钥)仅存服务端,不回显。"}),r.jsxs("div",{className:"grid grid-cols-[1fr_1fr] gap-3",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"应用 App ID(入站指令用)"}),r.jsx(Ae,{value:(e==null?void 0:e.app_id)||"",onChange:N=>t({...e,app_id:N.target.value.trim()}),placeholder:"cli_xxxx"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"App Secret"}),r.jsx(Ae,{type:"password",value:n.app_secret,onChange:N=>s({...n,app_secret:N.target.value}),placeholder:e!=null&&e.has_app_secret?"已设置(留空保持不变)":"凭证与基础信息页复制"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs",title:"凭据齐全且连接线程已启动时,机器人才能接收飞书消息;连接失败细节看 server.log",children:[r.jsxs("span",{children:["入站长连接:",(R=e==null?void 0:e.inbound)!=null&&R.thread?r.jsx("span",{className:"text-[var(--star-text)]",children:"运行中"}):(z=e==null?void 0:e.inbound)!=null&&z.configured?"已配置,待启动(保存后自动连接;仍不启动就点右侧「重连入站」)":"未配置(填写并保存后自动连接)"]}),r.jsx(V,{variant:"ghost",type:"button",disabled:o||a,onClick:y,children:a?"重连中…":"重连入站"})]}),r.jsx("div",{className:"hint",children:"入站指令需:应用开通「机器人」能力 + 权限 im:message.p2p_msg:readonly / im:message.group_at_msg:readonly / im:message:send_as_bot(斜杠指令另需 application:app_slash_command:read|write)+ 事件订阅选「长连接」并添加 im.message.receive_v1、回调 card.action.trigger + 应用发布生效。**下方「飞书接入」卡可扫码建应用并自动配好这些**;Secret 保存后不回显(留空=保持现有值),首次配置保存后自动建立长连接;换应用后旧机器人私聊会收到「确认换用新应用」卡片(先发新绑定码再用新应用重连),没收到就在机器人发「接入」重新获取;也可以直接点上方「重连入站」(等价于卡片上的「换用新应用」,同样无需重启站点)。"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"默认推送 Webhook(未绑定项目的回落目标)"}),r.jsx(Ae,{value:n.webhook_url,onChange:N=>s({...n,webhook_url:N.target.value}),placeholder:e!=null&&e.default_webhook?`已配置:${e.default_webhook}(留空保持不变)`:"https://open.feishu.cn/open-apis/bot/v2/hook/…"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"签名密钥(机器人开启签名校验时)"}),r.jsx(Ae,{type:"password",value:n.secret,onChange:N=>s({...n,secret:N.target.value}),placeholder:e!=null&&e.has_default_secret?"已设置(留空保持不变)":"可空"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"站点访问地址(通知里附「详情」链接,可空)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ae,{value:(e==null?void 0:e.base_url)||"",onChange:N=>t({...e,base_url:N.target.value}),placeholder:"http://192.0.2.10:4601"}),r.jsx(V,{variant:"ghost",type:"button",onClick:()=>t({...e,base_url:window.location.origin}),children:"用当前站点"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(V,{variant:"outline",disabled:o,onClick:j,children:"保存配置"}),r.jsx(V,{variant:"ghost",onClick:w,children:"清除默认 Webhook/密钥"}),r.jsx(V,{variant:"ghost",onClick:x,children:m?"收起投递记录":"投递记录"})]}),m&&r.jsx("div",{className:"max-h-60 overflow-y-auto rounded border border-border/60 text-xs",children:f.length?f.map(N=>r.jsxs("div",{className:"border-b border-border/40 px-2 py-1.5 last:border-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ql,{variant:N.status==="sent"?"secondary":N.status==="pending"?"outline":"destructive",children:N.status}),r.jsxs("span",{className:"text-muted-foreground",children:["重试×",N.retries]}),r.jsx("span",{className:"truncate font-mono",children:N.target}),r.jsx("span",{className:"ml-auto shrink-0 text-muted-foreground",children:N.created_at})]}),N.last_error&&r.jsx("div",{className:"truncate text-destructive",title:N.last_error,children:N.last_error})]},N.id)):r.jsx("div",{className:"px-2 py-3 text-muted-foreground",children:"暂无投递记录"})})]})]}),r.jsx(FI,{onCfgChanged:h}),r.jsx(HI,{}),r.jsx(zI,{}),r.jsx(UI,{}),r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(J0,{className:"size-4 text-[var(--star-text)]"})," 飞书账号绑定"]})}),r.jsxs(En,{className:"space-y-3 px-5",children:[c?c.bound?r.jsxs("div",{className:"space-y-1.5 text-sm",children:[r.jsxs("div",{children:["已绑定飞书账号 ",r.jsx("span",{className:"font-mono text-xs",children:c.open_id})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["默认项目:",c.default_project||"未设置(指令未指名项目时机器人会列出可选项目)"]}),r.jsx("div",{className:"hint",style:{textAlign:"left",margin:"0"},children:"在飞书私聊机器人发「帮助」可查看支持的指令。"})]}):r.jsxs("div",{className:"space-y-2 text-sm",children:[E&&r.jsx("div",{className:"rounded-md border border-border bg-accent/40 px-3 py-2 text-xs",children:"注意:上方机器人应用凭据(App ID / App Secret)尚未配置,此刻飞书消息无法送达平台,绑定不会生效。 请先填写并保存,再生成绑定码。"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"绑定后可在飞书私聊机器人执行看板指令(开始卡片 / 审核通过 / 驳回 / 作答提问等)。"}),c.code?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rounded-md border border-border bg-accent/40 px-3 py-2 text-center",children:[r.jsx("div",{className:"font-mono text-2xl font-bold tracking-[0.3em]",children:c.code}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"10 分钟内有效;重新生成会作废旧码"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["打开飞书 → 私聊你配置的机器人 → 发送「绑定 ",c.code,"」→ 回来点「刷新状态」确认。"]})]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"尚未绑定,点击下方「生成绑定码」开始。"})]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"加载中…"}),r.jsx("div",{className:"flex gap-2",children:c!=null&&c.bound?r.jsx(V,{variant:"destructive",onClick:k,children:"解绑"}):c!=null&&c.code?r.jsxs(r.Fragment,{children:[r.jsx(V,{variant:"outline",onClick:b,children:"重新生成"}),r.jsxs(V,{variant:"outline",onClick:S,children:[r.jsx(Za,{})," 刷新状态"]})]}):c&&r.jsx(V,{onClick:b,disabled:E,title:E?"先配置应用凭据,否则机器人收不到消息":void 0,children:"生成绑定码"})})]})]})]})}function zI(){const[e,t]=u.useState([]),[n,s]=u.useState(null),[o,l]=u.useState(null),[a,i]=u.useState({webhook_url:"",webhook_secret:""}),[c,d]=u.useState(!1),[f,p]=u.useState(!1);u.useEffect(()=>{let y=!0;return Pt.list().then(j=>{if(!y)return;t(j);const w=j.find(x=>!x.archived)||j[0];w&&s(w.id)}).catch(j=>M(j.message)),()=>{y=!1}},[]),u.useEffect(()=>{if(i({webhook_url:"",webhook_secret:""}),!n){l(null);return}let y=!0;return Pt.feishuHookGet(n).then(j=>{y&&l(j)}).catch(()=>{y&&l(null)}),()=>{y=!1}},[n]);async function m(){if(!(!n||!o)){p(!0);try{const y=RI(c,n,o,a);if(y.kind==="all"){const j=await Pt.feishuHookApplyAll(y.body);i({webhook_url:"",webhook_secret:""}),M(PI(j))}else await Pt.feishuHookSet(y.pid,y.body),i({webhook_url:"",webhook_secret:""}),M("项目飞书推送配置已保存");Pt.feishuHookGet(n).then(l).catch(()=>{})}catch(y){M(y.message)}finally{p(!1)}}}const g=e.map(y=>({value:y.id,label:y.name+(y.archived?"(已归档)":""),search:y.project_dir||""})),h=e.filter(y=>!y.archived).length;return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(ZC,{className:"size-4 text-[var(--star-text)]"})," 项目推送绑定"]})}),r.jsxs(En,{className:"space-y-4 px-5",children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"每个项目可单独绑定推送群与事件开关;未绑定或未启用时回落上方的默认推送 Webhook。 群 Webhook 消息与飞书单聊交互卡片共用这里的开关。"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"项目"}),r.jsx(Xc,{options:g,value:n,onChange:s,placeholder:e.length?"选择项目…":"暂无项目",emptyHint:"无匹配项目"})]}),e.length?o?r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",checked:!!o.enabled,onChange:y=>l({...o,enabled:y.target.checked})}),"启用推送"]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"群机器人 Webhook"}),r.jsx(Ae,{value:a.webhook_url,onChange:y=>i({...a,webhook_url:y.target.value}),placeholder:o.webhook_url?`已绑定:${o.webhook_url}(留空保持)`:"飞书群自定义机器人 Webhook URL"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"签名密钥(机器人开启签名校验时)"}),r.jsx(Ae,{type:"password",value:a.webhook_secret,onChange:y=>i({...a,webhook_secret:y.target.value}),placeholder:o.has_webhook_secret?"已设置(留空保持不变)":"可空"})]}),r.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-sm",children:LI.map(([y,j])=>r.jsxs("label",{className:"flex items-center gap-1.5",children:[r.jsx("input",{type:"checkbox",checked:o.events.includes(y),onChange:w=>l({...o,events:w.target.checked?[...o.events,y]:o.events.filter(x=>x!==y)})}),j]},y))}),r.jsx("div",{className:"hint",children:"交互等待 / 任务失败默认推送;卡片待审核默认关。Webhook 与签名密钥留空保存时不下发(保持现有值)。"}),r.jsx("div",{className:"hint",children:"以上开关同时管「群 Webhook 消息」与「飞书单聊交互卡片」:取消勾选「启用推送」后该项目不再推送,事件不勾的也不会推。"}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",checked:c,onChange:y=>d(y.target.checked)}),"同时应用到我的全部项目(",h," 个未归档项目;已归档项目不动)"]}),r.jsx("div",{children:r.jsx(V,{variant:"outline",disabled:f,onClick:m,children:c?"保存并应用到全部项目":"保存项目推送"})})]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"加载中…"}):null]})]})}function FI({onCfgChanged:e}){const[t,n]=u.useState(null),[s,o]=u.useState(null),[l,a]=u.useState(!1);async function i(){try{n(await $n.feishuProvisionGet())}catch(g){M(g.message)}}u.useEffect(()=>{i()},[]),u.useEffect(()=>{if((t==null?void 0:t.state)!=="waiting")return;const g=setInterval(async()=>{try{const h=await $n.feishuProvisionGet();n(h),h.state==="success"?(M(`应用已创建:${h.app_id}`),e==null||e()):h.state==="failed"&&M(h.error||"扫码创建失败")}catch{}},3e3);return()=>clearInterval(g)},[t==null?void 0:t.state]);async function c(g,h,y){a(!0);try{const j=await $n.feishuProvisionSet(g,h||{});g==="start"?(n(w=>({...w||{},state:j.state,url:j.url,error:j.error})),j.ok||M(j.error||"发起失败")):(o({action:g,...j}),j.ok?M(y):M(j.error||"操作失败"),await i())}catch(j){M(j.message)}finally{a(!1)}}const d=(t==null?void 0:t.state)||"idle",f=v1(t),p=OI(t),m=AI(t);return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(XC,{className:"size-4 text-[var(--star-text)]"})," 飞书接入(扫码一键配置)"]})}),r.jsx(En,{className:"space-y-3 px-5",children:t?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"没有应用也能开始:点「扫码创建飞书应用」→ 用手机飞书打开链接确认 → 平台自动拿到 App ID / Secret、建长连接,并自动开通所需权限、订阅事件与卡片回调。 发布新版本仍需企业管理员审批(或请管理员对该应用开「免审」)。"}),p.map(g=>r.jsx("div",{className:g.tone==="closed"?"text-xs text-[var(--star-text)]":"text-xs text-destructive",children:g.text},g.key)),d==="waiting"&&r.jsxs("div",{className:"rounded-md border border-border bg-accent/40 px-3 py-2 text-xs",children:[r.jsx("div",{children:"等待你在飞书里确认(链接 10 分钟内有效):"}),m?r.jsx("div",{className:"mt-1 break-all font-mono text-[11px]",children:m}):r.jsx("div",{className:"mt-1 text-muted-foreground",children:"正在获取确认链接…"}),r.jsxs("div",{className:"mt-1 flex gap-2",children:[m&&r.jsx(V,{variant:"ghost",size:"sm",onClick:()=>{var g;(g=navigator.clipboard)==null||g.writeText(m),M("链接已复制")},children:"复制链接"}),r.jsx(V,{variant:"ghost",size:"sm",disabled:l,onClick:()=>c("cancel"),children:"取消"})]})]}),d==="failed"&&t.error&&r.jsx("div",{className:"text-xs text-destructive",children:t.error}),d==="success"&&r.jsxs("div",{className:"text-xs",children:["已接入应用 ",r.jsx("span",{className:"font-mono",children:t.app_id}),t.error?r.jsx("div",{className:"text-destructive",children:t.error}):null]}),!!(t.steps||[]).length&&r.jsx("div",{className:"rounded border border-border/60 text-xs",children:t.steps.map(g=>r.jsxs("div",{className:"flex items-start gap-2 border-b border-border/40 px-2 py-1.5 last:border-0",children:[r.jsx("span",{children:g.ok?"✅":"❌"}),r.jsx("span",{className:"shrink-0",children:g.label}),r.jsx("span",{className:"truncate text-muted-foreground",title:g.detail,children:g.detail})]},g.key))}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(V,{variant:"outline",disabled:l||f.scanDisabled||d==="waiting",onClick:()=>{t.app_id&&!window.confirm(`当前已接入应用 ${t.app_id},重新扫码会换成新应用,继续?`)||c("start",{force:!!t.app_id})},children:"扫码创建飞书应用"}),r.jsx(V,{variant:"ghost",disabled:l||f.writeDisabled,onClick:()=>c("apply",{},"应用配置已补齐(发布后线上生效)"),children:"补齐应用配置"}),r.jsx(V,{variant:"ghost",disabled:l||f.writeDisabled,onClick:()=>{window.confirm("把当前改动作为新版本提交给企业管理员审批?(发布后需管理员同意才线上生效)")&&c("publish",{},"已提交发布,等管理员审批")},children:"提交发布"}),r.jsx(V,{variant:"ghost",disabled:l||f.refreshDisabled,onClick:i,children:"刷新状态"})]}),(s==null?void 0:s.action)==="publish"&&s.ok&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:["已提交版本 ",s.version,"(version_id=",s.version_id||"-","); 企业管理员审批通过后线上生效。"]}),r.jsx("div",{className:"hint",children:"「补齐应用配置」会写你飞书应用的权限/事件订阅/回调(需 application:application:patch 权限, 缺权限会给出开通指引);一键接入不需要它——扫码创建时已按平台清单预置。"})]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"加载中…"})})]})}const BI={ok:"✅",warn:"⚠️",fail:"❌",skip:"➖"};function HI(){const[e,t]=u.useState(null),[n,s]=u.useState(null),[o,l]=u.useState(!1),[a,i]=u.useState(!1);async function c(){i(!0);try{const d=await $n.feishuDoctor(o);t(d.items||[]),s(d.summary||null)}catch(d){M(d.message)}finally{i(!1)}}return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(VC,{className:"size-4 text-[var(--star-text)]"})," 配置自检"]})}),r.jsxs(En,{className:"space-y-3 px-5",children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"逐项检查「凭据/机器人能力/长连接/事件订阅/权限」,红色项按提示修即可。"}),r.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[r.jsx("input",{type:"checkbox",checked:o,onChange:d=>l(d.target.checked)}),"发送测试消息(验证「发消息」权限,会给你已绑定的飞书账号发一条 DM)"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(V,{variant:"outline",disabled:a,onClick:c,children:"运行自检"}),!e&&r.jsx("span",{className:"self-center text-xs text-muted-foreground",children:"点「运行自检」开始(会读取你应用的凭据与权限状态)"})]}),e&&r.jsx("div",{className:"rounded border border-border/60 text-xs",children:e.map(d=>r.jsxs("div",{className:"border-b border-border/40 px-2 py-1.5 last:border-0",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"shrink-0",children:BI[d.state]||"•"}),r.jsx("span",{className:"shrink-0",children:d.label}),r.jsx("span",{className:"text-muted-foreground",children:d.detail})]}),d.hint?r.jsxs("div",{className:"mt-0.5 pl-6 text-muted-foreground",children:["提示:",d.hint]}):null]},d.key))}),n&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:["汇总:通过 ",n.ok,"、待修 ",n.fail,"、提醒 ",n.warn,"、跳过 ",n.skip]})]})]})}function UI(){var m,g,h,y,j,w;const[e,t]=u.useState(null),[n,s]=u.useState(!1),[o,l]=u.useState(null);async function a(){try{t(await $n.feishuSlashGet())}catch(x){M(x.message)}}u.useEffect(()=>{a()},[]);async function i(x){s(!0);try{const v=await $n.feishuSlashSet(x);l({action:x,...v}),x==="notify"?v.ok?M("权限引导卡片已发到你的飞书私聊,点卡片上的按钮即可重试注册"):M(v.error||"卡片发送失败"):v.ok?M(x==="sync"?`同步完成:新增 ${v.created.length}、更新 ${v.updated.length}、已最新 ${v.kept.length}`:`已清除 ${v.deleted.length} 条 TS 指令`):M(v.card_sent?"需要先开通权限:已把引导卡片发到你的飞书私聊":v.error||"操作失败,请看卡片上的提示"),await a()}catch(v){M(v.message)}finally{s(!1)}}const c=(e==null?void 0:e.remote)||[],d=(e==null?void 0:e.desired)||[],f=new Set(c.map(x=>x.command)),p=d.filter(x=>{const v=c.find(b=>b.command===x.command);return!v||v.description!==x.description||v.icon!==x.icon});return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(KN,{className:"size-4 text-[var(--star-text)]"})," 快捷指令(输入框打「/」)"]})}),r.jsxs(En,{className:"space-y-3 px-5",children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"把平台指令注册成飞书斜杠指令:机器人私聊里输入「/」即可从指令面板选 /status、/cards、 /approve 等(选中后以「/名称 [参数]」发给机器人,用法与中文指令一致)。 同步只增改本平台的指令,不影响你应用里的其他指令。"}),e?r.jsxs(r.Fragment,{children:[e.error&&r.jsx("div",{className:"text-xs text-destructive",children:e.error}),e.need_scope&&r.jsx("div",{className:"text-xs text-[var(--star-text)]",children:"缺「应用指令」权限:点「发飞书权限卡片」→ 你的飞书私聊会收到一张引导卡片, 在上面点「我已开通,重试注册」即由后端重试(无需回站点手动重试)。"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(V,{variant:"outline",disabled:n,onClick:()=>i("sync"),children:"注册 / 同步到飞书"}),r.jsx(V,{variant:"ghost",disabled:n,onClick:()=>i("notify"),children:"发飞书权限卡片"}),r.jsx(V,{variant:"ghost",disabled:n,onClick:a,children:"刷新状态"}),r.jsx(V,{variant:"ghost",disabled:n||!f.size,onClick:()=>{window.confirm("删除飞书侧本平台的斜杠指令?(你应用里的其他指令不受影响)")&&i("clear")},children:"清除 TS 指令"})]}),r.jsxs("div",{className:"text-xs",children:["已注册 ",f.size," / ",d.length," 条",p.length?`,待同步 ${p.length} 条`:",均已与平台一致",(m=e.extra)!=null&&m.length?`;另有 ${e.extra.length} 条非 TS 指令(不会改动)`:""]}),r.jsx("div",{className:"max-h-52 overflow-y-auto rounded border border-border/60 text-xs",children:d.length?d.map(x=>r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/40 px-2 py-1.5 last:border-0",children:[r.jsx(Ql,{variant:f.has(x.command)?"secondary":"outline",children:f.has(x.command)?"已注册":"未注册"}),r.jsxs("span",{className:"shrink-0 font-mono",children:["/",x.command]}),r.jsx("span",{className:"truncate text-muted-foreground",title:x.description,children:x.description})]},x.command)):r.jsx("div",{className:"px-2 py-3 text-muted-foreground",children:"暂无可注册指令"})}),o&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.action==="sync"?`上次同步:新增 ${((g=o.created)==null?void 0:g.length)||0}、更新 ${((h=o.updated)==null?void 0:h.length)||0}、已最新 ${((y=o.kept)==null?void 0:y.length)||0}`:o.action==="notify"?"权限引导卡片已发送(去飞书私聊查看)":`上次清除:删除 ${((j=o.deleted)==null?void 0:j.length)||0} 条`,o.card_sent?r.jsx("div",{className:"text-[var(--star-text)]",children:"已把权限引导卡片发到你的飞书私聊,点卡片上的「我已开通,重试注册」即自动重试"}):null,o.card_error?r.jsx("div",{className:"text-destructive",children:o.card_error}):null,(w=o.failed)!=null&&w.length?r.jsx("div",{className:"text-destructive",title:o.failed.join(`
484
+ `),children:o.failed[0]}):null]}),r.jsx("div",{className:"hint",children:"权限:应用需开通 application:app_slash_command:read / write 并**创建版本发布**才可用; 缺权限时可点「发飞书权限卡片」,在飞书卡片上确认后自动重试。 注册结果约 5 分钟同步到客户端(客户端另有约 3 分钟缓存,重启飞书客户端可加速); PC 飞书需 7.70+、移动端 7.71+。"})]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"加载中…"})]})]})}const ip={absent:{label:"未安装",cls:"none",action:"安装"},installed:{label:"已安装",cls:"ok",action:"重新安装"},outdated:{label:"可更新",cls:"warn",action:"更新"},partial:{label:"需修复",cls:"bad",action:"修复"}},VI={marked:"平台注册(可整块卸载)",canonical:"手工注册(文本规范,平台可代管)",foreign:"自定义写法(平台只报告、不改动)","":"未注册"};function WI(){const e=Zn(),[t,n]=u.useState("user"),[s,o]=u.useState([]),[l,a]=u.useState(null),[i,c]=u.useState(null),[d,f]=u.useState(""),p=u.useRef(0);u.useEffect(()=>{let h=!0;return Pt.list().then(y=>{if(!h)return;o(y);const j=y.find(w=>!w.archived)||y[0];j&&a(j.id)}).catch(y=>M(y.message)),()=>{h=!1}},[]);async function m(){const h=++p.current;try{const y=await id.list(t,l);h===p.current&&c(y)}catch(y){h===p.current&&M(y.message)}}u.useEffect(()=>{c(null),!(t==="project"&&!l)&&m()},[t,l]);async function g(h,y){f(`${h.id}:${y}`);try{const j=y==="install"?await id.install(h.id,t,l):await id.uninstall(h.id,t,l);y==="uninstall"?M(`已卸载「${h.name}」`):j.state==="installed"?M(j.restart_required?`已安装「${h.name}」,需重启 dsh 生效`:h.type==="dsh_plugin"?`已安装「${h.name}」,注册行已写入(热生效)`:`已安装「${h.name}」,对之后新起的 agent 会话生效`):M(`「${h.name}」安装后状态:${(ip[j.state]||{}).label||j.state}`),await m()}catch(j){M(j.message)}finally{f("")}}return r.jsxs(r.Fragment,{children:[r.jsxs(Cn,{className:"max-w-2xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(Q0,{className:"size-4 text-[var(--star-text)]"})," 内置资产"]})}),r.jsxs(En,{className:"space-y-3 px-5",children:[r.jsxs("div",{className:"text-xs leading-relaxed text-muted-foreground",children:["安装平台内置资产(清单 = 仓库 ",r.jsx("span",{className:"font-mono",children:"extensions/*/asset.json"}),"), 两类:",r.jsx("span",{className:"font-mono",children:"skill"}),"(技能文件)与",r.jsx("span",{className:"font-mono",children:"dsh_plugin"}),"(dsh 原生插件:拷进 dsh profile 的 node_modules 并写入 ",r.jsx("span",{className:"font-mono",children:"cordis.patch.yml"})," 注册行,仅用户级)。 用户级写服务进程 HOME(如 ",r.jsx("span",{className:"font-mono",children:"~/.dsh/skills"}),"、",r.jsx("span",{className:"font-mono",children:"~/.dsh/profiles"}),"),影响本机所有项目、仅管理员可操作; 项目级写所选项目目录(如 ",r.jsx("span",{className:"font-mono",children:"<项目>/.dsh/skills"}),"),仅项目所有者可操作。 安装 = 收敛到清单期望状态(已装的会按内容更新)。"]}),r.jsxs("div",{className:"ext-seg",children:[r.jsx("button",{type:"button",className:t==="user"?"active":"",onClick:()=>n("user"),children:"用户级(本机)"}),r.jsx("button",{type:"button",className:t==="project"?"active":"",onClick:()=>n("project"),children:"项目级(所选项目)"})]}),t==="project"&&(s.length>0?r.jsx("div",{style:{maxWidth:320},children:r.jsx(Xc,{options:s.map(h=>({value:h.id,label:h.name+(h.archived?"(已归档)":""),search:h.project_dir})),value:l,onChange:a,placeholder:"选择项目"})}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"还没有项目:先在项目页创建项目,再回来装项目级资产。"})),t==="user"&&!e.isAdmin&&r.jsx("div",{className:"text-xs text-destructive",children:"用户级安装会写入本机 agent 配置、影响所有项目,仅管理员可操作——此处对你只读。"})]})]}),i&&i.assets.map(h=>r.jsx(qI,{a:h,target:t,canInstall:i.can_install,busy:d,onAct:g},h.id)),i&&i.assets.length===0&&r.jsx(Cn,{className:"max-w-2xl py-4",children:r.jsx(En,{className:"px-5 text-xs text-muted-foreground",children:"该目标下暂无可安装的内置资产。"})}),!i&&r.jsx(Cn,{className:"max-w-2xl py-4",children:r.jsx(En,{className:"px-5 text-xs text-muted-foreground",children:t==="project"&&!l?"请先选择项目。":"加载中…"})})]})}function qI({a:e,target:t,canInstall:n,busy:s,onAct:o}){const l=ip[e.state]||ip.absent,a=!e.supported||!n,i=s===`${e.id}:install`,c=s===`${e.id}:uninstall`;function d(){const f=e.type==="dsh_plugin"?"会删除插件包文件与平台写的注册行(用户自定义写法的注册行一律不动,遇到会拒绝并说明)。":"会删除平台安装进技能目录的文件(用户手工放的同名文件不动)。";window.confirm(`确认卸载「${e.name}」?
485
+ ${f}`)&&o(e,"uninstall")}return r.jsxs(Cn,{className:"max-w-2xl gap-3 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.name,r.jsx("span",{className:"ext-kind",children:e.type_label||e.type}),e.family_label&&e.family_label!==(e.type_label||e.type)&&r.jsx("span",{className:"ext-kind",children:e.family_label}),r.jsx("span",{className:"ext-state "+l.cls,children:l.label})]})}),r.jsxs(En,{className:"space-y-2 px-5",children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),e.files.map(f=>r.jsxs("div",{className:"ext-path",children:[f.path,f.exists?f.same?"":"(内容与仓库不一致)":"(尚未安装)"]},f.to)),e.plugin&&r.jsxs("div",{className:"text-xs leading-relaxed text-muted-foreground",children:[r.jsxs("div",{className:"ext-path",children:[e.plugin.patch_path," —— 注册行:",VI[e.plugin.patch_mode]||e.plugin.patch_mode,e.plugin.disabled?"(已被 dsh 面板停用,安装会重新启用)":""]}),r.jsxs("div",{children:["插件包 ",r.jsx("span",{className:"font-mono",children:e.plugin.package})," · profile"," ",r.jsx("span",{className:"font-mono",children:e.plugin.profile}),e.plugin.restart_required?" · 该 profile 未开 patchReload,装完需重启 dsh 生效":" · 改注册行即热生效"]}),!e.plugin.requires_ok&&r.jsxs("div",{className:"text-destructive",children:["依赖解析不到:",(e.plugin.requires||[]).filter(f=>!f.ok).map(f=>f.spec).join("、"),"——dsh 自带包需在 profile 的 node_modules 里有对应链接(同目录软链),否则插件加载即报模块缺失。"]})]}),!e.supported&&r.jsx("div",{className:"text-xs text-destructive",children:e.reason}),e.state==="outdated"&&r.jsx("div",{className:"text-xs text-destructive",children:"已装文件与仓库版本不一致(可能被本地改过):更新会用仓库版本覆盖,需要保留本地改动请先另存。"}),e.supported&&!n&&r.jsx("div",{className:"text-xs text-destructive",children:t==="user"?"用户级安装仅管理员可操作,此处只读。":"你没有该项目的操作权限。"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[r.jsxs(V,{size:"sm",disabled:a||!!s,onClick:()=>o(e,"install"),children:[r.jsx(ZN,{})," ",i?"处理中…":l.action]}),r.jsxs(V,{size:"sm",variant:"ghost",disabled:a||!!s||e.state==="absent",onClick:d,title:e.state==="absent"?"尚未安装":void 0,children:[r.jsx(Qs,{})," ",c?"卸载中…":"卸载"]})]})]})]})}const GI=[{key:"appearance",label:"外观主题",icon:ew,admin:!1},{key:"password",label:"修改密码",icon:dm,admin:!1},{key:"feishu",label:"飞书设置",icon:J0,admin:!1},{key:"assets",label:"内置资产",icon:Q0,admin:!1},{key:"rag",label:"RAG 检索配置",icon:Y0,admin:!0}];function Bx(){const e=ea(),t=jk(),n=Zn(),s=GI.filter(a=>!a.admin||n.isAdmin),o=s.find(a=>a.key===t.section)||s[0];u.useEffect(()=>{t.section!==o.key&&e(`/settings/${o.key}`,{replace:!0})},[t.section,o.key]);async function l(){await n.logout(),e("/login")}return r.jsxs("div",{className:"flex h-svh flex-col",children:[r.jsxs("header",{className:"flex flex-none items-center gap-3 border-b border-border bg-card px-6 py-3",children:[r.jsxs("div",{className:"flex items-center gap-2.5 font-semibold",children:[r.jsx("div",{className:"ts-logo ts-mark size-6 rounded-md text-[calc(11px*var(--fs))]",children:"TS"}),"设置"]}),r.jsx("span",{className:"ml-auto text-sm text-muted-foreground",children:n.username}),r.jsxs(V,{variant:"ghost",size:"sm",onClick:l,children:[r.jsx(fm,{})," 登出"]})]}),r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"sets-page-side",children:[r.jsx("nav",{className:"sets-page-nav",children:s.map(a=>r.jsxs("button",{type:"button",className:a.key===o.key?"active":"",onClick:()=>e(`/settings/${a.key}`),children:[r.jsx(a.icon,{})," ",a.label]},a.key))}),r.jsx("div",{className:"sets-page-foot",children:r.jsxs(V,{variant:"ghost",size:"sm",onClick:()=>e("/app"),children:[r.jsx(im,{})," 返回项目"]})})]}),r.jsxs("main",{className:"min-w-0 flex-1 space-y-5 overflow-y-auto px-6 py-5",children:[o.key==="appearance"&&r.jsx(KI,{}),o.key==="password"&&r.jsx(QI,{}),o.key==="feishu"&&r.jsx(DI,{}),o.key==="assets"&&r.jsx(WI,{}),o.key==="rag"&&r.jsx(CI,{})]})]})]})}function KI(){const[e,t]=u.useState(c1()),[n,s]=u.useState(f1()),[o,l]=u.useState(g1()),a=l1(e);function i(c){i1(c),t(c)}return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(ew,{className:"size-4 text-[var(--star-text)]"})," 外观主题"]})}),r.jsxs(En,{className:"space-y-4 px-5",children:[r.jsx("div",{className:"text-xs leading-relaxed text-muted-foreground",children:"选择界面配色、文字亮度与字体大小,点选即生效,记录在本浏览器(localStorage),不影响其他用户。 「DSH 深色 / DSH 浅色」对齐 dsh 自身外观;「跟随 DSH」按 dsh 宿主的明暗自动切换。 文字亮度只压文字色梯(正文/次级/强调文字及日志、气泡、菜单文字),不动状态色、背景与按钮填充; 浅色皮肤(DSH 浅色)下不生效——与 dsh 宿主 dim-text 插件的口径一致。"}),r.jsxs("button",{type:"button",className:"skin-pick skin-pick-wide"+(e===qs?" active":""),onClick:()=>i(qs),children:[r.jsx("span",{className:"sw",children:yI.map(c=>r.jsx("i",{style:{background:c}},c))}),r.jsxs("span",{className:"skin-pick-txt",children:[r.jsx("span",{children:"跟随 DSH"}),r.jsx("span",{className:"sub",children:e===qs?`当前生效:${kI(a)}`:"按 dsh 宿主的明暗外观自动切换"})]}),e===qs&&r.jsx(dr,{className:"ml-auto size-3.5 text-[var(--star)]"})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3",children:Jm.map(c=>r.jsxs("button",{type:"button",className:"skin-pick"+(e===c.id?" active":""),onClick:()=>i(c.id),children:[r.jsx("span",{className:"sw",children:c.preview.map(d=>r.jsx("i",{style:{background:d}},d))}),r.jsx("span",{children:c.label}),e===c.id&&r.jsx(dr,{className:"ml-auto size-3.5 text-[var(--star)]"})]},c.id))}),r.jsx("div",{className:"grid grid-cols-4 gap-3",children:d1.map(c=>r.jsxs("button",{type:"button",className:"fs-pick"+(n===c.value?" active":""),onClick:()=>{p1(c.value),s(c.value)},children:[r.jsx("span",{className:"sample",style:{fontSize:`calc(13px * ${c.value})`},children:"字A"}),r.jsx("span",{children:c.label}),n===c.value&&r.jsx(dr,{className:"ml-auto size-3.5 text-[var(--star)]"})]},c.value))}),r.jsx("div",{className:"grid grid-cols-3 gap-3",children:Zm.map(c=>r.jsxs("button",{type:"button","data-br":c.id,title:c.hint,className:"br-pick"+(o===c.id?" active":""),onClick:()=>{x1(c.id),l(c.id)},children:[r.jsx("span",{className:"sample",children:"文A"}),r.jsxs("span",{className:"br-pick-txt",children:[r.jsx("span",{children:c.label}),r.jsx("span",{className:"sub",children:c.hint})]}),o===c.id&&r.jsx(dr,{className:"ml-auto size-3.5 text-[var(--star)]"})]},c.id))})]})]})}function QI(){const[e,t]=u.useState({old:"",new:""}),[n,s]=u.useState(!1);async function o(){s(!0);try{await $l.changePassword(e.old,e.new),M("密码已修改"),t({old:"",new:""})}catch(l){M(l.message)}finally{s(!1)}}return r.jsxs(Cn,{className:"max-w-xl gap-4 py-4",children:[r.jsx(qn,{className:"px-5 pb-0",children:r.jsxs(Gn,{className:"flex items-center gap-2 text-sm",children:[r.jsx(dm,{className:"size-4 text-[var(--star-text)]"})," 修改密码"]})}),r.jsxs(En,{className:"space-y-4 px-5",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"原密码"}),r.jsx(Ae,{type:"password",value:e.old,onChange:l=>t({...e,old:l.target.value})})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{className:"text-xs text-muted-foreground",children:"新密码(至少 6 位)"}),r.jsx(Ae,{type:"password",value:e.new,onChange:l=>t({...e,new:l.target.value})})]}),r.jsx(V,{variant:"outline",disabled:n,onClick:o,children:"保存"})]})]})}function YI(e){return e.startsWith("### PROMPT")?"lp-prompt":e.startsWith("### CMD")?"lp-cmd":e.startsWith("### PID")?"lp-dim":e.startsWith("### COMPACT")?"lp-compact":/### 轮次\s*\d+\s*(开始|结束)/.test(e)?"lp-round":/ROUND_DONE|FIX_DONE|RETEST_SUMMARY|STRESS_DONE/.test(e)?"lp-done":/Exception|Traceback|error|ERR|失败|超时|exit=-?\d+/.test(e)?"lp-err":e.startsWith("{")?"lp-json":""}const XI=5e3;function JI(){const[e,t]=Hk(),n=+(e.get("task")||0),s=+(e.get("round")||0),[o,l]=u.useState(null),[a,i]=u.useState([]),[c,d]=u.useState(""),[f,p]=u.useState(!1),[m,g]=u.useState(""),h=u.useRef(null),y=u.useRef(!0),j=u.useMemo(()=>c?c.split(`
486
+ `):[],[c]);u.useEffect(()=>{if(!n){g("缺少 task 参数");return}let x=!1;return(async()=>{try{const[v,b]=await Promise.all([Ve.get(n),Ve.rounds(n)]);if(x)return;l(v),i(b),b.length&&!b.some(S=>S.round_no===s)&&t({task:String(n),round:String(b[b.length-1].round_no)},{replace:!0})}catch(v){x||g(v.message)}})(),()=>{x=!0}},[n,s]),u.useEffect(()=>(document.title=o?`日志 · ${o.name}`:"任务日志",()=>{document.title="Touchstone"}),[o]),u.useEffect(()=>{if(!n||!s)return;let x=null,v=!1;const b=async()=>{const S=h.current;y.current=S?S.scrollHeight-S.scrollTop-S.clientHeight<60:!0;try{const k=await Ve.log(n,s,XI);if(v)return;p(!1),d(E=>E===k.log?E:k.log)}catch{v||(p(!0),d(""))}};return b(),x=setInterval(b,2e3),()=>{v=!0,clearInterval(x)}},[n,s]),u.useEffect(()=>{const x=h.current;x&&y.current&&(x.scrollTop=x.scrollHeight)},[c]);function w(){y.current=!0;const x=h.current;x&&(x.scrollTop=x.scrollHeight)}return r.jsxs("div",{className:"log-page",children:[r.jsxs("div",{className:"log-page-head",children:[r.jsx(vu,{size:20}),r.jsx("span",{className:"t",children:"任务日志"}),o&&r.jsxs("span",{className:"dim",children:["「",o.name,"」"]}),o&&r.jsxs("span",{className:"badge st-"+o.status,children:[r.jsx("span",{className:"dot"}),hr[o.status]||o.status]}),r.jsx("span",{className:"spacer"}),a.length>0&&r.jsxs(Ht,{value:String(s),onValueChange:x=>t({task:String(n),round:x}),children:[r.jsx(Lt,{size:"sm",className:"h-7 min-w-[90px] text-xs",children:r.jsx(Ot,{})}),r.jsx(Dt,{children:a.map(x=>r.jsxs(Le,{value:String(x.round_no),children:["第 ",x.round_no," 轮"]},x.round_no))})]}),r.jsxs("span",{className:"hint",children:[j.length," 行 · 2s 自动刷新 · 在底部时自动跟随"]}),r.jsxs(V,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",title:"回到底部并恢复自动跟随",onClick:w,children:[r.jsx(MN,{})," 底部"]})]}),(o==null?void 0:o.task_type)==="stress"&&r.jsx(Oj,{task:o}),r.jsx("div",{className:"log-page-body",children:m?r.jsxs("div",{className:"hint",style:{margin:"auto"},children:["加载失败:",m]}):f?r.jsx("div",{className:"hint",style:{margin:"auto"},children:"该轮暂无日志"}):r.jsx("div",{className:"log",ref:h,children:j.map((x,v)=>r.jsx("div",{className:"log-line "+YI(x),children:x||" "},v))})})]})}function y1(){const e=Zn(),[t,n]=u.useState(""),[s,o]=u.useState(""),[l,a]=u.useState(""),[i,c]=u.useState(""),[d,f]=u.useState(!1);async function p(){if(!d){if(c(""),s.length<6){c("新密码至少 6 位");return}if(s!==l){c("两次输入的新密码不一致");return}f(!0);try{await $l.changePassword(t,s),await e.load(),M("密码已修改")}catch(m){c(m.message||"修改失败")}finally{f(!1)}}}return r.jsx("div",{className:"flex min-h-svh items-center justify-center bg-[radial-gradient(1200px_600px_at_70%_-10%,var(--login-glow)_0%,var(--bg)_55%)] p-4",children:r.jsxs(Cn,{className:"w-[380px] shadow-xl",children:[r.jsxs(qn,{className:"items-center gap-3 border-b border-border/60 pb-5",children:[r.jsx("div",{className:"justify-self-center",children:r.jsx(vu,{size:40})}),r.jsxs("div",{className:"text-center",children:[r.jsxs(Gn,{className:"flex items-center justify-center gap-2 font-serif text-lg",children:[r.jsx(dm,{className:"size-4 text-[var(--star-text)]"})," 首次登录须修改密码"]}),r.jsxs(q0,{className:"mt-1",children:["账号 ",e.username," 仍在使用一次性初始口令"]})]})]}),r.jsxs(En,{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"force-old-pw",className:"text-xs text-muted-foreground",children:"当前口令(启动横幅里的一次性口令)"}),r.jsx(Ae,{id:"force-old-pw",value:t,type:"password",onChange:m=>n(m.target.value),autoComplete:"current-password",autoFocus:!0})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"force-new-pw",className:"text-xs text-muted-foreground",children:"新密码(至少 6 位)"}),r.jsx(Ae,{id:"force-new-pw",value:s,type:"password",onChange:m=>o(m.target.value),autoComplete:"new-password"})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(st,{htmlFor:"force-new-pw2",className:"text-xs text-muted-foreground",children:"确认新密码"}),r.jsx(Ae,{id:"force-new-pw2",value:l,type:"password",onChange:m=>a(m.target.value),autoComplete:"new-password",onKeyUp:m=>{m.key==="Enter"&&p()}})]}),r.jsx("div",{className:"min-h-5 text-[calc(13px*var(--fs))] leading-5 text-destructive",children:i}),r.jsxs(V,{size:"lg",className:"w-full",disabled:d,onClick:p,children:[d&&r.jsx(Z0,{className:"size-4 animate-spin"}),"修改并进入"]})]}),r.jsx(G0,{className:"flex-col items-center pt-0",children:r.jsx("button",{type:"button",className:"text-sm text-[var(--run)] underline-offset-4 hover:underline",onClick:()=>e.logout(),children:"退出登录"})})]})})}const w1="ts.last_route",ZI=["","app","monitor","admin","settings"];function Tu(){return"/touchstone/".replace(/\/+$/,"")}function j1(e){const t=Tu();return t&&e.startsWith(t+"/")?e.slice(t.length):t&&e===t?"/":e}function eA(e,t){const n=Tu();return(n?[n+"/",n+"/app"]:["/","/app"]).includes(e)&&!t}function tA(e,t=""){try{if(!e)return;const n=j1(e);if(n==="/login"||n==="/log")return;localStorage.setItem(w1,Tu()+n+(t||""))}catch{}}function nA(){try{const e=localStorage.getItem(w1)||"";if(!e.startsWith("/"))return"";const t=Tu();if(t&&!(e===t||e.startsWith(t+"/")))return"";const[n,s=""]=e.split("?"),o=j1(n).split("/")[1]||"";return ZI.includes(o)?e:""}catch{return""}}function sA(){const e=nA();if(!e)return"";const{pathname:t,search:n}=window.location;return t+n===e||!eA(t,n)?"":(window.history.replaceState(null,"",e),e)}function va({children:e}){const t=Zn(s=>s.username),n=Zn(s=>s.mustChangePassword);return t?n?r.jsx(y1,{}):e:r.jsx(Vl,{to:"/login",replace:!0})}function rA({children:e}){const t=Zn(o=>o.username),n=Zn(o=>o.isAdmin),s=Zn(o=>o.mustChangePassword);return t?s?r.jsx(y1,{}):n?e:r.jsx(Vl,{to:"/app",replace:!0}):r.jsx(Vl,{to:"/login",replace:!0})}function oA({children:e}){return Zn(n=>n.username)?r.jsx(Vl,{to:"/app",replace:!0}):e}function lA(){const e=di();return u.useEffect(()=>{tA(e.pathname,e.search)},[e.pathname,e.search]),r.jsxs(Lk,{children:[r.jsx(Fs,{path:"/login",element:r.jsx(oA,{children:r.jsx(s2,{})})}),r.jsx(Fs,{path:"/",element:r.jsx(Vl,{to:"/app",replace:!0})}),r.jsx(Fs,{path:"/app",element:r.jsx(va,{children:r.jsx(Fx,{})})}),r.jsx(Fs,{path:"/monitor",element:r.jsx(va,{children:r.jsx(Fx,{})})}),r.jsx(Fs,{path:"/admin",element:r.jsx(rA,{children:r.jsx(hI,{})})}),r.jsx(Fs,{path:"/settings",element:r.jsx(va,{children:r.jsx(Bx,{})})}),r.jsx(Fs,{path:"/settings/:section",element:r.jsx(va,{children:r.jsx(Bx,{})})}),r.jsx(Fs,{path:"/log",element:r.jsx(va,{children:r.jsx(JI,{})})}),r.jsx(Fs,{path:"*",element:r.jsx(Vl,{to:"/app",replace:!0})})]})}_I();SI();NI();WM();Zn.getState().load().finally(()=>{sA(),n0(document.getElementById("app")).render(r.jsx(Bk,{basename:"/touchstone/".replace(/\/+$/,"")||"/",children:r.jsx(lA,{})}))});