@agentprojectcontext/apx 1.33.1 → 1.34.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 (169) hide show
  1. package/package.json +1 -1
  2. package/skills/apx/SKILL.md +49 -61
  3. package/src/core/agent/a2a/reply.js +48 -0
  4. package/src/core/agent/build-agent-system.js +4 -3
  5. package/src/core/agent/channels/voice-context.js +98 -0
  6. package/src/core/agent/memory.js +2 -1
  7. package/src/core/agent/prompt-builder.js +2 -1
  8. package/src/core/agent/prompts/modes/code-build.md +1 -0
  9. package/src/core/agent/prompts/modes/code-plan.md +1 -0
  10. package/src/core/agent/prompts/modes/index.js +28 -0
  11. package/src/core/agent/skills/loader.js +22 -18
  12. package/src/core/agent/stream/turn-accumulator.js +73 -0
  13. package/src/core/agent/suggestions.js +37 -0
  14. package/src/core/agent/tools/handlers/add-project.js +5 -2
  15. package/src/core/agent/tools/handlers/call-runtime.js +3 -2
  16. package/src/core/agent/tools/handlers/transcribe-audio.js +1 -1
  17. package/src/core/agent/tools/helpers.js +2 -2
  18. package/src/core/agent/tools/names.js +138 -0
  19. package/src/core/agent/tools/registry-bridge.js +6 -14
  20. package/src/core/agent/tools/registry.js +68 -65
  21. package/src/core/apc/context-copy.js +27 -0
  22. package/src/core/apc/notes.js +19 -0
  23. package/src/core/apc/parser.js +12 -5
  24. package/src/core/apc/paths.js +87 -0
  25. package/src/core/apc/scaffold.js +82 -76
  26. package/src/core/apc/skill-sync.js +10 -0
  27. package/src/{host/daemon/plugins → core/channels}/telegram/dispatch.js +38 -16
  28. package/src/core/config/index.js +3 -2
  29. package/src/core/config/redact.js +95 -0
  30. package/src/core/constants/channels.js +2 -0
  31. package/src/core/constants/code-modes.js +10 -0
  32. package/src/core/constants/index.js +1 -0
  33. package/src/core/deck/manifest.js +186 -0
  34. package/src/core/engines/catalog.js +83 -0
  35. package/src/core/{tools → http-tools}/browser.js +0 -1
  36. package/src/core/{tools → http-tools}/fetch.js +0 -1
  37. package/src/core/{tools → http-tools}/glob.js +0 -1
  38. package/src/core/{tools → http-tools}/grep.js +0 -1
  39. package/src/core/{tools → http-tools}/registry.js +0 -1
  40. package/src/core/{tools → http-tools}/search.js +0 -1
  41. package/src/core/i18n/en.js +9 -0
  42. package/src/core/i18n/es.js +12 -0
  43. package/src/core/i18n/index.js +54 -0
  44. package/src/core/i18n/pt.js +9 -0
  45. package/src/core/identity/telegram.js +2 -1
  46. package/src/core/mcp/runner.js +272 -14
  47. package/src/core/mcp/sources.js +3 -2
  48. package/src/core/routines/index.js +16 -0
  49. package/src/{host/daemon/routines.js → core/routines/runner.js} +36 -103
  50. package/src/core/runtime-skills/apc-context/SKILL.md +159 -0
  51. package/src/core/runtime-skills/apx/SKILL.md +95 -0
  52. package/src/core/runtime-skills/apx-mcp/SKILL.md +116 -0
  53. package/src/core/runtime-skills/{claude-code.md → claude-code/SKILL.md} +1 -0
  54. package/src/core/runtime-skills/{codex-cli.md → codex-cli/SKILL.md} +1 -0
  55. package/src/core/runtime-skills/{opencode-cli.md → opencode-cli/SKILL.md} +1 -0
  56. package/src/core/runtime-skills/{openrouter.md → openrouter/SKILL.md} +1 -0
  57. package/src/{host/daemon/env-detect.js → core/runtimes/detect.js} +1 -1
  58. package/src/core/stores/code-sessions.js +50 -2
  59. package/src/core/stores/routine-memory.js +1 -1
  60. package/src/core/stores/sessions-search.js +121 -0
  61. package/src/core/stores/sessions.js +38 -0
  62. package/src/core/vars/index.js +14 -0
  63. package/src/core/vars/interpolate.js +86 -0
  64. package/src/core/vars/sources.js +151 -0
  65. package/src/core/voice/audio-decode.js +38 -0
  66. package/src/core/voice/transcription.js +225 -0
  67. package/src/host/daemon/api/admin-config.js +5 -82
  68. package/src/host/daemon/api/agents.js +5 -5
  69. package/src/host/daemon/api/code.js +17 -169
  70. package/src/host/daemon/api/config.js +3 -4
  71. package/src/host/daemon/api/conversations.js +8 -29
  72. package/src/host/daemon/api/deck.js +37 -404
  73. package/src/host/daemon/api/engines.js +1 -80
  74. package/src/host/daemon/api/exec.js +1 -1
  75. package/src/host/daemon/api/mcps.js +32 -0
  76. package/src/host/daemon/api/routines.js +1 -1
  77. package/src/host/daemon/api/runtimes.js +4 -3
  78. package/src/host/daemon/api/sessions-search.js +24 -140
  79. package/src/host/daemon/api/sessions.js +12 -30
  80. package/src/host/daemon/api/shared.js +2 -1
  81. package/src/host/daemon/api/telegram.js +1 -11
  82. package/src/host/daemon/api/tools.js +6 -6
  83. package/src/host/daemon/api/transcribe.js +2 -2
  84. package/src/host/daemon/api/vars.js +137 -0
  85. package/src/host/daemon/api/voice.js +13 -290
  86. package/src/host/daemon/api.js +2 -0
  87. package/src/host/daemon/db.js +6 -6
  88. package/src/host/daemon/deck-exec.js +148 -0
  89. package/src/host/daemon/index.js +3 -3
  90. package/src/host/daemon/plugins/telegram/index.js +9 -9
  91. package/src/host/daemon/routines-scheduler.js +64 -0
  92. package/src/host/daemon/smoke.js +3 -2
  93. package/src/host/daemon/whisper-server.js +225 -0
  94. package/src/interfaces/cli/commands/agent.js +3 -2
  95. package/src/interfaces/cli/commands/command.js +2 -3
  96. package/src/interfaces/cli/commands/messages.js +6 -2
  97. package/src/interfaces/cli/commands/pair.js +5 -4
  98. package/src/interfaces/cli/commands/search.js +1 -1
  99. package/src/interfaces/cli/commands/sessions.js +3 -2
  100. package/src/interfaces/cli/commands/skills.js +36 -55
  101. package/src/interfaces/web/dist/assets/index-DdmSRtsz.css +1 -0
  102. package/src/interfaces/web/dist/assets/index-M4FspaCH.js +613 -0
  103. package/src/interfaces/web/dist/assets/index-M4FspaCH.js.map +1 -0
  104. package/src/interfaces/web/dist/index.html +2 -2
  105. package/src/interfaces/web/package-lock.json +182 -182
  106. package/src/interfaces/web/src/components/ModelCombobox.tsx +2 -1
  107. package/src/interfaces/web/src/components/TelegramChannelDialog.tsx +1 -1
  108. package/src/interfaces/web/src/components/chat/AskAnswersCard.tsx +76 -0
  109. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +16 -3
  110. package/src/interfaces/web/src/components/chat/MessageList.tsx +23 -1
  111. package/src/interfaces/web/src/components/chat/ModelPicker.tsx +3 -1
  112. package/src/interfaces/web/src/components/code/CodeArtifactsTab.tsx +4 -4
  113. package/src/interfaces/web/src/components/code/CodeChangesTab.tsx +1 -1
  114. package/src/interfaces/web/src/components/code/CodeFileTree.tsx +3 -2
  115. package/src/interfaces/web/src/components/code/CodeFileViewer.tsx +3 -2
  116. package/src/interfaces/web/src/components/code/CodeTerminal.tsx +3 -2
  117. package/src/interfaces/web/src/components/config/GlobalConfigEditor.tsx +2 -1
  118. package/src/interfaces/web/src/components/deck/WidgetRow.tsx +2 -1
  119. package/src/interfaces/web/src/components/inputs/KeyValueList.tsx +93 -0
  120. package/src/interfaces/web/src/components/inputs/VarTokenInput.tsx +449 -0
  121. package/src/interfaces/web/src/components/settings/DefaultRouterCard.tsx +2 -1
  122. package/src/interfaces/web/src/components/settings/EnginesPanel.tsx +2 -2
  123. package/src/interfaces/web/src/components/settings/MemoryPanel.tsx +5 -4
  124. package/src/interfaces/web/src/components/settings/providers/ProviderCard.tsx +3 -2
  125. package/src/interfaces/web/src/components/settings/providers/ProviderModal.tsx +3 -2
  126. package/src/interfaces/web/src/components/ui/chat-input.tsx +5 -4
  127. package/src/interfaces/web/src/components/ui/sidebar.tsx +3 -2
  128. package/src/interfaces/web/src/components/voice/VoiceProviderModal.tsx +2 -1
  129. package/src/interfaces/web/src/constants/index.ts +1 -1
  130. package/src/interfaces/web/src/i18n/en.ts +174 -7
  131. package/src/interfaces/web/src/i18n/es.ts +179 -15
  132. package/src/interfaces/web/src/lib/api/mcps.ts +25 -0
  133. package/src/interfaces/web/src/lib/api/vars.ts +38 -0
  134. package/src/interfaces/web/src/lib/api.ts +1 -0
  135. package/src/interfaces/web/src/screens/ProjectScreen.tsx +8 -31
  136. package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +1 -1
  137. package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +4 -3
  138. package/src/interfaces/web/src/screens/modules/DesktopScreen.tsx +7 -6
  139. package/src/interfaces/web/src/screens/modules/VoiceScreen.tsx +4 -3
  140. package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +1 -1
  141. package/src/interfaces/web/src/screens/project/ConfigTab.tsx +132 -1
  142. package/src/interfaces/web/src/screens/project/McpsTab.tsx +549 -104
  143. package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +1 -1
  144. package/src/interfaces/web/src/screens/project/VarsTab.tsx +300 -0
  145. package/src/interfaces/web/src/types/daemon.ts +5 -0
  146. package/src/host/daemon/transcription.js +0 -538
  147. package/src/host/daemon/whisper-transcribe.py +0 -73
  148. package/src/interfaces/web/dist/assets/index-Aaiw8BZN.css +0 -1
  149. package/src/interfaces/web/dist/assets/index-DPqtjDjh.js +0 -602
  150. package/src/interfaces/web/dist/assets/index-DPqtjDjh.js.map +0 -1
  151. /package/src/{host/daemon → core/apc}/projects-helpers.js +0 -0
  152. /package/src/{host/daemon/plugins → core/channels}/telegram/ask.js +0 -0
  153. /package/src/{host/daemon/plugins → core/channels}/telegram/helpers.js +0 -0
  154. /package/src/{host/daemon/plugins → core/channels}/telegram/media.js +0 -0
  155. /package/src/core/{tools → http-tools}/index.js +0 -0
  156. /package/{skills → src/core/runtime-skills}/apx-agency-agents/SKILL.md +0 -0
  157. /package/{skills → src/core/runtime-skills}/apx-agent/SKILL.md +0 -0
  158. /package/{skills → src/core/runtime-skills}/apx-mcp-builder/SKILL.md +0 -0
  159. /package/{skills → src/core/runtime-skills}/apx-project/SKILL.md +0 -0
  160. /package/{skills → src/core/runtime-skills}/apx-routine/SKILL.md +0 -0
  161. /package/{skills → src/core/runtime-skills}/apx-runtime/SKILL.md +0 -0
  162. /package/{skills → src/core/runtime-skills}/apx-sessions/SKILL.md +0 -0
  163. /package/{skills → src/core/runtime-skills}/apx-skill-builder/SKILL.md +0 -0
  164. /package/{skills → src/core/runtime-skills}/apx-task/SKILL.md +0 -0
  165. /package/{skills → src/core/runtime-skills}/apx-telegram/SKILL.md +0 -0
  166. /package/{skills → src/core/runtime-skills}/apx-voice/SKILL.md +0 -0
  167. /package/src/{host/daemon/compact.js → core/stores/conversations-compactor.js} +0 -0
  168. /package/src/{host/daemon → core/stores}/conversations.js +0 -0
  169. /package/src/{host/daemon → core/util}/thinking.js +0 -0
@@ -0,0 +1,613 @@
1
+ function AN(e,n){for(var s=0;s<n.length;s++){const o=n[s];if(typeof o!="string"&&!Array.isArray(o)){for(const l in o)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(o,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>o[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();function Qh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qm={exports:{}},Ti={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and 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 S1;function MN(){if(S1)return Ti;S1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(o,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:o,key:d,ref:l!==void 0?l:null,props:c}}return Ti.Fragment=n,Ti.jsx=s,Ti.jsxs=s,Ti}var C1;function ON(){return C1||(C1=1,qm.exports=MN()),qm.exports}var r=ON(),$m={exports:{}},rt={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and 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 k1;function zN(){if(k1)return rt;k1=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function S(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,w={};function k(U,K,F){this.props=U,this.context=K,this.refs=w,this.updater=F||C}k.prototype.isReactComponent={},k.prototype.setState=function(U,K){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,K,"setState")},k.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function E(){}E.prototype=k.prototype;function R(U,K,F){this.props=U,this.context=K,this.refs=w,this.updater=F||C}var N=R.prototype=new E;N.constructor=R,j(N,k.prototype),N.isPureReactComponent=!0;var T=Array.isArray;function M(){}var O={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function B(U,K,F){var J=F.ref;return{$$typeof:e,type:U,key:K,ref:J!==void 0?J:null,props:F}}function L(U,K){return B(U.type,K,U.props)}function D(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function z(U){var K={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(F){return K[F]})}var H=/\/+/g;function q(U,K){return typeof U=="object"&&U!==null&&U.key!=null?z(""+U.key):K.toString(36)}function Y(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(M,M):(U.status="pending",U.then(function(K){U.status==="pending"&&(U.status="fulfilled",U.value=K)},function(K){U.status==="pending"&&(U.status="rejected",U.reason=K)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function V(U,K,F,J,ie){var re=typeof U;(re==="undefined"||re==="boolean")&&(U=null);var oe=!1;if(U===null)oe=!0;else switch(re){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(U.$$typeof){case e:case n:oe=!0;break;case g:return oe=U._init,V(oe(U._payload),K,F,J,ie)}}if(oe)return ie=ie(U),oe=J===""?"."+q(U,0):J,T(ie)?(F="",oe!=null&&(F=oe.replace(H,"$&/")+"/"),V(ie,K,F,"",function(Te){return Te})):ie!=null&&(D(ie)&&(ie=L(ie,F+(ie.key==null||U&&U.key===ie.key?"":(""+ie.key).replace(H,"$&/")+"/")+oe)),K.push(ie)),1;oe=0;var ce=J===""?".":J+":";if(T(U))for(var ee=0;ee<U.length;ee++)J=U[ee],re=ce+q(J,ee),oe+=V(J,K,F,re,ie);else if(ee=S(U),typeof ee=="function")for(U=ee.call(U),ee=0;!(J=U.next()).done;)J=J.value,re=ce+q(J,ee++),oe+=V(J,K,F,re,ie);else if(re==="object"){if(typeof U.then=="function")return V(Y(U),K,F,J,ie);throw K=String(U),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return oe}function $(U,K,F){if(U==null)return U;var J=[],ie=0;return V(U,J,"","",function(re){return K.call(F,re,ie++)}),J}function Z(U){if(U._status===-1){var K=U._result;K=K(),K.then(function(F){(U._status===0||U._status===-1)&&(U._status=1,U._result=F)},function(F){(U._status===0||U._status===-1)&&(U._status=2,U._result=F)}),U._status===-1&&(U._status=0,U._result=K)}if(U._status===1)return U._result.default;throw U._result}var G=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},X={map:$,forEach:function(U,K,F){$(U,function(){K.apply(this,arguments)},F)},count:function(U){var K=0;return $(U,function(){K++}),K},toArray:function(U){return $(U,function(K){return K})||[]},only:function(U){if(!D(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return rt.Activity=b,rt.Children=X,rt.Component=k,rt.Fragment=s,rt.Profiler=l,rt.PureComponent=R,rt.StrictMode=o,rt.Suspense=p,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,rt.__COMPILER_RUNTIME={__proto__:null,c:function(U){return O.H.useMemoCache(U)}},rt.cache=function(U){return function(){return U.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(U,K,F){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var J=j({},U.props),ie=U.key;if(K!=null)for(re in K.key!==void 0&&(ie=""+K.key),K)!P.call(K,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&K.ref===void 0||(J[re]=K[re]);var re=arguments.length-2;if(re===1)J.children=F;else if(1<re){for(var oe=Array(re),ce=0;ce<re;ce++)oe[ce]=arguments[ce+2];J.children=oe}return B(U.type,ie,J)},rt.createContext=function(U){return U={$$typeof:d,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:c,_context:U},U},rt.createElement=function(U,K,F){var J,ie={},re=null;if(K!=null)for(J in K.key!==void 0&&(re=""+K.key),K)P.call(K,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(ie[J]=K[J]);var oe=arguments.length-2;if(oe===1)ie.children=F;else if(1<oe){for(var ce=Array(oe),ee=0;ee<oe;ee++)ce[ee]=arguments[ee+2];ie.children=ce}if(U&&U.defaultProps)for(J in oe=U.defaultProps,oe)ie[J]===void 0&&(ie[J]=oe[J]);return B(U,re,ie)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(U){return{$$typeof:f,render:U}},rt.isValidElement=D,rt.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:Z}},rt.memo=function(U,K){return{$$typeof:m,type:U,compare:K===void 0?null:K}},rt.startTransition=function(U){var K=O.T,F={};O.T=F;try{var J=U(),ie=O.S;ie!==null&&ie(F,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(M,G)}catch(re){G(re)}finally{K!==null&&F.types!==null&&(K.types=F.types),O.T=K}},rt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},rt.use=function(U){return O.H.use(U)},rt.useActionState=function(U,K,F){return O.H.useActionState(U,K,F)},rt.useCallback=function(U,K){return O.H.useCallback(U,K)},rt.useContext=function(U){return O.H.useContext(U)},rt.useDebugValue=function(){},rt.useDeferredValue=function(U,K){return O.H.useDeferredValue(U,K)},rt.useEffect=function(U,K){return O.H.useEffect(U,K)},rt.useEffectEvent=function(U){return O.H.useEffectEvent(U)},rt.useId=function(){return O.H.useId()},rt.useImperativeHandle=function(U,K,F){return O.H.useImperativeHandle(U,K,F)},rt.useInsertionEffect=function(U,K){return O.H.useInsertionEffect(U,K)},rt.useLayoutEffect=function(U,K){return O.H.useLayoutEffect(U,K)},rt.useMemo=function(U,K){return O.H.useMemo(U,K)},rt.useOptimistic=function(U,K){return O.H.useOptimistic(U,K)},rt.useReducer=function(U,K,F){return O.H.useReducer(U,K,F)},rt.useRef=function(U){return O.H.useRef(U)},rt.useState=function(U){return O.H.useState(U)},rt.useSyncExternalStore=function(U,K,F){return O.H.useSyncExternalStore(U,K,F)},rt.useTransition=function(){return O.H.useTransition()},rt.version="19.2.7",rt}var E1;function wc(){return E1||(E1=1,$m.exports=zN()),$m.exports}var x=wc();const Sc=Qh(x),DN=AN({__proto__:null,default:Sc},[x]);var Gm={exports:{}},Ai={},Fm={exports:{}},Ym={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and 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
+ */var N1;function LN(){return N1||(N1=1,(function(e){function n(V,$){var Z=V.length;V.push($);e:for(;0<Z;){var G=Z-1>>>1,X=V[G];if(0<l(X,$))V[G]=$,V[Z]=X,Z=G;else break e}}function s(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var $=V[0],Z=V.pop();if(Z!==$){V[0]=Z;e:for(var G=0,X=V.length,U=X>>>1;G<U;){var K=2*(G+1)-1,F=V[K],J=K+1,ie=V[J];if(0>l(F,Z))J<X&&0>l(ie,F)?(V[G]=ie,V[J]=Z,G=J):(V[G]=F,V[K]=Z,G=K);else if(J<X&&0>l(ie,Z))V[G]=ie,V[J]=Z,G=J;else break e}}return $}function l(V,$){var Z=V.sortIndex-$.sortIndex;return Z!==0?Z:V.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],m=[],g=1,b=null,v=3,S=!1,C=!1,j=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function N(V){for(var $=s(m);$!==null;){if($.callback===null)o(m);else if($.startTime<=V)o(m),$.sortIndex=$.expirationTime,n(p,$);else break;$=s(m)}}function T(V){if(j=!1,N(V),!C)if(s(p)!==null)C=!0,M||(M=!0,z());else{var $=s(m);$!==null&&Y(T,$.startTime-V)}}var M=!1,O=-1,P=5,B=-1;function L(){return w?!0:!(e.unstable_now()-B<P)}function D(){if(w=!1,M){var V=e.unstable_now();B=V;var $=!0;try{e:{C=!1,j&&(j=!1,E(O),O=-1),S=!0;var Z=v;try{t:{for(N(V),b=s(p);b!==null&&!(b.expirationTime>V&&L());){var G=b.callback;if(typeof G=="function"){b.callback=null,v=b.priorityLevel;var X=G(b.expirationTime<=V);if(V=e.unstable_now(),typeof X=="function"){b.callback=X,N(V),$=!0;break t}b===s(p)&&o(p),N(V)}else o(p);b=s(p)}if(b!==null)$=!0;else{var U=s(m);U!==null&&Y(T,U.startTime-V),$=!1}}break e}finally{b=null,v=Z,S=!1}$=void 0}}finally{$?z():M=!1}}}var z;if(typeof R=="function")z=function(){R(D)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=D,z=function(){q.postMessage(null)}}else z=function(){k(D,0)};function Y(V,$){O=k(function(){V(e.unstable_now())},$)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(V){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var Z=v;v=$;try{return V()}finally{v=Z}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(V,$){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var Z=v;v=V;try{return $()}finally{v=Z}},e.unstable_scheduleCallback=function(V,$,Z){var G=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?G+Z:G):Z=G,V){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=Z+X,V={id:g++,callback:$,priorityLevel:V,startTime:Z,expirationTime:X,sortIndex:-1},Z>G?(V.sortIndex=Z,n(m,V),s(p)===null&&V===s(m)&&(j?(E(O),O=-1):j=!0,Y(T,Z-G))):(V.sortIndex=X,n(p,V),C||S||(C=!0,M||(M=!0,z()))),V},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(V){var $=v;return function(){var Z=v;v=$;try{return V.apply(this,arguments)}finally{v=Z}}}})(Ym)),Ym}var R1;function PN(){return R1||(R1=1,Fm.exports=LN()),Fm.exports}var Xm={exports:{}},Ln={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and 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 T1;function IN(){if(T1)return Ln;T1=1;var e=wc();function n(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(n(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(p,m,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:p,containerInfo:m,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Ln.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Ln.createPortal=function(p,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return c(p,m,null,g)},Ln.flushSync=function(p){var m=d.T,g=o.p;try{if(d.T=null,o.p=2,p)return p()}finally{d.T=m,o.p=g,o.d.f()}},Ln.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(p,m))},Ln.prefetchDNS=function(p){typeof p=="string"&&o.d.D(p)},Ln.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var g=m.as,b=f(g,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?o.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:S}):g==="script"&&o.d.X(p,{crossOrigin:b,integrity:v,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Ln.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=f(m.as,m.crossOrigin);o.d.M(p,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(p)},Ln.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,b=f(g,m.crossOrigin);o.d.L(p,g,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Ln.preloadModule=function(p,m){if(typeof p=="string")if(m){var g=f(m.as,m.crossOrigin);o.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(p)},Ln.requestFormReset=function(p){o.d.r(p)},Ln.unstable_batchedUpdates=function(p,m){return p(m)},Ln.useFormState=function(p,m,g){return d.H.useFormState(p,m,g)},Ln.useFormStatus=function(){return d.H.useHostTransitionStatus()},Ln.version="19.2.7",Ln}var A1;function uw(){if(A1)return Xm.exports;A1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Xm.exports=IN(),Xm.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var M1;function BN(){if(M1)return Ai;M1=1;var e=PN(),n=wc(),s=uw();function o(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,i=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(i=a.return),t=a.return;while(t)}return a.tag===3?i:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function p(t){if(c(t)!==t)throw Error(o(188))}function m(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(o(188));return a!==t?null:t}for(var i=t,u=a;;){var h=i.return;if(h===null)break;var y=h.alternate;if(y===null){if(u=h.return,u!==null){i=u;continue}break}if(h.child===y.child){for(y=h.child;y;){if(y===i)return p(h),t;if(y===u)return p(h),a;y=y.sibling}throw Error(o(188))}if(i.return!==u.return)i=h,u=y;else{for(var A=!1,I=h.child;I;){if(I===i){A=!0,i=h,u=y;break}if(I===u){A=!0,u=h,i=y;break}I=I.sibling}if(!A){for(I=y.child;I;){if(I===i){A=!0,i=y,u=h;break}if(I===u){A=!0,u=y,i=h;break}I=I.sibling}if(!A)throw Error(o(189))}}if(i.alternate!==u)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?t:a}function g(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=g(t),a!==null)return a;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function z(t){return t===null||typeof t!="object"?null:(t=D&&t[D]||t["@@iterator"],typeof t=="function"?t:null)}var H=Symbol.for("react.client.reference");function q(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===H?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case k:return"Profiler";case w:return"StrictMode";case T:return"Suspense";case M:return"SuspenseList";case B:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case C:return"Portal";case R:return t.displayName||"Context";case E:return(t._context.displayName||"Context")+".Consumer";case N:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case O:return a=t.displayName||null,a!==null?a:q(t.type)||"Memo";case P:a=t._payload,t=t._init;try{return q(t(a))}catch{}}return null}var Y=Array.isArray,V=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},G=[],X=-1;function U(t){return{current:t}}function K(t){0>X||(t.current=G[X],G[X]=null,X--)}function F(t,a){X++,G[X]=t.current,t.current=a}var J=U(null),ie=U(null),re=U(null),oe=U(null);function ce(t,a){switch(F(re,a),F(ie,t),F(J,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Y0(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Y0(a),t=X0(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(J),F(J,t)}function ee(){K(J),K(ie),K(re)}function Te(t){t.memoizedState!==null&&F(oe,t);var a=J.current,i=X0(a,t.type);a!==i&&(F(ie,t),F(J,i))}function Fe(t){ie.current===t&&(K(J),K(ie)),oe.current===t&&(K(oe),ki._currentValue=Z)}var ve,Ce;function Ne(t){if(ve===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);ve=a&&a[1]||"",Ce=-1<i.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ve+t+Ce}var Pe=!1;function Ie(t,a){if(!t||Pe)return"";Pe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ue){var se=ue}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(ue){se=ue}t.call(xe.prototype)}}else{try{throw Error()}catch(ue){se=ue}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&se&&typeof ue.stack=="string")return[ue.stack,se.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=u.DetermineComponentFrameRoot(),A=y[0],I=y[1];if(A&&I){var Q=A.split(`
44
+ `),ae=I.split(`
45
+ `);for(h=u=0;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;for(;h<ae.length&&!ae[h].includes("DetermineComponentFrameRoot");)h++;if(u===Q.length||h===ae.length)for(u=Q.length-1,h=ae.length-1;1<=u&&0<=h&&Q[u]!==ae[h];)h--;for(;1<=u&&0<=h;u--,h--)if(Q[u]!==ae[h]){if(u!==1||h!==1)do if(u--,h--,0>h||Q[u]!==ae[h]){var fe=`
46
+ `+Q[u].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=u&&0<=h);break}}}finally{Pe=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Ne(i):""}function be(t,a){switch(t.tag){case 26:case 27:case 5:return Ne(t.type);case 16:return Ne("Lazy");case 13:return t.child!==a&&a!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ie(t.type,!1);case 11:return Ie(t.type.render,!1);case 1:return Ie(t.type,!0);case 31:return Ne("Activity");default:return""}}function Ae(t){try{var a="",i=null;do a+=be(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var we=Object.prototype.hasOwnProperty,Be=e.unstable_scheduleCallback,Xe=e.unstable_cancelCallback,Ye=e.unstable_shouldYield,De=e.unstable_requestPaint,ye=e.unstable_now,le=e.unstable_getCurrentPriorityLevel,_e=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Je=e.unstable_LowPriority,_t=e.unstable_IdlePriority,zt=e.log,pe=e.unstable_setDisableYieldValue,ke=null,Re=null;function Ve(t){if(typeof zt=="function"&&pe(t),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(ke,t)}catch{}}var at=Math.clz32?Math.clz32:mt,nn=Math.log,Vt=Math.LN2;function mt(t){return t>>>=0,t===0?32:31-(nn(t)/Vt|0)|0}var Nt=256,Zt=262144,St=4194304;function an(t){var a=t&42;if(a!==0)return a;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ft(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var h=0,y=t.suspendedLanes,A=t.pingedLanes;t=t.warmLanes;var I=u&134217727;return I!==0?(u=I&~y,u!==0?h=an(u):(A&=I,A!==0?h=an(A):i||(i=I&~t,i!==0&&(h=an(i))))):(I=u&~y,I!==0?h=an(I):A!==0?h=an(A):i||(i=u&~t,i!==0&&(h=an(i)))),h===0?0:a!==0&&a!==h&&(a&y)===0&&(y=h&-h,i=a&-a,y>=i||y===32&&(i&4194048)!==0)?a:h}function dn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function zn(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xn(){var t=St;return St<<=1,(St&62914560)===0&&(St=4194304),t}function ia(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function Kn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function is(t,a,i,u,h,y){var A=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var I=t.entanglements,Q=t.expirationTimes,ae=t.hiddenUpdates;for(i=A&~i;0<i;){var fe=31-at(i),xe=1<<fe;I[fe]=0,Q[fe]=-1;var se=ae[fe];if(se!==null)for(ae[fe]=null,fe=0;fe<se.length;fe++){var ue=se[fe];ue!==null&&(ue.lane&=-536870913)}i&=~xe}u!==0&&Dn(t,u,0),y!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=y&~(A&~a))}function Dn(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-at(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function ca(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-at(i),h=1<<u;h&a|t[u]&a&&(t[u]|=a),i&=~h}}function Pa(t,a){var i=a&-a;return i=(i&42)!==0?1:cs(i),(i&(t.suspendedLanes|a))!==0?0:i}function cs(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function ct(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Dt(){var t=$.p;return t!==0?t:(t=window.event,t===void 0?32:x1(t.type))}function Sn(t,a){var i=$.p;try{return $.p=t,a()}finally{$.p=i}}var sn=Math.random().toString(36).slice(2),Rt="__reactFiber$"+sn,gn="__reactProps$"+sn,zr="__reactContainer$"+sn,Dc="__reactEvents$"+sn,yk="__reactListeners$"+sn,_k="__reactHandles$"+sn,zb="__reactResources$"+sn,Hl="__reactMarker$"+sn;function Df(t){delete t[Rt],delete t[gn],delete t[Dc],delete t[yk],delete t[_k]}function So(t){var a=t[Rt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[zr]||i[Rt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=t1(t);t!==null;){if(i=t[Rt])return i;t=t1(t)}return a}t=i,i=t.parentNode}return null}function Co(t){if(t=t[Rt]||t[zr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Vl(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(o(33))}function ko(t){var a=t[zb];return a||(a=t[zb]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function jn(t){t[Hl]=!0}var Db=new Set,Lb={};function Dr(t,a){Eo(t,a),Eo(t+"Capture",a)}function Eo(t,a){for(Lb[t]=a,t=0;t<a.length;t++)Db.add(a[t])}var jk=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Pb={},Ib={};function wk(t){return we.call(Ib,t)?!0:we.call(Pb,t)?!1:jk.test(t)?Ib[t]=!0:(Pb[t]=!0,!1)}function Lc(t,a,i){if(wk(a))if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+i)}}function Pc(t,a,i){if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+i)}}function us(t,a,i,u){if(u===null)t.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttributeNS(a,i,""+u)}}function ya(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Bb(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Sk(t,a,i){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var h=u.get,y=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return h.call(this)},set:function(A){i=""+A,y.call(this,A)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(A){i=""+A},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Lf(t){if(!t._valueTracker){var a=Bb(t)?"checked":"value";t._valueTracker=Sk(t,a,""+t[a])}}function Ub(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=Bb(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function Ic(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Ck=/[\n"\\]/g;function _a(t){return t.replace(Ck,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Pf(t,a,i,u,h,y,A,I){t.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.type=A:t.removeAttribute("type"),a!=null?A==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ya(a)):t.value!==""+ya(a)&&(t.value=""+ya(a)):A!=="submit"&&A!=="reset"||t.removeAttribute("value"),a!=null?If(t,A,ya(a)):i!=null?If(t,A,ya(i)):u!=null&&t.removeAttribute("value"),h==null&&y!=null&&(t.defaultChecked=!!y),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?t.name=""+ya(I):t.removeAttribute("name")}function Hb(t,a,i,u,h,y,A,I){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),a!=null||i!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){Lf(t);return}i=i!=null?""+ya(i):"",a=a!=null?""+ya(a):i,I||a===t.value||(t.value=a),t.defaultValue=a}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=I?t.checked:!!u,t.defaultChecked=!!u,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(t.name=A),Lf(t)}function If(t,a,i){a==="number"&&Ic(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function No(t,a,i,u){if(t=t.options,a){a={};for(var h=0;h<i.length;h++)a["$"+i[h]]=!0;for(i=0;i<t.length;i++)h=a.hasOwnProperty("$"+t[i].value),t[i].selected!==h&&(t[i].selected=h),h&&u&&(t[i].defaultSelected=!0)}else{for(i=""+ya(i),a=null,h=0;h<t.length;h++){if(t[h].value===i){t[h].selected=!0,u&&(t[h].defaultSelected=!0);return}a!==null||t[h].disabled||(a=t[h])}a!==null&&(a.selected=!0)}}function Vb(t,a,i){if(a!=null&&(a=""+ya(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+ya(i):""}function qb(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(o(92));if(Y(u)){if(1<u.length)throw Error(o(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=ya(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),Lf(t)}function Ro(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var kk=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $b(t,a,i){var u=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,i):typeof i!="number"||i===0||kk.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function Gb(t,a,i){if(a!=null&&typeof a!="object")throw Error(o(62));if(t=t.style,i!=null){for(var u in i)!i.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var h in a)u=a[h],a.hasOwnProperty(h)&&i[h]!==u&&$b(t,h,u)}else for(var y in a)a.hasOwnProperty(y)&&$b(t,y,a[y])}function Bf(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Ek=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Nk=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bc(t){return Nk.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ds(){}var Uf=null;function Hf(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var To=null,Ao=null;function Fb(t){var a=Co(t);if(a&&(t=a.stateNode)){var i=t[gn]||null;e:switch(t=a.stateNode,a.type){case"input":if(Pf(t,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+_a(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var h=u[gn]||null;if(!h)throw Error(o(90));Pf(u,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&Ub(u)}break e;case"textarea":Vb(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&No(t,!!i.multiple,a,!1)}}}var Vf=!1;function Yb(t,a,i){if(Vf)return t(a,i);Vf=!0;try{var u=t(a);return u}finally{if(Vf=!1,(To!==null||Ao!==null)&&(ku(),To&&(a=To,t=Ao,Ao=To=null,Fb(a),t)))for(a=0;a<t.length;a++)Fb(t[a])}}function ql(t,a){var i=t.stateNode;if(i===null)return null;var u=i[gn]||null;if(u===null)return null;i=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(o(231,a,typeof i));return i}var fs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qf=!1;if(fs)try{var $l={};Object.defineProperty($l,"passive",{get:function(){qf=!0}}),window.addEventListener("test",$l,$l),window.removeEventListener("test",$l,$l)}catch{qf=!1}var qs=null,$f=null,Uc=null;function Xb(){if(Uc)return Uc;var t,a=$f,i=a.length,u,h="value"in qs?qs.value:qs.textContent,y=h.length;for(t=0;t<i&&a[t]===h[t];t++);var A=i-t;for(u=1;u<=A&&a[i-u]===h[y-u];u++);return Uc=h.slice(t,1<u?1-u:void 0)}function Hc(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Vc(){return!0}function Kb(){return!1}function Qn(t){function a(i,u,h,y,A){this._reactName=i,this._targetInst=h,this.type=u,this.nativeEvent=y,this.target=A,this.currentTarget=null;for(var I in t)t.hasOwnProperty(I)&&(i=t[I],this[I]=i?i(y):y[I]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Vc:Kb,this.isPropagationStopped=Kb,this}return b(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Vc)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Vc)},persist:function(){},isPersistent:Vc}),a}var Lr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qc=Qn(Lr),Gl=b({},Lr,{view:0,detail:0}),Rk=Qn(Gl),Gf,Ff,Fl,$c=b({},Gl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Fl&&(Fl&&t.type==="mousemove"?(Gf=t.screenX-Fl.screenX,Ff=t.screenY-Fl.screenY):Ff=Gf=0,Fl=t),Gf)},movementY:function(t){return"movementY"in t?t.movementY:Ff}}),Qb=Qn($c),Tk=b({},$c,{dataTransfer:0}),Ak=Qn(Tk),Mk=b({},Gl,{relatedTarget:0}),Yf=Qn(Mk),Ok=b({},Lr,{animationName:0,elapsedTime:0,pseudoElement:0}),zk=Qn(Ok),Dk=b({},Lr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Lk=Qn(Dk),Pk=b({},Lr,{data:0}),Zb=Qn(Pk),Ik={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bk={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"},Uk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hk(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Uk[t])?!!a[t]:!1}function Xf(){return Hk}var Vk=b({},Gl,{key:function(t){if(t.key){var a=Ik[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Hc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Bk[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xf,charCode:function(t){return t.type==="keypress"?Hc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Hc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),qk=Qn(Vk),$k=b({},$c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wb=Qn($k),Gk=b({},Gl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xf}),Fk=Qn(Gk),Yk=b({},Lr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xk=Qn(Yk),Kk=b({},$c,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Qk=Qn(Kk),Zk=b({},Lr,{newState:0,oldState:0}),Wk=Qn(Zk),Jk=[9,13,27,32],Kf=fs&&"CompositionEvent"in window,Yl=null;fs&&"documentMode"in document&&(Yl=document.documentMode);var eE=fs&&"TextEvent"in window&&!Yl,Jb=fs&&(!Kf||Yl&&8<Yl&&11>=Yl),ev=" ",tv=!1;function nv(t,a){switch(t){case"keyup":return Jk.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function av(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Mo=!1;function tE(t,a){switch(t){case"compositionend":return av(a);case"keypress":return a.which!==32?null:(tv=!0,ev);case"textInput":return t=a.data,t===ev&&tv?null:t;default:return null}}function nE(t,a){if(Mo)return t==="compositionend"||!Kf&&nv(t,a)?(t=Xb(),Uc=$f=qs=null,Mo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Jb&&a.locale!=="ko"?null:a.data;default:return null}}var aE={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 sv(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!aE[t.type]:a==="textarea"}function rv(t,a,i,u){To?Ao?Ao.push(u):Ao=[u]:To=u,a=Ou(a,"onChange"),0<a.length&&(i=new qc("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var Xl=null,Kl=null;function sE(t){H0(t,0)}function Gc(t){var a=Vl(t);if(Ub(a))return t}function ov(t,a){if(t==="change")return a}var lv=!1;if(fs){var Qf;if(fs){var Zf="oninput"in document;if(!Zf){var iv=document.createElement("div");iv.setAttribute("oninput","return;"),Zf=typeof iv.oninput=="function"}Qf=Zf}else Qf=!1;lv=Qf&&(!document.documentMode||9<document.documentMode)}function cv(){Xl&&(Xl.detachEvent("onpropertychange",uv),Kl=Xl=null)}function uv(t){if(t.propertyName==="value"&&Gc(Kl)){var a=[];rv(a,Kl,t,Hf(t)),Yb(sE,a)}}function rE(t,a,i){t==="focusin"?(cv(),Xl=a,Kl=i,Xl.attachEvent("onpropertychange",uv)):t==="focusout"&&cv()}function oE(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gc(Kl)}function lE(t,a){if(t==="click")return Gc(a)}function iE(t,a){if(t==="input"||t==="change")return Gc(a)}function cE(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var ua=typeof Object.is=="function"?Object.is:cE;function Ql(t,a){if(ua(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var i=Object.keys(t),u=Object.keys(a);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var h=i[u];if(!we.call(a,h)||!ua(t[h],a[h]))return!1}return!0}function dv(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function fv(t,a){var i=dv(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=a&&u>=a)return{node:i,offset:a-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=dv(i)}}function pv(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?pv(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function mv(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Ic(t.document);a instanceof t.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)t=a.contentWindow;else break;a=Ic(t.document)}return a}function Wf(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var uE=fs&&"documentMode"in document&&11>=document.documentMode,Oo=null,Jf=null,Zl=null,ep=!1;function gv(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ep||Oo==null||Oo!==Ic(u)||(u=Oo,"selectionStart"in u&&Wf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Zl&&Ql(Zl,u)||(Zl=u,u=Ou(Jf,"onSelect"),0<u.length&&(a=new qc("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=Oo)))}function Pr(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var zo={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionrun:Pr("Transition","TransitionRun"),transitionstart:Pr("Transition","TransitionStart"),transitioncancel:Pr("Transition","TransitionCancel"),transitionend:Pr("Transition","TransitionEnd")},tp={},hv={};fs&&(hv=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function Ir(t){if(tp[t])return tp[t];if(!zo[t])return t;var a=zo[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in hv)return tp[t]=a[i];return t}var xv=Ir("animationend"),bv=Ir("animationiteration"),vv=Ir("animationstart"),dE=Ir("transitionrun"),fE=Ir("transitionstart"),pE=Ir("transitioncancel"),yv=Ir("transitionend"),_v=new Map,np="abort auxClick beforeToggle 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(" ");np.push("scrollEnd");function Ia(t,a){_v.set(t,a),Dr(a,[t])}var Fc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ja=[],Do=0,ap=0;function Yc(){for(var t=Do,a=ap=Do=0;a<t;){var i=ja[a];ja[a++]=null;var u=ja[a];ja[a++]=null;var h=ja[a];ja[a++]=null;var y=ja[a];if(ja[a++]=null,u!==null&&h!==null){var A=u.pending;A===null?h.next=h:(h.next=A.next,A.next=h),u.pending=h}y!==0&&jv(i,h,y)}}function Xc(t,a,i,u){ja[Do++]=t,ja[Do++]=a,ja[Do++]=i,ja[Do++]=u,ap|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function sp(t,a,i,u){return Xc(t,a,i,u),Kc(t)}function Br(t,a){return Xc(t,null,null,a),Kc(t)}function jv(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var h=!1,y=t.return;y!==null;)y.childLanes|=i,u=y.alternate,u!==null&&(u.childLanes|=i),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(h=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,h&&a!==null&&(h=31-at(i),t=y.hiddenUpdates,u=t[h],u===null?t[h]=[a]:u.push(a),a.lane=i|536870912),y):null}function Kc(t){if(50<vi)throw vi=0,pm=null,Error(o(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var Lo={};function mE(t,a,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function da(t,a,i,u){return new mE(t,a,i,u)}function rp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ps(t,a){var i=t.alternate;return i===null?(i=da(t.tag,a,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=a,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,a=t.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function wv(t,a){t.flags&=65011714;var i=t.alternate;return i===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,a=i.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function Qc(t,a,i,u,h,y){var A=0;if(u=t,typeof t=="function")rp(t)&&(A=1);else if(typeof t=="string")A=vN(t,i,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=da(31,i,a,h),t.elementType=B,t.lanes=y,t;case j:return Ur(i.children,h,y,a);case w:A=8,h|=24;break;case k:return t=da(12,i,a,h|2),t.elementType=k,t.lanes=y,t;case T:return t=da(13,i,a,h),t.elementType=T,t.lanes=y,t;case M:return t=da(19,i,a,h),t.elementType=M,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case R:A=10;break e;case E:A=9;break e;case N:A=11;break e;case O:A=14;break e;case P:A=16,u=null;break e}A=29,i=Error(o(130,t===null?"null":typeof t,"")),u=null}return a=da(A,i,a,h),a.elementType=t,a.type=u,a.lanes=y,a}function Ur(t,a,i,u){return t=da(7,t,u,a),t.lanes=i,t}function op(t,a,i){return t=da(6,t,null,a),t.lanes=i,t}function Sv(t){var a=da(18,null,null,0);return a.stateNode=t,a}function lp(t,a,i){return a=da(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Cv=new WeakMap;function wa(t,a){if(typeof t=="object"&&t!==null){var i=Cv.get(t);return i!==void 0?i:(a={value:t,source:a,stack:Ae(a)},Cv.set(t,a),a)}return{value:t,source:a,stack:Ae(a)}}var Po=[],Io=0,Zc=null,Wl=0,Sa=[],Ca=0,$s=null,Fa=1,Ya="";function ms(t,a){Po[Io++]=Wl,Po[Io++]=Zc,Zc=t,Wl=a}function kv(t,a,i){Sa[Ca++]=Fa,Sa[Ca++]=Ya,Sa[Ca++]=$s,$s=t;var u=Fa;t=Ya;var h=32-at(u)-1;u&=~(1<<h),i+=1;var y=32-at(a)+h;if(30<y){var A=h-h%5;y=(u&(1<<A)-1).toString(32),u>>=A,h-=A,Fa=1<<32-at(a)+h|i<<h|u,Ya=y+t}else Fa=1<<y|i<<h|u,Ya=t}function ip(t){t.return!==null&&(ms(t,1),kv(t,1,0))}function cp(t){for(;t===Zc;)Zc=Po[--Io],Po[Io]=null,Wl=Po[--Io],Po[Io]=null;for(;t===$s;)$s=Sa[--Ca],Sa[Ca]=null,Ya=Sa[--Ca],Sa[Ca]=null,Fa=Sa[--Ca],Sa[Ca]=null}function Ev(t,a){Sa[Ca++]=Fa,Sa[Ca++]=Ya,Sa[Ca++]=$s,Fa=a.id,Ya=a.overflow,$s=t}var Cn=null,Yt=null,jt=!1,Gs=null,ka=!1,up=Error(o(519));function Fs(t){var a=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(wa(a,t)),up}function Nv(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[Rt]=t,a[gn]=u,i){case"dialog":ht("cancel",a),ht("close",a);break;case"iframe":case"object":case"embed":ht("load",a);break;case"video":case"audio":for(i=0;i<_i.length;i++)ht(_i[i],a);break;case"source":ht("error",a);break;case"img":case"image":case"link":ht("error",a),ht("load",a);break;case"details":ht("toggle",a);break;case"input":ht("invalid",a),Hb(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":ht("invalid",a);break;case"textarea":ht("invalid",a),qb(a,u.value,u.defaultValue,u.children)}i=u.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||u.suppressHydrationWarning===!0||G0(a.textContent,i)?(u.popover!=null&&(ht("beforetoggle",a),ht("toggle",a)),u.onScroll!=null&&ht("scroll",a),u.onScrollEnd!=null&&ht("scrollend",a),u.onClick!=null&&(a.onclick=ds),a=!0):a=!1,a||Fs(t,!0)}function Rv(t){for(Cn=t.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:ka=!1;return;case 27:case 3:ka=!0;return;default:Cn=Cn.return}}function Bo(t){if(t!==Cn)return!1;if(!jt)return Rv(t),jt=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||Nm(t.type,t.memoizedProps)),i=!i),i&&Yt&&Fs(t),Rv(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=e1(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=e1(t)}else a===27?(a=Yt,or(t.type)?(t=Om,Om=null,Yt=t):Yt=a):Yt=Cn?Na(t.stateNode.nextSibling):null;return!0}function Hr(){Yt=Cn=null,jt=!1}function dp(){var t=Gs;return t!==null&&(ea===null?ea=t:ea.push.apply(ea,t),Gs=null),t}function Jl(t){Gs===null?Gs=[t]:Gs.push(t)}var fp=U(null),Vr=null,gs=null;function Ys(t,a,i){F(fp,a._currentValue),a._currentValue=i}function hs(t){t._currentValue=fp.current,K(fp)}function pp(t,a,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===i)break;t=t.return}}function mp(t,a,i,u){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var y=h.dependencies;if(y!==null){var A=h.child;y=y.firstContext;e:for(;y!==null;){var I=y;y=h;for(var Q=0;Q<a.length;Q++)if(I.context===a[Q]){y.lanes|=i,I=y.alternate,I!==null&&(I.lanes|=i),pp(y.return,i,t),u||(A=null);break e}y=I.next}}else if(h.tag===18){if(A=h.return,A===null)throw Error(o(341));A.lanes|=i,y=A.alternate,y!==null&&(y.lanes|=i),pp(A,i,t),A=null}else A=h.child;if(A!==null)A.return=h;else for(A=h;A!==null;){if(A===t){A=null;break}if(h=A.sibling,h!==null){h.return=A.return,A=h;break}A=A.return}h=A}}function Uo(t,a,i,u){t=null;for(var h=a,y=!1;h!==null;){if(!y){if((h.flags&524288)!==0)y=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var A=h.alternate;if(A===null)throw Error(o(387));if(A=A.memoizedProps,A!==null){var I=h.type;ua(h.pendingProps.value,A.value)||(t!==null?t.push(I):t=[I])}}else if(h===oe.current){if(A=h.alternate,A===null)throw Error(o(387));A.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(ki):t=[ki])}h=h.return}t!==null&&mp(a,t,i,u),a.flags|=262144}function Wc(t){for(t=t.firstContext;t!==null;){if(!ua(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function qr(t){Vr=t,gs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function kn(t){return Tv(Vr,t)}function Jc(t,a){return Vr===null&&qr(t),Tv(t,a)}function Tv(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},gs===null){if(t===null)throw Error(o(308));gs=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else gs=gs.next=a;return i}var gE=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(i,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(i){return i()})}},hE=e.unstable_scheduleCallback,xE=e.unstable_NormalPriority,hn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gp(){return{controller:new gE,data:new Map,refCount:0}}function ei(t){t.refCount--,t.refCount===0&&hE(xE,function(){t.controller.abort()})}var ti=null,hp=0,Ho=0,Vo=null;function bE(t,a){if(ti===null){var i=ti=[];hp=0,Ho=vm(),Vo={status:"pending",value:void 0,then:function(u){i.push(u)}}}return hp++,a.then(Av,Av),a}function Av(){if(--hp===0&&ti!==null){Vo!==null&&(Vo.status="fulfilled");var t=ti;ti=null,Ho=0,Vo=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function vE(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(h){i.push(h)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var h=0;h<i.length;h++)(0,i[h])(a)},function(h){for(u.status="rejected",u.reason=h,h=0;h<i.length;h++)(0,i[h])(void 0)}),u}var Mv=V.S;V.S=function(t,a){g0=ye(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&bE(t,a),Mv!==null&&Mv(t,a)};var $r=U(null);function xp(){var t=$r.current;return t!==null?t:qt.pooledCache}function eu(t,a){a===null?F($r,$r.current):F($r,a.pool)}function Ov(){var t=xp();return t===null?null:{parent:hn._currentValue,pool:t}}var qo=Error(o(460)),bp=Error(o(474)),tu=Error(o(542)),nu={then:function(){}};function zv(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Dv(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(ds,ds),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Pv(t),t;default:if(typeof a.status=="string")a.then(ds,ds);else{if(t=qt,t!==null&&100<t.shellSuspendCounter)throw Error(o(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var h=a;h.status="fulfilled",h.value=u}},function(u){if(a.status==="pending"){var h=a;h.status="rejected",h.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Pv(t),t}throw Fr=a,qo}}function Gr(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Fr=i,qo):i}}var Fr=null;function Lv(){if(Fr===null)throw Error(o(459));var t=Fr;return Fr=null,t}function Pv(t){if(t===qo||t===tu)throw Error(o(483))}var $o=null,ni=0;function au(t){var a=ni;return ni+=1,$o===null&&($o=[]),Dv($o,t,a)}function ai(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function su(t,a){throw a.$$typeof===v?Error(o(525)):(t=Object.prototype.toString.call(a),Error(o(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Iv(t){function a(te,W){if(t){var ne=te.deletions;ne===null?(te.deletions=[W],te.flags|=16):ne.push(W)}}function i(te,W){if(!t)return null;for(;W!==null;)a(te,W),W=W.sibling;return null}function u(te){for(var W=new Map;te!==null;)te.key!==null?W.set(te.key,te):W.set(te.index,te),te=te.sibling;return W}function h(te,W){return te=ps(te,W),te.index=0,te.sibling=null,te}function y(te,W,ne){return te.index=ne,t?(ne=te.alternate,ne!==null?(ne=ne.index,ne<W?(te.flags|=67108866,W):ne):(te.flags|=67108866,W)):(te.flags|=1048576,W)}function A(te){return t&&te.alternate===null&&(te.flags|=67108866),te}function I(te,W,ne,he){return W===null||W.tag!==6?(W=op(ne,te.mode,he),W.return=te,W):(W=h(W,ne),W.return=te,W)}function Q(te,W,ne,he){var Ke=ne.type;return Ke===j?fe(te,W,ne.props.children,he,ne.key):W!==null&&(W.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===P&&Gr(Ke)===W.type)?(W=h(W,ne.props),ai(W,ne),W.return=te,W):(W=Qc(ne.type,ne.key,ne.props,null,te.mode,he),ai(W,ne),W.return=te,W)}function ae(te,W,ne,he){return W===null||W.tag!==4||W.stateNode.containerInfo!==ne.containerInfo||W.stateNode.implementation!==ne.implementation?(W=lp(ne,te.mode,he),W.return=te,W):(W=h(W,ne.children||[]),W.return=te,W)}function fe(te,W,ne,he,Ke){return W===null||W.tag!==7?(W=Ur(ne,te.mode,he,Ke),W.return=te,W):(W=h(W,ne),W.return=te,W)}function xe(te,W,ne){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=op(""+W,te.mode,ne),W.return=te,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return ne=Qc(W.type,W.key,W.props,null,te.mode,ne),ai(ne,W),ne.return=te,ne;case C:return W=lp(W,te.mode,ne),W.return=te,W;case P:return W=Gr(W),xe(te,W,ne)}if(Y(W)||z(W))return W=Ur(W,te.mode,ne,null),W.return=te,W;if(typeof W.then=="function")return xe(te,au(W),ne);if(W.$$typeof===R)return xe(te,Jc(te,W),ne);su(te,W)}return null}function se(te,W,ne,he){var Ke=W!==null?W.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ke!==null?null:I(te,W,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return ne.key===Ke?Q(te,W,ne,he):null;case C:return ne.key===Ke?ae(te,W,ne,he):null;case P:return ne=Gr(ne),se(te,W,ne,he)}if(Y(ne)||z(ne))return Ke!==null?null:fe(te,W,ne,he,null);if(typeof ne.then=="function")return se(te,W,au(ne),he);if(ne.$$typeof===R)return se(te,W,Jc(te,ne),he);su(te,ne)}return null}function ue(te,W,ne,he,Ke){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return te=te.get(ne)||null,I(W,te,""+he,Ke);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case S:return te=te.get(he.key===null?ne:he.key)||null,Q(W,te,he,Ke);case C:return te=te.get(he.key===null?ne:he.key)||null,ae(W,te,he,Ke);case P:return he=Gr(he),ue(te,W,ne,he,Ke)}if(Y(he)||z(he))return te=te.get(ne)||null,fe(W,te,he,Ke,null);if(typeof he.then=="function")return ue(te,W,ne,au(he),Ke);if(he.$$typeof===R)return ue(te,W,ne,Jc(W,he),Ke);su(W,he)}return null}function He(te,W,ne,he){for(var Ke=null,Ct=null,qe=W,ut=W=0,bt=null;qe!==null&&ut<ne.length;ut++){qe.index>ut?(bt=qe,qe=null):bt=qe.sibling;var kt=se(te,qe,ne[ut],he);if(kt===null){qe===null&&(qe=bt);break}t&&qe&&kt.alternate===null&&a(te,qe),W=y(kt,W,ut),Ct===null?Ke=kt:Ct.sibling=kt,Ct=kt,qe=bt}if(ut===ne.length)return i(te,qe),jt&&ms(te,ut),Ke;if(qe===null){for(;ut<ne.length;ut++)qe=xe(te,ne[ut],he),qe!==null&&(W=y(qe,W,ut),Ct===null?Ke=qe:Ct.sibling=qe,Ct=qe);return jt&&ms(te,ut),Ke}for(qe=u(qe);ut<ne.length;ut++)bt=ue(qe,te,ut,ne[ut],he),bt!==null&&(t&&bt.alternate!==null&&qe.delete(bt.key===null?ut:bt.key),W=y(bt,W,ut),Ct===null?Ke=bt:Ct.sibling=bt,Ct=bt);return t&&qe.forEach(function(dr){return a(te,dr)}),jt&&ms(te,ut),Ke}function et(te,W,ne,he){if(ne==null)throw Error(o(151));for(var Ke=null,Ct=null,qe=W,ut=W=0,bt=null,kt=ne.next();qe!==null&&!kt.done;ut++,kt=ne.next()){qe.index>ut?(bt=qe,qe=null):bt=qe.sibling;var dr=se(te,qe,kt.value,he);if(dr===null){qe===null&&(qe=bt);break}t&&qe&&dr.alternate===null&&a(te,qe),W=y(dr,W,ut),Ct===null?Ke=dr:Ct.sibling=dr,Ct=dr,qe=bt}if(kt.done)return i(te,qe),jt&&ms(te,ut),Ke;if(qe===null){for(;!kt.done;ut++,kt=ne.next())kt=xe(te,kt.value,he),kt!==null&&(W=y(kt,W,ut),Ct===null?Ke=kt:Ct.sibling=kt,Ct=kt);return jt&&ms(te,ut),Ke}for(qe=u(qe);!kt.done;ut++,kt=ne.next())kt=ue(qe,te,ut,kt.value,he),kt!==null&&(t&&kt.alternate!==null&&qe.delete(kt.key===null?ut:kt.key),W=y(kt,W,ut),Ct===null?Ke=kt:Ct.sibling=kt,Ct=kt);return t&&qe.forEach(function(TN){return a(te,TN)}),jt&&ms(te,ut),Ke}function It(te,W,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===j&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:e:{for(var Ke=ne.key;W!==null;){if(W.key===Ke){if(Ke=ne.type,Ke===j){if(W.tag===7){i(te,W.sibling),he=h(W,ne.props.children),he.return=te,te=he;break e}}else if(W.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===P&&Gr(Ke)===W.type){i(te,W.sibling),he=h(W,ne.props),ai(he,ne),he.return=te,te=he;break e}i(te,W);break}else a(te,W);W=W.sibling}ne.type===j?(he=Ur(ne.props.children,te.mode,he,ne.key),he.return=te,te=he):(he=Qc(ne.type,ne.key,ne.props,null,te.mode,he),ai(he,ne),he.return=te,te=he)}return A(te);case C:e:{for(Ke=ne.key;W!==null;){if(W.key===Ke)if(W.tag===4&&W.stateNode.containerInfo===ne.containerInfo&&W.stateNode.implementation===ne.implementation){i(te,W.sibling),he=h(W,ne.children||[]),he.return=te,te=he;break e}else{i(te,W);break}else a(te,W);W=W.sibling}he=lp(ne,te.mode,he),he.return=te,te=he}return A(te);case P:return ne=Gr(ne),It(te,W,ne,he)}if(Y(ne))return He(te,W,ne,he);if(z(ne)){if(Ke=z(ne),typeof Ke!="function")throw Error(o(150));return ne=Ke.call(ne),et(te,W,ne,he)}if(typeof ne.then=="function")return It(te,W,au(ne),he);if(ne.$$typeof===R)return It(te,W,Jc(te,ne),he);su(te,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,W!==null&&W.tag===6?(i(te,W.sibling),he=h(W,ne),he.return=te,te=he):(i(te,W),he=op(ne,te.mode,he),he.return=te,te=he),A(te)):i(te,W)}return function(te,W,ne,he){try{ni=0;var Ke=It(te,W,ne,he);return $o=null,Ke}catch(qe){if(qe===qo||qe===tu)throw qe;var Ct=da(29,qe,null,te.mode);return Ct.lanes=he,Ct.return=te,Ct}finally{}}}var Yr=Iv(!0),Bv=Iv(!1),Xs=!1;function vp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yp(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ks(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Qs(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Et&2)!==0){var h=u.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),u.pending=a,a=Kc(t),jv(t,null,i),a}return Xc(t,u,a,i),Kc(t)}function si(t,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ca(t,i)}}function _p(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var h=null,y=null;if(i=i.firstBaseUpdate,i!==null){do{var A={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};y===null?h=y=A:y=y.next=A,i=i.next}while(i!==null);y===null?h=y=a:y=y.next=a}else h=y=a;i={baseState:u.baseState,firstBaseUpdate:h,lastBaseUpdate:y,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=a:t.next=a,i.lastBaseUpdate=a}var jp=!1;function ri(){if(jp){var t=Vo;if(t!==null)throw t}}function oi(t,a,i,u){jp=!1;var h=t.updateQueue;Xs=!1;var y=h.firstBaseUpdate,A=h.lastBaseUpdate,I=h.shared.pending;if(I!==null){h.shared.pending=null;var Q=I,ae=Q.next;Q.next=null,A===null?y=ae:A.next=ae,A=Q;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,I=fe.lastBaseUpdate,I!==A&&(I===null?fe.firstBaseUpdate=ae:I.next=ae,fe.lastBaseUpdate=Q))}if(y!==null){var xe=h.baseState;A=0,fe=ae=Q=null,I=y;do{var se=I.lane&-536870913,ue=se!==I.lane;if(ue?(xt&se)===se:(u&se)===se){se!==0&&se===Ho&&(jp=!0),fe!==null&&(fe=fe.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var He=t,et=I;se=a;var It=i;switch(et.tag){case 1:if(He=et.payload,typeof He=="function"){xe=He.call(It,xe,se);break e}xe=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=et.payload,se=typeof He=="function"?He.call(It,xe,se):He,se==null)break e;xe=b({},xe,se);break e;case 2:Xs=!0}}se=I.callback,se!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=h.callbacks,ue===null?h.callbacks=[se]:ue.push(se))}else ue={lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},fe===null?(ae=fe=ue,Q=xe):fe=fe.next=ue,A|=se;if(I=I.next,I===null){if(I=h.shared.pending,I===null)break;ue=I,I=ue.next,ue.next=null,h.lastBaseUpdate=ue,h.shared.pending=null}}while(!0);fe===null&&(Q=xe),h.baseState=Q,h.firstBaseUpdate=ae,h.lastBaseUpdate=fe,y===null&&(h.shared.lanes=0),tr|=A,t.lanes=A,t.memoizedState=xe}}function Uv(t,a){if(typeof t!="function")throw Error(o(191,t));t.call(a)}function Hv(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)Uv(i[t],a)}var Go=U(null),ru=U(0);function Vv(t,a){t=Cs,F(ru,t),F(Go,a),Cs=t|a.baseLanes}function wp(){F(ru,Cs),F(Go,Go.current)}function Sp(){Cs=ru.current,K(Go),K(ru)}var fa=U(null),Ea=null;function Zs(t){var a=t.alternate;F(fn,fn.current&1),F(fa,t),Ea===null&&(a===null||Go.current!==null||a.memoizedState!==null)&&(Ea=t)}function Cp(t){F(fn,fn.current),F(fa,t),Ea===null&&(Ea=t)}function qv(t){t.tag===22?(F(fn,fn.current),F(fa,t),Ea===null&&(Ea=t)):Ws()}function Ws(){F(fn,fn.current),F(fa,fa.current)}function pa(t){K(fa),Ea===t&&(Ea=null),K(fn)}var fn=U(0);function ou(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Am(i)||Mm(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var xs=0,ot=null,Lt=null,xn=null,lu=!1,Fo=!1,Xr=!1,iu=0,li=0,Yo=null,yE=0;function rn(){throw Error(o(321))}function kp(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!ua(t[i],a[i]))return!1;return!0}function Ep(t,a,i,u,h,y){return xs=y,ot=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,V.H=t===null||t.memoizedState===null?ky:Vp,Xr=!1,y=i(u,h),Xr=!1,Fo&&(y=Gv(a,i,u,h)),$v(t),y}function $v(t){V.H=ui;var a=Lt!==null&&Lt.next!==null;if(xs=0,xn=Lt=ot=null,lu=!1,li=0,Yo=null,a)throw Error(o(300));t===null||bn||(t=t.dependencies,t!==null&&Wc(t)&&(bn=!0))}function Gv(t,a,i,u){ot=t;var h=0;do{if(Fo&&(Yo=null),li=0,Fo=!1,25<=h)throw Error(o(301));if(h+=1,xn=Lt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}V.H=Ey,y=a(i,u)}while(Fo);return y}function _E(){var t=V.H,a=t.useState()[0];return a=typeof a.then=="function"?ii(a):a,t=t.useState()[0],(Lt!==null?Lt.memoizedState:null)!==t&&(ot.flags|=1024),a}function Np(){var t=iu!==0;return iu=0,t}function Rp(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function Tp(t){if(lu){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}lu=!1}xs=0,xn=Lt=ot=null,Fo=!1,li=iu=0,Yo=null}function qn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xn===null?ot.memoizedState=xn=t:xn=xn.next=t,xn}function pn(){if(Lt===null){var t=ot.alternate;t=t!==null?t.memoizedState:null}else t=Lt.next;var a=xn===null?ot.memoizedState:xn.next;if(a!==null)xn=a,Lt=t;else{if(t===null)throw ot.alternate===null?Error(o(467)):Error(o(310));Lt=t,t={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},xn===null?ot.memoizedState=xn=t:xn=xn.next=t}return xn}function cu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ii(t){var a=li;return li+=1,Yo===null&&(Yo=[]),t=Dv(Yo,t,a),a=ot,(xn===null?a.memoizedState:xn.next)===null&&(a=a.alternate,V.H=a===null||a.memoizedState===null?ky:Vp),t}function uu(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ii(t);if(t.$$typeof===R)return kn(t)}throw Error(o(438,String(t)))}function Ap(t){var a=null,i=ot.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var u=ot.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(h){return h.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=cu(),ot.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(t),u=0;u<t;u++)i[u]=L;return a.index++,i}function bs(t,a){return typeof a=="function"?a(t):a}function du(t){var a=pn();return Mp(a,Lt,t)}function Mp(t,a,i){var u=t.queue;if(u===null)throw Error(o(311));u.lastRenderedReducer=i;var h=t.baseQueue,y=u.pending;if(y!==null){if(h!==null){var A=h.next;h.next=y.next,y.next=A}a.baseQueue=h=y,u.pending=null}if(y=t.baseState,h===null)t.memoizedState=y;else{a=h.next;var I=A=null,Q=null,ae=a,fe=!1;do{var xe=ae.lane&-536870913;if(xe!==ae.lane?(xt&xe)===xe:(xs&xe)===xe){var se=ae.revertLane;if(se===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),xe===Ho&&(fe=!0);else if((xs&se)===se){ae=ae.next,se===Ho&&(fe=!0);continue}else xe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(I=Q=xe,A=y):Q=Q.next=xe,ot.lanes|=se,tr|=se;xe=ae.action,Xr&&i(y,xe),y=ae.hasEagerState?ae.eagerState:i(y,xe)}else se={lane:xe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(I=Q=se,A=y):Q=Q.next=se,ot.lanes|=xe,tr|=xe;ae=ae.next}while(ae!==null&&ae!==a);if(Q===null?A=y:Q.next=I,!ua(y,t.memoizedState)&&(bn=!0,fe&&(i=Vo,i!==null)))throw i;t.memoizedState=y,t.baseState=A,t.baseQueue=Q,u.lastRenderedState=y}return h===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Op(t){var a=pn(),i=a.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=t;var u=i.dispatch,h=i.pending,y=a.memoizedState;if(h!==null){i.pending=null;var A=h=h.next;do y=t(y,A.action),A=A.next;while(A!==h);ua(y,a.memoizedState)||(bn=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),i.lastRenderedState=y}return[y,u]}function Fv(t,a,i){var u=ot,h=pn(),y=jt;if(y){if(i===void 0)throw Error(o(407));i=i()}else i=a();var A=!ua((Lt||h).memoizedState,i);if(A&&(h.memoizedState=i,bn=!0),h=h.queue,Lp(Kv.bind(null,u,h,t),[t]),h.getSnapshot!==a||A||xn!==null&&xn.memoizedState.tag&1){if(u.flags|=2048,Xo(9,{destroy:void 0},Xv.bind(null,u,h,i,a),null),qt===null)throw Error(o(349));y||(xs&127)!==0||Yv(u,a,i)}return i}function Yv(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=ot.updateQueue,a===null?(a=cu(),ot.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function Xv(t,a,i,u){a.value=i,a.getSnapshot=u,Qv(a)&&Zv(t)}function Kv(t,a,i){return i(function(){Qv(a)&&Zv(t)})}function Qv(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!ua(t,i)}catch{return!0}}function Zv(t){var a=Br(t,2);a!==null&&ta(a,t,2)}function zp(t){var a=qn();if(typeof t=="function"){var i=t;if(t=i(),Xr){Ve(!0);try{i()}finally{Ve(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:t},a}function Wv(t,a,i,u){return t.baseState=i,Mp(t,Lt,typeof u=="function"?u:bs)}function jE(t,a,i,u,h){if(mu(t))throw Error(o(485));if(t=a.action,t!==null){var y={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){y.listeners.push(A)}};V.T!==null?i(!0):y.isTransition=!1,u(y),i=a.pending,i===null?(y.next=a.pending=y,Jv(a,y)):(y.next=i.next,a.pending=i.next=y)}}function Jv(t,a){var i=a.action,u=a.payload,h=t.state;if(a.isTransition){var y=V.T,A={};V.T=A;try{var I=i(h,u),Q=V.S;Q!==null&&Q(A,I),ey(t,a,I)}catch(ae){Dp(t,a,ae)}finally{y!==null&&A.types!==null&&(y.types=A.types),V.T=y}}else try{y=i(h,u),ey(t,a,y)}catch(ae){Dp(t,a,ae)}}function ey(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){ty(t,a,u)},function(u){return Dp(t,a,u)}):ty(t,a,i)}function ty(t,a,i){a.status="fulfilled",a.value=i,ny(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,Jv(t,i)))}function Dp(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,ny(a),a=a.next;while(a!==u)}t.action=null}function ny(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function ay(t,a){return a}function sy(t,a){if(jt){var i=qt.formState;if(i!==null){e:{var u=ot;if(jt){if(Yt){t:{for(var h=Yt,y=ka;h.nodeType!==8;){if(!y){h=null;break t}if(h=Na(h.nextSibling),h===null){h=null;break t}}y=h.data,h=y==="F!"||y==="F"?h:null}if(h){Yt=Na(h.nextSibling),u=h.data==="F!";break e}}Fs(u)}u=!1}u&&(a=i[0])}}return i=qn(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ay,lastRenderedState:a},i.queue=u,i=wy.bind(null,ot,u),u.dispatch=i,u=zp(!1),y=Hp.bind(null,ot,!1,u.queue),u=qn(),h={state:a,dispatch:null,action:t,pending:null},u.queue=h,i=jE.bind(null,ot,h,y,i),h.dispatch=i,u.memoizedState=t,[a,i,!1]}function ry(t){var a=pn();return oy(a,Lt,t)}function oy(t,a,i){if(a=Mp(t,a,ay)[0],t=du(bs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=ii(a)}catch(A){throw A===qo?tu:A}else u=a;a=pn();var h=a.queue,y=h.dispatch;return i!==a.memoizedState&&(ot.flags|=2048,Xo(9,{destroy:void 0},wE.bind(null,h,i),null)),[u,y,t]}function wE(t,a){t.action=a}function ly(t){var a=pn(),i=Lt;if(i!==null)return oy(a,i,t);pn(),a=a.memoizedState,i=pn();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function Xo(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=ot.updateQueue,a===null&&(a=cu(),ot.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,a.lastEffect=t),t}function iy(){return pn().memoizedState}function fu(t,a,i,u){var h=qn();ot.flags|=t,h.memoizedState=Xo(1|a,{destroy:void 0},i,u===void 0?null:u)}function pu(t,a,i,u){var h=pn();u=u===void 0?null:u;var y=h.memoizedState.inst;Lt!==null&&u!==null&&kp(u,Lt.memoizedState.deps)?h.memoizedState=Xo(a,y,i,u):(ot.flags|=t,h.memoizedState=Xo(1|a,y,i,u))}function cy(t,a){fu(8390656,8,t,a)}function Lp(t,a){pu(2048,8,t,a)}function SE(t){ot.flags|=4;var a=ot.updateQueue;if(a===null)a=cu(),ot.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function uy(t){var a=pn().memoizedState;return SE({ref:a,nextImpl:t}),function(){if((Et&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}function dy(t,a){return pu(4,2,t,a)}function fy(t,a){return pu(4,4,t,a)}function py(t,a){if(typeof a=="function"){t=t();var i=a(t);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function my(t,a,i){i=i!=null?i.concat([t]):null,pu(4,4,py.bind(null,a,t),i)}function Pp(){}function gy(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&kp(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function hy(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&kp(a,u[1]))return u[0];if(u=t(),Xr){Ve(!0);try{t()}finally{Ve(!1)}}return i.memoizedState=[u,a],u}function Ip(t,a,i){return i===void 0||(xs&1073741824)!==0&&(xt&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=x0(),ot.lanes|=t,tr|=t,i)}function xy(t,a,i,u){return ua(i,a)?i:Go.current!==null?(t=Ip(t,i,u),ua(t,a)||(bn=!0),t):(xs&42)===0||(xs&1073741824)!==0&&(xt&261930)===0?(bn=!0,t.memoizedState=i):(t=x0(),ot.lanes|=t,tr|=t,a)}function by(t,a,i,u,h){var y=$.p;$.p=y!==0&&8>y?y:8;var A=V.T,I={};V.T=I,Hp(t,!1,a,i);try{var Q=h(),ae=V.S;if(ae!==null&&ae(I,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=vE(Q,u);ci(t,a,fe,ha(t))}else ci(t,a,u,ha(t))}catch(xe){ci(t,a,{then:function(){},status:"rejected",reason:xe},ha())}finally{$.p=y,A!==null&&I.types!==null&&(A.types=I.types),V.T=A}}function CE(){}function Bp(t,a,i,u){if(t.tag!==5)throw Error(o(476));var h=vy(t).queue;by(t,h,a,Z,i===null?CE:function(){return yy(t),i(u)})}function vy(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:Z},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bs,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function yy(t){var a=vy(t);a.next===null&&(a=t.alternate.memoizedState),ci(t,a.next.queue,{},ha())}function Up(){return kn(ki)}function _y(){return pn().memoizedState}function jy(){return pn().memoizedState}function kE(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=ha();t=Ks(i);var u=Qs(a,t,i);u!==null&&(ta(u,a,i),si(u,a,i)),a={cache:gp()},t.payload=a;return}a=a.return}}function EE(t,a,i){var u=ha();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},mu(t)?Sy(a,i):(i=sp(t,a,i,u),i!==null&&(ta(i,t,u),Cy(i,a,u)))}function wy(t,a,i){var u=ha();ci(t,a,i,u)}function ci(t,a,i,u){var h={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(mu(t))Sy(a,h);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var A=a.lastRenderedState,I=y(A,i);if(h.hasEagerState=!0,h.eagerState=I,ua(I,A))return Xc(t,a,h,0),qt===null&&Yc(),!1}catch{}finally{}if(i=sp(t,a,h,u),i!==null)return ta(i,t,u),Cy(i,a,u),!0}return!1}function Hp(t,a,i,u){if(u={lane:2,revertLane:vm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},mu(t)){if(a)throw Error(o(479))}else a=sp(t,i,u,2),a!==null&&ta(a,t,2)}function mu(t){var a=t.alternate;return t===ot||a!==null&&a===ot}function Sy(t,a){Fo=lu=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function Cy(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ca(t,i)}}var ui={readContext:kn,use:uu,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useLayoutEffect:rn,useInsertionEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useSyncExternalStore:rn,useId:rn,useHostTransitionStatus:rn,useFormState:rn,useActionState:rn,useOptimistic:rn,useMemoCache:rn,useCacheRefresh:rn};ui.useEffectEvent=rn;var ky={readContext:kn,use:uu,useCallback:function(t,a){return qn().memoizedState=[t,a===void 0?null:a],t},useContext:kn,useEffect:cy,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,fu(4194308,4,py.bind(null,a,t),i)},useLayoutEffect:function(t,a){return fu(4194308,4,t,a)},useInsertionEffect:function(t,a){fu(4,2,t,a)},useMemo:function(t,a){var i=qn();a=a===void 0?null:a;var u=t();if(Xr){Ve(!0);try{t()}finally{Ve(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=qn();if(i!==void 0){var h=i(a);if(Xr){Ve(!0);try{i(a)}finally{Ve(!1)}}}else h=a;return u.memoizedState=u.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},u.queue=t,t=t.dispatch=EE.bind(null,ot,t),[u.memoizedState,t]},useRef:function(t){var a=qn();return t={current:t},a.memoizedState=t},useState:function(t){t=zp(t);var a=t.queue,i=wy.bind(null,ot,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:Pp,useDeferredValue:function(t,a){var i=qn();return Ip(i,t,a)},useTransition:function(){var t=zp(!1);return t=by.bind(null,ot,t.queue,!0,!1),qn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=ot,h=qn();if(jt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=a(),qt===null)throw Error(o(349));(xt&127)!==0||Yv(u,a,i)}h.memoizedState=i;var y={value:i,getSnapshot:a};return h.queue=y,cy(Kv.bind(null,u,y,t),[t]),u.flags|=2048,Xo(9,{destroy:void 0},Xv.bind(null,u,y,i,a),null),i},useId:function(){var t=qn(),a=qt.identifierPrefix;if(jt){var i=Ya,u=Fa;i=(u&~(1<<32-at(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=iu++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=yE++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Up,useFormState:sy,useActionState:sy,useOptimistic:function(t){var a=qn();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=Hp.bind(null,ot,!0,i),i.dispatch=a,[t,a]},useMemoCache:Ap,useCacheRefresh:function(){return qn().memoizedState=kE.bind(null,ot)},useEffectEvent:function(t){var a=qn(),i={impl:t};return a.memoizedState=i,function(){if((Et&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Vp={readContext:kn,use:uu,useCallback:gy,useContext:kn,useEffect:Lp,useImperativeHandle:my,useInsertionEffect:dy,useLayoutEffect:fy,useMemo:hy,useReducer:du,useRef:iy,useState:function(){return du(bs)},useDebugValue:Pp,useDeferredValue:function(t,a){var i=pn();return xy(i,Lt.memoizedState,t,a)},useTransition:function(){var t=du(bs)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ii(t),a]},useSyncExternalStore:Fv,useId:_y,useHostTransitionStatus:Up,useFormState:ry,useActionState:ry,useOptimistic:function(t,a){var i=pn();return Wv(i,Lt,t,a)},useMemoCache:Ap,useCacheRefresh:jy};Vp.useEffectEvent=uy;var Ey={readContext:kn,use:uu,useCallback:gy,useContext:kn,useEffect:Lp,useImperativeHandle:my,useInsertionEffect:dy,useLayoutEffect:fy,useMemo:hy,useReducer:Op,useRef:iy,useState:function(){return Op(bs)},useDebugValue:Pp,useDeferredValue:function(t,a){var i=pn();return Lt===null?Ip(i,t,a):xy(i,Lt.memoizedState,t,a)},useTransition:function(){var t=Op(bs)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ii(t),a]},useSyncExternalStore:Fv,useId:_y,useHostTransitionStatus:Up,useFormState:ly,useActionState:ly,useOptimistic:function(t,a){var i=pn();return Lt!==null?Wv(i,Lt,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:Ap,useCacheRefresh:jy};Ey.useEffectEvent=uy;function qp(t,a,i,u){a=t.memoizedState,i=i(u,a),i=i==null?a:b({},a,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var $p={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=ha(),h=Ks(u);h.payload=a,i!=null&&(h.callback=i),a=Qs(t,h,u),a!==null&&(ta(a,t,u),si(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=ha(),h=Ks(u);h.tag=1,h.payload=a,i!=null&&(h.callback=i),a=Qs(t,h,u),a!==null&&(ta(a,t,u),si(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=ha(),u=Ks(i);u.tag=2,a!=null&&(u.callback=a),a=Qs(t,u,i),a!==null&&(ta(a,t,i),si(a,t,i))}};function Ny(t,a,i,u,h,y,A){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,y,A):a.prototype&&a.prototype.isPureReactComponent?!Ql(i,u)||!Ql(h,y):!0}function Ry(t,a,i,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,u),a.state!==t&&$p.enqueueReplaceState(a,a.state,null)}function Kr(t,a){var i=a;if("ref"in a){i={};for(var u in a)u!=="ref"&&(i[u]=a[u])}if(t=t.defaultProps){i===a&&(i=b({},i));for(var h in t)i[h]===void 0&&(i[h]=t[h])}return i}function Ty(t){Fc(t)}function Ay(t){console.error(t)}function My(t){Fc(t)}function gu(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function Oy(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Gp(t,a,i){return i=Ks(i),i.tag=3,i.payload={element:null},i.callback=function(){gu(t,a)},i}function zy(t){return t=Ks(t),t.tag=3,t}function Dy(t,a,i,u){var h=i.type.getDerivedStateFromError;if(typeof h=="function"){var y=u.value;t.payload=function(){return h(y)},t.callback=function(){Oy(a,i,u)}}var A=i.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(t.callback=function(){Oy(a,i,u),typeof h!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var I=u.stack;this.componentDidCatch(u.value,{componentStack:I!==null?I:""})})}function NE(t,a,i,u,h){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&Uo(a,i,h,!0),i=fa.current,i!==null){switch(i.tag){case 31:case 13:return Ea===null?Eu():i.alternate===null&&on===0&&(on=3),i.flags&=-257,i.flags|=65536,i.lanes=h,u===nu?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),hm(t,u,h)),!1;case 22:return i.flags|=65536,u===nu?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([u]):i.add(u)),hm(t,u,h)),!1}throw Error(o(435,i.tag))}return hm(t,u,h),Eu(),!1}if(jt)return a=fa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=h,u!==up&&(t=Error(o(422),{cause:u}),Jl(wa(t,i)))):(u!==up&&(a=Error(o(423),{cause:u}),Jl(wa(a,i))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,u=wa(u,i),h=Gp(t.stateNode,u,h),_p(t,h),on!==4&&(on=2)),!1;var y=Error(o(520),{cause:u});if(y=wa(y,i),bi===null?bi=[y]:bi.push(y),on!==4&&(on=2),a===null)return!0;u=wa(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=h&-h,i.lanes|=t,t=Gp(i.stateNode,u,t),_p(i,t),!1;case 1:if(a=i.type,y=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(nr===null||!nr.has(y))))return i.flags|=65536,h&=-h,i.lanes|=h,h=zy(h),Dy(h,t,i,u),_p(i,h),!1}i=i.return}while(i!==null);return!1}var Fp=Error(o(461)),bn=!1;function En(t,a,i,u){a.child=t===null?Bv(a,null,i,u):Yr(a,t.child,i,u)}function Ly(t,a,i,u,h){i=i.render;var y=a.ref;if("ref"in u){var A={};for(var I in u)I!=="ref"&&(A[I]=u[I])}else A=u;return qr(a),u=Ep(t,a,i,A,y,h),I=Np(),t!==null&&!bn?(Rp(t,a,h),vs(t,a,h)):(jt&&I&&ip(a),a.flags|=1,En(t,a,u,h),a.child)}function Py(t,a,i,u,h){if(t===null){var y=i.type;return typeof y=="function"&&!rp(y)&&y.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=y,Iy(t,a,y,u,h)):(t=Qc(i.type,null,u,a,a.mode,h),t.ref=a.ref,t.return=a,a.child=t)}if(y=t.child,!em(t,h)){var A=y.memoizedProps;if(i=i.compare,i=i!==null?i:Ql,i(A,u)&&t.ref===a.ref)return vs(t,a,h)}return a.flags|=1,t=ps(y,u),t.ref=a.ref,t.return=a,a.child=t}function Iy(t,a,i,u,h){if(t!==null){var y=t.memoizedProps;if(Ql(y,u)&&t.ref===a.ref)if(bn=!1,a.pendingProps=u=y,em(t,h))(t.flags&131072)!==0&&(bn=!0);else return a.lanes=t.lanes,vs(t,a,h)}return Yp(t,a,i,u,h)}function By(t,a,i,u){var h=u.children,y=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|i:i,t!==null){for(u=a.child=t.child,h=0;u!==null;)h=h|u.lanes|u.childLanes,u=u.sibling;u=h&~y}else u=0,a.child=null;return Uy(t,a,y,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&eu(a,y!==null?y.cachePool:null),y!==null?Vv(a,y):wp(),qv(a);else return u=a.lanes=536870912,Uy(t,a,y!==null?y.baseLanes|i:i,i,u)}else y!==null?(eu(a,y.cachePool),Vv(a,y),Ws(),a.memoizedState=null):(t!==null&&eu(a,null),wp(),Ws());return En(t,a,h,i),a.child}function di(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Uy(t,a,i,u,h){var y=xp();return y=y===null?null:{parent:hn._currentValue,pool:y},a.memoizedState={baseLanes:i,cachePool:y},t!==null&&eu(a,null),wp(),qv(a),t!==null&&Uo(t,a,u,!0),a.childLanes=h,null}function hu(t,a){return a=bu({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function Hy(t,a,i){return Yr(a,t.child,null,i),t=hu(a,a.pendingProps),t.flags|=2,pa(a),a.memoizedState=null,t}function RE(t,a,i){var u=a.pendingProps,h=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(jt){if(u.mode==="hidden")return t=hu(a,u),a.lanes=536870912,di(null,t);if(Cp(a),(t=Yt)?(t=J0(t,ka),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:$s!==null?{id:Fa,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},i=Sv(t),i.return=a,a.child=i,Cn=a,Yt=null)):t=null,t===null)throw Fs(a);return a.lanes=536870912,null}return hu(a,u)}var y=t.memoizedState;if(y!==null){var A=y.dehydrated;if(Cp(a),h)if(a.flags&256)a.flags&=-257,a=Hy(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(o(558));else if(bn||Uo(t,a,i,!1),h=(i&t.childLanes)!==0,bn||h){if(u=qt,u!==null&&(A=Pa(u,i),A!==0&&A!==y.retryLane))throw y.retryLane=A,Br(t,A),ta(u,t,A),Fp;Eu(),a=Hy(t,a,i)}else t=y.treeContext,Yt=Na(A.nextSibling),Cn=a,jt=!0,Gs=null,ka=!1,t!==null&&Ev(a,t),a=hu(a,u),a.flags|=4096;return a}return t=ps(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function xu(t,a){var i=a.ref;if(i===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(t===null||t.ref!==i)&&(a.flags|=4194816)}}function Yp(t,a,i,u,h){return qr(a),i=Ep(t,a,i,u,void 0,h),u=Np(),t!==null&&!bn?(Rp(t,a,h),vs(t,a,h)):(jt&&u&&ip(a),a.flags|=1,En(t,a,i,h),a.child)}function Vy(t,a,i,u,h,y){return qr(a),a.updateQueue=null,i=Gv(a,u,i,h),$v(t),u=Np(),t!==null&&!bn?(Rp(t,a,y),vs(t,a,y)):(jt&&u&&ip(a),a.flags|=1,En(t,a,i,y),a.child)}function qy(t,a,i,u,h){if(qr(a),a.stateNode===null){var y=Lo,A=i.contextType;typeof A=="object"&&A!==null&&(y=kn(A)),y=new i(u,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=$p,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=u,y.state=a.memoizedState,y.refs={},vp(a),A=i.contextType,y.context=typeof A=="object"&&A!==null?kn(A):Lo,y.state=a.memoizedState,A=i.getDerivedStateFromProps,typeof A=="function"&&(qp(a,i,A,u),y.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(A=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),A!==y.state&&$p.enqueueReplaceState(y,y.state,null),oi(a,u,y,h),ri(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){y=a.stateNode;var I=a.memoizedProps,Q=Kr(i,I);y.props=Q;var ae=y.context,fe=i.contextType;A=Lo,typeof fe=="object"&&fe!==null&&(A=kn(fe));var xe=i.getDerivedStateFromProps;fe=typeof xe=="function"||typeof y.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,fe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(I||ae!==A)&&Ry(a,y,u,A),Xs=!1;var se=a.memoizedState;y.state=se,oi(a,u,y,h),ri(),ae=a.memoizedState,I||se!==ae||Xs?(typeof xe=="function"&&(qp(a,i,xe,u),ae=a.memoizedState),(Q=Xs||Ny(a,i,Q,u,se,ae,A))?(fe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ae),y.props=u,y.state=ae,y.context=A,u=Q):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{y=a.stateNode,yp(t,a),A=a.memoizedProps,fe=Kr(i,A),y.props=fe,xe=a.pendingProps,se=y.context,ae=i.contextType,Q=Lo,typeof ae=="object"&&ae!==null&&(Q=kn(ae)),I=i.getDerivedStateFromProps,(ae=typeof I=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(A!==xe||se!==Q)&&Ry(a,y,u,Q),Xs=!1,se=a.memoizedState,y.state=se,oi(a,u,y,h),ri();var ue=a.memoizedState;A!==xe||se!==ue||Xs||t!==null&&t.dependencies!==null&&Wc(t.dependencies)?(typeof I=="function"&&(qp(a,i,I,u),ue=a.memoizedState),(fe=Xs||Ny(a,i,fe,u,se,ue,Q)||t!==null&&t.dependencies!==null&&Wc(t.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(u,ue,Q),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(u,ue,Q)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||A===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ue),y.props=u,y.state=ue,y.context=Q,u=fe):(typeof y.componentDidUpdate!="function"||A===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),u=!1)}return y=u,xu(t,a),u=(a.flags&128)!==0,y||u?(y=a.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,t!==null&&u?(a.child=Yr(a,t.child,null,h),a.child=Yr(a,null,i,h)):En(t,a,i,h),a.memoizedState=y.state,t=a.child):t=vs(t,a,h),t}function $y(t,a,i,u){return Hr(),a.flags|=256,En(t,a,i,u),a.child}var Xp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kp(t){return{baseLanes:t,cachePool:Ov()}}function Qp(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=ga),t}function Gy(t,a,i){var u=a.pendingProps,h=!1,y=(a.flags&128)!==0,A;if((A=y)||(A=t!==null&&t.memoizedState===null?!1:(fn.current&2)!==0),A&&(h=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,t===null){if(jt){if(h?Zs(a):Ws(),(t=Yt)?(t=J0(t,ka),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:$s!==null?{id:Fa,overflow:Ya}:null,retryLane:536870912,hydrationErrors:null},i=Sv(t),i.return=a,a.child=i,Cn=a,Yt=null)):t=null,t===null)throw Fs(a);return Mm(t)?a.lanes=32:a.lanes=536870912,null}var I=u.children;return u=u.fallback,h?(Ws(),h=a.mode,I=bu({mode:"hidden",children:I},h),u=Ur(u,h,i,null),I.return=a,u.return=a,I.sibling=u,a.child=I,u=a.child,u.memoizedState=Kp(i),u.childLanes=Qp(t,A,i),a.memoizedState=Xp,di(null,u)):(Zs(a),Zp(a,I))}var Q=t.memoizedState;if(Q!==null&&(I=Q.dehydrated,I!==null)){if(y)a.flags&256?(Zs(a),a.flags&=-257,a=Wp(t,a,i)):a.memoizedState!==null?(Ws(),a.child=t.child,a.flags|=128,a=null):(Ws(),I=u.fallback,h=a.mode,u=bu({mode:"visible",children:u.children},h),I=Ur(I,h,i,null),I.flags|=2,u.return=a,I.return=a,u.sibling=I,a.child=u,Yr(a,t.child,null,i),u=a.child,u.memoizedState=Kp(i),u.childLanes=Qp(t,A,i),a.memoizedState=Xp,a=di(null,u));else if(Zs(a),Mm(I)){if(A=I.nextSibling&&I.nextSibling.dataset,A)var ae=A.dgst;A=ae,u=Error(o(419)),u.stack="",u.digest=A,Jl({value:u,source:null,stack:null}),a=Wp(t,a,i)}else if(bn||Uo(t,a,i,!1),A=(i&t.childLanes)!==0,bn||A){if(A=qt,A!==null&&(u=Pa(A,i),u!==0&&u!==Q.retryLane))throw Q.retryLane=u,Br(t,u),ta(A,t,u),Fp;Am(I)||Eu(),a=Wp(t,a,i)}else Am(I)?(a.flags|=192,a.child=t.child,a=null):(t=Q.treeContext,Yt=Na(I.nextSibling),Cn=a,jt=!0,Gs=null,ka=!1,t!==null&&Ev(a,t),a=Zp(a,u.children),a.flags|=4096);return a}return h?(Ws(),I=u.fallback,h=a.mode,Q=t.child,ae=Q.sibling,u=ps(Q,{mode:"hidden",children:u.children}),u.subtreeFlags=Q.subtreeFlags&65011712,ae!==null?I=ps(ae,I):(I=Ur(I,h,i,null),I.flags|=2),I.return=a,u.return=a,u.sibling=I,a.child=u,di(null,u),u=a.child,I=t.child.memoizedState,I===null?I=Kp(i):(h=I.cachePool,h!==null?(Q=hn._currentValue,h=h.parent!==Q?{parent:Q,pool:Q}:h):h=Ov(),I={baseLanes:I.baseLanes|i,cachePool:h}),u.memoizedState=I,u.childLanes=Qp(t,A,i),a.memoizedState=Xp,di(t.child,u)):(Zs(a),i=t.child,t=i.sibling,i=ps(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(A=a.deletions,A===null?(a.deletions=[t],a.flags|=16):A.push(t)),a.child=i,a.memoizedState=null,i)}function Zp(t,a){return a=bu({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function bu(t,a){return t=da(22,t,null,a),t.lanes=0,t}function Wp(t,a,i){return Yr(a,t.child,null,i),t=Zp(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Fy(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),pp(t.return,a,i)}function Jp(t,a,i,u,h,y){var A=t.memoizedState;A===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:h,treeForkCount:y}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=u,A.tail=i,A.tailMode=h,A.treeForkCount=y)}function Yy(t,a,i){var u=a.pendingProps,h=u.revealOrder,y=u.tail;u=u.children;var A=fn.current,I=(A&2)!==0;if(I?(A=A&1|2,a.flags|=128):A&=1,F(fn,A),En(t,a,u,i),u=jt?Wl:0,!I&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Fy(t,i,a);else if(t.tag===19)Fy(t,i,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(i=a.child,h=null;i!==null;)t=i.alternate,t!==null&&ou(t)===null&&(h=i),i=i.sibling;i=h,i===null?(h=a.child,a.child=null):(h=i.sibling,i.sibling=null),Jp(a,!1,h,i,y,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,h=a.child,a.child=null;h!==null;){if(t=h.alternate,t!==null&&ou(t)===null){a.child=h;break}t=h.sibling,h.sibling=i,i=h,h=t}Jp(a,!0,i,null,y,u);break;case"together":Jp(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function vs(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),tr|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(Uo(t,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(o(153));if(a.child!==null){for(t=a.child,i=ps(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=ps(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function em(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Wc(t)))}function TE(t,a,i){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Ys(a,hn,t.memoizedState.cache),Hr();break;case 27:case 5:Te(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:Ys(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Cp(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Zs(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Gy(t,a,i):(Zs(a),t=vs(t,a,i),t!==null?t.sibling:null);Zs(a);break;case 19:var h=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(Uo(t,a,i,!1),u=(i&a.childLanes)!==0),h){if(u)return Yy(t,a,i);a.flags|=128}if(h=a.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),F(fn,fn.current),u)break;return null;case 22:return a.lanes=0,By(t,a,i,a.pendingProps);case 24:Ys(a,hn,t.memoizedState.cache)}return vs(t,a,i)}function Xy(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)bn=!0;else{if(!em(t,i)&&(a.flags&128)===0)return bn=!1,TE(t,a,i);bn=(t.flags&131072)!==0}else bn=!1,jt&&(a.flags&1048576)!==0&&kv(a,Wl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Gr(a.elementType),a.type=t,typeof t=="function")rp(t)?(u=Kr(t,u),a.tag=1,a=qy(null,a,t,u,i)):(a.tag=0,a=Yp(null,a,t,u,i));else{if(t!=null){var h=t.$$typeof;if(h===N){a.tag=11,a=Ly(null,a,t,u,i);break e}else if(h===O){a.tag=14,a=Py(null,a,t,u,i);break e}}throw a=q(t)||t,Error(o(306,a,""))}}return a;case 0:return Yp(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,h=Kr(u,a.pendingProps),qy(t,a,u,h,i);case 3:e:{if(ce(a,a.stateNode.containerInfo),t===null)throw Error(o(387));u=a.pendingProps;var y=a.memoizedState;h=y.element,yp(t,a),oi(a,u,null,i);var A=a.memoizedState;if(u=A.cache,Ys(a,hn,u),u!==y.cache&&mp(a,[hn],i,!0),ri(),u=A.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=$y(t,a,u,i);break e}else if(u!==h){h=wa(Error(o(424)),a),Jl(h),a=$y(t,a,u,i);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Yt=Na(t.firstChild),Cn=a,jt=!0,Gs=null,ka=!0,i=Bv(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Hr(),u===h){a=vs(t,a,i);break e}En(t,a,u,i)}a=a.child}return a;case 26:return xu(t,a),t===null?(i=r1(a.type,null,a.pendingProps,null))?a.memoizedState=i:jt||(i=a.type,t=a.pendingProps,u=zu(re.current).createElement(i),u[Rt]=a,u[gn]=t,Nn(u,i,t),jn(u),a.stateNode=u):a.memoizedState=r1(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return Te(a),t===null&&jt&&(u=a.stateNode=n1(a.type,a.pendingProps,re.current),Cn=a,ka=!0,h=Yt,or(a.type)?(Om=h,Yt=Na(u.firstChild)):Yt=h),En(t,a,a.pendingProps.children,i),xu(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&jt&&((h=u=Yt)&&(u=oN(u,a.type,a.pendingProps,ka),u!==null?(a.stateNode=u,Cn=a,Yt=Na(u.firstChild),ka=!1,h=!0):h=!1),h||Fs(a)),Te(a),h=a.type,y=a.pendingProps,A=t!==null?t.memoizedProps:null,u=y.children,Nm(h,y)?u=null:A!==null&&Nm(h,A)&&(a.flags|=32),a.memoizedState!==null&&(h=Ep(t,a,_E,null,null,i),ki._currentValue=h),xu(t,a),En(t,a,u,i),a.child;case 6:return t===null&&jt&&((t=i=Yt)&&(i=lN(i,a.pendingProps,ka),i!==null?(a.stateNode=i,Cn=a,Yt=null,t=!0):t=!1),t||Fs(a)),null;case 13:return Gy(t,a,i);case 4:return ce(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Yr(a,null,u,i):En(t,a,u,i),a.child;case 11:return Ly(t,a,a.type,a.pendingProps,i);case 7:return En(t,a,a.pendingProps,i),a.child;case 8:return En(t,a,a.pendingProps.children,i),a.child;case 12:return En(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Ys(a,a.type,u.value),En(t,a,u.children,i),a.child;case 9:return h=a.type._context,u=a.pendingProps.children,qr(a),h=kn(h),u=u(h),a.flags|=1,En(t,a,u,i),a.child;case 14:return Py(t,a,a.type,a.pendingProps,i);case 15:return Iy(t,a,a.type,a.pendingProps,i);case 19:return Yy(t,a,i);case 31:return RE(t,a,i);case 22:return By(t,a,i,a.pendingProps);case 24:return qr(a),u=kn(hn),t===null?(h=xp(),h===null&&(h=qt,y=gp(),h.pooledCache=y,y.refCount++,y!==null&&(h.pooledCacheLanes|=i),h=y),a.memoizedState={parent:u,cache:h},vp(a),Ys(a,hn,h)):((t.lanes&i)!==0&&(yp(t,a),oi(a,null,null,i),ri()),h=t.memoizedState,y=a.memoizedState,h.parent!==u?(h={parent:u,cache:u},a.memoizedState=h,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=h),Ys(a,hn,u)):(u=y.cache,Ys(a,hn,u),u!==h.cache&&mp(a,[hn],i,!0))),En(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(o(156,a.tag))}function ys(t){t.flags|=4}function tm(t,a,i,u,h){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(_0())t.flags|=8192;else throw Fr=nu,bp}else t.flags&=-16777217}function Ky(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!u1(a))if(_0())t.flags|=8192;else throw Fr=nu,bp}function vu(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Xn():536870912,t.lanes|=a,Wo|=a)}function fi(t,a){if(!jt)switch(t.tailMode){case"hidden":a=t.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Xt(t){var a=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(a)for(var h=t.child;h!==null;)i|=h.lanes|h.childLanes,u|=h.subtreeFlags&65011712,u|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)i|=h.lanes|h.childLanes,u|=h.subtreeFlags,u|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function AE(t,a,i){var u=a.pendingProps;switch(cp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(a),null;case 1:return Xt(a),null;case 3:return i=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),hs(hn),ee(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(Bo(a)?ys(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,dp())),Xt(a),null;case 26:var h=a.type,y=a.memoizedState;return t===null?(ys(a),y!==null?(Xt(a),Ky(a,y)):(Xt(a),tm(a,h,null,u,i))):y?y!==t.memoizedState?(ys(a),Xt(a),Ky(a,y)):(Xt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&ys(a),Xt(a),tm(a,h,t,u,i)),null;case 27:if(Fe(a),i=re.current,h=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&ys(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}t=J.current,Bo(a)?Nv(a):(t=n1(h,u,i),a.stateNode=t,ys(a))}return Xt(a),null;case 5:if(Fe(a),h=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&ys(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}if(y=J.current,Bo(a))Nv(a);else{var A=zu(re.current);switch(y){case 1:y=A.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:y=A.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":y=A.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":y=A.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":y=A.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof u.is=="string"?A.createElement("select",{is:u.is}):A.createElement("select"),u.multiple?y.multiple=!0:u.size&&(y.size=u.size);break;default:y=typeof u.is=="string"?A.createElement(h,{is:u.is}):A.createElement(h)}}y[Rt]=a,y[gn]=u;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)y.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=y;e:switch(Nn(y,h,u),h){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&ys(a)}}return Xt(a),tm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&ys(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(o(166));if(t=re.current,Bo(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,h=Cn,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}t[Rt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||G0(t.nodeValue,i)),t||Fs(a,!0)}else t=zu(t).createTextNode(u),t[Rt]=a,a.stateNode=t}return Xt(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=Bo(a),i!==null){if(t===null){if(!u)throw Error(o(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[Rt]=a}else Hr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),t=!1}else i=dp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(pa(a),a):(pa(a),null);if((a.flags&128)!==0)throw Error(o(558))}return Xt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Bo(a),u!==null&&u.dehydrated!==null){if(t===null){if(!h)throw Error(o(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(o(317));h[Rt]=a}else Hr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),h=!1}else h=dp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(pa(a),a):(pa(a),null)}return pa(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==h&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),vu(a,a.updateQueue),Xt(a),null);case 4:return ee(),t===null&&wm(a.stateNode.containerInfo),Xt(a),null;case 10:return hs(a.type),Xt(a),null;case 19:if(K(fn),u=a.memoizedState,u===null)return Xt(a),null;if(h=(a.flags&128)!==0,y=u.rendering,y===null)if(h)fi(u,!1);else{if(on!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(y=ou(t),y!==null){for(a.flags|=128,fi(u,!1),t=y.updateQueue,a.updateQueue=t,vu(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)wv(i,t),i=i.sibling;return F(fn,fn.current&1|2),jt&&ms(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ye()>Su&&(a.flags|=128,h=!0,fi(u,!1),a.lanes=4194304)}else{if(!h)if(t=ou(y),t!==null){if(a.flags|=128,h=!0,t=t.updateQueue,a.updateQueue=t,vu(a,t),fi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!y.alternate&&!jt)return Xt(a),null}else 2*ye()-u.renderingStartTime>Su&&i!==536870912&&(a.flags|=128,h=!0,fi(u,!1),a.lanes=4194304);u.isBackwards?(y.sibling=a.child,a.child=y):(t=u.last,t!==null?t.sibling=y:a.child=y,u.last=y)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ye(),t.sibling=null,i=fn.current,F(fn,h?i&1|2:i&1),jt&&ms(a,u.treeForkCount),t):(Xt(a),null);case 22:case 23:return pa(a),Sp(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(i&536870912)!==0&&(a.flags&128)===0&&(Xt(a),a.subtreeFlags&6&&(a.flags|=8192)):Xt(a),i=a.updateQueue,i!==null&&vu(a,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==i&&(a.flags|=2048),t!==null&&K($r),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),hs(hn),Xt(a),null;case 25:return null;case 30:return null}throw Error(o(156,a.tag))}function ME(t,a){switch(cp(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return hs(hn),ee(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return Fe(a),null;case 31:if(a.memoizedState!==null){if(pa(a),a.alternate===null)throw Error(o(340));Hr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(pa(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(o(340));Hr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return K(fn),null;case 4:return ee(),null;case 10:return hs(a.type),null;case 22:case 23:return pa(a),Sp(),t!==null&&K($r),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return hs(hn),null;case 25:return null;default:return null}}function Qy(t,a){switch(cp(a),a.tag){case 3:hs(hn),ee();break;case 26:case 27:case 5:Fe(a);break;case 4:ee();break;case 31:a.memoizedState!==null&&pa(a);break;case 13:pa(a);break;case 19:K(fn);break;case 10:hs(a.type);break;case 22:case 23:pa(a),Sp(),t!==null&&K($r);break;case 24:hs(hn)}}function pi(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var h=u.next;i=h;do{if((i.tag&t)===t){u=void 0;var y=i.create,A=i.inst;u=y(),A.destroy=u}i=i.next}while(i!==h)}}catch(I){At(a,a.return,I)}}function Js(t,a,i){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var y=h.next;u=y;do{if((u.tag&t)===t){var A=u.inst,I=A.destroy;if(I!==void 0){A.destroy=void 0,h=a;var Q=i,ae=I;try{ae()}catch(fe){At(h,Q,fe)}}}u=u.next}while(u!==y)}}catch(fe){At(a,a.return,fe)}}function Zy(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{Hv(a,i)}catch(u){At(t,t.return,u)}}}function Wy(t,a,i){i.props=Kr(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){At(t,a,u)}}function mi(t,a){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(h){At(t,a,h)}}function Xa(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(h){At(t,a,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(h){At(t,a,h)}else i.current=null}function Jy(t){var a=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(h){At(t,t.return,h)}}function nm(t,a,i){try{var u=t.stateNode;eN(u,t.type,i,a),u[gn]=a}catch(h){At(t,t.return,h)}}function e0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&or(t.type)||t.tag===4}function am(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||e0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&or(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function sm(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(t),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=ds));else if(u!==4&&(u===27&&or(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(sm(t,a,i),t=t.sibling;t!==null;)sm(t,a,i),t=t.sibling}function yu(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?i.insertBefore(t,a):i.appendChild(t);else if(u!==4&&(u===27&&or(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(yu(t,a,i),t=t.sibling;t!==null;)yu(t,a,i),t=t.sibling}function t0(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);Nn(a,u,i),a[Rt]=t,a[gn]=i}catch(y){At(t,t.return,y)}}var _s=!1,vn=!1,rm=!1,n0=typeof WeakSet=="function"?WeakSet:Set,wn=null;function OE(t,a){if(t=t.containerInfo,km=Hu,t=mv(t),Wf(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var h=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{i.nodeType,y.nodeType}catch{i=null;break e}var A=0,I=-1,Q=-1,ae=0,fe=0,xe=t,se=null;t:for(;;){for(var ue;xe!==i||h!==0&&xe.nodeType!==3||(I=A+h),xe!==y||u!==0&&xe.nodeType!==3||(Q=A+u),xe.nodeType===3&&(A+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)se=xe,xe=ue;for(;;){if(xe===t)break t;if(se===i&&++ae===h&&(I=A),se===y&&++fe===u&&(Q=A),(ue=xe.nextSibling)!==null)break;xe=se,se=xe.parentNode}xe=ue}i=I===-1||Q===-1?null:{start:I,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(Em={focusedElem:t,selectionRange:i},Hu=!1,wn=a;wn!==null;)if(a=wn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,wn=t;else for(;wn!==null;){switch(a=wn,y=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i<t.length;i++)h=t[i],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,i=a,h=y.memoizedProps,y=y.memoizedState,u=i.stateNode;try{var He=Kr(i.type,h);t=u.getSnapshotBeforeUpdate(He,y),u.__reactInternalSnapshotBeforeUpdate=t}catch(et){At(i,i.return,et)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)Tm(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Tm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(o(163))}if(t=a.sibling,t!==null){t.return=a.return,wn=t;break}wn=a.return}}function a0(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:ws(t,i),u&4&&pi(5,i);break;case 1:if(ws(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(A){At(i,i.return,A)}else{var h=Kr(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(h,a,t.__reactInternalSnapshotBeforeUpdate)}catch(A){At(i,i.return,A)}}u&64&&Zy(i),u&512&&mi(i,i.return);break;case 3:if(ws(t,i),u&64&&(t=i.updateQueue,t!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Hv(t,a)}catch(A){At(i,i.return,A)}}break;case 27:a===null&&u&4&&t0(i);case 26:case 5:ws(t,i),a===null&&u&4&&Jy(i),u&512&&mi(i,i.return);break;case 12:ws(t,i);break;case 31:ws(t,i),u&4&&o0(t,i);break;case 13:ws(t,i),u&4&&l0(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=VE.bind(null,i),iN(t,i))));break;case 22:if(u=i.memoizedState!==null||_s,!u){a=a!==null&&a.memoizedState!==null||vn,h=_s;var y=vn;_s=u,(vn=a)&&!y?Ss(t,i,(i.subtreeFlags&8772)!==0):ws(t,i),_s=h,vn=y}break;case 30:break;default:ws(t,i)}}function s0(t){var a=t.alternate;a!==null&&(t.alternate=null,s0(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&Df(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Wt=null,Zn=!1;function js(t,a,i){for(i=i.child;i!==null;)r0(t,a,i),i=i.sibling}function r0(t,a,i){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(ke,i)}catch{}switch(i.tag){case 26:vn||Xa(i,a),js(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:vn||Xa(i,a);var u=Wt,h=Zn;or(i.type)&&(Wt=i.stateNode,Zn=!1),js(t,a,i),wi(i.stateNode),Wt=u,Zn=h;break;case 5:vn||Xa(i,a);case 6:if(u=Wt,h=Zn,Wt=null,js(t,a,i),Wt=u,Zn=h,Wt!==null)if(Zn)try{(Wt.nodeType===9?Wt.body:Wt.nodeName==="HTML"?Wt.ownerDocument.body:Wt).removeChild(i.stateNode)}catch(y){At(i,a,y)}else try{Wt.removeChild(i.stateNode)}catch(y){At(i,a,y)}break;case 18:Wt!==null&&(Zn?(t=Wt,Z0(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),ol(t)):Z0(Wt,i.stateNode));break;case 4:u=Wt,h=Zn,Wt=i.stateNode.containerInfo,Zn=!0,js(t,a,i),Wt=u,Zn=h;break;case 0:case 11:case 14:case 15:Js(2,i,a),vn||Js(4,i,a),js(t,a,i);break;case 1:vn||(Xa(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&Wy(i,a,u)),js(t,a,i);break;case 21:js(t,a,i);break;case 22:vn=(u=vn)||i.memoizedState!==null,js(t,a,i),vn=u;break;default:js(t,a,i)}}function o0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ol(t)}catch(i){At(a,a.return,i)}}}function l0(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ol(t)}catch(i){At(a,a.return,i)}}function zE(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new n0),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new n0),a;default:throw Error(o(435,t.tag))}}function _u(t,a){var i=zE(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var h=qE.bind(null,t,u);u.then(h,h)}})}function Wn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var h=i[u],y=t,A=a,I=A;e:for(;I!==null;){switch(I.tag){case 27:if(or(I.type)){Wt=I.stateNode,Zn=!1;break e}break;case 5:Wt=I.stateNode,Zn=!1;break e;case 3:case 4:Wt=I.stateNode.containerInfo,Zn=!0;break e}I=I.return}if(Wt===null)throw Error(o(160));r0(y,A,h),Wt=null,Zn=!1,y=h.alternate,y!==null&&(y.return=null),h.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)i0(a,t),a=a.sibling}var Ba=null;function i0(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Wn(a,t),Jn(t),u&4&&(Js(3,t,t.return),pi(3,t),Js(5,t,t.return));break;case 1:Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),u&64&&_s&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(i=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=i===null?u:i.concat(u))));break;case 26:var h=Ba;if(Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),u&4){var y=i!==null?i.memoizedState:null;if(u=t.memoizedState,i===null)if(u===null)if(t.stateNode===null){e:{u=t.type,i=t.memoizedProps,h=h.ownerDocument||h;t:switch(u){case"title":y=h.getElementsByTagName("title")[0],(!y||y[Hl]||y[Rt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=h.createElement(u),h.head.insertBefore(y,h.querySelector("head > title"))),Nn(y,u,i),y[Rt]=t,jn(y),u=y;break e;case"link":var A=i1("link","href",h).get(u+(i.href||""));if(A){for(var I=0;I<A.length;I++)if(y=A[I],y.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&y.getAttribute("rel")===(i.rel==null?null:i.rel)&&y.getAttribute("title")===(i.title==null?null:i.title)&&y.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){A.splice(I,1);break t}}y=h.createElement(u),Nn(y,u,i),h.head.appendChild(y);break;case"meta":if(A=i1("meta","content",h).get(u+(i.content||""))){for(I=0;I<A.length;I++)if(y=A[I],y.getAttribute("content")===(i.content==null?null:""+i.content)&&y.getAttribute("name")===(i.name==null?null:i.name)&&y.getAttribute("property")===(i.property==null?null:i.property)&&y.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&y.getAttribute("charset")===(i.charSet==null?null:i.charSet)){A.splice(I,1);break t}}y=h.createElement(u),Nn(y,u,i),h.head.appendChild(y);break;default:throw Error(o(468,u))}y[Rt]=t,jn(y),u=y}t.stateNode=u}else c1(h,t.type,t.stateNode);else t.stateNode=l1(h,u,t.memoizedProps);else y!==u?(y===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):y.count--,u===null?c1(h,t.type,t.stateNode):l1(h,u,t.memoizedProps)):u===null&&t.stateNode!==null&&nm(t,t.memoizedProps,i.memoizedProps)}break;case 27:Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),i!==null&&u&4&&nm(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Wn(a,t),Jn(t),u&512&&(vn||i===null||Xa(i,i.return)),t.flags&32){h=t.stateNode;try{Ro(h,"")}catch(He){At(t,t.return,He)}}u&4&&t.stateNode!=null&&(h=t.memoizedProps,nm(t,h,i!==null?i.memoizedProps:h)),u&1024&&(rm=!0);break;case 6:if(Wn(a,t),Jn(t),u&4){if(t.stateNode===null)throw Error(o(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(He){At(t,t.return,He)}}break;case 3:if(Pu=null,h=Ba,Ba=Du(a.containerInfo),Wn(a,t),Ba=h,Jn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{ol(a.containerInfo)}catch(He){At(t,t.return,He)}rm&&(rm=!1,c0(t));break;case 4:u=Ba,Ba=Du(t.stateNode.containerInfo),Wn(a,t),Jn(t),Ba=u;break;case 12:Wn(a,t),Jn(t);break;case 31:Wn(a,t),Jn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,_u(t,u)));break;case 13:Wn(a,t),Jn(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(wu=ye()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,_u(t,u)));break;case 22:h=t.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,ae=_s,fe=vn;if(_s=ae||h,vn=fe||Q,Wn(a,t),vn=fe,_s=ae,Jn(t),u&8192)e:for(a=t.stateNode,a._visibility=h?a._visibility&-2:a._visibility|1,h&&(i===null||Q||_s||vn||Qr(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){Q=i=a;try{if(y=Q.stateNode,h)A=y.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{I=Q.stateNode;var xe=Q.memoizedProps.style,se=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;I.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(He){At(Q,Q.return,He)}}}else if(a.tag===6){if(i===null){Q=a;try{Q.stateNode.nodeValue=h?"":Q.memoizedProps}catch(He){At(Q,Q.return,He)}}}else if(a.tag===18){if(i===null){Q=a;try{var ue=Q.stateNode;h?W0(ue,!0):W0(Q.stateNode,!1)}catch(He){At(Q,Q.return,He)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(i=u.retryQueue,i!==null&&(u.retryQueue=null,_u(t,i))));break;case 19:Wn(a,t),Jn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,_u(t,u)));break;case 30:break;case 21:break;default:Wn(a,t),Jn(t)}}function Jn(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(e0(u)){i=u;break}u=u.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var h=i.stateNode,y=am(t);yu(t,y,h);break;case 5:var A=i.stateNode;i.flags&32&&(Ro(A,""),i.flags&=-33);var I=am(t);yu(t,I,A);break;case 3:case 4:var Q=i.stateNode.containerInfo,ae=am(t);sm(t,ae,Q);break;default:throw Error(o(161))}}catch(fe){At(t,t.return,fe)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function c0(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;c0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function ws(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)a0(t,a.alternate,a),a=a.sibling}function Qr(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Js(4,a,a.return),Qr(a);break;case 1:Xa(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&Wy(a,a.return,i),Qr(a);break;case 27:wi(a.stateNode);case 26:case 5:Xa(a,a.return),Qr(a);break;case 22:a.memoizedState===null&&Qr(a);break;case 30:Qr(a);break;default:Qr(a)}t=t.sibling}}function Ss(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,h=t,y=a,A=y.flags;switch(y.tag){case 0:case 11:case 15:Ss(h,y,i),pi(4,y);break;case 1:if(Ss(h,y,i),u=y,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ae){At(u,u.return,ae)}if(u=y,h=u.updateQueue,h!==null){var I=u.stateNode;try{var Q=h.shared.hiddenCallbacks;if(Q!==null)for(h.shared.hiddenCallbacks=null,h=0;h<Q.length;h++)Uv(Q[h],I)}catch(ae){At(u,u.return,ae)}}i&&A&64&&Zy(y),mi(y,y.return);break;case 27:t0(y);case 26:case 5:Ss(h,y,i),i&&u===null&&A&4&&Jy(y),mi(y,y.return);break;case 12:Ss(h,y,i);break;case 31:Ss(h,y,i),i&&A&4&&o0(h,y);break;case 13:Ss(h,y,i),i&&A&4&&l0(h,y);break;case 22:y.memoizedState===null&&Ss(h,y,i),mi(y,y.return);break;case 30:break;default:Ss(h,y,i)}a=a.sibling}}function om(t,a){var i=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==i&&(t!=null&&t.refCount++,i!=null&&ei(i))}function lm(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ei(t))}function Ua(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)u0(t,a,i,u),a=a.sibling}function u0(t,a,i,u){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Ua(t,a,i,u),h&2048&&pi(9,a);break;case 1:Ua(t,a,i,u);break;case 3:Ua(t,a,i,u),h&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ei(t)));break;case 12:if(h&2048){Ua(t,a,i,u),t=a.stateNode;try{var y=a.memoizedProps,A=y.id,I=y.onPostCommit;typeof I=="function"&&I(A,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(Q){At(a,a.return,Q)}}else Ua(t,a,i,u);break;case 31:Ua(t,a,i,u);break;case 13:Ua(t,a,i,u);break;case 23:break;case 22:y=a.stateNode,A=a.alternate,a.memoizedState!==null?y._visibility&2?Ua(t,a,i,u):gi(t,a):y._visibility&2?Ua(t,a,i,u):(y._visibility|=2,Ko(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),h&2048&&om(A,a);break;case 24:Ua(t,a,i,u),h&2048&&lm(a.alternate,a);break;default:Ua(t,a,i,u)}}function Ko(t,a,i,u,h){for(h=h&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=t,A=a,I=i,Q=u,ae=A.flags;switch(A.tag){case 0:case 11:case 15:Ko(y,A,I,Q,h),pi(8,A);break;case 23:break;case 22:var fe=A.stateNode;A.memoizedState!==null?fe._visibility&2?Ko(y,A,I,Q,h):gi(y,A):(fe._visibility|=2,Ko(y,A,I,Q,h)),h&&ae&2048&&om(A.alternate,A);break;case 24:Ko(y,A,I,Q,h),h&&ae&2048&&lm(A.alternate,A);break;default:Ko(y,A,I,Q,h)}a=a.sibling}}function gi(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,h=u.flags;switch(u.tag){case 22:gi(i,u),h&2048&&om(u.alternate,u);break;case 24:gi(i,u),h&2048&&lm(u.alternate,u);break;default:gi(i,u)}a=a.sibling}}var hi=8192;function Qo(t,a,i){if(t.subtreeFlags&hi)for(t=t.child;t!==null;)d0(t,a,i),t=t.sibling}function d0(t,a,i){switch(t.tag){case 26:Qo(t,a,i),t.flags&hi&&t.memoizedState!==null&&yN(i,Ba,t.memoizedState,t.memoizedProps);break;case 5:Qo(t,a,i);break;case 3:case 4:var u=Ba;Ba=Du(t.stateNode.containerInfo),Qo(t,a,i),Ba=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=hi,hi=16777216,Qo(t,a,i),hi=u):Qo(t,a,i));break;default:Qo(t,a,i)}}function f0(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function xi(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];wn=u,m0(u,t)}f0(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)p0(t),t=t.sibling}function p0(t){switch(t.tag){case 0:case 11:case 15:xi(t),t.flags&2048&&Js(9,t,t.return);break;case 3:xi(t);break;case 12:xi(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,ju(t)):xi(t);break;default:xi(t)}}function ju(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];wn=u,m0(u,t)}f0(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Js(8,a,a.return),ju(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,ju(a));break;default:ju(a)}t=t.sibling}}function m0(t,a){for(;wn!==null;){var i=wn;switch(i.tag){case 0:case 11:case 15:Js(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var u=i.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:ei(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,wn=u;else e:for(i=t;wn!==null;){u=wn;var h=u.sibling,y=u.return;if(s0(u),u===i){wn=null;break e}if(h!==null){h.return=y,wn=h;break e}wn=y}}}var DE={getCacheForType:function(t){var a=kn(hn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return kn(hn).controller.signal}},LE=typeof WeakMap=="function"?WeakMap:Map,Et=0,qt=null,gt=null,xt=0,Tt=0,ma=null,er=!1,Zo=!1,im=!1,Cs=0,on=0,tr=0,Zr=0,cm=0,ga=0,Wo=0,bi=null,ea=null,um=!1,wu=0,g0=0,Su=1/0,Cu=null,nr=null,_n=0,ar=null,Jo=null,ks=0,dm=0,fm=null,h0=null,vi=0,pm=null;function ha(){return(Et&2)!==0&&xt!==0?xt&-xt:V.T!==null?vm():Dt()}function x0(){if(ga===0)if((xt&536870912)===0||jt){var t=Zt;Zt<<=1,(Zt&3932160)===0&&(Zt=262144),ga=t}else ga=536870912;return t=fa.current,t!==null&&(t.flags|=32),ga}function ta(t,a,i){(t===qt&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)&&(el(t,0),sr(t,xt,ga,!1)),Kn(t,i),((Et&2)===0||t!==qt)&&(t===qt&&((Et&2)===0&&(Zr|=i),on===4&&sr(t,xt,ga,!1)),Ka(t))}function b0(t,a,i){if((Et&6)!==0)throw Error(o(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||dn(t,a),h=u?BE(t,a):gm(t,a,!0),y=u;do{if(h===0){Zo&&!u&&sr(t,a,0,!1);break}else{if(i=t.current.alternate,y&&!PE(i)){h=gm(t,a,!1),y=!1;continue}if(h===2){if(y=a,t.errorRecoveryDisabledLanes&y)var A=0;else A=t.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var I=t;h=bi;var Q=I.current.memoizedState.isDehydrated;if(Q&&(el(I,A).flags|=256),A=gm(I,A,!1),A!==2){if(im&&!Q){I.errorRecoveryDisabledLanes|=y,Zr|=y,h=4;break e}y=ea,ea=h,y!==null&&(ea===null?ea=y:ea.push.apply(ea,y))}h=A}if(y=!1,h!==2)continue}}if(h===1){el(t,0),sr(t,a,0,!0);break}e:{switch(u=t,y=h,y){case 0:case 1:throw Error(o(345));case 4:if((a&4194048)!==a)break;case 6:sr(u,a,ga,!er);break e;case 2:ea=null;break;case 3:case 5:break;default:throw Error(o(329))}if((a&62914560)===a&&(h=wu+300-ye(),10<h)){if(sr(u,a,ga,!er),Ft(u,0,!0)!==0)break e;ks=a,u.timeoutHandle=K0(v0.bind(null,u,i,ea,Cu,um,a,ga,Zr,Wo,er,y,"Throttled",-0,0),h);break e}v0(u,i,ea,Cu,um,a,ga,Zr,Wo,er,y,null,-0,0)}}break}while(!0);Ka(t)}function v0(t,a,i,u,h,y,A,I,Q,ae,fe,xe,se,ue){if(t.timeoutHandle=-1,xe=a.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ds},d0(a,y,xe);var He=(y&62914560)===y?wu-ye():(y&4194048)===y?g0-ye():0;if(He=_N(xe,He),He!==null){ks=y,t.cancelPendingCommit=He(E0.bind(null,t,a,y,i,u,h,A,I,Q,fe,xe,null,se,ue)),sr(t,y,A,!ae);return}}E0(t,a,y,i,u,h,A,I,Q)}function PE(t){for(var a=t;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var u=0;u<i.length;u++){var h=i[u],y=h.getSnapshot;h=h.value;try{if(!ua(y(),h))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function sr(t,a,i,u){a&=~cm,a&=~Zr,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var h=a;0<h;){var y=31-at(h),A=1<<y;u[y]=-1,h&=~A}i!==0&&Dn(t,i,a)}function ku(){return(Et&6)===0?(yi(0),!1):!0}function mm(){if(gt!==null){if(Tt===0)var t=gt.return;else t=gt,gs=Vr=null,Tp(t),$o=null,ni=0,t=gt;for(;t!==null;)Qy(t.alternate,t),t=t.return;gt=null}}function el(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,aN(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),ks=0,mm(),qt=t,gt=i=ps(t.current,null),xt=a,Tt=0,ma=null,er=!1,Zo=dn(t,a),im=!1,Wo=ga=cm=Zr=tr=on=0,ea=bi=null,um=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var h=31-at(u),y=1<<h;a|=t[h],u&=~y}return Cs=a,Yc(),i}function y0(t,a){ot=null,V.H=ui,a===qo||a===tu?(a=Lv(),Tt=3):a===bp?(a=Lv(),Tt=4):Tt=a===Fp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ma=a,gt===null&&(on=1,gu(t,wa(a,t.current)))}function _0(){var t=fa.current;return t===null?!0:(xt&4194048)===xt?Ea===null:(xt&62914560)===xt||(xt&536870912)!==0?t===Ea:!1}function j0(){var t=V.H;return V.H=ui,t===null?ui:t}function w0(){var t=V.A;return V.A=DE,t}function Eu(){on=4,er||(xt&4194048)!==xt&&fa.current!==null||(Zo=!0),(tr&134217727)===0&&(Zr&134217727)===0||qt===null||sr(qt,xt,ga,!1)}function gm(t,a,i){var u=Et;Et|=2;var h=j0(),y=w0();(qt!==t||xt!==a)&&(Cu=null,el(t,a)),a=!1;var A=on;e:do try{if(Tt!==0&&gt!==null){var I=gt,Q=ma;switch(Tt){case 8:mm(),A=6;break e;case 3:case 2:case 9:case 6:fa.current===null&&(a=!0);var ae=Tt;if(Tt=0,ma=null,tl(t,I,Q,ae),i&&Zo){A=0;break e}break;default:ae=Tt,Tt=0,ma=null,tl(t,I,Q,ae)}}IE(),A=on;break}catch(fe){y0(t,fe)}while(!0);return a&&t.shellSuspendCounter++,gs=Vr=null,Et=u,V.H=h,V.A=y,gt===null&&(qt=null,xt=0,Yc()),A}function IE(){for(;gt!==null;)S0(gt)}function BE(t,a){var i=Et;Et|=2;var u=j0(),h=w0();qt!==t||xt!==a?(Cu=null,Su=ye()+500,el(t,a)):Zo=dn(t,a);e:do try{if(Tt!==0&&gt!==null){a=gt;var y=ma;t:switch(Tt){case 1:Tt=0,ma=null,tl(t,a,y,1);break;case 2:case 9:if(zv(y)){Tt=0,ma=null,C0(a);break}a=function(){Tt!==2&&Tt!==9||qt!==t||(Tt=7),Ka(t)},y.then(a,a);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:zv(y)?(Tt=0,ma=null,C0(a)):(Tt=0,ma=null,tl(t,a,y,7));break;case 5:var A=null;switch(gt.tag){case 26:A=gt.memoizedState;case 5:case 27:var I=gt;if(A?u1(A):I.stateNode.complete){Tt=0,ma=null;var Q=I.sibling;if(Q!==null)gt=Q;else{var ae=I.return;ae!==null?(gt=ae,Nu(ae)):gt=null}break t}}Tt=0,ma=null,tl(t,a,y,5);break;case 6:Tt=0,ma=null,tl(t,a,y,6);break;case 8:mm(),on=6;break e;default:throw Error(o(462))}}UE();break}catch(fe){y0(t,fe)}while(!0);return gs=Vr=null,V.H=u,V.A=h,Et=i,gt!==null?0:(qt=null,xt=0,Yc(),on)}function UE(){for(;gt!==null&&!Ye();)S0(gt)}function S0(t){var a=Xy(t.alternate,t,Cs);t.memoizedProps=t.pendingProps,a===null?Nu(t):gt=a}function C0(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=Vy(i,a,a.pendingProps,a.type,void 0,xt);break;case 11:a=Vy(i,a,a.pendingProps,a.type.render,a.ref,xt);break;case 5:Tp(a);default:Qy(i,a),a=gt=wv(a,Cs),a=Xy(i,a,Cs)}t.memoizedProps=t.pendingProps,a===null?Nu(t):gt=a}function tl(t,a,i,u){gs=Vr=null,Tp(a),$o=null,ni=0;var h=a.return;try{if(NE(t,h,a,i,xt)){on=1,gu(t,wa(i,t.current)),gt=null;return}}catch(y){if(h!==null)throw gt=h,y;on=1,gu(t,wa(i,t.current)),gt=null;return}a.flags&32768?(jt||u===1?t=!0:Zo||(xt&536870912)!==0?t=!1:(er=t=!0,(u===2||u===9||u===3||u===6)&&(u=fa.current,u!==null&&u.tag===13&&(u.flags|=16384))),k0(a,t)):Nu(a)}function Nu(t){var a=t;do{if((a.flags&32768)!==0){k0(a,er);return}t=a.return;var i=AE(a.alternate,a,Cs);if(i!==null){gt=i;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=t}while(a!==null);on===0&&(on=5)}function k0(t,a){do{var i=ME(t.alternate,t);if(i!==null){i.flags&=32767,gt=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){gt=t;return}gt=t=i}while(t!==null);on=6,gt=null}function E0(t,a,i,u,h,y,A,I,Q){t.cancelPendingCommit=null;do Ru();while(_n!==0);if((Et&6)!==0)throw Error(o(327));if(a!==null){if(a===t.current)throw Error(o(177));if(y=a.lanes|a.childLanes,y|=ap,is(t,i,y,A,I,Q),t===qt&&(gt=qt=null,xt=0),Jo=a,ar=t,ks=i,dm=y,fm=h,h0=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,$E(Ue,function(){return M0(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,h=$.p,$.p=2,A=Et,Et|=4;try{OE(t,a,i)}finally{Et=A,$.p=h,V.T=u}}_n=1,N0(),R0(),T0()}}function N0(){if(_n===1){_n=0;var t=ar,a=Jo,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=V.T,V.T=null;var u=$.p;$.p=2;var h=Et;Et|=4;try{i0(a,t);var y=Em,A=mv(t.containerInfo),I=y.focusedElem,Q=y.selectionRange;if(A!==I&&I&&I.ownerDocument&&pv(I.ownerDocument.documentElement,I)){if(Q!==null&&Wf(I)){var ae=Q.start,fe=Q.end;if(fe===void 0&&(fe=ae),"selectionStart"in I)I.selectionStart=ae,I.selectionEnd=Math.min(fe,I.value.length);else{var xe=I.ownerDocument||document,se=xe&&xe.defaultView||window;if(se.getSelection){var ue=se.getSelection(),He=I.textContent.length,et=Math.min(Q.start,He),It=Q.end===void 0?et:Math.min(Q.end,He);!ue.extend&&et>It&&(A=It,It=et,et=A);var te=fv(I,et),W=fv(I,It);if(te&&W&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==W.node||ue.focusOffset!==W.offset)){var ne=xe.createRange();ne.setStart(te.node,te.offset),ue.removeAllRanges(),et>It?(ue.addRange(ne),ue.extend(W.node,W.offset)):(ne.setEnd(W.node,W.offset),ue.addRange(ne))}}}}for(xe=[],ue=I;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<xe.length;I++){var he=xe[I];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Hu=!!km,Em=km=null}finally{Et=h,$.p=u,V.T=i}}t.current=a,_n=2}}function R0(){if(_n===2){_n=0;var t=ar,a=Jo,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=V.T,V.T=null;var u=$.p;$.p=2;var h=Et;Et|=4;try{a0(t,a.alternate,a)}finally{Et=h,$.p=u,V.T=i}}_n=3}}function T0(){if(_n===4||_n===3){_n=0,De();var t=ar,a=Jo,i=ks,u=h0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?_n=5:(_n=0,Jo=ar=null,A0(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(nr=null),ct(i),a=a.stateNode,Re&&typeof Re.onCommitFiberRoot=="function")try{Re.onCommitFiberRoot(ke,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=V.T,h=$.p,$.p=2,V.T=null;try{for(var y=t.onRecoverableError,A=0;A<u.length;A++){var I=u[A];y(I.value,{componentStack:I.stack})}}finally{V.T=a,$.p=h}}(ks&3)!==0&&Ru(),Ka(t),h=t.pendingLanes,(i&261930)!==0&&(h&42)!==0?t===pm?vi++:(vi=0,pm=t):vi=0,yi(0)}}function A0(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,ei(a)))}function Ru(){return N0(),R0(),T0(),M0()}function M0(){if(_n!==5)return!1;var t=ar,a=dm;dm=0;var i=ct(ks),u=V.T,h=$.p;try{$.p=32>i?32:i,V.T=null,i=fm,fm=null;var y=ar,A=ks;if(_n=0,Jo=ar=null,ks=0,(Et&6)!==0)throw Error(o(331));var I=Et;if(Et|=4,p0(y.current),u0(y,y.current,A,i),Et=I,yi(0,!1),Re&&typeof Re.onPostCommitFiberRoot=="function")try{Re.onPostCommitFiberRoot(ke,y)}catch{}return!0}finally{$.p=h,V.T=u,A0(t,a)}}function O0(t,a,i){a=wa(i,a),a=Gp(t.stateNode,a,2),t=Qs(t,a,2),t!==null&&(Kn(t,2),Ka(t))}function At(t,a,i){if(t.tag===3)O0(t,t,i);else for(;a!==null;){if(a.tag===3){O0(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(nr===null||!nr.has(u))){t=wa(i,t),i=zy(2),u=Qs(a,i,2),u!==null&&(Dy(i,u,a,t),Kn(u,2),Ka(u));break}}a=a.return}}function hm(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new LE;var h=new Set;u.set(a,h)}else h=u.get(a),h===void 0&&(h=new Set,u.set(a,h));h.has(i)||(im=!0,h.add(i),t=HE.bind(null,t,a,i),a.then(t,t))}function HE(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,qt===t&&(xt&i)===i&&(on===4||on===3&&(xt&62914560)===xt&&300>ye()-wu?(Et&2)===0&&el(t,0):cm|=i,Wo===xt&&(Wo=0)),Ka(t)}function z0(t,a){a===0&&(a=Xn()),t=Br(t,a),t!==null&&(Kn(t,a),Ka(t))}function VE(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),z0(t,i)}function qE(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,h=t.memoizedState;h!==null&&(i=h.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(a),z0(t,i)}function $E(t,a){return Be(t,a)}var Tu=null,nl=null,xm=!1,Au=!1,bm=!1,rr=0;function Ka(t){t!==nl&&t.next===null&&(nl===null?Tu=nl=t:nl=nl.next=t),Au=!0,xm||(xm=!0,FE())}function yi(t,a){if(!bm&&Au){bm=!0;do for(var i=!1,u=Tu;u!==null;){if(t!==0){var h=u.pendingLanes;if(h===0)var y=0;else{var A=u.suspendedLanes,I=u.pingedLanes;y=(1<<31-at(42|t)+1)-1,y&=h&~(A&~I),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(i=!0,I0(u,y))}else y=xt,y=Ft(u,u===qt?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(y&3)===0||dn(u,y)||(i=!0,I0(u,y));u=u.next}while(i);bm=!1}}function GE(){D0()}function D0(){Au=xm=!1;var t=0;rr!==0&&nN()&&(t=rr);for(var a=ye(),i=null,u=Tu;u!==null;){var h=u.next,y=L0(u,a);y===0?(u.next=null,i===null?Tu=h:i.next=h,h===null&&(nl=i)):(i=u,(t!==0||(y&3)!==0)&&(Au=!0)),u=h}_n!==0&&_n!==5||yi(t),rr!==0&&(rr=0)}function L0(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,h=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var A=31-at(y),I=1<<A,Q=h[A];Q===-1?((I&i)===0||(I&u)!==0)&&(h[A]=zn(I,a)):Q<=a&&(t.expiredLanes|=I),y&=~I}if(a=qt,i=xt,i=Ft(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Xe(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||dn(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&&Xe(u),ct(i)){case 2:case 8:i=Se;break;case 32:i=Ue;break;case 268435456:i=_t;break;default:i=Ue}return u=P0.bind(null,t),i=Be(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&&Xe(u),t.callbackPriority=2,t.callbackNode=null,2}function P0(t,a){if(_n!==0&&_n!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Ru()&&t.callbackNode!==i)return null;var u=xt;return u=Ft(t,t===qt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(b0(t,u,a),L0(t,ye()),t.callbackNode!=null&&t.callbackNode===i?P0.bind(null,t):null)}function I0(t,a){if(Ru())return null;b0(t,a,!0)}function FE(){sN(function(){(Et&6)!==0?Be(_e,GE):D0()})}function vm(){if(rr===0){var t=Ho;t===0&&(t=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),rr=t}return rr}function B0(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Bc(""+t)}function U0(t,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,t.id&&i.setAttribute("form",t.id),a.parentNode.insertBefore(i,a),t=new FormData(t),i.parentNode.removeChild(i),t}function YE(t,a,i,u,h){if(a==="submit"&&i&&i.stateNode===h){var y=B0((h[gn]||null).action),A=u.submitter;A&&(a=(a=A[gn]||null)?B0(a.formAction):A.getAttribute("formAction"),a!==null&&(y=a,A=null));var I=new qc("action","action",null,u,h);t.push({event:I,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(rr!==0){var Q=A?U0(h,A):new FormData(h);Bp(i,{pending:!0,data:Q,method:h.method,action:y},null,Q)}}else typeof y=="function"&&(I.preventDefault(),Q=A?U0(h,A):new FormData(h),Bp(i,{pending:!0,data:Q,method:h.method,action:y},y,Q))},currentTarget:h}]})}}for(var ym=0;ym<np.length;ym++){var _m=np[ym],XE=_m.toLowerCase(),KE=_m[0].toUpperCase()+_m.slice(1);Ia(XE,"on"+KE)}Ia(xv,"onAnimationEnd"),Ia(bv,"onAnimationIteration"),Ia(vv,"onAnimationStart"),Ia("dblclick","onDoubleClick"),Ia("focusin","onFocus"),Ia("focusout","onBlur"),Ia(dE,"onTransitionRun"),Ia(fE,"onTransitionStart"),Ia(pE,"onTransitionCancel"),Ia(yv,"onTransitionEnd"),Eo("onMouseEnter",["mouseout","mouseover"]),Eo("onMouseLeave",["mouseout","mouseover"]),Eo("onPointerEnter",["pointerout","pointerover"]),Eo("onPointerLeave",["pointerout","pointerover"]),Dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _i="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(" "),QE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_i));function H0(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],h=u.event;u=u.listeners;e:{var y=void 0;if(a)for(var A=u.length-1;0<=A;A--){var I=u[A],Q=I.instance,ae=I.currentTarget;if(I=I.listener,Q!==y&&h.isPropagationStopped())break e;y=I,h.currentTarget=ae;try{y(h)}catch(fe){Fc(fe)}h.currentTarget=null,y=Q}else for(A=0;A<u.length;A++){if(I=u[A],Q=I.instance,ae=I.currentTarget,I=I.listener,Q!==y&&h.isPropagationStopped())break e;y=I,h.currentTarget=ae;try{y(h)}catch(fe){Fc(fe)}h.currentTarget=null,y=Q}}}}function ht(t,a){var i=a[Dc];i===void 0&&(i=a[Dc]=new Set);var u=t+"__bubble";i.has(u)||(V0(a,t,2,!1),i.add(u))}function jm(t,a,i){var u=0;a&&(u|=4),V0(i,t,u,a)}var Mu="_reactListening"+Math.random().toString(36).slice(2);function wm(t){if(!t[Mu]){t[Mu]=!0,Db.forEach(function(i){i!=="selectionchange"&&(QE.has(i)||jm(i,!1,t),jm(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Mu]||(a[Mu]=!0,jm("selectionchange",!1,a))}}function V0(t,a,i,u){switch(x1(a)){case 2:var h=SN;break;case 8:h=CN;break;default:h=Im}i=h.bind(null,a,i,t),h=void 0,!qf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(h=!0),u?h!==void 0?t.addEventListener(a,i,{capture:!0,passive:h}):t.addEventListener(a,i,!0):h!==void 0?t.addEventListener(a,i,{passive:h}):t.addEventListener(a,i,!1)}function Sm(t,a,i,u,h){var y=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var A=u.tag;if(A===3||A===4){var I=u.stateNode.containerInfo;if(I===h)break;if(A===4)for(A=u.return;A!==null;){var Q=A.tag;if((Q===3||Q===4)&&A.stateNode.containerInfo===h)return;A=A.return}for(;I!==null;){if(A=So(I),A===null)return;if(Q=A.tag,Q===5||Q===6||Q===26||Q===27){u=y=A;continue e}I=I.parentNode}}u=u.return}Yb(function(){var ae=y,fe=Hf(i),xe=[];e:{var se=_v.get(t);if(se!==void 0){var ue=qc,He=t;switch(t){case"keypress":if(Hc(i)===0)break e;case"keydown":case"keyup":ue=qk;break;case"focusin":He="focus",ue=Yf;break;case"focusout":He="blur",ue=Yf;break;case"beforeblur":case"afterblur":ue=Yf;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Qb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Ak;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=Fk;break;case xv:case bv:case vv:ue=zk;break;case yv:ue=Xk;break;case"scroll":case"scrollend":ue=Rk;break;case"wheel":ue=Qk;break;case"copy":case"cut":case"paste":ue=Lk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Wb;break;case"toggle":case"beforetoggle":ue=Wk}var et=(a&4)!==0,It=!et&&(t==="scroll"||t==="scrollend"),te=et?se!==null?se+"Capture":null:se;et=[];for(var W=ae,ne;W!==null;){var he=W;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||te===null||(he=ql(W,te),he!=null&&et.push(ji(W,he,ne))),It)break;W=W.return}0<et.length&&(se=new ue(se,He,null,i,fe),xe.push({event:se,listeners:et}))}}if((a&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",se&&i!==Uf&&(He=i.relatedTarget||i.fromElement)&&(So(He)||He[zr]))break e;if((ue||se)&&(se=fe.window===fe?fe:(se=fe.ownerDocument)?se.defaultView||se.parentWindow:window,ue?(He=i.relatedTarget||i.toElement,ue=ae,He=He?So(He):null,He!==null&&(It=c(He),et=He.tag,He!==It||et!==5&&et!==27&&et!==6)&&(He=null)):(ue=null,He=ae),ue!==He)){if(et=Qb,he="onMouseLeave",te="onMouseEnter",W="mouse",(t==="pointerout"||t==="pointerover")&&(et=Wb,he="onPointerLeave",te="onPointerEnter",W="pointer"),It=ue==null?se:Vl(ue),ne=He==null?se:Vl(He),se=new et(he,W+"leave",ue,i,fe),se.target=It,se.relatedTarget=ne,he=null,So(fe)===ae&&(et=new et(te,W+"enter",He,i,fe),et.target=ne,et.relatedTarget=It,he=et),It=he,ue&&He)t:{for(et=ZE,te=ue,W=He,ne=0,he=te;he;he=et(he))ne++;he=0;for(var Ke=W;Ke;Ke=et(Ke))he++;for(;0<ne-he;)te=et(te),ne--;for(;0<he-ne;)W=et(W),he--;for(;ne--;){if(te===W||W!==null&&te===W.alternate){et=te;break t}te=et(te),W=et(W)}et=null}else et=null;ue!==null&&q0(xe,se,ue,et,!1),He!==null&&It!==null&&q0(xe,It,He,et,!0)}}e:{if(se=ae?Vl(ae):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var Ct=ov;else if(sv(se))if(lv)Ct=iE;else{Ct=oE;var qe=rE}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&Bf(ae.elementType)&&(Ct=ov):Ct=lE;if(Ct&&(Ct=Ct(t,ae))){rv(xe,Ct,i,fe);break e}qe&&qe(t,se,ae),t==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&If(se,"number",se.value)}switch(qe=ae?Vl(ae):window,t){case"focusin":(sv(qe)||qe.contentEditable==="true")&&(Oo=qe,Jf=ae,Zl=null);break;case"focusout":Zl=Jf=Oo=null;break;case"mousedown":ep=!0;break;case"contextmenu":case"mouseup":case"dragend":ep=!1,gv(xe,i,fe);break;case"selectionchange":if(uE)break;case"keydown":case"keyup":gv(xe,i,fe)}var ut;if(Kf)e:{switch(t){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else Mo?nv(t,i)&&(bt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(bt="onCompositionStart");bt&&(Jb&&i.locale!=="ko"&&(Mo||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Mo&&(ut=Xb()):(qs=fe,$f="value"in qs?qs.value:qs.textContent,Mo=!0)),qe=Ou(ae,bt),0<qe.length&&(bt=new Zb(bt,t,null,i,fe),xe.push({event:bt,listeners:qe}),ut?bt.data=ut:(ut=av(i),ut!==null&&(bt.data=ut)))),(ut=eE?tE(t,i):nE(t,i))&&(bt=Ou(ae,"onBeforeInput"),0<bt.length&&(qe=new Zb("onBeforeInput","beforeinput",null,i,fe),xe.push({event:qe,listeners:bt}),qe.data=ut)),YE(xe,t,ae,i,fe)}H0(xe,a)})}function ji(t,a,i){return{instance:t,listener:a,currentTarget:i}}function Ou(t,a){for(var i=a+"Capture",u=[];t!==null;){var h=t,y=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||y===null||(h=ql(t,i),h!=null&&u.unshift(ji(t,h,y)),h=ql(t,a),h!=null&&u.push(ji(t,h,y))),t.tag===3)return u;t=t.return}return[]}function ZE(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function q0(t,a,i,u,h){for(var y=a._reactName,A=[];i!==null&&i!==u;){var I=i,Q=I.alternate,ae=I.stateNode;if(I=I.tag,Q!==null&&Q===u)break;I!==5&&I!==26&&I!==27||ae===null||(Q=ae,h?(ae=ql(i,y),ae!=null&&A.unshift(ji(i,ae,Q))):h||(ae=ql(i,y),ae!=null&&A.push(ji(i,ae,Q)))),i=i.return}A.length!==0&&t.push({event:a,listeners:A})}var WE=/\r\n?/g,JE=/\u0000|\uFFFD/g;function $0(t){return(typeof t=="string"?t:""+t).replace(WE,`
49
+ `).replace(JE,"")}function G0(t,a){return a=$0(a),$0(t)===a}function Pt(t,a,i,u,h,y){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||Ro(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&Ro(t,""+u);break;case"className":Pc(t,"class",u);break;case"tabIndex":Pc(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Pc(t,i,u);break;case"style":Gb(t,u,y);break;case"data":if(a!=="object"){Pc(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||i!=="href")){t.removeAttribute(i);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Bc(""+u),t.setAttribute(i,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(i==="formAction"?(a!=="input"&&Pt(t,a,"name",h.name,h,null),Pt(t,a,"formEncType",h.formEncType,h,null),Pt(t,a,"formMethod",h.formMethod,h,null),Pt(t,a,"formTarget",h.formTarget,h,null)):(Pt(t,a,"encType",h.encType,h,null),Pt(t,a,"method",h.method,h,null),Pt(t,a,"target",h.target,h,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Bc(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=ds);break;case"onScroll":u!=null&&ht("scroll",t);break;case"onScrollEnd":u!=null&&ht("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(o(61));if(i=u.__html,i!=null){if(h.children!=null)throw Error(o(60));t.innerHTML=i}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}i=Bc(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""+u):t.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""):t.removeAttribute(i);break;case"capture":case"download":u===!0?t.setAttribute(i,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,u):t.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(i,u):t.removeAttribute(i);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(i):t.setAttribute(i,u);break;case"popover":ht("beforetoggle",t),ht("toggle",t),Lc(t,"popover",u);break;case"xlinkActuate":us(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":us(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":us(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":us(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":us(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":us(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":us(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":us(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":us(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Lc(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=Ek.get(i)||i,Lc(t,i,u))}}function Cm(t,a,i,u,h,y){switch(i){case"style":Gb(t,u,y);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(o(61));if(i=u.__html,i!=null){if(h.children!=null)throw Error(o(60));t.innerHTML=i}}break;case"children":typeof u=="string"?Ro(t,u):(typeof u=="number"||typeof u=="bigint")&&Ro(t,""+u);break;case"onScroll":u!=null&&ht("scroll",t);break;case"onScrollEnd":u!=null&&ht("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ds);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Lb.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(h=i.endsWith("Capture"),a=i.slice(2,h?i.length-7:void 0),y=t[gn]||null,y=y!=null?y[i]:null,typeof y=="function"&&t.removeEventListener(a,y,h),typeof u=="function")){typeof y!="function"&&y!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,h);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):Lc(t,i,u)}}}function Nn(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",t),ht("load",t);var u=!1,h=!1,y;for(y in i)if(i.hasOwnProperty(y)){var A=i[y];if(A!=null)switch(y){case"src":u=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,y,A,i,null)}}h&&Pt(t,a,"srcSet",i.srcSet,i,null),u&&Pt(t,a,"src",i.src,i,null);return;case"input":ht("invalid",t);var I=y=A=h=null,Q=null,ae=null;for(u in i)if(i.hasOwnProperty(u)){var fe=i[u];if(fe!=null)switch(u){case"name":h=fe;break;case"type":A=fe;break;case"checked":Q=fe;break;case"defaultChecked":ae=fe;break;case"value":y=fe;break;case"defaultValue":I=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(o(137,a));break;default:Pt(t,a,u,fe,i,null)}}Hb(t,y,I,Q,ae,A,h,!1);return;case"select":ht("invalid",t),u=A=y=null;for(h in i)if(i.hasOwnProperty(h)&&(I=i[h],I!=null))switch(h){case"value":y=I;break;case"defaultValue":A=I;break;case"multiple":u=I;default:Pt(t,a,h,I,i,null)}a=y,i=A,t.multiple=!!u,a!=null?No(t,!!u,a,!1):i!=null&&No(t,!!u,i,!0);return;case"textarea":ht("invalid",t),y=h=u=null;for(A in i)if(i.hasOwnProperty(A)&&(I=i[A],I!=null))switch(A){case"value":u=I;break;case"defaultValue":h=I;break;case"children":y=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(o(91));break;default:Pt(t,a,A,I,i,null)}qb(t,u,h,y);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(u=i[Q],u!=null))switch(Q){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Pt(t,a,Q,u,i,null)}return;case"dialog":ht("beforetoggle",t),ht("toggle",t),ht("cancel",t),ht("close",t);break;case"iframe":case"object":ht("load",t);break;case"video":case"audio":for(u=0;u<_i.length;u++)ht(_i[u],t);break;case"image":ht("error",t),ht("load",t);break;case"details":ht("toggle",t);break;case"embed":case"source":case"link":ht("error",t),ht("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in i)if(i.hasOwnProperty(ae)&&(u=i[ae],u!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,ae,u,i,null)}return;default:if(Bf(a)){for(fe in i)i.hasOwnProperty(fe)&&(u=i[fe],u!==void 0&&Cm(t,a,fe,u,i,void 0));return}}for(I in i)i.hasOwnProperty(I)&&(u=i[I],u!=null&&Pt(t,a,I,u,i,null))}function eN(t,a,i,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,y=null,A=null,I=null,Q=null,ae=null,fe=null;for(ue in i){var xe=i[ue];if(i.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":Q=xe;default:u.hasOwnProperty(ue)||Pt(t,a,ue,null,u,xe)}}for(var se in u){var ue=u[se];if(xe=i[se],u.hasOwnProperty(se)&&(ue!=null||xe!=null))switch(se){case"type":y=ue;break;case"name":h=ue;break;case"checked":ae=ue;break;case"defaultChecked":fe=ue;break;case"value":A=ue;break;case"defaultValue":I=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(o(137,a));break;default:ue!==xe&&Pt(t,a,se,ue,u,xe)}}Pf(t,A,I,Q,ae,fe,y,h);return;case"select":ue=A=I=se=null;for(y in i)if(Q=i[y],i.hasOwnProperty(y)&&Q!=null)switch(y){case"value":break;case"multiple":ue=Q;default:u.hasOwnProperty(y)||Pt(t,a,y,null,u,Q)}for(h in u)if(y=u[h],Q=i[h],u.hasOwnProperty(h)&&(y!=null||Q!=null))switch(h){case"value":se=y;break;case"defaultValue":I=y;break;case"multiple":A=y;default:y!==Q&&Pt(t,a,h,y,u,Q)}a=I,i=A,u=ue,se!=null?No(t,!!i,se,!1):!!u!=!!i&&(a!=null?No(t,!!i,a,!0):No(t,!!i,i?[]:"",!1));return;case"textarea":ue=se=null;for(I in i)if(h=i[I],i.hasOwnProperty(I)&&h!=null&&!u.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Pt(t,a,I,null,u,h)}for(A in u)if(h=u[A],y=i[A],u.hasOwnProperty(A)&&(h!=null||y!=null))switch(A){case"value":se=h;break;case"defaultValue":ue=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(o(91));break;default:h!==y&&Pt(t,a,A,h,u,y)}Vb(t,se,ue);return;case"option":for(var He in i)if(se=i[He],i.hasOwnProperty(He)&&se!=null&&!u.hasOwnProperty(He))switch(He){case"selected":t.selected=!1;break;default:Pt(t,a,He,null,u,se)}for(Q in u)if(se=u[Q],ue=i[Q],u.hasOwnProperty(Q)&&se!==ue&&(se!=null||ue!=null))switch(Q){case"selected":t.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Pt(t,a,Q,se,u,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var et in i)se=i[et],i.hasOwnProperty(et)&&se!=null&&!u.hasOwnProperty(et)&&Pt(t,a,et,null,u,se);for(ae in u)if(se=u[ae],ue=i[ae],u.hasOwnProperty(ae)&&se!==ue&&(se!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(o(137,a));break;default:Pt(t,a,ae,se,u,ue)}return;default:if(Bf(a)){for(var It in i)se=i[It],i.hasOwnProperty(It)&&se!==void 0&&!u.hasOwnProperty(It)&&Cm(t,a,It,void 0,u,se);for(fe in u)se=u[fe],ue=i[fe],!u.hasOwnProperty(fe)||se===ue||se===void 0&&ue===void 0||Cm(t,a,fe,se,u,ue);return}}for(var te in i)se=i[te],i.hasOwnProperty(te)&&se!=null&&!u.hasOwnProperty(te)&&Pt(t,a,te,null,u,se);for(xe in u)se=u[xe],ue=i[xe],!u.hasOwnProperty(xe)||se===ue||se==null&&ue==null||Pt(t,a,xe,se,u,ue)}function F0(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tN(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var h=i[u],y=h.transferSize,A=h.initiatorType,I=h.duration;if(y&&I&&F0(A)){for(A=0,I=h.responseEnd,u+=1;u<i.length;u++){var Q=i[u],ae=Q.startTime;if(ae>I)break;var fe=Q.transferSize,xe=Q.initiatorType;fe&&F0(xe)&&(Q=Q.responseEnd,A+=fe*(Q<I?1:(I-ae)/(Q-ae)))}if(--u,a+=8*(y+A)/(h.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var km=null,Em=null;function zu(t){return t.nodeType===9?t:t.ownerDocument}function Y0(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function X0(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Nm(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Rm=null;function nN(){var t=window.event;return t&&t.type==="popstate"?t===Rm?!1:(Rm=t,!0):(Rm=null,!1)}var K0=typeof setTimeout=="function"?setTimeout:void 0,aN=typeof clearTimeout=="function"?clearTimeout:void 0,Q0=typeof Promise=="function"?Promise:void 0,sN=typeof queueMicrotask=="function"?queueMicrotask:typeof Q0<"u"?function(t){return Q0.resolve(null).then(t).catch(rN)}:K0;function rN(t){setTimeout(function(){throw t})}function or(t){return t==="head"}function Z0(t,a){var i=a,u=0;do{var h=i.nextSibling;if(t.removeChild(i),h&&h.nodeType===8)if(i=h.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(h),ol(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")wi(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,wi(i);for(var y=i.firstChild;y;){var A=y.nextSibling,I=y.nodeName;y[Hl]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&y.rel.toLowerCase()==="stylesheet"||i.removeChild(y),y=A}}else i==="body"&&wi(t.ownerDocument.body);i=h}while(i);ol(a)}function W0(t,a){var i=t;t=0;do{var u=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),u&&u.nodeType===8)if(i=u.data,i==="/$"){if(t===0)break;t--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||t++;i=u}while(i)}function Tm(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Tm(i),Df(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function oN(t,a,i,u){for(;t.nodeType===1;){var h=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Hl])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var y=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Na(t.nextSibling),t===null)break}return null}function lN(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Na(t.nextSibling),t===null))return null;return t}function J0(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Na(t.nextSibling),t===null))return null;return t}function Am(t){return t.data==="$?"||t.data==="$~"}function Mm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function iN(t,a){var i=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||i.readyState!=="loading")a();else{var u=function(){a(),i.removeEventListener("DOMContentLoaded",u)};i.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Na(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var Om=null;function e1(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Na(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function t1(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return t;a--}else i!=="/$"&&i!=="/&"||a++}t=t.previousSibling}return null}function n1(t,a,i){switch(a=zu(i),t){case"html":if(t=a.documentElement,!t)throw Error(o(452));return t;case"head":if(t=a.head,!t)throw Error(o(453));return t;case"body":if(t=a.body,!t)throw Error(o(454));return t;default:throw Error(o(451))}}function wi(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Df(t)}var Ra=new Map,a1=new Set;function Du(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Es=$.d;$.d={f:cN,r:uN,D:dN,C:fN,L:pN,m:mN,X:hN,S:gN,M:xN};function cN(){var t=Es.f(),a=ku();return t||a}function uN(t){var a=Co(t);a!==null&&a.tag===5&&a.type==="form"?yy(a):Es.r(t)}var al=typeof document>"u"?null:document;function s1(t,a,i){var u=al;if(u&&typeof a=="string"&&a){var h=_a(a);h='link[rel="'+t+'"][href="'+h+'"]',typeof i=="string"&&(h+='[crossorigin="'+i+'"]'),a1.has(h)||(a1.add(h),t={rel:t,crossOrigin:i,href:a},u.querySelector(h)===null&&(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function dN(t){Es.D(t),s1("dns-prefetch",t,null)}function fN(t,a){Es.C(t,a),s1("preconnect",t,a)}function pN(t,a,i){Es.L(t,a,i);var u=al;if(u&&t&&a){var h='link[rel="preload"][as="'+_a(a)+'"]';a==="image"&&i&&i.imageSrcSet?(h+='[imagesrcset="'+_a(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(h+='[imagesizes="'+_a(i.imageSizes)+'"]')):h+='[href="'+_a(t)+'"]';var y=h;switch(a){case"style":y=sl(t);break;case"script":y=rl(t)}Ra.has(y)||(t=b({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Ra.set(y,t),u.querySelector(h)!==null||a==="style"&&u.querySelector(Si(y))||a==="script"&&u.querySelector(Ci(y))||(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function mN(t,a){Es.m(t,a);var i=al;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+_a(u)+'"][href="'+_a(t)+'"]',y=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=rl(t)}if(!Ra.has(y)&&(t=b({rel:"modulepreload",href:t},a),Ra.set(y,t),i.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ci(y)))return}u=i.createElement("link"),Nn(u,"link",t),jn(u),i.head.appendChild(u)}}}function gN(t,a,i){Es.S(t,a,i);var u=al;if(u&&t){var h=ko(u).hoistableStyles,y=sl(t);a=a||"default";var A=h.get(y);if(!A){var I={loading:0,preload:null};if(A=u.querySelector(Si(y)))I.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Ra.get(y))&&zm(t,i);var Q=A=u.createElement("link");jn(Q),Nn(Q,"link",t),Q._p=new Promise(function(ae,fe){Q.onload=ae,Q.onerror=fe}),Q.addEventListener("load",function(){I.loading|=1}),Q.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Lu(A,a,u)}A={type:"stylesheet",instance:A,count:1,state:I},h.set(y,A)}}}function hN(t,a){Es.X(t,a);var i=al;if(i&&t){var u=ko(i).hoistableScripts,h=rl(t),y=u.get(h);y||(y=i.querySelector(Ci(h)),y||(t=b({src:t,async:!0},a),(a=Ra.get(h))&&Dm(t,a),y=i.createElement("script"),jn(y),Nn(y,"link",t),i.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(h,y))}}function xN(t,a){Es.M(t,a);var i=al;if(i&&t){var u=ko(i).hoistableScripts,h=rl(t),y=u.get(h);y||(y=i.querySelector(Ci(h)),y||(t=b({src:t,async:!0,type:"module"},a),(a=Ra.get(h))&&Dm(t,a),y=i.createElement("script"),jn(y),Nn(y,"link",t),i.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(h,y))}}function r1(t,a,i,u){var h=(h=re.current)?Du(h):null;if(!h)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=sl(i.href),i=ko(h).hoistableStyles,u=i.get(a),u||(u={type:"style",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=sl(i.href);var y=ko(h).hoistableStyles,A=y.get(t);if(A||(h=h.ownerDocument||h,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,A),(y=h.querySelector(Si(t)))&&!y._p&&(A.instance=y,A.state.loading=5),Ra.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Ra.set(t,i),y||bN(h,t,i,A.state))),a&&u===null)throw Error(o(528,""));return A}if(a&&u!==null)throw Error(o(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=rl(i),i=ko(h).hoistableScripts,u=i.get(a),u||(u={type:"script",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function sl(t){return'href="'+_a(t)+'"'}function Si(t){return'link[rel="stylesheet"]['+t+"]"}function o1(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function bN(t,a,i,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Nn(a,"link",i),jn(a),t.head.appendChild(a))}function rl(t){return'[src="'+_a(t)+'"]'}function Ci(t){return"script[async]"+t}function l1(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+_a(i.href)+'"]');if(u)return a.instance=u,jn(u),u;var h=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),jn(u),Nn(u,"style",h),Lu(u,i.precedence,t),a.instance=u;case"stylesheet":h=sl(i.href);var y=t.querySelector(Si(h));if(y)return a.state.loading|=4,a.instance=y,jn(y),y;u=o1(i),(h=Ra.get(h))&&zm(u,h),y=(t.ownerDocument||t).createElement("link"),jn(y);var A=y;return A._p=new Promise(function(I,Q){A.onload=I,A.onerror=Q}),Nn(y,"link",u),a.state.loading|=4,Lu(y,i.precedence,t),a.instance=y;case"script":return y=rl(i.src),(h=t.querySelector(Ci(y)))?(a.instance=h,jn(h),h):(u=i,(h=Ra.get(y))&&(u=b({},i),Dm(u,h)),t=t.ownerDocument||t,h=t.createElement("script"),jn(h),Nn(h,"link",u),t.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(o(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Lu(u,i.precedence,t));return a.instance}function Lu(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=u.length?u[u.length-1]:null,y=h,A=0;A<u.length;A++){var I=u[A];if(I.dataset.precedence===a)y=I;else if(y!==h)break}y?y.parentNode.insertBefore(t,y.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function zm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function Dm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Pu=null;function i1(t,a,i){if(Pu===null){var u=new Map,h=Pu=new Map;h.set(i,u)}else h=Pu,u=h.get(i),u||(u=new Map,h.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),h=0;h<i.length;h++){var y=i[h];if(!(y[Hl]||y[Rt]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var A=y.getAttribute(a)||"";A=t+A;var I=u.get(A);I?I.push(y):u.set(A,[y])}}return u}function c1(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function vN(t,a,i){if(i===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return t=a.disabled,typeof a.precedence=="string"&&t==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function u1(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function yN(t,a,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var h=sl(u.href),y=a.querySelector(Si(h));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Iu.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=y,jn(y);return}y=a.ownerDocument||a,u=o1(u),(h=Ra.get(h))&&zm(u,h),y=y.createElement("link"),jn(y);var A=y;A._p=new Promise(function(I,Q){A.onload=I,A.onerror=Q}),Nn(y,"link",u),i.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=Iu.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var Lm=0;function _N(t,a){return t.stylesheets&&t.count===0&&Uu(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&Uu(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+a);0<t.imgBytes&&Lm===0&&(Lm=62500*tN());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Uu(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Lm?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(h)}}:null}function Iu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Uu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bu=null;function Uu(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bu=new Map,a.forEach(jN,t),Bu=null,Iu.call(t))}function jN(t,a){if(!(a.state.loading&4)){var i=Bu.get(t);if(i)var u=i.get(null);else{i=new Map,Bu.set(t,i);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<h.length;y++){var A=h[y];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(i.set(A.dataset.precedence,A),u=A)}u&&i.set(null,u)}h=a.instance,A=h.getAttribute("data-precedence"),y=i.get(A)||u,y===u&&i.set(null,h),i.set(A,h),this.count++,u=Iu.bind(this),h.addEventListener("load",u),h.addEventListener("error",u),y?y.parentNode.insertBefore(h,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),a.state.loading|=4}}var ki={$$typeof:R,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function wN(t,a,i,u,h,y,A,I,Q){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ia(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ia(0),this.hiddenUpdates=ia(null),this.identifierPrefix=u,this.onUncaughtError=h,this.onCaughtError=y,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function d1(t,a,i,u,h,y,A,I,Q,ae,fe,xe){return t=new wN(t,a,i,A,Q,ae,fe,xe,I),a=1,y===!0&&(a|=24),y=da(3,null,null,a),t.current=y,y.stateNode=t,a=gp(),a.refCount++,t.pooledCache=a,a.refCount++,y.memoizedState={element:u,isDehydrated:i,cache:a},vp(y),t}function f1(t){return t?(t=Lo,t):Lo}function p1(t,a,i,u,h,y){h=f1(h),u.context===null?u.context=h:u.pendingContext=h,u=Ks(a),u.payload={element:i},y=y===void 0?null:y,y!==null&&(u.callback=y),i=Qs(t,u,a),i!==null&&(ta(i,t,a),si(i,t,a))}function m1(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function Pm(t,a){m1(t,a),(t=t.alternate)&&m1(t,a)}function g1(t){if(t.tag===13||t.tag===31){var a=Br(t,67108864);a!==null&&ta(a,t,67108864),Pm(t,67108864)}}function h1(t){if(t.tag===13||t.tag===31){var a=ha();a=cs(a);var i=Br(t,a);i!==null&&ta(i,t,a),Pm(t,a)}}var Hu=!0;function SN(t,a,i,u){var h=V.T;V.T=null;var y=$.p;try{$.p=2,Im(t,a,i,u)}finally{$.p=y,V.T=h}}function CN(t,a,i,u){var h=V.T;V.T=null;var y=$.p;try{$.p=8,Im(t,a,i,u)}finally{$.p=y,V.T=h}}function Im(t,a,i,u){if(Hu){var h=Bm(u);if(h===null)Sm(t,a,u,Vu,i),b1(t,u);else if(EN(h,t,a,i,u))u.stopPropagation();else if(b1(t,u),a&4&&-1<kN.indexOf(t)){for(;h!==null;){var y=Co(h);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var A=an(y.pendingLanes);if(A!==0){var I=y;for(I.pendingLanes|=2,I.entangledLanes|=2;A;){var Q=1<<31-at(A);I.entanglements[1]|=Q,A&=~Q}Ka(y),(Et&6)===0&&(Su=ye()+500,yi(0))}}break;case 31:case 13:I=Br(y,2),I!==null&&ta(I,y,2),ku(),Pm(y,2)}if(y=Bm(u),y===null&&Sm(t,a,u,Vu,i),y===h)break;h=y}h!==null&&u.stopPropagation()}else Sm(t,a,u,null,i)}}function Bm(t){return t=Hf(t),Um(t)}var Vu=null;function Um(t){if(Vu=null,t=So(t),t!==null){var a=c(t);if(a===null)t=null;else{var i=a.tag;if(i===13){if(t=d(a),t!==null)return t;t=null}else if(i===31){if(t=f(a),t!==null)return t;t=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return Vu=t,null}function x1(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(le()){case _e:return 2;case Se:return 8;case Ue:case Je:return 32;case _t:return 268435456;default:return 32}default:return 32}}var Hm=!1,lr=null,ir=null,cr=null,Ei=new Map,Ni=new Map,ur=[],kN="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function b1(t,a){switch(t){case"focusin":case"focusout":lr=null;break;case"dragenter":case"dragleave":ir=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":Ei.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ni.delete(a.pointerId)}}function Ri(t,a,i,u,h,y){return t===null||t.nativeEvent!==y?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:y,targetContainers:[h]},a!==null&&(a=Co(a),a!==null&&g1(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,h!==null&&a.indexOf(h)===-1&&a.push(h),t)}function EN(t,a,i,u,h){switch(a){case"focusin":return lr=Ri(lr,t,a,i,u,h),!0;case"dragenter":return ir=Ri(ir,t,a,i,u,h),!0;case"mouseover":return cr=Ri(cr,t,a,i,u,h),!0;case"pointerover":var y=h.pointerId;return Ei.set(y,Ri(Ei.get(y)||null,t,a,i,u,h)),!0;case"gotpointercapture":return y=h.pointerId,Ni.set(y,Ri(Ni.get(y)||null,t,a,i,u,h)),!0}return!1}function v1(t){var a=So(t.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=d(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){h1(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){h1(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function qu(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=Bm(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);Uf=u,i.target.dispatchEvent(u),Uf=null}else return a=Co(i),a!==null&&g1(a),t.blockedOn=i,!1;a.shift()}return!0}function y1(t,a,i){qu(t)&&i.delete(a)}function NN(){Hm=!1,lr!==null&&qu(lr)&&(lr=null),ir!==null&&qu(ir)&&(ir=null),cr!==null&&qu(cr)&&(cr=null),Ei.forEach(y1),Ni.forEach(y1)}function $u(t,a){t.blockedOn===a&&(t.blockedOn=null,Hm||(Hm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,NN)))}var Gu=null;function _1(t){Gu!==t&&(Gu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Gu===t&&(Gu=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],h=t[a+2];if(typeof u!="function"){if(Um(u||i)===null)continue;break}var y=Co(i);y!==null&&(t.splice(a,3),a-=3,Bp(y,{pending:!0,data:h,method:i.method,action:u},u,h))}}))}function ol(t){function a(Q){return $u(Q,t)}lr!==null&&$u(lr,t),ir!==null&&$u(ir,t),cr!==null&&$u(cr,t),Ei.forEach(a),Ni.forEach(a);for(var i=0;i<ur.length;i++){var u=ur[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<ur.length&&(i=ur[0],i.blockedOn===null);)v1(i),i.blockedOn===null&&ur.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var h=i[u],y=i[u+1],A=h[gn]||null;if(typeof y=="function")A||_1(i);else if(A){var I=null;if(y&&y.hasAttribute("formAction")){if(h=y,A=y[gn]||null)I=A.formAction;else if(Um(h)!==null)continue}else I=A.action;typeof I=="function"?i[u+1]=I:(i.splice(u,3),u-=3),_1(i)}}}function j1(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(A){return h=A})},focusReset:"manual",scroll:"manual"})}function a(){h!==null&&(h(),h=null),u||setTimeout(i,20)}function i(){if(!u&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),h!==null&&(h(),h=null)}}}function Vm(t){this._internalRoot=t}Fu.prototype.render=Vm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(o(409));var i=a.current,u=ha();p1(i,u,t,a,null,null)},Fu.prototype.unmount=Vm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;p1(t.current,2,null,t,null,null),ku(),a[zr]=null}};function Fu(t){this._internalRoot=t}Fu.prototype.unstable_scheduleHydration=function(t){if(t){var a=Dt();t={blockedOn:null,target:t,priority:a};for(var i=0;i<ur.length&&a!==0&&a<ur[i].priority;i++);ur.splice(i,0,t),i===0&&v1(t)}};var w1=n.version;if(w1!=="19.2.7")throw Error(o(527,w1,"19.2.7"));$.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(o(188)):(t=Object.keys(t).join(","),Error(o(268,t)));return t=m(a),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var RN={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yu.isDisabled&&Yu.supportsFiber)try{ke=Yu.inject(RN),Re=Yu}catch{}}return Ai.createRoot=function(t,a){if(!l(t))throw Error(o(299));var i=!1,u="",h=Ty,y=Ay,A=My;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=d1(t,1,!1,null,null,i,u,null,h,y,A,j1),t[zr]=a.current,wm(t),new Vm(a)},Ai.hydrateRoot=function(t,a,i){if(!l(t))throw Error(o(299));var u=!1,h="",y=Ty,A=Ay,I=My,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(A=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),a=d1(t,1,!0,a,i??null,u,h,Q,y,A,I,j1),a.context=f1(null),i=a.current,u=ha(),u=cs(u),h=Ks(u),h.callback=null,Qs(i,h,u),i=u,a.current.lanes=i,Kn(a,i),Ka(a),t[zr]=a.current,wm(t),new Fu(a)},Ai.version="19.2.7",Ai}var O1;function UN(){if(O1)return Gm.exports;O1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Gm.exports=BN(),Gm.exports}var HN=UN();const VN=Qh(HN);/**
50
+ * react-router v7.17.0
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
+ */var z1="popstate";function D1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function qN(e={}){function n(o,l){let c=l.state?.masked,{pathname:d,search:f,hash:p}=c||o.location;return ih("",{pathname:d,search:f,hash:p},l.state&&l.state.usr||null,l.state&&l.state.key||"default",c?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function s(o,l){return typeof l=="string"?l:uc(l)}return GN(n,s,null,e)}function tn(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function $a(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function $N(){return Math.random().toString(36).substring(2,10)}function L1(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ih(e,n,s=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Tl(n):n,state:s,key:n&&n.key||o||$N(),mask:l}}function uc({pathname:e="/",search:n="",hash:s=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Tl(e){let n={};if(e){let s=e.indexOf("#");s>=0&&(n.hash=e.substring(s),e=e.substring(0,s));let o=e.indexOf("?");o>=0&&(n.search=e.substring(o),e=e.substring(0,o)),e&&(n.pathname=e)}return n}function GN(e,n,s,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,d=l.history,f="POP",p=null,m=g();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function g(){return(d.state||{idx:null}).idx}function b(){f="POP";let w=g(),k=w==null?null:w-m;m=w,p&&p({action:f,location:j.location,delta:k})}function v(w,k){f="PUSH";let E=D1(w)?w:ih(j.location,w,k);m=g()+1;let R=L1(E,m),N=j.createHref(E.mask||E);try{d.pushState(R,"",N)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;l.location.assign(N)}c&&p&&p({action:f,location:j.location,delta:1})}function S(w,k){f="REPLACE";let E=D1(w)?w:ih(j.location,w,k);m=g();let R=L1(E,m),N=j.createHref(E.mask||E);d.replaceState(R,"",N),c&&p&&p({action:f,location:j.location,delta:0})}function C(w){return FN(l,w)}let j={get action(){return f},get location(){return e(l,d)},listen(w){if(p)throw new Error("A history only accepts one active listener");return l.addEventListener(z1,b),p=w,()=>{l.removeEventListener(z1,b),p=null}},createHref(w){return n(l,w)},createURL:C,encodeLocation(w){let k=C(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:v,replace:S,go(w){return d.go(w)}};return j}function FN(e,n,s=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),tn(o,"No window.location.(origin|href) available to create URL");let l=typeof n=="string"?n:uc(n);return l=l.replace(/ $/,"%20"),!s&&l.startsWith("//")&&(l=o+l),new URL(l,o)}function dw(e,n,s="/"){return YN(e,n,s,!1)}function YN(e,n,s,o,l){let c=typeof n=="string"?Tl(n):n,d=Ls(c.pathname||"/",s);if(d==null)return null;let f=XN(e),p=null,m=oR(d);for(let g=0;p==null&&g<f.length;++g)p=sR(f[g],m,o);return p}function XN(e){let n=fw(e);return KN(n),n}function fw(e,n=[],s=[],o="",l=!1){let c=(d,f,p=l,m)=>{let g={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(o)&&p)return;tn(g.relativePath.startsWith(o),`Absolute route path "${g.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(o.length)}let b=qa([o,g.relativePath]),v=s.concat(g);d.children&&d.children.length>0&&(tn(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),fw(d.children,n,v,b,p)),!(d.path==null&&!d.index)&&n.push({path:b,score:nR(b,d.index),routesMeta:v})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let p of pw(d.path))c(d,f,!0,p)}),n}function pw(e){let n=e.split("/");if(n.length===0)return[];let[s,...o]=n,l=s.endsWith("?"),c=s.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let d=pw(o.join("/")),f=[];return f.push(...d.map(p=>p===""?c:[c,p].join("/"))),l&&f.push(...d),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function KN(e){e.sort((n,s)=>n.score!==s.score?s.score-n.score:aR(n.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var QN=/^:[\w-]+$/,ZN=3,WN=2,JN=1,eR=10,tR=-2,P1=e=>e==="*";function nR(e,n){let s=e.split("/"),o=s.length;return s.some(P1)&&(o+=tR),n&&(o+=WN),s.filter(l=>!P1(l)).reduce((l,c)=>l+(QN.test(c)?ZN:c===""?JN:eR),o)}function aR(e,n){return e.length===n.length&&e.slice(0,-1).every((o,l)=>o===n[l])?e[e.length-1]-n[n.length-1]:0}function sR(e,n,s=!1){let{routesMeta:o}=e,l={},c="/",d=[];for(let f=0;f<o.length;++f){let p=o[f],m=f===o.length-1,g=c==="/"?n:n.slice(c.length)||"/",b=Ed({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},g),v=p.route;if(!b&&m&&s&&!o[o.length-1].route.index&&(b=Ed({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!b)return null;Object.assign(l,b.params),d.push({params:l,pathname:qa([c,b.pathname]),pathnameBase:uR(qa([c,b.pathnameBase])),route:v}),b.pathnameBase!=="/"&&(c=qa([c,b.pathnameBase]))}return d}function Ed(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,o]=rR(e.path,e.caseSensitive,e.end),l=n.match(s);if(!l)return null;let c=l[0],d=c.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:o.reduce((m,{paramName:g,isOptional:b},v)=>{if(g==="*"){let C=f[v]||"";d=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const S=f[v];return b&&!S?m[g]=void 0:m[g]=(S||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function rR(e,n=!1,s=!0){$a(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 o=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,p,m,g)=>{if(o.push({paramName:f,isOptional:p!=null}),p){let b=g.charAt(m+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),o]}function oR(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return $a(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Ls(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let s=n.endsWith("/")?n.length-1:n.length,o=e.charAt(s);return o&&o!=="/"?null:e.slice(s)||"/"}var lR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function iR(e,n="/"){let{pathname:s,search:o="",hash:l=""}=typeof e=="string"?Tl(e):e,c;return s?(s=gw(s),s.startsWith("/")?c=I1(s.substring(1),"/"):c=I1(s,n)):c=n,{pathname:c,search:dR(o),hash:fR(l)}}function I1(e,n){let s=Nd(n).split("/");return e.split("/").forEach(l=>{l===".."?s.length>1&&s.pop():l!=="."&&s.push(l)}),s.length>1?s.join("/"):"/"}function Km(e,n,s,o){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function cR(e){return e.filter((n,s)=>s===0||n.route.path&&n.route.path.length>0)}function mw(e){let n=cR(e);return n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase)}function Zh(e,n,s,o=!1){let l;typeof e=="string"?l=Tl(e):(l={...e},tn(!l.pathname||!l.pathname.includes("?"),Km("?","pathname","search",l)),tn(!l.pathname||!l.pathname.includes("#"),Km("#","pathname","hash",l)),tn(!l.search||!l.search.includes("#"),Km("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,f;if(d==null)f=s;else{let b=n.length-1;if(!o&&d.startsWith("..")){let v=d.split("/");for(;v[0]==="..";)v.shift(),b-=1;l.pathname=v.join("/")}f=b>=0?n[b]:"/"}let p=iR(l,f),m=d&&d!=="/"&&d.endsWith("/"),g=(c||d===".")&&s.endsWith("/");return!p.pathname.endsWith("/")&&(m||g)&&(p.pathname+="/"),p}var gw=e=>e.replace(/\/\/+/g,"/"),qa=e=>gw(e.join("/")),Nd=e=>e.replace(/\/+$/,""),uR=e=>Nd(e).replace(/^\/*/,"/"),dR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,fR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,pR=class{constructor(e,n,s,o=!1){this.status=e,this.statusText=n||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function mR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function gR(e){let n=e.map(s=>s.route.path).filter(Boolean);return qa(n)||"/"}var hw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xw(e,n){let s=e;if(typeof s!="string"||!lR.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,l=!1;if(hw)try{let c=new URL(window.location.href),d=s.startsWith("//")?new URL(c.protocol+s):new URL(s),f=Ls(d.pathname,n);d.origin===c.origin&&f!=null?s=f+d.search+d.hash:l=!0}catch{$a(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var bw=["POST","PUT","PATCH","DELETE"];new Set(bw);var hR=["GET",...bw];new Set(hR);var Al=x.createContext(null);Al.displayName="DataRouter";var tf=x.createContext(null);tf.displayName="DataRouterState";var vw=x.createContext(!1);function xR(){return x.useContext(vw)}var yw=x.createContext({isTransitioning:!1});yw.displayName="ViewTransition";var bR=x.createContext(new Map);bR.displayName="Fetchers";var vR=x.createContext(null);vR.displayName="Await";var Da=x.createContext(null);Da.displayName="Navigation";var Cc=x.createContext(null);Cc.displayName="Location";var ss=x.createContext({outlet:null,matches:[],isDataRoute:!1});ss.displayName="Route";var Wh=x.createContext(null);Wh.displayName="RouteError";var _w="REACT_ROUTER_ERROR",yR="REDIRECT",_R="ROUTE_ERROR_RESPONSE";function jR(e){if(e.startsWith(`${_w}:${yR}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function wR(e){if(e.startsWith(`${_w}:${_R}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new pR(n.status,n.statusText,n.data)}catch{}}function SR(e,{relative:n}={}){tn(kc(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=x.useContext(Da),{hash:l,pathname:c,search:d}=Ec(e,{relative:n}),f=c;return s!=="/"&&(f=c==="/"?s:qa([s,c])),o.createHref({pathname:f,search:d,hash:l})}function kc(){return x.useContext(Cc)!=null}function oa(){return tn(kc(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Cc).location}var jw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ww(e){x.useContext(Da).static||x.useLayoutEffect(e)}function La(){let{isDataRoute:e}=x.useContext(ss);return e?PR():CR()}function CR(){tn(kc(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Al),{basename:n,navigator:s}=x.useContext(Da),{matches:o}=x.useContext(ss),{pathname:l}=oa(),c=JSON.stringify(mw(o)),d=x.useRef(!1);return ww(()=>{d.current=!0}),x.useCallback((p,m={})=>{if($a(d.current,jw),!d.current)return;if(typeof p=="number"){s.go(p);return}let g=Zh(p,JSON.parse(c),l,m.relative==="path");e==null&&n!=="/"&&(g.pathname=g.pathname==="/"?n:qa([n,g.pathname])),(m.replace?s.replace:s.push)(g,m.state,m)},[n,s,c,l,e])}x.createContext(null);function Sw(){let{matches:e}=x.useContext(ss);return e[e.length-1]?.params??{}}function Ec(e,{relative:n}={}){let{matches:s}=x.useContext(ss),{pathname:o}=oa(),l=JSON.stringify(mw(s));return x.useMemo(()=>Zh(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function kR(e,n){return Cw(e,n)}function Cw(e,n,s){tn(kc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(Da),{matches:l}=x.useContext(ss),c=l[l.length-1],d=c?c.params:{},f=c?c.pathname:"/",p=c?c.pathnameBase:"/",m=c&&c.route;{let w=m&&m.path||"";Ew(f,!m||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let g=oa(),b;if(n){let w=typeof n=="string"?Tl(n):n;tn(p==="/"||w.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=g;let v=b.pathname||"/",S=v;if(p!=="/"){let w=p.replace(/^\//,"").split("/");S="/"+v.replace(/^\//,"").split("/").slice(w.length).join("/")}let C=s&&s.state.matches.length?s.state.matches.map(w=>Object.assign(w,{route:s.manifest[w.route.id]||w.route})):dw(e,{pathname:S});$a(m||C!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),$a(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=AR(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:qa([p,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?p:qa([p,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),l,s);return n&&j?x.createElement(Cc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},j):j}function ER(){let e=LR(),n=mR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:c},"ErrorBoundary")," or"," ",x.createElement("code",{style:c},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},n),s?x.createElement("pre",{style:l},s):null,d)}var NR=x.createElement(ER,null),kw=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const s=wR(e.digest);s&&(e=s)}let n=e!==void 0?x.createElement(ss.Provider,{value:this.props.routeContext},x.createElement(Wh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(RR,{error:e},n):n}};kw.contextType=vw;var Qm=new WeakMap;function RR({children:e,error:n}){let{basename:s}=x.useContext(Da);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=jR(n.digest);if(o){let l=Qm.get(n);if(l)throw l;let c=xw(o.location,s);if(hw&&!Qm.get(n))if(c.isExternal||o.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Qm.set(n,d),d}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function TR({routeContext:e,match:n,children:s}){let o=x.useContext(Al);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(ss.Provider,{value:e},s)}function AR(e,n=[],s){let o=s?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o?.errors;if(c!=null){let g=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);tn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,g+1))}let d=!1,f=-1;if(s&&o){d=o.renderFallback;for(let g=0;g<l.length;g++){let b=l[g];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(f=g),b.route.id){let{loaderData:v,errors:S}=o,C=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||C){s.isStatic&&(d=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let p=s?.onError,m=o&&p?(g,b)=>{p(g,{location:o.location,params:o.matches?.[0]?.params??{},pattern:gR(o.matches),errorInfo:b})}:void 0;return l.reduceRight((g,b,v)=>{let S,C=!1,j=null,w=null;o&&(S=c&&b.route.id?c[b.route.id]:void 0,j=b.route.errorElement||NR,d&&(f<0&&v===0?(Ew("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,w=null):f===v&&(C=!0,w=b.route.hydrateFallbackElement||null)));let k=n.concat(l.slice(0,v+1)),E=()=>{let R;return S?R=j:C?R=w:b.route.Component?R=x.createElement(b.route.Component,null):b.route.element?R=b.route.element:R=g,x.createElement(TR,{match:b,routeContext:{outlet:g,matches:k,isDataRoute:o!=null},children:R})};return o&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?x.createElement(kw,{location:o.location,revalidation:o.revalidation,component:j,error:S,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Jh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function MR(e){let n=x.useContext(Al);return tn(n,Jh(e)),n}function OR(e){let n=x.useContext(tf);return tn(n,Jh(e)),n}function zR(e){let n=x.useContext(ss);return tn(n,Jh(e)),n}function ex(e){let n=zR(e),s=n.matches[n.matches.length-1];return tn(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function DR(){return ex("useRouteId")}function LR(){let e=x.useContext(Wh),n=OR("useRouteError"),s=ex("useRouteError");return e!==void 0?e:n.errors?.[s]}function PR(){let{router:e}=MR("useNavigate"),n=ex("useNavigate"),s=x.useRef(!1);return ww(()=>{s.current=!0}),x.useCallback(async(l,c={})=>{$a(s.current,jw),s.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...c}))},[e,n])}var B1={};function Ew(e,n,s){!n&&!B1[e]&&(B1[e]=!0,$a(!1,s))}x.memo(IR);function IR({routes:e,manifest:n,future:s,state:o,isStatic:l,onError:c}){return Cw(e,void 0,{manifest:n,state:o,isStatic:l,onError:c})}function $t(e){tn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function BR({basename:e="/",children:n=null,location:s,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:d}){tn(!kc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=x.useMemo(()=>({basename:f,navigator:l,static:c,useTransitions:d,future:{}}),[f,l,c,d]);typeof s=="string"&&(s=Tl(s));let{pathname:m="/",search:g="",hash:b="",state:v=null,key:S="default",mask:C}=s,j=x.useMemo(()=>{let w=Ls(m,f);return w==null?null:{location:{pathname:w,search:g,hash:b,state:v,key:S,mask:C},navigationType:o}},[f,m,g,b,v,S,o,C]);return $a(j!=null,`<Router basename="${f}"> is not able to match the URL "${m}${g}${b}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Da.Provider,{value:p},x.createElement(Cc.Provider,{children:n,value:j}))}function Nw({children:e,location:n}){return kR(ch(e),n)}function ch(e,n=[]){let s=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...n,l];if(o.type===x.Fragment){s.push.apply(s,ch(o.props.children,c));return}tn(o.type===$t,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),tn(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||c.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=ch(o.props.children,c)),s.push(d)}),s}var xd="get",bd="application/x-www-form-urlencoded";function nf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function UR(e){return nf(e)&&e.tagName.toLowerCase()==="button"}function HR(e){return nf(e)&&e.tagName.toLowerCase()==="form"}function VR(e){return nf(e)&&e.tagName.toLowerCase()==="input"}function qR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $R(e,n){return e.button===0&&(!n||n==="_self")&&!qR(e)}function uh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,s)=>{let o=e[s];return n.concat(Array.isArray(o)?o.map(l=>[s,l]):[[s,o]])},[]))}function GR(e,n){let s=uh(e);return n&&n.forEach((o,l)=>{s.has(l)||n.getAll(l).forEach(c=>{s.append(l,c)})}),s}var Xu=null;function FR(){if(Xu===null)try{new FormData(document.createElement("form"),0),Xu=!1}catch{Xu=!0}return Xu}var YR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zm(e){return e!=null&&!YR.has(e)?($a(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${bd}"`),null):e}function XR(e,n){let s,o,l,c,d;if(HR(e)){let f=e.getAttribute("action");o=f?Ls(f,n):null,s=e.getAttribute("method")||xd,l=Zm(e.getAttribute("enctype"))||bd,c=new FormData(e)}else if(UR(e)||VR(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||f.getAttribute("action");if(o=p?Ls(p,n):null,s=e.getAttribute("formmethod")||f.getAttribute("method")||xd,l=Zm(e.getAttribute("formenctype"))||Zm(f.getAttribute("enctype"))||bd,c=new FormData(f,e),!FR()){let{name:m,type:g,value:b}=e;if(g==="image"){let v=m?`${m}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else m&&c.append(m,b)}}else{if(nf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=xd,o=null,l=bd,d=e}return c&&l==="text/plain"&&(d=c,c=void 0),{action:o,method:s.toLowerCase(),encType:l,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function tx(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Rw(e,n,s,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:n&&Ls(l.pathname,n)==="/"?l.pathname=`${Nd(n)}/_root.${o}`:l.pathname=`${Nd(l.pathname)}.${o}`,l}async function KR(e,n){if(e.id in n)return n[e.id];try{let s=await import(e.module);return n[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function QR(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function ZR(e,n,s){let o=await Promise.all(e.map(async l=>{let c=n.routes[l.route.id];if(c){let d=await KR(c,s);return d.links?d.links():[]}return[]}));return tT(o.flat(1).filter(QR).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function U1(e,n,s,o,l,c){let d=(p,m)=>s[m]?p.route.id!==s[m].route.id:!0,f=(p,m)=>s[m].pathname!==p.pathname||s[m].route.path?.endsWith("*")&&s[m].params["*"]!==p.params["*"];return c==="assets"?n.filter((p,m)=>d(p,m)||f(p,m)):c==="data"?n.filter((p,m)=>{let g=o.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(d(p,m)||f(p,m))return!0;if(p.route.shouldRevalidate){let b=p.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function WR(e,n,{includeHydrateFallback:s}={}){return JR(e.map(o=>{let l=n.routes[o.route.id];if(!l)return[];let c=[l.module];return l.clientActionModule&&(c=c.concat(l.clientActionModule)),l.clientLoaderModule&&(c=c.concat(l.clientLoaderModule)),s&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function JR(e){return[...new Set(e)]}function eT(e){let n={},s=Object.keys(e).sort();for(let o of s)n[o]=e[o];return n}function tT(e,n){let s=new Set;return new Set(n),e.reduce((o,l)=>{let c=JSON.stringify(eT(l));return s.has(c)||(s.add(c),o.push({key:c,link:l})),o},[])}function nx(){let e=x.useContext(Al);return tx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function nT(){let e=x.useContext(tf);return tx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ax=x.createContext(void 0);ax.displayName="FrameworkContext";function sx(){let e=x.useContext(ax);return tx(e,"You must render this element inside a <HydratedRouter> element"),e}function aT(e,n){let s=x.useContext(ax),[o,l]=x.useState(!1),[c,d]=x.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:m,onMouseLeave:g,onTouchStart:b}=n,v=x.useRef(null);x.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let j=k=>{k.forEach(E=>{d(E.isIntersecting)})},w=new IntersectionObserver(j,{threshold:.5});return v.current&&w.observe(v.current),()=>{w.disconnect()}}},[e]),x.useEffect(()=>{if(o){let j=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(j)}}},[o]);let S=()=>{l(!0)},C=()=>{l(!1),d(!1)};return s?e!=="intent"?[c,v,{}]:[c,v,{onFocus:Mi(f,S),onBlur:Mi(p,C),onMouseEnter:Mi(m,S),onMouseLeave:Mi(g,C),onTouchStart:Mi(b,S)}]:[!1,v,{}]}function Mi(e,n){return s=>{e&&e(s),s.defaultPrevented||n(s)}}function sT({page:e,...n}){let s=xR(),{router:o}=nx(),l=x.useMemo(()=>dw(o.routes,e,o.basename),[o.routes,e,o.basename]);return l?s?x.createElement(oT,{page:e,matches:l,...n}):x.createElement(lT,{page:e,matches:l,...n}):null}function rT(e){let{manifest:n,routeModules:s}=sx(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return ZR(e,n,s).then(d=>{c||l(d)}),()=>{c=!0}},[e,n,s]),o}function oT({page:e,matches:n,...s}){let o=oa(),{future:l}=sx(),{basename:c}=nx(),d=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let f=Rw(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let g of n)typeof g.route.shouldRevalidate=="function"?p=!0:m.push(g.route.id);return p&&m.length>0&&f.searchParams.set("_routes",m.join(",")),[f.pathname+f.search]},[c,l.v8_trailingSlashAwareDataRequests,e,o,n]);return x.createElement(x.Fragment,null,d.map(f=>x.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...s})))}function lT({page:e,matches:n,...s}){let o=oa(),{future:l,manifest:c,routeModules:d}=sx(),{basename:f}=nx(),{loaderData:p,matches:m}=nT(),g=x.useMemo(()=>U1(e,n,m,c,o,"data"),[e,n,m,c,o]),b=x.useMemo(()=>U1(e,n,m,c,o,"assets"),[e,n,m,c,o]),v=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let j=new Set,w=!1;if(n.forEach(E=>{let R=c.routes[E.route.id];!R||!R.hasLoader||(!g.some(N=>N.route.id===E.route.id)&&E.route.id in p&&d[E.route.id]?.shouldRevalidate||R.hasClientLoader?w=!0:j.add(E.route.id))}),j.size===0)return[];let k=Rw(e,f,l.v8_trailingSlashAwareDataRequests,"data");return w&&j.size>0&&k.searchParams.set("_routes",n.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[f,l.v8_trailingSlashAwareDataRequests,p,o,c,g,n,e,d]),S=x.useMemo(()=>WR(b,c),[b,c]),C=rT(b);return x.createElement(x.Fragment,null,v.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...s})),S.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...s})),C.map(({key:j,link:w})=>x.createElement("link",{key:j,nonce:s.nonce,...w,crossOrigin:w.crossOrigin??s.crossOrigin})))}function iT(...e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}var cT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{cT&&(window.__reactRouterVersion="7.17.0")}catch{}function uT({basename:e,children:n,useTransitions:s,window:o}){let l=x.useRef();l.current==null&&(l.current=qN({window:o,v5Compat:!0}));let c=l.current,[d,f]=x.useState({action:c.action,location:c.location}),p=x.useCallback(m=>{s===!1?f(m):x.startTransition(()=>f(m))},[s]);return x.useLayoutEffect(()=>c.listen(p),[c,p]),x.createElement(BR,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:s})}var Tw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rx=x.forwardRef(function({onClick:n,discover:s="render",prefetch:o="none",relative:l,reloadDocument:c,replace:d,mask:f,state:p,target:m,to:g,preventScrollReset:b,viewTransition:v,defaultShouldRevalidate:S,...C},j){let{basename:w,navigator:k,useTransitions:E}=x.useContext(Da),R=typeof g=="string"&&Tw.test(g),N=xw(g,w);g=N.to;let T=SR(g,{relative:l}),M=oa(),O=null;if(f){let Y=Zh(f,[],M.mask?M.mask.pathname:"/",!0);w!=="/"&&(Y.pathname=Y.pathname==="/"?w:qa([w,Y.pathname])),O=k.createHref(Y)}let[P,B,L]=aT(o,C),D=pT(g,{replace:d,mask:f,state:p,target:m,preventScrollReset:b,relative:l,viewTransition:v,defaultShouldRevalidate:S,useTransitions:E});function z(Y){n&&n(Y),Y.defaultPrevented||D(Y)}let H=!(N.isExternal||c),q=x.createElement("a",{...C,...L,href:(H?O:void 0)||N.absoluteURL||T,onClick:H?z:n,ref:iT(j,B),target:m,"data-discover":!R&&s==="render"?"true":void 0});return P&&!R?x.createElement(x.Fragment,null,q,x.createElement(sT,{page:T})):q});rx.displayName="Link";var Aw=x.forwardRef(function({"aria-current":n="page",caseSensitive:s=!1,className:o="",end:l=!1,style:c,to:d,viewTransition:f,children:p,...m},g){let b=Ec(d,{relative:m.relative}),v=oa(),S=x.useContext(tf),{navigator:C,basename:j}=x.useContext(Da),w=S!=null&&bT(b)&&f===!0,k=C.encodeLocation?C.encodeLocation(b).pathname:b.pathname,E=v.pathname,R=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(E=E.toLowerCase(),R=R?R.toLowerCase():null,k=k.toLowerCase()),R&&j&&(R=Ls(R,j)||R);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let T=E===k||!l&&E.startsWith(k)&&E.charAt(N)==="/",M=R!=null&&(R===k||!l&&R.startsWith(k)&&R.charAt(k.length)==="/"),O={isActive:T,isPending:M,isTransitioning:w},P=T?n:void 0,B;typeof o=="function"?B=o(O):B=[o,T?"active":null,M?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(O):c;return x.createElement(rx,{...m,"aria-current":P,className:B,ref:g,style:L,to:d,viewTransition:f},typeof p=="function"?p(O):p)});Aw.displayName="NavLink";var dT=x.forwardRef(({discover:e="render",fetcherKey:n,navigate:s,reloadDocument:o,replace:l,state:c,method:d=xd,action:f,onSubmit:p,relative:m,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v,...S},C)=>{let{useTransitions:j}=x.useContext(Da),w=hT(),k=xT(f,{relative:m}),E=d.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&Tw.test(f),N=T=>{if(p&&p(T),T.defaultPrevented)return;T.preventDefault();let M=T.nativeEvent.submitter,O=M?.getAttribute("formmethod")||d,P=()=>w(M||T.currentTarget,{fetcherKey:n,method:O,navigate:s,replace:l,state:c,relative:m,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v});j&&s!==!1?x.startTransition(()=>P()):P()};return x.createElement("form",{ref:C,method:E,action:k,onSubmit:o?p:N,...S,"data-discover":!R&&e==="render"?"true":void 0})});dT.displayName="Form";function fT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mw(e){let n=x.useContext(Al);return tn(n,fT(e)),n}function pT(e,{target:n,replace:s,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p,useTransitions:m}={}){let g=La(),b=oa(),v=Ec(e,{relative:d});return x.useCallback(S=>{if($R(S,n)){S.preventDefault();let C=s!==void 0?s:uc(b)===uc(v),j=()=>g(e,{replace:C,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p});m?x.startTransition(()=>j()):j()}},[b,g,v,s,o,l,n,e,c,d,f,p,m])}function Ow(e){$a(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=x.useRef(uh(e)),s=x.useRef(!1),o=oa(),l=x.useMemo(()=>GR(o.search,s.current?null:n.current),[o.search]),c=La(),d=x.useCallback((f,p)=>{const m=uh(typeof f=="function"?f(new URLSearchParams(l)):f);s.current=!0,c("?"+m,p)},[c,l]);return[l,d]}var mT=0,gT=()=>`__${String(++mT)}__`;function hT(){let{router:e}=Mw("useSubmit"),{basename:n}=x.useContext(Da),s=DR(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,d={})=>{let{action:f,method:p,encType:m,formData:g,body:b}=XR(c,n);if(d.navigate===!1){let v=d.fetcherKey||gT();await o(v,s,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:b,formMethod:d.method||p,formEncType:d.encType||m,flushSync:d.flushSync})}else await l(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:b,formMethod:d.method||p,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,l,n,s])}function xT(e,{relative:n}={}){let{basename:s}=x.useContext(Da),o=x.useContext(ss);tn(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Ec(e||".",{relative:n})},d=oa();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),p=f.getAll("index");if(p.some(g=>g==="")){f.delete("index"),p.filter(b=>b).forEach(b=>f.append("index",b));let g=f.toString();c.search=g?`?${g}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:qa([s,c.pathname])),uc(c)}function bT(e,{relative:n}={}){let s=x.useContext(yw);tn(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Mw("useViewTransitionState"),l=Ec(e,{relative:n});if(!s.isTransitioning)return!1;let c=Ls(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Ls(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Ed(l.pathname,d)!=null||Ed(l.pathname,c)!=null}var Er=uw();/**
61
+ * @license lucide-react v0.469.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const vT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zw=(...e)=>e.filter((n,s,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===s).join(" ").trim();/**
66
+ * @license lucide-react v0.469.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var yT={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"};/**
71
+ * @license lucide-react v0.469.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const _T=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},p)=>x.createElement("svg",{ref:p,...yT,width:n,height:n,stroke:e,strokeWidth:o?Number(s)*24/Number(n):s,className:zw("lucide",l),...f},[...d.map(([m,g])=>x.createElement(m,g)),...Array.isArray(c)?c:[c]]));/**
76
+ * @license lucide-react v0.469.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const je=(e,n)=>{const s=x.forwardRef(({className:o,...l},c)=>x.createElement(_T,{ref:c,iconNode:n,className:zw(`lucide-${vT(e)}`,o),...l}));return s.displayName=`${e}`,s};/**
81
+ * @license lucide-react v0.469.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Dw=je("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.469.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const Lw=je("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/**
91
+ * @license lucide-react v0.469.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const jT=je("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
+ * @license lucide-react v0.469.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const Pw=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
101
+ * @license lucide-react v0.469.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const Iw=je("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
106
+ * @license lucide-react v0.469.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const wT=je("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
111
+ * @license lucide-react v0.469.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const yn=je("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
116
+ * @license lucide-react v0.469.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const ST=je("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
121
+ * @license lucide-react v0.469.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const CT=je("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
126
+ * @license lucide-react v0.469.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const Rd=je("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
131
+ * @license lucide-react v0.469.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const dc=je("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
136
+ * @license lucide-react v0.469.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const xo=je("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
141
+ * @license lucide-react v0.469.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const af=je("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
146
+ * @license lucide-react v0.469.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Bw=je("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
151
+ * @license lucide-react v0.469.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const kT=je("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
156
+ * @license lucide-react v0.469.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const ox=je("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
161
+ * @license lucide-react v0.469.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const ET=je("CircleX",[["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"}]]);/**
166
+ * @license lucide-react v0.469.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const NT=je("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
171
+ * @license lucide-react v0.469.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const RT=je("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
176
+ * @license lucide-react v0.469.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const TT=je("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
181
+ * @license lucide-react v0.469.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const Td=je("Copy",[["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"}]]);/**
186
+ * @license lucide-react v0.469.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const AT=je("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
191
+ * @license lucide-react v0.469.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const MT=je("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
196
+ * @license lucide-react v0.469.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const lx=je("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
201
+ * @license lucide-react v0.469.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const Ps=je("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
206
+ * @license lucide-react v0.469.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const Uw=je("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
211
+ * @license lucide-react v0.469.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const OT=je("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
216
+ * @license lucide-react v0.469.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const zT=je("EyeOff",[["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"}]]);/**
221
+ * @license lucide-react v0.469.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const sf=je("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
226
+ * @license lucide-react v0.469.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const DT=je("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
231
+ * @license lucide-react v0.469.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const Ad=je("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
236
+ * @license lucide-react v0.469.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const LT=je("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
241
+ * @license lucide-react v0.469.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const PT=je("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
246
+ * @license lucide-react v0.469.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const IT=je("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
251
+ * @license lucide-react v0.469.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const BT=je("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
256
+ * @license lucide-react v0.469.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const UT=je("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
261
+ * @license lucide-react v0.469.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const Hw=je("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
266
+ * @license lucide-react v0.469.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const HT=je("FolderGit2",[["path",{d:"M9 20H4a2 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.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
271
+ * @license lucide-react v0.469.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const Vw=je("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
276
+ * @license lucide-react v0.469.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const qw=je("FolderOpen",[["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"}]]);/**
281
+ * @license lucide-react v0.469.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const $w=je("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
286
+ * @license lucide-react v0.469.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const VT=je("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
291
+ * @license lucide-react v0.469.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const rf=je("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
296
+ * @license lucide-react v0.469.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const qT=je("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
301
+ * @license lucide-react v0.469.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const ix=je("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
306
+ * @license lucide-react v0.469.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const $T=je("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
311
+ * @license lucide-react v0.469.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const GT=je("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
316
+ * @license lucide-react v0.469.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const vl=je("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
321
+ * @license lucide-react v0.469.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const FT=je("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
326
+ * @license lucide-react v0.469.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const YT=je("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
331
+ * @license lucide-react v0.469.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const XT=je("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
336
+ * @license lucide-react v0.469.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const dh=je("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
341
+ * @license lucide-react v0.469.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const KT=je("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
346
+ * @license lucide-react v0.469.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const QT=je("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
351
+ * @license lucide-react v0.469.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const ZT=je("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
356
+ * @license lucide-react v0.469.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const WT=je("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
361
+ * @license lucide-react v0.469.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const of=je("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
366
+ * @license lucide-react v0.469.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const Gw=je("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
371
+ * @license lucide-react v0.469.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const Fw=je("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
376
+ * @license lucide-react v0.469.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const nc=je("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
381
+ * @license lucide-react v0.469.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const JT=je("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
386
+ * @license lucide-react v0.469.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const eA=je("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
391
+ * @license lucide-react v0.469.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const tA=je("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
396
+ * @license lucide-react v0.469.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const nA=je("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
401
+ * @license lucide-react v0.469.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const aA=je("Palette",[["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:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
406
+ * @license lucide-react v0.469.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const Yw=je("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
411
+ * @license lucide-react v0.469.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const sA=je("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
416
+ * @license lucide-react v0.469.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const Ml=je("Pencil",[["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"}]]);/**
421
+ * @license lucide-react v0.469.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const cx=je("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
426
+ * @license lucide-react v0.469.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const rA=je("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
431
+ * @license lucide-react v0.469.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const un=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
436
+ * @license lucide-react v0.469.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const fh=je("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
441
+ * @license lucide-react v0.469.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const oA=je("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
446
+ * @license lucide-react v0.469.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const Nr=je("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
451
+ * @license lucide-react v0.469.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const ux=je("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
456
+ * @license lucide-react v0.469.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const lf=je("Save",[["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"}]]);/**
461
+ * @license lucide-react v0.469.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const Md=je("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
466
+ * @license lucide-react v0.469.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const vd=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
471
+ * @license lucide-react v0.469.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const rs=je("Send",[["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"}]]);/**
476
+ * @license lucide-react v0.469.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const Xw=je("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
481
+ * @license lucide-react v0.469.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const lA=je("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
486
+ * @license lucide-react v0.469.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */const Od=je("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
491
+ * @license lucide-react v0.469.0 - ISC
492
+ *
493
+ * This source code is licensed under the ISC license.
494
+ * See the LICENSE file in the root directory of this source tree.
495
+ */const iA=je("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
496
+ * @license lucide-react v0.469.0 - ISC
497
+ *
498
+ * This source code is licensed under the ISC license.
499
+ * See the LICENSE file in the root directory of this source tree.
500
+ */const Ol=je("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
501
+ * @license lucide-react v0.469.0 - ISC
502
+ *
503
+ * This source code is licensed under the ISC license.
504
+ * See the LICENSE file in the root directory of this source tree.
505
+ */const cA=je("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
506
+ * @license lucide-react v0.469.0 - ISC
507
+ *
508
+ * This source code is licensed under the ISC license.
509
+ * See the LICENSE file in the root directory of this source tree.
510
+ */const Kw=je("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
511
+ * @license lucide-react v0.469.0 - ISC
512
+ *
513
+ * This source code is licensed under the ISC license.
514
+ * See the LICENSE file in the root directory of this source tree.
515
+ */const uA=je("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
516
+ * @license lucide-react v0.469.0 - ISC
517
+ *
518
+ * This source code is licensed under the ISC license.
519
+ * See the LICENSE file in the root directory of this source tree.
520
+ */const Sr=je("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
521
+ * @license lucide-react v0.469.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */const la=je("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
526
+ * @license lucide-react v0.469.0 - ISC
527
+ *
528
+ * This source code is licensed under the ISC license.
529
+ * See the LICENSE file in the root directory of this source tree.
530
+ */const Qw=je("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
531
+ * @license lucide-react v0.469.0 - ISC
532
+ *
533
+ * This source code is licensed under the ISC license.
534
+ * See the LICENSE file in the root directory of this source tree.
535
+ */const dA=je("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
536
+ * @license lucide-react v0.469.0 - ISC
537
+ *
538
+ * This source code is licensed under the ISC license.
539
+ * See the LICENSE file in the root directory of this source tree.
540
+ */const Zw=je("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
541
+ * @license lucide-react v0.469.0 - ISC
542
+ *
543
+ * This source code is licensed under the ISC license.
544
+ * See the LICENSE file in the root directory of this source tree.
545
+ */const fA=je("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
546
+ * @license lucide-react v0.469.0 - ISC
547
+ *
548
+ * This source code is licensed under the ISC license.
549
+ * See the LICENSE file in the root directory of this source tree.
550
+ */const zl=je("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
551
+ * @license lucide-react v0.469.0 - ISC
552
+ *
553
+ * This source code is licensed under the ISC license.
554
+ * See the LICENSE file in the root directory of this source tree.
555
+ */const bo=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
556
+ * @license lucide-react v0.469.0 - ISC
557
+ *
558
+ * This source code is licensed under the ISC license.
559
+ * See the LICENSE file in the root directory of this source tree.
560
+ */const fc=je("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),cf={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Rn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},dx=["total","automatico","permiso"],H1=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],pA={icon:{light:"/logo/logo_only_white.webp",dark:"/logo/logo_only_dark.webp"},full:{light:"/logo/logo_white.webp",dark:"/logo/logo_dark.webp"},vertical:{light:"/logo/logo_vertical_white.webp",dark:"/logo/logo_vertical_dark.webp"}};function mA(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Rn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const Ww=x.createContext(null);function gA({children:e}){const[n,s]=x.useState(mA);x.useEffect(()=>{document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Rn.theme,n)}catch{}},[n]);const o=x.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),l=x.useMemo(()=>({theme:n,toggle:o,set:s}),[n,o]);return r.jsx(Ww.Provider,{value:l,children:e})}function fx(){const e=x.useContext(Ww);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const hA=1367/458,xA=735/1016;function bA({size:e=32,title:n="APX",variant:s="icon"}){const{theme:o}=fx(),l=pA[s][o];if(s==="full"){const c=e,d=Math.round(e*hA);return r.jsx("img",{src:l,alt:n,width:d,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,d=Math.round(e/xA);return r.jsx("img",{src:l,alt:n,width:c,height:d,className:"block object-contain",draggable:!1})}return r.jsx("img",{src:l,alt:n,width:e,height:e,className:"block object-contain",draggable:!1})}function Jw(e){var n,s,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(n=0;n<l;n++)e[n]&&(s=Jw(e[n]))&&(o&&(o+=" "),o+=s)}else for(s in e)e[s]&&(o&&(o+=" "),o+=s);return o}function px(){for(var e,n,s=0,o="",l=arguments.length;s<l;s++)(e=arguments[s])&&(n=Jw(e))&&(o&&(o+=" "),o+=n);return o}const mx="-",vA=e=>{const n=_A(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:d=>{const f=d.split(mx);return f[0]===""&&f.length!==1&&f.shift(),eS(f,n)||yA(d)},getConflictingClassGroupIds:(d,f)=>{const p=s[d]||[];return f&&o[d]?[...p,...o[d]]:p}}},eS=(e,n)=>{if(e.length===0)return n.classGroupId;const s=e[0],o=n.nextPart.get(s),l=o?eS(e.slice(1),o):void 0;if(l)return l;if(n.validators.length===0)return;const c=e.join(mx);return n.validators.find(({validator:d})=>d(c))?.classGroupId},V1=/^\[(.+)\]$/,yA=e=>{if(V1.test(e)){const n=V1.exec(e)[1],s=n?.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},_A=e=>{const{theme:n,prefix:s}=e,o={nextPart:new Map,validators:[]};return wA(Object.entries(e.classGroups),s).forEach(([c,d])=>{ph(d,o,c,n)}),o},ph=(e,n,s,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?n:q1(n,l);c.classGroupId=s;return}if(typeof l=="function"){if(jA(l)){ph(l(o),n,s,o);return}n.validators.push({validator:l,classGroupId:s});return}Object.entries(l).forEach(([c,d])=>{ph(d,q1(n,c),s,o)})})},q1=(e,n)=>{let s=e;return n.split(mx).forEach(o=>{s.nextPart.has(o)||s.nextPart.set(o,{nextPart:new Map,validators:[]}),s=s.nextPart.get(o)}),s},jA=e=>e.isThemeGetter,wA=(e,n)=>n?e.map(([s,o])=>{const l=o.map(c=>typeof c=="string"?n+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,f])=>[n+d,f])):c);return[s,l]}):e,SA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,s=new Map,o=new Map;const l=(c,d)=>{s.set(c,d),n++,n>e&&(n=0,o=s,s=new Map)};return{get(c){let d=s.get(c);if(d!==void 0)return d;if((d=o.get(c))!==void 0)return l(c,d),d},set(c,d){s.has(c)?s.set(c,d):l(c,d)}}},tS="!",CA=e=>{const{separator:n,experimentalParseClassName:s}=e,o=n.length===1,l=n[0],c=n.length,d=f=>{const p=[];let m=0,g=0,b;for(let w=0;w<f.length;w++){let k=f[w];if(m===0){if(k===l&&(o||f.slice(w,w+c)===n)){p.push(f.slice(g,w)),g=w+c;continue}if(k==="/"){b=w;continue}}k==="["?m++:k==="]"&&m--}const v=p.length===0?f:f.substring(g),S=v.startsWith(tS),C=S?v.substring(1):v,j=b&&b>g?b-g:void 0;return{modifiers:p,hasImportantModifier:S,baseClassName:C,maybePostfixModifierPosition:j}};return s?f=>s({className:f,parseClassName:d}):d},kA=e=>{if(e.length<=1)return e;const n=[];let s=[];return e.forEach(o=>{o[0]==="["?(n.push(...s.sort(),o),s=[]):s.push(o)}),n.push(...s.sort()),n},EA=e=>({cache:SA(e.cacheSize),parseClassName:CA(e),...vA(e)}),NA=/\s+/,RA=(e,n)=>{const{parseClassName:s,getClassGroupId:o,getConflictingClassGroupIds:l}=n,c=[],d=e.trim().split(NA);let f="";for(let p=d.length-1;p>=0;p-=1){const m=d[p],{modifiers:g,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:S}=s(m);let C=!!S,j=o(C?v.substring(0,S):v);if(!j){if(!C){f=m+(f.length>0?" "+f:f);continue}if(j=o(v),!j){f=m+(f.length>0?" "+f:f);continue}C=!1}const w=kA(g).join(":"),k=b?w+tS:w,E=k+j;if(c.includes(E))continue;c.push(E);const R=l(j,C);for(let N=0;N<R.length;++N){const T=R[N];c.push(k+T)}f=m+(f.length>0?" "+f:f)}return f};function TA(){let e=0,n,s,o="";for(;e<arguments.length;)(n=arguments[e++])&&(s=nS(n))&&(o&&(o+=" "),o+=s);return o}const nS=e=>{if(typeof e=="string")return e;let n,s="";for(let o=0;o<e.length;o++)e[o]&&(n=nS(e[o]))&&(s&&(s+=" "),s+=n);return s};function AA(e,...n){let s,o,l,c=d;function d(p){const m=n.reduce((g,b)=>b(g),e());return s=EA(m),o=s.cache.get,l=s.cache.set,c=f,f(p)}function f(p){const m=o(p);if(m)return m;const g=RA(p,s);return l(p,g),g}return function(){return c(TA.apply(null,arguments))}}const Kt=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},aS=/^\[(?:([a-z-]+):)?(.+)\]$/i,MA=/^\d+\/\d+$/,OA=new Set(["px","full","screen"]),zA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DA=/\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$/,LA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,IA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ns=e=>pl(e)||OA.has(e)||MA.test(e),fr=e=>Dl(e,"length",FA),pl=e=>!!e&&!Number.isNaN(Number(e)),Wm=e=>Dl(e,"number",pl),Oi=e=>!!e&&Number.isInteger(Number(e)),BA=e=>e.endsWith("%")&&pl(e.slice(0,-1)),dt=e=>aS.test(e),pr=e=>zA.test(e),UA=new Set(["length","size","percentage"]),HA=e=>Dl(e,UA,sS),VA=e=>Dl(e,"position",sS),qA=new Set(["image","url"]),$A=e=>Dl(e,qA,XA),GA=e=>Dl(e,"",YA),zi=()=>!0,Dl=(e,n,s)=>{const o=aS.exec(e);return o?o[1]?typeof n=="string"?o[1]===n:n.has(o[1]):s(o[2]):!1},FA=e=>DA.test(e)&&!LA.test(e),sS=()=>!1,YA=e=>PA.test(e),XA=e=>IA.test(e),KA=()=>{const e=Kt("colors"),n=Kt("spacing"),s=Kt("blur"),o=Kt("brightness"),l=Kt("borderColor"),c=Kt("borderRadius"),d=Kt("borderSpacing"),f=Kt("borderWidth"),p=Kt("contrast"),m=Kt("grayscale"),g=Kt("hueRotate"),b=Kt("invert"),v=Kt("gap"),S=Kt("gradientColorStops"),C=Kt("gradientColorStopPositions"),j=Kt("inset"),w=Kt("margin"),k=Kt("opacity"),E=Kt("padding"),R=Kt("saturate"),N=Kt("scale"),T=Kt("sepia"),M=Kt("skew"),O=Kt("space"),P=Kt("translate"),B=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",dt,n],z=()=>[dt,n],H=()=>["",Ns,fr],q=()=>["auto",pl,dt],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",dt],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[pl,dt];return{cacheSize:500,separator:":",theme:{colors:[zi],spacing:[Ns,fr],blur:["none","",pr,dt],brightness:U(),borderColor:[e],borderRadius:["none","","full",pr,dt],borderSpacing:z(),borderWidth:H(),contrast:U(),grayscale:G(),hueRotate:U(),invert:G(),gap:z(),gradientColorStops:[e],gradientColorStopPositions:[BA,fr],inset:D(),margin:D(),opacity:U(),padding:z(),saturate:U(),scale:U(),sepia:G(),skew:U(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[pr]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"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"],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:[...Y(),dt]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Oi,dt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Oi,dt]}],"grid-cols":[{"grid-cols":[zi]}],"col-start-end":[{col:["auto",{span:["full",Oi,dt]},dt]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[zi]}],"row-start-end":[{row:["auto",{span:[Oi,dt]},dt]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dt,n]}],"min-w":[{"min-w":[dt,n,"min","max","fit"]}],"max-w":[{"max-w":[dt,n,"none","full","min","max","fit","prose",{screen:[pr]},pr]}],h:[{h:[dt,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dt,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dt,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dt,n,"auto","min","max","fit"]}],"font-size":[{text:["base",pr,fr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wm]}],"font-family":[{font:[zi]}],"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:["tighter","tight","normal","wide","wider","widest",dt]}],"line-clamp":[{"line-clamp":["none",pl,Wm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ns,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ns,fr]}],"underline-offset":[{"underline-offset":["auto",Ns,dt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),VA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",HA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$A]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:V()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-b":[{"border-b":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Ns,dt]}],"outline-w":[{outline:[Ns,fr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Ns,fr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",pr,GA]}],"shadow-color":[{shadow:[zi]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[o]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",pr,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[b]}],saturate:[{saturate:[R]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[Oi,dt]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ns,fr,Wm]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},rS=AA(KA);function Me(...e){return rS(px(e))}const $1={};function va(e,n){const s=x.useRef($1);return s.current===$1&&(s.current=e(n)),s}const mh=[];let gh;function QA(){return gh}function ZA(e){mh.push(e)}function oS(e){const n=(s,o)=>{const l=va(JA).current;let c;try{gh=l;for(const d of mh)d.before(l);c=e(s,o);for(const d of mh)d.after(l);l.didInitialize=!0}finally{gh=void 0}return c};return n.displayName=e.displayName||e.name,n}function WA(e){return x.forwardRef(oS(e))}function JA(){return{didInitialize:!1}}function gx(e){const n=x.useRef(!0);n.current&&(n.current=!1,e())}const eM=()=>{},Oe=typeof document<"u"?x.useLayoutEffect:eM;function tM(e,n){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(d=>c.searchParams.append("args[]",d)),`${n} error #${o}; visit ${c} for the full message.`}}const On=tM("https://base-ui.com/production-error","Base UI"),lS=x.createContext(void 0);function Nc(e){const n=x.useContext(lS);if(n===void 0&&!e)throw new Error(On(72));return n}const nM=[];function hx(e){x.useEffect(e,nM)}const Di=0;class Ga{static create(){return new Ga}currentId=Di;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Di,s()},n)}isStarted(){return this.currentId!==Di}clear=()=>{this.currentId!==Di&&(clearTimeout(this.currentId),this.currentId=Di)};disposeEffect=()=>this.clear}function aa(){const e=va(Ga.create).current;return hx(e.disposeEffect),e}const Ll=typeof navigator<"u",Jm=sM(),iS=oM(),cS=rM(),xx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),uS=Jm.platform==="MacIntel"&&Jm.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Jm.platform),dS=Ll&&/apple/i.test(navigator.vendor),hh=Ll&&/android/i.test(iS)||/android/i.test(cS),aM=Ll&&iS.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,fS=cS.includes("jsdom/");function sM(){if(!Ll)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function rM(){if(!Ll)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:n,version:s})=>`${n}/${s}`).join(" "):navigator.userAgent}function oM(){if(!Ll)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function xa(e){e.preventDefault(),e.stopPropagation()}function lM(e){return"nativeEvent"in e}function bx(e){return e.pointerType===""&&e.isTrusted?!0:hh&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function pS(e){return fS?!1:!hh&&e.width===0&&e.height===0||hh&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function io(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function iM(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}function uf(){return typeof window<"u"}function Vn(e){return vx(e)?(e.nodeName||"").toLowerCase():"#document"}function Qt(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function os(e){var n;return(n=(vx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function vx(e){return uf()?e instanceof Node||e instanceof Qt(e).Node:!1}function ft(e){return uf()?e instanceof Element||e instanceof Qt(e).Element:!1}function Gt(e){return uf()?e instanceof HTMLElement||e instanceof Qt(e).HTMLElement:!1}function yl(e){return!uf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qt(e).ShadowRoot}function Rr(e){const{overflow:n,overflowX:s,overflowY:o,display:l}=ra(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+s)&&l!=="inline"&&l!=="contents"}function cM(e){return/^(table|td|th)$/.test(Vn(e))}function df(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uM=/transform|translate|scale|rotate|perspective|filter/,dM=/paint|layout|strict|content/,Wr=e=>!!e&&e!=="none";let eg;function yx(e){const n=ft(e)?ra(e):e;return Wr(n.transform)||Wr(n.translate)||Wr(n.scale)||Wr(n.rotate)||Wr(n.perspective)||!ff()&&(Wr(n.backdropFilter)||Wr(n.filter))||uM.test(n.willChange||"")||dM.test(n.contain||"")}function fM(e){let n=Is(e);for(;Gt(n)&&!zs(n);){if(yx(n))return n;if(df(n))return null;n=Is(n)}return null}function ff(){return eg==null&&(eg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),eg}function zs(e){return/^(html|body|#document)$/.test(Vn(e))}function ra(e){return Qt(e).getComputedStyle(e)}function pf(e){return ft(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Is(e){if(Vn(e)==="html")return e;const n=e.assignedSlot||e.parentNode||yl(e)&&e.host||os(e);return yl(n)?n.host:n}function mS(e){const n=Is(e);return zs(n)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(n)&&Rr(n)?n:mS(n)}function pc(e,n,s){var o;n===void 0&&(n=[]),s===void 0&&(s=!0);const l=mS(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),d=Qt(l);if(c){const f=xh(d);return n.concat(d,d.visualViewport||[],Rr(l)?l:[],f&&s?pc(f):[])}else return n.concat(l,pc(l,[],s))}function xh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const bh="data-base-ui-focusable",gS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",yr="ArrowLeft",_r="ArrowRight",_x="ArrowUp",Rc="ArrowDown";function In(e){let n=e.activeElement;for(;n?.shadowRoot?.activeElement!=null;)n=n.shadowRoot.activeElement;return n}function Ze(e,n){if(!e||!n)return!1;const s=n.getRootNode?.();if(e.contains(n))return!0;if(s&&yl(s)){let o=n;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Tn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function zd(e,n){if(!ft(e))return!1;const s=e;if(n.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,o]of n.entries())if(Ze(o,s))return!o.hasAttribute("data-trigger-disabled");return!1}function tg(e,n){if(n==null)return!1;if("composedPath"in e)return e.composedPath().includes(n);const s=e;return s.target!=null&&n.contains(s.target)}function pM(e){return e.matches("html,body")}function mf(e){return Gt(e)&&e.matches(gS)}function mM(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${gS}`)!=null}function vh(e){return e?e.getAttribute("role")==="combobox"&&mf(e):!1}function gM(e){if(!e||fS)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Dd(e){return e?e.hasAttribute(bh)?e:e.querySelector(`[${bh}]`)||e:null}function hM(e,n){return n!=null&&!io(n)?0:typeof e=="function"?e():e}function Ld(e,n,s){const o=hM(e,s);return typeof o=="number"?o:o?.[n]}function G1(e){return typeof e=="function"?e():e}function hS(e,n){return n||e==="click"||e==="mousedown"}function xM(e){return e?.includes("mouse")&&e!=="mousedown"}function Un(){}const mc=Object.freeze([]),cn=Object.freeze({}),Bs="none",gc="trigger-press",$n="trigger-hover",yd="trigger-focus",jx="outside-press",ng="item-press",bM="close-press",gf="focus-out",wx="escape-key",F1="list-navigation",vM="cancel-open",xS="disabled",Y1="missing",X1="initial",bS="imperative-action",yM="window-resize";function lt(e,n,s,o){let l=!1,c=!1;const d=o??cn;return{reason:e,event:n??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:s,...d}}const vS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ga,currentIdRef:{current:null},currentContextRef:{current:null}});function _M(e){const{children:n,delay:s,timeoutMs:o=0}=e,l=x.useRef(s),c=x.useRef(s),d=x.useRef(null),f=x.useRef(null),p=aa();return r.jsx(vS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:d,timeoutMs:o,currentContextRef:f,timeout:p}),[o,p]),children:n})}function jM(e,n={open:!1}){const{open:s}=n,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(vS),{currentIdRef:d,delayRef:f,timeoutMs:p,initialDelayRef:m,currentContextRef:g,hasProvider:b,timeout:v}=c,[S,C]=x.useState(!1);return Oe(()=>{function j(){C(!1),g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,f.current=m.current}if(d.current&&!s&&d.current===l){if(C(!1),p){const w=l;return v.start(p,()=>{o.select("open")||d.current&&d.current!==w||j()}),()=>{v.clear()}}j()}},[s,l,d,f,p,m,g,v,o]),Oe(()=>{if(!s)return;const j=g.current,w=d.current;v.clear(),g.current={onOpenChange:o.setOpen,setIsInstantPhase:C},d.current=l,f.current={open:0,close:Ld(m.current,"close")},w!==null&&w!==l?(C(!0),j?.setIsInstantPhase(!0),j?.onOpenChange(!1,lt(Bs))):(C(!1),j?.setIsInstantPhase(!1))},[s,l,o,d,f,m,g,v]),Oe(()=>()=>{g.current=null},[g]),x.useMemo(()=>({hasProvider:b,delayRef:f,isInstantPhase:S}),[b,f,S])}function pt(e,n,s,o){return e.addEventListener(n,s,o),()=>{e.removeEventListener(n,s,o)}}function ns(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function Us(e,n,s,o){const l=va(yS).current;return SM(l,e,n,s,o)&&_S(l,[e,n,s,o]),l.callback}function wM(e){const n=va(yS).current;return CM(n,e)&&_S(n,e),n.callback}function yS(){return{callback:null,cleanup:null,refs:[]}}function SM(e,n,s,o,l){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==o||e.refs[3]!==l}function CM(e,n){return e.refs.length!==n.length||e.refs.some((s,o)=>s!==n[o])}function _S(e,n){if(e.refs=n,n.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const o=Array(n.length).fill(null);for(let l=0;l<n.length;l+=1){const c=n[l];if(c!=null)switch(typeof c){case"function":{const d=c(s);typeof d=="function"&&(o[l]=d);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let l=0;l<n.length;l+=1){const c=n[l];if(c!=null)switch(typeof c){case"function":{const d=o[l];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function mn(e){const n=va(kM,e).current;return n.next=e,Oe(n.effect),n}function kM(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Sx={...DN},ag=Sx.useInsertionEffect,EM=ag&&ag!==Sx.useLayoutEffect?ag:e=>e();function Le(e){const n=va(NM).current;return n.next=e,EM(n.effect),n.trampoline}function NM(){const e={next:void 0,callback:RM,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function RM(){}const Ku=null;class TM{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const s=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<s.length;l+=1)s[l]?.(n)};request(n){const s=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(n){const s=n-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const Qu=new TM;class Wa{static create(){return new Wa}static request(n){return Qu.request(n)}static cancel(n){return Qu.cancel(n)}currentId=Ku;request(n){this.cancel(),this.currentId=Qu.request(()=>{this.currentId=Ku,n()})}cancel=()=>{this.currentId!==Ku&&(Qu.cancel(this.currentId),this.currentId=Ku)};disposeEffect=()=>this.cancel}function _l(){const e=va(Wa.create).current;return hx(e.disposeEffect),e}function yt(e){return e?.ownerDocument||document}const jS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Cx={...jS,position:"fixed",top:0,left:0},wS={...jS,position:"absolute"},Pd=x.forwardRef(function(n,s){const[o,l]=x.useState();Oe(()=>{dS&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...n,ref:s,style:Cx,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),AM=["top","right","bottom","left"],jl=Math.min,ba=Math.max,Id=Math.round,ao=Math.floor,as=e=>({x:e,y:e}),MM={left:"right",right:"left",bottom:"top",top:"bottom"};function yh(e,n,s){return ba(e,jl(n,s))}function Hs(e,n){return typeof e=="function"?e(n):e}function sa(e){return e.split("-")[0]}function Tr(e){return e.split("-")[1]}function kx(e){return e==="x"?"y":"x"}function Ex(e){return e==="y"?"height":"width"}function Aa(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function Nx(e){return kx(Aa(e))}function OM(e,n,s){s===void 0&&(s=!1);const o=Tr(e),l=Nx(e),c=Ex(l);let d=l==="x"?o===(s?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=Bd(d)),[d,Bd(d)]}function zM(e){const n=Bd(e);return[_h(e),n,_h(n)]}function _h(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const K1=["left","right"],Q1=["right","left"],DM=["top","bottom"],LM=["bottom","top"];function PM(e,n,s){switch(e){case"top":case"bottom":return s?n?Q1:K1:n?K1:Q1;case"left":case"right":return n?DM:LM;default:return[]}}function IM(e,n,s,o){const l=Tr(e);let c=PM(sa(e),s==="start",o);return l&&(c=c.map(d=>d+"-"+l),n&&(c=c.concat(c.map(_h)))),c}function Bd(e){const n=sa(e);return MM[n]+e.slice(n.length)}function BM(e){return{top:0,right:0,bottom:0,left:0,...e}}function SS(e){return typeof e!="number"?BM(e):{top:e,right:e,bottom:e,left:e}}function hc(e){const{x:n,y:s,width:o,height:l}=e;return{width:o,height:l,top:s,left:n,right:n+o,bottom:s+l,x:n,y:s}}function Zu(e,n,s){return Math.floor(e/n)!==s}function xc(e,n){return n<0||n>=e.length}function _d(e,n){return Pn(e.current,{disabledIndices:n})}function jh(e,n){return Pn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function Pn(e,{startingIndex:n=-1,decrement:s=!1,disabledIndices:o,amount:l=1}={}){let c=n;do c+=s?-l:l;while(c>=0&&c<=e.length-1&&Ds(e,c,o));return c}function CS(e,{event:n,orientation:s,loopFocus:o,onLoop:l,rtl:c,cols:d,disabledIndices:f,minIndex:p,maxIndex:m,prevIndex:g,stopEvent:b=!1}){let v=g,S;if(n.key===_x?S="up":n.key===Rc&&(S="down"),S){const C=[],j=[];let w=!1,k=0;{let B=null,L=-1;e.forEach((D,z)=>{if(D==null)return;k+=1;const H=D.closest('[role="row"]');H&&(w=!0),(H!==B||L===-1)&&(B=H,L+=1,C[L]=[]),C[L].push(z),j[z]=L})}let E=!1,R=0;if(w)for(const B of C){const L=B.length;L>R&&(R=L),L!==d&&(E=!0)}const N=E&&k<e.length,T=R||d,M=B=>{if(!E||g===-1)return;const L=j[g];if(L==null)return;const D=C[L].indexOf(g),z=B==="up"?-1:1;for(let H=L+z,q=0;q<C.length;q+=1,H+=z){if(H<0||H>=C.length){if(!o||N)return;if(H=H<0?C.length-1:0,l){const V=Math.min(D,C[H].length-1),$=C[H][V]??C[H][0],Z=l(n,g,$);H=j[Z]??H}}const Y=C[H];for(let V=Math.min(D,Y.length-1);V>=0;V-=1){const $=Y[V];if(!Ds(e,$,f))return $}}},O=B=>{if(!N||g===-1)return;const L=g%T,D=B==="up"?-T:T,z=m-m%T,H=ao(m/T)+1;for(let q=g-L+D,Y=0;Y<H;Y+=1,q+=D){if(q<0||q>m){if(!o)return;q=q<0?z:0}const V=Math.min(q+T-1,m);for(let $=Math.min(q+L,V);$>=q;$-=1)if(!Ds(e,$,f))return $}};b&&xa(n);const P=M(S)??O(S);if(P!==void 0)v=P;else if(g===-1)v=S==="up"?m:p;else if(v=Pn(e,{startingIndex:g,amount:T,decrement:S==="up",disabledIndices:f}),o){if(S==="up"&&(g-T<p||v<0)){const B=g%T,L=m%T,D=m-(L-B);L===B?v=m:v=L>B?D:D-T,l&&(v=l(n,g,v))}S==="down"&&g+T>m&&(v=Pn(e,{startingIndex:g%T-T,amount:T,disabledIndices:f}),l&&(v=l(n,g,v)))}xc(e,v)&&(v=g)}if(s==="both"){const C=ao(g/d);n.key===(c?yr:_r)&&(b&&xa(n),g%d!==d-1?(v=Pn(e,{startingIndex:g,disabledIndices:f}),o&&Zu(v,d,C)&&(v=Pn(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v)))):o&&(v=Pn(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v))),Zu(v,d,C)&&(v=g)),n.key===(c?_r:yr)&&(b&&xa(n),g%d!==0?(v=Pn(e,{startingIndex:g,decrement:!0,disabledIndices:f}),o&&Zu(v,d,C)&&(v=Pn(e,{startingIndex:g+(d-g%d),decrement:!0,disabledIndices:f}),l&&(v=l(n,g,v)))):o&&(v=Pn(e,{startingIndex:g+(d-g%d),decrement:!0,disabledIndices:f}),l&&(v=l(n,g,v))),Zu(v,d,C)&&(v=g));const j=ao(m/d)===C;xc(e,v)&&(o&&j?(v=n.key===(c?_r:yr)?m:Pn(e,{startingIndex:g-g%d-1,disabledIndices:f}),l&&(v=l(n,g,v))):v=g)}return v}function kS(e,n,s){const o=[];let l=0;return e.forEach(({width:c,height:d},f)=>{let p=!1;for(s&&(l=0);!p;){const m=[];for(let g=0;g<c;g+=1)for(let b=0;b<d;b+=1)m.push(l+g+b*n);l%n+c<=n&&m.every(g=>o[g]==null)?(m.forEach(g=>{o[g]=f}),p=!0):l+=1}}),[...o]}function ES(e,n,s,o,l){if(e===-1)return-1;const c=s.indexOf(e),d=n[e];switch(l){case"tl":return c;case"tr":return d?c+d.width-1:c;case"bl":return d?c+(d.height-1)*o:c;case"br":return s.lastIndexOf(e);default:return-1}}function NS(e,n){return n.flatMap((s,o)=>e.includes(s)?[o]:[])}function Ds(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const l=e[n];return l?hf(l)?!s&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function UM(e){return e.visibility==="hidden"||e.visibility==="collapse"}function hf(e,n=e?ra(e):null){return!e||!e.isConnected||!n||UM(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const HM='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function VM(e){const n=e.assignedSlot;if(n)return n;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return yl(s)?s.host:null}function wh(e){for(const n of Array.from(e.children))if(Vn(n)==="summary")return n;return null}function qM(e,n){const s=wh(n);return!!s&&(e===s||Ze(s,e))}function RS(e){const n=e?Vn(e):"";return e!=null&&e.matches(HM)&&(n!=="summary"||e.parentElement!=null&&Vn(e.parentElement)==="details"&&wh(e.parentElement)===e)&&(n!=="details"||wh(e)==null)&&(n!=="input"||e.type!=="hidden")}function TS(e){if(!RS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=VM(n)){const s=n!==e,o=Vn(n)==="slot";if(n.hasAttribute("inert")||s&&Vn(n)==="details"&&!n.open&&!qM(e,n)||n.hasAttribute("hidden")||!o&&!$M(n,s))return!1}return!0}function $M(e,n){const s=ra(e);return n?s.display!=="none":hf(e,s)}function AS(e){const n=e.tabIndex;if(n<0){const s=Vn(e);if(s==="details"||s==="audio"||s==="video"||Gt(e)&&e.isContentEditable)return 0}return n}function sg(e){if(Vn(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function GM(e,n){const s=sg(e);if(!s)return!0;const o=n.find(l=>{const c=sg(l);return c?.name===s.name&&c.form===s.form&&c.checked});return o?o===s:n.find(l=>{const c=sg(l);return c?.name===s.name&&c.form===s.form})===s}function MS(e){if(Gt(e)&&Vn(e)==="slot"){const n=e.assignedElements({flatten:!0});if(n.length>0)return n}return Gt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function OS(e,n){MS(e).forEach(s=>{RS(s)&&n.push(s),OS(s,n)})}function zS(e,n,s){MS(e).forEach(o=>{Gt(o)&&o.matches(n)&&s.push(o),zS(o,n,s)})}function Rx(e){return TS(e)&&AS(e)>=0}function DS(e){const n=[];return OS(e,n),n.filter(TS)}function xf(e){const n=DS(e);return n.filter(s=>AS(s)>=0&&GM(s,n))}function LS(e,n){const s=xf(e),o=s.length;if(o===0)return;const l=In(yt(e)),c=s.indexOf(l),d=c===-1?n===1?0:o-1:c+n;return s[d]}function PS(e){return LS(yt(e).body,1)||e}function IS(e){return LS(yt(e).body,-1)||e}function ac(e,n){const s=n||e.currentTarget,o=e.relatedTarget;return!o||!Ze(s,o)}function FM(e){xf(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Z1(e){const n=[];zS(e,"[data-tabindex]",n),n.forEach(s=>{const o=s.dataset.tabindex;delete s.dataset.tabindex,o?s.setAttribute("tabindex",o):s.removeAttribute("tabindex")})}function Cr(e,n,s=!0){return e.filter(l=>l.parentId===n).flatMap(l=>[...!s||l.context?.open?[l]:[],...Cr(e,l.id,s)])}function W1(e,n){let s=[],o=e.find(l=>l.id===n)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(s=s.concat(l))}return s}function bc(e){return`data-base-ui-${e}`}let Wu=0;function jd(e,n={}){const{preventScroll:s=!1,sync:o=!1,shouldFocus:l}=n;cancelAnimationFrame(Wu);function c(){l&&!l()||e?.focus({preventScroll:s})}if(o)return c(),Un;const d=requestAnimationFrame(c);return Wu=d,()=>{Wu===d&&(cancelAnimationFrame(d),Wu=0)}}const rg={inert:new WeakMap,"aria-hidden":new WeakMap},J1="data-base-ui-inert",Sh={inert:new WeakSet,"aria-hidden":new WeakSet};let Li=new WeakMap,og=0;function YM(e){return Sh[e]}function BS(e){return e?yl(e)?e.host:BS(e.parentNode):null}const lg=(e,n)=>n.map(s=>{if(e.contains(s))return s;const o=BS(s);return e.contains(o)?o:null}).filter(s=>s!=null),e_=e=>{const n=new Set;return e.forEach(s=>{let o=s;for(;o&&!n.has(o);)n.add(o),o=o.parentNode}),n},t_=(e,n,s)=>{const o=[],l=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{Vn(d)!=="script"&&(n.has(d)?l(d):o.push(d))})};return l(e),o};function XM(e,n,s,o,{mark:l=!0,markerIgnoreElements:c=[]}){const d=o?"inert":s?"aria-hidden":null;let f=null,p=null;const m=lg(n,e),g=l?lg(n,c):[],b=new Set(g),v=l?t_(n,e_(m),new Set(m)).filter(j=>!b.has(j)):[],S=[],C=[];if(d){const j=rg[d],w=YM(d);p=w,f=j;const k=lg(n,Array.from(n.querySelectorAll("[aria-live]"))),E=m.concat(k);t_(n,e_(E),new Set(E)).forEach(N=>{const T=N.getAttribute(d),M=T!==null&&T!=="false",O=(j.get(N)||0)+1;j.set(N,O),S.push(N),O===1&&M&&w.add(N),M||N.setAttribute(d,d==="inert"?"":"true")})}return l&&v.forEach(j=>{const w=(Li.get(j)||0)+1;Li.set(j,w),C.push(j),w===1&&j.setAttribute(J1,"")}),og+=1,()=>{f&&S.forEach(j=>{const k=(f.get(j)||0)-1;f.set(j,k),k||(!p?.has(j)&&d&&j.removeAttribute(d),p?.delete(j))}),l&&C.forEach(j=>{const w=(Li.get(j)||0)-1;Li.set(j,w),w||j.removeAttribute(J1)}),og-=1,og||(rg.inert=new WeakMap,rg["aria-hidden"]=new WeakMap,Sh.inert=new WeakSet,Sh["aria-hidden"]=new WeakSet,Li=new WeakMap)}}function n_(e,n={}){const{ariaHidden:s=!1,inert:o=!1,mark:l=!0,markerIgnoreElements:c=[]}=n,d=yt(e[0]).body;return XM(e,d,s,o,{mark:l,markerIgnoreElements:c})}let a_=0;function KM(e,n="mui"){const[s,o]=x.useState(e),l=e||s;return x.useEffect(()=>{s==null&&(a_+=1,o(`${n}-${a_}`))},[s,n]),l}const s_=Sx.useId;function bf(e,n){if(s_!==void 0){const s=s_();return e??(n?`${n}-${s}`:s)}return KM(e,n)}const QM=parseInt(x.version,10);function Tx(e){return QM>=e}function r_(e){if(!x.isValidElement(e))return null;const n=e,s=n.props;return(Tx(19)?s?.ref:n.ref)??null}function Ch(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function ZM(e,n){const s={};for(const o in e){const l=e[o];if(n?.hasOwnProperty(o)){const c=n[o](l);c!=null&&Object.assign(s,c);continue}l===!0?s[`data-${o.toLowerCase()}`]="":l&&(s[`data-${o.toLowerCase()}`]=l.toString())}return s}function WM(e,n){return typeof e=="function"?e(n):e}function JM(e,n){return typeof e=="function"?e(n):e}const Ax={};function Oa(e,n,s,o,l){if(!s&&!o&&!l&&!e)return Ud(n);let c=Ud(e);return n&&(c=Ki(c,n)),s&&(c=Ki(c,s)),o&&(c=Ki(c,o)),l&&(c=Ki(c,l)),c}function e3(e){if(e.length===0)return Ax;if(e.length===1)return Ud(e[0]);let n=Ud(e[0]);for(let s=1;s<e.length;s+=1)n=Ki(n,e[s]);return n}function Ud(e){return Mx(e)?{...HS(e,Ax)}:t3(e)}function Ki(e,n){return Mx(n)?HS(n,e):n3(e,n)}function t3(e){const n={...e};for(const s in n){const o=n[s];US(s,o)&&(n[s]=VS(o))}return n}function n3(e,n){if(!n)return e;for(const s in n){const o=n[s];switch(s){case"style":{e[s]=Ch(e.style,o);break}case"className":{e[s]=qS(e.className,o);break}default:US(s,o)?e[s]=a3(e[s],o):e[s]=o}}return e}function US(e,n){const s=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return s===111&&o===110&&l>=65&&l<=90&&(typeof n=="function"||typeof n>"u")}function Mx(e){return typeof e=="function"}function HS(e,n){return Mx(e)?e(n):e??Ax}function a3(e,n){return n?e?(...s)=>{const o=s[0];if($S(o)){const c=o;Hd(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const l=n(...s);return e?.(...s),l}:VS(n):e}function VS(e){return e&&((...n)=>{const s=n[0];return $S(s)&&Hd(s),e(...n)})}function Hd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function qS(e,n){return n?e?n+" "+e:n:e}function $S(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ht(e,n,s={}){const o=n.render,l=s3(n,s);if(s.enabled===!1)return null;const c=s.state??cn;return l3(e,o,l,c)}function s3(e,n={}){const{className:s,style:o,render:l}=e,{state:c=cn,ref:d,props:f,stateAttributesMapping:p,enabled:m=!0}=n,g=m?WM(s,c):void 0,b=m?JM(o,c):void 0,v=m?ZM(c,p):cn,S=m&&f?r3(f):void 0,C=m?Ch(v,S)??{}:cn;return typeof document<"u"&&(m?Array.isArray(d)?C.ref=wM([C.ref,r_(l),...d]):C.ref=Us(C.ref,r_(l),d):Us(null,null)),m?(g!==void 0&&(C.className=qS(C.className,g)),b!==void 0&&(C.style=Ch(C.style,b)),C):cn}function r3(e){return Array.isArray(e)?e3(e):Oa(void 0,e)}const o3=Symbol.for("react.lazy");function l3(e,n,s,o){if(n){if(typeof n=="function")return n(s,o);const l=Oa(s,n.props);l.ref=s.ref;let c=n;return c?.$$typeof===o3&&(c=x.Children.toArray(n)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return i3(e,s);throw new Error(On(8))}function i3(e,n){return e==="button"?x.createElement("button",{type:"button",...n,key:n.key}):e==="img"?x.createElement("img",{alt:"",...n,key:n.key}):x.createElement(e,n)}const c3={style:{transition:"none"}},u3="data-base-ui-click-trigger",d3={fallbackAxisSide:"none"},f3={fallbackAxisSide:"end"},p3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},GS=x.createContext(null),FS=()=>x.useContext(GS),m3=bc("portal");function YS(e={}){const{ref:n,container:s,componentProps:o=cn,elementProps:l}=e,c=bf(),f=FS()?.portalNode,[p,m]=x.useState(null),[g,b]=x.useState(null),v=Le(w=>{w!==null&&b(w)}),S=x.useRef(null);Oe(()=>{if(s===null){S.current&&(S.current=null,b(null),m(null));return}if(c==null)return;const w=(s&&(vx(s)?s:s.current))??f??document.body;if(w==null){S.current&&(S.current=null,b(null),m(null));return}S.current!==w&&(S.current=w,b(null),m(w))},[s,f,c]);const C=Ht("div",o,{ref:[n,v],props:[{id:c,[m3]:""},l]});return{portalNode:g,portalSubtree:p&&C?Er.createPortal(C,p):null}}const XS=x.forwardRef(function(n,s){const{render:o,className:l,style:c,children:d,container:f,renderGuards:p,...m}=n,{portalNode:g,portalSubtree:b}=YS({container:f,ref:s,componentProps:n,elementProps:m}),v=x.useRef(null),S=x.useRef(null),C=x.useRef(null),j=x.useRef(null),[w,k]=x.useState(null),E=x.useRef(!1),R=w?.modal,N=w?.open,T=typeof p=="boolean"?p:!!w&&!w.modal&&w.open&&!!g;x.useEffect(()=>{if(!g||R)return;function O(P){g&&P.relatedTarget&&ac(P)&&(P.type==="focusin"?E.current&&(Z1(g),E.current=!1):(FM(g),E.current=!0))}return ns(pt(g,"focusin",O,!0),pt(g,"focusout",O,!0))},[g,R]),x.useEffect(()=>{!g||N!==!1||(Z1(g),E.current=!1)},[N,g]);const M=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:S,beforeInsideRef:C,afterInsideRef:j,portalNode:g,setFocusManagerState:k}),[g]);return r.jsxs(x.Fragment,{children:[b,r.jsxs(GS.Provider,{value:M,children:[T&&g&&r.jsx(Pd,{"data-type":"outside",ref:v,onFocus:O=>{if(ac(O,g))C.current?.focus();else{const P=w?w.domReference:null;IS(P)?.focus()}}}),T&&g&&r.jsx("span",{"aria-owns":g.id,style:p3}),g&&Er.createPortal(d,g),T&&g&&r.jsx(Pd,{"data-type":"outside",ref:S,onFocus:O=>{if(ac(O,g))j.current?.focus();else{const P=w?w.domReference:null;PS(P)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,lt(gf,O.nativeEvent))}}})]})]})});function g3(){const e=new Map;return{emit(n,s){e.get(n)?.forEach(o=>o(s))},on(n,s){e.has(n)||e.set(n,new Set),e.get(n).add(s)},off(n,s){e.get(n)?.delete(s)}}}const h3=x.createContext(null),x3=x.createContext(null),vf=()=>x.useContext(h3)?.id||null,Pl=e=>{const n=x.useContext(x3);return e??n};function As(e){return e==null?e:"current"in e?e.current:e}function b3(e,n){const s=Qt(Tn(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const o_=20;let br=[];function Ox(){br=br.filter(e=>e.deref()?.isConnected)}function v3(e){Ox(),e&&Vn(e)!=="body"&&(br.push(new WeakRef(e)),br.length>o_&&(br=br.slice(-o_)))}function ig(){return Ox(),br[br.length-1]?.deref()}function y3(e){return e?Rx(e)?e:xf(e)[0]||e:null}function l_(e,n){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const o=DS(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return Rx(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),l=e.getAttribute("tabindex");n.current.includes("floating")||o.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function KS(e){const{context:n,children:s,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:f=!0,closeOnFocusOut:p=!0,openInteractionType:m="",nextFocusableElement:g,previousFocusableElement:b,beforeContentFocusGuardRef:v,externalTree:S,getInsideElements:C}=e,j="rootStore"in n?n.rootStore:n,w=j.useState("open"),k=j.useState("domReferenceElement"),E=j.useState("floatingElement"),{events:R,dataRef:N}=j.context,T=Le(()=>N.current.floatingContext?.nodeId),M=l===!1,O=vh(k)&&M,P=x.useRef(["content"]),B=mn(l),L=mn(c),D=mn(m),z=Pl(S),H=FS(),q=x.useRef(!1),Y=x.useRef(!1),V=x.useRef(!1),$=x.useRef(null),Z=x.useRef(""),G=x.useRef(""),X=x.useRef(null),U=x.useRef(null),K=Us(X,v,H?.beforeInsideRef),F=Us(U,H?.afterInsideRef),J=aa(),ie=aa(),re=_l(),oe=H!=null,ce=Dd(E),ee=Le((ve=ce)=>ve?xf(ve):[]),Te=Le(()=>C?.().filter(ve=>ve!=null)??[]);x.useEffect(()=>{if(o||!f)return;function ve(Ne){Ne.key==="Tab"&&Ze(ce,In(yt(ce)))&&ee().length===0&&!O&&xa(Ne)}const Ce=yt(ce);return pt(Ce,"keydown",ve)},[o,ce,f,O,ee]),x.useEffect(()=>{if(o||!w)return;const ve=yt(ce);function Ce(){V.current=!1}function Ne(Ie){const be=Tn(Ie),Ae=Te(),we=Ze(E,be)||Ze(k,be)||Ze(H?.portalNode,be)||Ae.some(Be=>Be===be||Ze(Be,be));V.current=!we,G.current=Ie.pointerType||"keyboard",be?.closest(`[${u3}]`)&&(Y.current=!0)}function Pe(){G.current="keyboard"}return ns(pt(ve,"pointerdown",Ne,!0),pt(ve,"pointerup",Ce,!0),pt(ve,"pointercancel",Ce,!0),pt(ve,"keydown",Pe,!0))},[o,E,k,ce,w,H,Te]),x.useEffect(()=>{if(o||!p)return;const ve=yt(ce);function Ce(){Y.current=!0,ie.start(0,()=>{Y.current=!1})}function Ne(Ae){const we=Tn(Ae);Rx(we)&&($.current=we)}function Pe(Ae){const we=Ae.relatedTarget,Be=Ae.currentTarget,Xe=Tn(Ae);queueMicrotask(()=>{const Ye=T(),De=j.context.triggerElements,ye=Te(),le=we?.hasAttribute(bc("focus-guard"))&&[X.current,U.current,H?.beforeInsideRef.current,H?.afterInsideRef.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,As(b),As(g)].includes(we),_e=!(Ze(k,we)||Ze(E,we)||Ze(we,E)||Ze(H?.portalNode,we)||ye.some(Se=>Se===we||Ze(Se,we))||we!=null&&De.hasElement(we)||De.hasMatchingElement(Se=>Ze(Se,we))||le||z&&(Cr(z.nodesRef.current,Ye).find(Se=>Ze(Se.context?.elements.floating,we)||Ze(Se.context?.elements.domReference,we))||W1(z.nodesRef.current,Ye).find(Se=>[Se.context?.elements.floating,Dd(Se.context?.elements.floating)].includes(we)||Se.context?.elements.domReference===we)));if(Be===k&&ce&&l_(ce,P),d&&Be!==k&&!hf(Xe)&&In(ve)===ve.body){if(Gt(ce)&&(ce.focus(),d==="popup")){re.request(()=>{ce.focus()});return}const Se=ee(),Ue=$.current,Je=(Ue&&Se.includes(Ue)?Ue:null)||Se[Se.length-1]||ce;Gt(Je)&&Je.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(O||!f)&&we&&_e&&!Y.current&&(O||we!==ig())&&(q.current=!0,j.setOpen(!1,lt(gf,Ae)))})}function Ie(){V.current||(N.current.insideReactTree=!0,J.start(0,()=>{N.current.insideReactTree=!1}))}const be=Gt(k)?k:null;if(!(!E&&!be))return ns(be&&pt(be,"focusout",Pe),be&&pt(be,"pointerdown",Ce),E&&pt(E,"focusin",Ne),E&&pt(E,"focusout",Pe),E&&H&&pt(E,"focusout",Ie,!0))},[o,k,E,ce,f,z,H,j,p,d,ee,O,T,P,N,J,ie,re,g,b,Te]),x.useEffect(()=>{if(o||!E||!w)return;const ve=Array.from(H?.portalNode?.querySelectorAll(`[${bc("portal")}]`)||[]),Ne=(z?W1(z.nodesRef.current,T()):[]).find(Be=>vh(Be.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[E,...ve,X.current,U.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,...Te()],Ne,As(b),As(g),O?k:null].filter(Be=>Be!=null),be=n_(Ie,{ariaHidden:f||O,mark:!1}),Ae=[E,...ve].filter(Be=>Be!=null),we=n_(Ae);return()=>{we(),be()}},[w,o,k,E,f,H,O,z,T,g,b,Te]),Oe(()=>{if(!w||o||!Gt(ce))return;const ve=yt(ce),Ce=In(ve);queueMicrotask(()=>{const Ne=B.current,Pe=typeof Ne=="function"?Ne(D.current||""):Ne;if(Pe===void 0||Pe===!1||Ze(ce,Ce))return;let be=null;const Ae=()=>(be==null&&(be=ee(ce)),be[0]||ce);let we;Pe===!0||Pe===null?we=Ae():we=As(Pe),we=we||Ae();const Be=Ze(ce,In(ve));jd(we,{preventScroll:we===ce,shouldFocus(){if(Be)return!0;const Xe=In(ve);return!(Xe!==we&&Ze(ce,Xe))}})})},[o,w,ce,ee,B,D]),Oe(()=>{if(o||!ce)return;const ve=yt(ce),Ce=In(ve);v3(Ce);function Ne(Ie){if(Ie.open||(Z.current=b3(Ie.nativeEvent,G.current)),Ie.reason===$n&&Ie.nativeEvent.type==="mouseleave"&&(q.current=!0),Ie.reason===jx)if(Ie.nested)q.current=!1;else if(bx(Ie.nativeEvent)||pS(Ie.nativeEvent))q.current=!1;else{let be=!1;yt(ce).createElement("div").focus({get preventScroll(){return be=!0,!1}}),be?q.current=!1:q.current=!0}}R.on("openchange",Ne);function Pe(){const Ie=L.current;let be=typeof Ie=="function"?Ie(Z.current):Ie;if(be===void 0||be===!1)return null;if(be===null&&(be=!0),typeof be=="boolean")return k?.isConnected?k:ig()||null;const Ae=k?.isConnected?k:ig();return As(be)||Ae||null}return()=>{R.off("openchange",Ne);const Ie=In(ve),be=Te(),Ae=Ze(E,Ie)||be.some(Xe=>Xe===Ie||Ze(Xe,Ie))||z&&Cr(z.nodesRef.current,T(),!1).some(Xe=>Ze(Xe.context?.elements.floating,Ie)),we=L.current,Be=Pe();queueMicrotask(()=>{const Xe=y3(Be),Ye=typeof we!="boolean";we&&!q.current&&Gt(Xe)&&(!(!Ye&&Xe!==Ie&&Ie!==ve.body)||Ae)&&Xe.focus({preventScroll:!0}),q.current=!1})}},[o,E,ce,L,R,z,k,T,Te]),Oe(()=>{if(!xx||w||!E)return;const ve=In(yt(E));!Gt(ve)||!mf(ve)||Ze(E,ve)&&ve.blur()},[w,E]),Oe(()=>{if(!(o||!H))return H.setFocusManagerState({modal:f,closeOnFocusOut:p,open:w,onOpenChange:j.setOpen,domReference:k}),()=>{H.setFocusManagerState(null)}},[o,H,f,w,j,p,k]),Oe(()=>{if(!(o||!ce))return l_(ce,P),()=>{queueMicrotask(Ox)}},[o,ce,P]);const Fe=!o&&(f?!O:!0)&&(oe||f);return r.jsxs(x.Fragment,{children:[Fe&&r.jsx(Pd,{"data-type":"inside",ref:K,onFocus:ve=>{if(f){const Ce=ee();jd(Ce[Ce.length-1])}else H?.portalNode&&(q.current=!1,ac(ve,H.portalNode)?PS(k)?.focus():As(b??H.beforeOutsideRef)?.focus())}}),s,Fe&&r.jsx(Pd,{"data-type":"inside",ref:F,onFocus:ve=>{f?jd(ee()[0]):H?.portalNode&&(p&&(q.current=!0),ac(ve,H.portalNode)?IS(k)?.focus():As(g??H.afterOutsideRef)?.focus())}})]})}function _3(e,n={}){const{enabled:s=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:f=0,reason:p=gc}=n,m="rootStore"in e?e.rootStore:e,g=m.context.dataRef,b=x.useRef(void 0),v=_l(),S=aa(),C=x.useMemo(()=>{function j(k,E,R,N){const T=lt(p,E,R);k&&N==="touch"&&f>0?S.start(f,()=>{m.setOpen(!0,T)}):m.setOpen(k,T)}function w(k,E,R){const N=g.current.openEvent,T=m.select("domReferenceElement")!==E;return k&&T||!k||!l?!0:N&&d?!R(N.type):!1}return{onPointerDown(k){b.current=k.pointerType},onMouseDown(k){const E=b.current,R=k.nativeEvent,N=m.select("open");if(k.button!==0||o==="click"||io(E,!0)&&c)return;const T=w(N,k.currentTarget,P=>P==="click"||P==="mousedown"),M=Tn(R);if(mf(M)){j(T,R,M,E);return}const O=k.currentTarget;v.request(()=>{j(T,R,O,E)})},onClick(k){if(o==="mousedown-only")return;const E=b.current;if(o==="mousedown"&&E){b.current=void 0;return}if(io(E,!0)&&c)return;const R=m.select("open"),N=w(R,k.currentTarget,T=>T==="click"||T==="mousedown"||T==="keydown"||T==="keyup");j(N,k.nativeEvent,k.currentTarget,E)},onKeyDown(){b.current=void 0}}},[g,o,c,p,m,d,l,v,S,f]);return x.useMemo(()=>s?{reference:C}:cn,[s,C])}function j3(e,n){let s=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=n.axis==="x"||n.axis==="both",f=n.axis==="y"||n.axis==="both",p=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let m=c.width,g=c.height,b=c.x,v=c.y;return s==null&&n.x&&d&&(s=c.x-n.x),o==null&&n.y&&f&&(o=c.y-n.y),b-=s||0,v-=o||0,m=0,g=0,!l||p?(m=n.axis==="y"?c.width:0,g=n.axis==="x"?c.height:0,b=d&&n.x!=null?n.x:b,v=f&&n.y!=null?n.y:v):l&&!p&&(g=n.axis==="x"?c.height:g,m=n.axis==="y"?c.width:m),l=!0,{width:m,height:g,x:b,y:v,top:v,right:b+m,bottom:v+g,left:b}}}}function i_(e){return e!=null&&e.clientX!=null}function w3(e,n={}){const{enabled:s=!0,axis:o="both"}=n,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),d=l.useState("floatingElement"),f=l.useState("domReferenceElement"),p=l.context.dataRef,m=x.useRef(!1),g=x.useRef(null),[b,v]=x.useState(),[S,C]=x.useState([]),j=Le(N=>{l.set("positionReference",N)}),w=Le((N,T,M)=>{m.current||p.current.openEvent&&!i_(p.current.openEvent)||l.set("positionReference",j3(M??f,{x:N,y:T,axis:o,dataRef:p,pointerType:b}))}),k=Le(N=>{c?g.current||(w(N.clientX,N.clientY,N.currentTarget),C([])):w(N.clientX,N.clientY,N.currentTarget)}),E=io(b)?d:c;x.useEffect(()=>{if(!s){j(f);return}if(!E)return;function N(){g.current?.(),g.current=null}const T=Qt(d);function M(O){const P=Tn(O);Ze(d,P)?N():w(O.clientX,O.clientY)}return!p.current.openEvent||i_(p.current.openEvent)?g.current=pt(T,"mousemove",M):j(f),N},[E,s,d,p,f,l,w,j,S]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{s&&!d&&(m.current=!1)},[s,d]),x.useEffect(()=>{!s&&c&&(m.current=!0)},[s,c]);const R=x.useMemo(()=>{function N(T){v(T.pointerType)}return{onPointerDown:N,onPointerEnter:N,onMouseMove:k,onMouseEnter:k}},[k]);return x.useMemo(()=>s?{reference:R,trigger:R}:{},[s,R])}const S3={intentional:"onClick",sloppy:"onPointerDown"};function C3(){return!1}function k3(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function zx(e,n={}){const{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=C3,referencePressEvent:f="sloppy",bubbles:p,externalTree:m}=n,g="rootStore"in e?e.rootStore:e,b=g.useState("open"),v=g.useState("floatingElement"),{dataRef:S}=g.context,C=Pl(m),j=Le(typeof l=="function"?l:()=>!1),w=typeof l=="function"?j:l,k=w!==!1,E=Le(()=>c),{escapeKey:R,outsidePress:N}=k3(p),T=x.useRef(!1),M=x.useRef(!1),O=x.useRef(!1),P=x.useRef(!1),B=x.useRef(""),L=x.useRef(null),D=aa(),z=aa(),H=Le(()=>{z.clear(),S.current.insideReactTree=!1}),q=Le(F=>{const J=S.current.floatingContext?.nodeId;return(C?Cr(C.nodesRef.current,J):[]).some(re=>re.context?.open&&!re.context.dataRef.current[F])}),Y=Le(F=>tg(F,g.select("floatingElement"))||tg(F,g.select("domReferenceElement"))),V=Le(F=>{d()&&g.setOpen(!1,lt(gc,F.nativeEvent))}),$=Le(F=>{if(!b||!s||!o||F.key!=="Escape"||P.current||!R&&q("__escapeKeyBubbles"))return;const J=lM(F)?F.nativeEvent:F,ie=lt(wx,J);g.setOpen(!1,ie),ie.isCanceled||F.preventDefault(),!R&&!ie.isPropagationAllowed&&F.stopPropagation()}),Z=Le(()=>{S.current.insideReactTree=!0,z.start(0,H)}),G=Le(F=>{if(!b||!s||F.button!==0)return;const J=Tn(F.nativeEvent);Ze(g.select("floatingElement"),J)&&(T.current||(T.current=!0,M.current=!1))}),X=Le(F=>{!b||!s||(F.defaultPrevented||F.nativeEvent.defaultPrevented)&&T.current&&(M.current=!0)});x.useEffect(()=>{if(!b||!s)return;S.current.__escapeKeyBubbles=R,S.current.__outsidePressBubbles=N;const F=new Ga,J=new Ga;function ie(){F.clear(),P.current=!0}function re(){F.start(ff()?5:0,()=>{P.current=!1})}function oe(){O.current=!0,J.start(0,()=>{O.current=!1})}function ce(){T.current=!1,M.current=!1}function ee(){const le=B.current,_e=le==="pen"||!le?"mouse":le,Se=E(),Ue=typeof Se=="function"?Se():Se;return typeof Ue=="string"?Ue:Ue[_e]}function Te(le){const _e=ee();return _e==="intentional"&&le.type!=="click"||_e==="sloppy"&&le.type==="click"}function Fe(le){const _e=S.current.floatingContext?.nodeId,Se=C&&Cr(C.nodesRef.current,_e).some(Ue=>tg(le,Ue.context?.elements.floating));return Y(le)||Se}function ve(le){if(Te(le)){le.type!=="click"&&!Y(le)&&(J.clear(),O.current=!1),H();return}if(S.current.insideReactTree){H();return}const _e=Tn(le),Se=`[${bc("inert")}]`,Ue=ft(_e)?_e.getRootNode():null,Je=Array.from((yl(Ue)?Ue:yt(g.select("floatingElement"))).querySelectorAll(Se)),_t=g.context.triggerElements;if(_e&&(_t.hasElement(_e)||_t.hasMatchingElement(pe=>Ze(pe,_e))))return;let zt=ft(_e)?_e:null;for(;zt&&!zs(zt);){const pe=Is(zt);if(zs(pe)||!ft(pe))break;zt=pe}if(!(Je.length&&ft(_e)&&!pM(_e)&&!Ze(_e,g.select("floatingElement"))&&Je.every(pe=>!Ze(zt,pe)))){if(Gt(_e)&&!("touches"in le)){const pe=zs(_e),ke=ra(_e),Re=/auto|scroll/,Ve=pe||Re.test(ke.overflowX),at=pe||Re.test(ke.overflowY),nn=Ve&&_e.clientWidth>0&&_e.scrollWidth>_e.clientWidth,Vt=at&&_e.clientHeight>0&&_e.scrollHeight>_e.clientHeight,mt=ke.direction==="rtl",Nt=Vt&&(mt?le.offsetX<=_e.offsetWidth-_e.clientWidth:le.offsetX>_e.clientWidth),Zt=nn&&le.offsetY>_e.clientHeight;if(Nt||Zt)return}if(!Fe(le)){if(ee()==="intentional"&&O.current){J.clear(),O.current=!1;return}typeof w=="function"&&!w(le)||q("__outsidePressBubbles")||(g.setOpen(!1,lt(jx,le)),H())}}}function Ce(le){ee()!=="sloppy"||le.pointerType==="touch"||!g.select("open")||!s||Y(le)||ve(le)}function Ne(le){if(ee()!=="sloppy"||!g.select("open")||!s||Y(le))return;const _e=le.touches[0];_e&&(L.current={startTime:Date.now(),startX:_e.clientX,startY:_e.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Pe(le,_e){const Se=Tn(le);if(!Se)return;const Ue=pt(Se,le.type,()=>{_e(le),Ue()})}function Ie(le){B.current="touch",Pe(le,Ne)}function be(le){D.clear(),le.type==="pointerdown"&&(B.current=le.pointerType),!(le.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)&&Pe(le,_e=>{_e.type==="pointerdown"?Ce(_e):ve(_e)})}function Ae(le){if(!T.current)return;const _e=M.current;if(ce(),ee()==="intentional"){if(le.type==="pointercancel"){_e&&oe();return}if(!Fe(le)){if(_e){oe();return}typeof w=="function"&&!w(le)||(J.clear(),O.current=!0,H())}}}function we(le){if(ee()!=="sloppy"||!L.current||Y(le))return;const _e=le.touches[0];if(!_e)return;const Se=Math.abs(_e.clientX-L.current.startX),Ue=Math.abs(_e.clientY-L.current.startY),Je=Math.sqrt(Se*Se+Ue*Ue);Je>5&&(L.current.dismissOnTouchEnd=!0),Je>10&&(ve(le),D.clear(),L.current=null)}function Be(le){Pe(le,we)}function Xe(le){ee()!=="sloppy"||!L.current||Y(le)||(L.current.dismissOnTouchEnd&&ve(le),D.clear(),L.current=null)}function Ye(le){Pe(le,Xe)}const De=yt(v),ye=ns(o&&ns(pt(De,"keydown",$),pt(De,"compositionstart",ie),pt(De,"compositionend",re)),k&&ns(pt(De,"click",be,!0),pt(De,"pointerdown",be,!0),pt(De,"pointerup",Ae,!0),pt(De,"pointercancel",Ae,!0),pt(De,"mousedown",be,!0),pt(De,"mouseup",Ae,!0),pt(De,"touchstart",Ie,!0),pt(De,"touchmove",Be,!0),pt(De,"touchend",Ye,!0)));return()=>{ye(),F.clear(),J.clear(),ce(),O.current=!1}},[S,v,o,k,w,b,s,R,N,$,H,E,q,Y,C,g,D]),x.useEffect(H,[w,H]);const U=x.useMemo(()=>({onKeyDown:$,[S3[f]]:V,...f!=="intentional"&&{onClick:V}}),[$,V,f]),K=x.useMemo(()=>({onKeyDown:$,onPointerDown:X,onMouseDown:X,onClickCapture:Z,onMouseDownCapture(F){Z(),G(F)},onPointerDownCapture(F){Z(),G(F)},onMouseUpCapture:Z,onTouchEndCapture:Z,onTouchMoveCapture:Z}),[$,Z,G,X]);return x.useMemo(()=>s?{reference:U,floating:K,trigger:U}:{},[s,U,K])}function c_(e,n,s){let{reference:o,floating:l}=e;const c=Aa(n),d=Nx(n),f=Ex(d),p=sa(n),m=c==="y",g=o.x+o.width/2-l.width/2,b=o.y+o.height/2-l.height/2,v=o[f]/2-l[f]/2;let S;switch(p){case"top":S={x:g,y:o.y-l.height};break;case"bottom":S={x:g,y:o.y+o.height};break;case"right":S={x:o.x+o.width,y:b};break;case"left":S={x:o.x-l.width,y:b};break;default:S={x:o.x,y:o.y}}switch(Tr(n)){case"start":S[d]-=v*(s&&m?-1:1);break;case"end":S[d]+=v*(s&&m?-1:1);break}return S}async function E3(e,n){var s;n===void 0&&(n={});const{x:o,y:l,platform:c,rects:d,elements:f,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:g="viewport",elementContext:b="floating",altBoundary:v=!1,padding:S=0}=Hs(n,e),C=SS(S),w=f[v?b==="floating"?"reference":"floating":b],k=hc(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(w)))==null||s?w:w.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:m,rootBoundary:g,strategy:p})),E=b==="floating"?{x:o,y:l,width:d.floating.width,height:d.floating.height}:d.reference,R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),N=await(c.isElement==null?void 0:c.isElement(R))?await(c.getScale==null?void 0:c.getScale(R))||{x:1,y:1}:{x:1,y:1},T=hc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:R,strategy:p}):E);return{top:(k.top-T.top+C.top)/N.y,bottom:(T.bottom-k.bottom+C.bottom)/N.y,left:(k.left-T.left+C.left)/N.x,right:(T.right-k.right+C.right)/N.x}}const N3=50,R3=async(e,n,s)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:d}=s,f=d.detectOverflow?d:{...d,detectOverflow:E3},p=await(d.isRTL==null?void 0:d.isRTL(n));let m=await d.getElementRects({reference:e,floating:n,strategy:l}),{x:g,y:b}=c_(m,o,p),v=o,S=0;const C={};for(let j=0;j<c.length;j++){const w=c[j];if(!w)continue;const{name:k,fn:E}=w,{x:R,y:N,data:T,reset:M}=await E({x:g,y:b,initialPlacement:o,placement:v,strategy:l,middlewareData:C,rects:m,platform:f,elements:{reference:e,floating:n}});g=R??g,b=N??b,C[k]={...C[k],...T},M&&S<N3&&(S++,typeof M=="object"&&(M.placement&&(v=M.placement),M.rects&&(m=M.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:l}):M.rects),{x:g,y:b}=c_(m,v,p)),j=-1)}return{x:g,y:b,placement:v,strategy:l,middlewareData:C}},T3=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var s,o;const{placement:l,middlewareData:c,rects:d,initialPlacement:f,platform:p,elements:m}=n,{mainAxis:g=!0,crossAxis:b=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=Hs(e,n);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const k=sa(l),E=Aa(f),R=sa(f)===f,N=await(p.isRTL==null?void 0:p.isRTL(m.floating)),T=v||(R||!j?[Bd(f)]:zM(f)),M=C!=="none";!v&&M&&T.push(...IM(f,j,C,N));const O=[f,...T],P=await p.detectOverflow(n,w),B=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(g&&B.push(P[k]),b){const q=OM(l,d,N);B.push(P[q[0]],P[q[1]])}if(L=[...L,{placement:l,overflows:B}],!B.every(q=>q<=0)){var D,z;const q=(((D=c.flip)==null?void 0:D.index)||0)+1,Y=O[q];if(Y&&(!(b==="alignment"?E!==Aa(Y):!1)||L.every(Z=>Aa(Z.placement)===E?Z.overflows[0]>0:!0)))return{data:{index:q,overflows:L},reset:{placement:Y}};let V=(z=L.filter($=>$.overflows[0]<=0).sort(($,Z)=>$.overflows[1]-Z.overflows[1])[0])==null?void 0:z.placement;if(!V)switch(S){case"bestFit":{var H;const $=(H=L.filter(Z=>{if(M){const G=Aa(Z.placement);return G===E||G==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(G=>G>0).reduce((G,X)=>G+X,0)]).sort((Z,G)=>Z[1]-G[1])[0])==null?void 0:H[0];$&&(V=$);break}case"initialPlacement":V=f;break}if(l!==V)return{reset:{placement:V}}}return{}}}};function u_(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function d_(e){return AM.some(n=>e[n]>=0)}const A3=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:s,platform:o}=n,{strategy:l="referenceHidden",...c}=Hs(e,n);switch(l){case"referenceHidden":{const d=await o.detectOverflow(n,{...c,elementContext:"reference"}),f=u_(d,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:d_(f)}}}case"escaped":{const d=await o.detectOverflow(n,{...c,altBoundary:!0}),f=u_(d,s.floating);return{data:{escapedOffsets:f,escaped:d_(f)}}}default:return{}}}}},QS=new Set(["left","top"]);async function M3(e,n){const{placement:s,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),d=sa(s),f=Tr(s),p=Aa(s)==="y",m=QS.has(d)?-1:1,g=c&&p?-1:1,b=Hs(n,e);let{mainAxis:v,crossAxis:S,alignmentAxis:C}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return f&&typeof C=="number"&&(S=f==="end"?C*-1:C),p?{x:S*g,y:v*m}:{x:v*m,y:S*g}}const O3=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var s,o;const{x:l,y:c,placement:d,middlewareData:f}=n,p=await M3(n,e);return d===((s=f.offset)==null?void 0:s.placement)&&(o=f.arrow)!=null&&o.alignmentOffset?{}:{x:l+p.x,y:c+p.y,data:{...p,placement:d}}}}},z3=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:s,y:o,placement:l,platform:c}=n,{mainAxis:d=!0,crossAxis:f=!1,limiter:p={fn:k=>{let{x:E,y:R}=k;return{x:E,y:R}}},...m}=Hs(e,n),g={x:s,y:o},b=await c.detectOverflow(n,m),v=Aa(sa(l)),S=kx(v);let C=g[S],j=g[v];if(d){const k=S==="y"?"top":"left",E=S==="y"?"bottom":"right",R=C+b[k],N=C-b[E];C=yh(R,C,N)}if(f){const k=v==="y"?"top":"left",E=v==="y"?"bottom":"right",R=j+b[k],N=j-b[E];j=yh(R,j,N)}const w=p.fn({...n,[S]:C,[v]:j});return{...w,data:{x:w.x-s,y:w.y-o,enabled:{[S]:d,[v]:f}}}}}},D3=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:s,y:o,placement:l,rects:c,middlewareData:d}=n,{offset:f=0,mainAxis:p=!0,crossAxis:m=!0}=Hs(e,n),g={x:s,y:o},b=Aa(l),v=kx(b);let S=g[v],C=g[b];const j=Hs(f,n),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const R=v==="y"?"height":"width",N=c.reference[v]-c.floating[R]+w.mainAxis,T=c.reference[v]+c.reference[R]-w.mainAxis;S<N?S=N:S>T&&(S=T)}if(m){var k,E;const R=v==="y"?"width":"height",N=QS.has(sa(l)),T=c.reference[b]-c.floating[R]+(N&&((k=d.offset)==null?void 0:k[b])||0)+(N?0:w.crossAxis),M=c.reference[b]+c.reference[R]+(N?0:((E=d.offset)==null?void 0:E[b])||0)-(N?w.crossAxis:0);C<T?C=T:C>M&&(C=M)}return{[v]:S,[b]:C}}}},L3=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var s,o;const{placement:l,rects:c,platform:d,elements:f}=n,{apply:p=()=>{},...m}=Hs(e,n),g=await d.detectOverflow(n,m),b=sa(l),v=Tr(l),S=Aa(l)==="y",{width:C,height:j}=c.floating;let w,k;b==="top"||b==="bottom"?(w=b,k=v===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?"start":"end")?"left":"right"):(k=b,w=v==="end"?"top":"bottom");const E=j-g.top-g.bottom,R=C-g.left-g.right,N=jl(j-g[w],E),T=jl(C-g[k],R),M=!n.middlewareData.shift;let O=N,P=T;if((s=n.middlewareData.shift)!=null&&s.enabled.x&&(P=R),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(O=E),M&&!v){const L=ba(g.left,0),D=ba(g.right,0),z=ba(g.top,0),H=ba(g.bottom,0);S?P=C-2*(L!==0||D!==0?L+D:ba(g.left,g.right)):O=j-2*(z!==0||H!==0?z+H:ba(g.top,g.bottom))}await p({...n,availableWidth:P,availableHeight:O});const B=await d.getDimensions(f.floating);return C!==B.width||j!==B.height?{reset:{rects:!0}}:{}}}};function ZS(e){const n=ra(e);let s=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const l=Gt(e),c=l?e.offsetWidth:s,d=l?e.offsetHeight:o,f=Id(s)!==c||Id(o)!==d;return f&&(s=c,o=d),{width:s,height:o,$:f}}function Dx(e){return ft(e)?e:e.contextElement}function ml(e){const n=Dx(e);if(!Gt(n))return as(1);const s=n.getBoundingClientRect(),{width:o,height:l,$:c}=ZS(n);let d=(c?Id(s.width):s.width)/o,f=(c?Id(s.height):s.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const P3=as(0);function WS(e){const n=Qt(e);return!ff()||!n.visualViewport?P3:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function I3(e,n,s){return n===void 0&&(n=!1),!s||n&&s!==Qt(e)?!1:n}function co(e,n,s,o){n===void 0&&(n=!1),s===void 0&&(s=!1);const l=e.getBoundingClientRect(),c=Dx(e);let d=as(1);n&&(o?ft(o)&&(d=ml(o)):d=ml(e));const f=I3(c,s,o)?WS(c):as(0);let p=(l.left+f.x)/d.x,m=(l.top+f.y)/d.y,g=l.width/d.x,b=l.height/d.y;if(c){const v=Qt(c),S=o&&ft(o)?Qt(o):o;let C=v,j=xh(C);for(;j&&o&&S!==C;){const w=ml(j),k=j.getBoundingClientRect(),E=ra(j),R=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,N=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;p*=w.x,m*=w.y,g*=w.x,b*=w.y,p+=R,m+=N,C=Qt(j),j=xh(C)}}return hc({width:g,height:b,x:p,y:m})}function yf(e,n){const s=pf(e).scrollLeft;return n?n.left+s:co(os(e)).left+s}function JS(e,n){const s=e.getBoundingClientRect(),o=s.left+n.scrollLeft-yf(e,s),l=s.top+n.scrollTop;return{x:o,y:l}}function B3(e){let{elements:n,rect:s,offsetParent:o,strategy:l}=e;const c=l==="fixed",d=os(o),f=n?df(n.floating):!1;if(o===d||f&&c)return s;let p={scrollLeft:0,scrollTop:0},m=as(1);const g=as(0),b=Gt(o);if((b||!b&&!c)&&((Vn(o)!=="body"||Rr(d))&&(p=pf(o)),b)){const S=co(o);m=ml(o),g.x=S.x+o.clientLeft,g.y=S.y+o.clientTop}const v=d&&!b&&!c?JS(d,p):as(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-p.scrollLeft*m.x+g.x+v.x,y:s.y*m.y-p.scrollTop*m.y+g.y+v.y}}function U3(e){return Array.from(e.getClientRects())}function H3(e){const n=os(e),s=pf(e),o=e.ownerDocument.body,l=ba(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),c=ba(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let d=-s.scrollLeft+yf(e);const f=-s.scrollTop;return ra(o).direction==="rtl"&&(d+=ba(n.clientWidth,o.clientWidth)-l),{width:l,height:c,x:d,y:f}}const f_=25;function V3(e,n){const s=Qt(e),o=os(e),l=s.visualViewport;let c=o.clientWidth,d=o.clientHeight,f=0,p=0;if(l){c=l.width,d=l.height;const g=ff();(!g||g&&n==="fixed")&&(f=l.offsetLeft,p=l.offsetTop)}const m=yf(o);if(m<=0){const g=o.ownerDocument,b=g.body,v=getComputedStyle(b),S=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,C=Math.abs(o.clientWidth-b.clientWidth-S);C<=f_&&(c-=C)}else m<=f_&&(c+=m);return{width:c,height:d,x:f,y:p}}function q3(e,n){const s=co(e,!0,n==="fixed"),o=s.top+e.clientTop,l=s.left+e.clientLeft,c=Gt(e)?ml(e):as(1),d=e.clientWidth*c.x,f=e.clientHeight*c.y,p=l*c.x,m=o*c.y;return{width:d,height:f,x:p,y:m}}function p_(e,n,s){let o;if(n==="viewport")o=V3(e,s);else if(n==="document")o=H3(os(e));else if(ft(n))o=q3(n,s);else{const l=WS(e);o={x:n.x-l.x,y:n.y-l.y,width:n.width,height:n.height}}return hc(o)}function e2(e,n){const s=Is(e);return s===n||!ft(s)||zs(s)?!1:ra(s).position==="fixed"||e2(s,n)}function $3(e,n){const s=n.get(e);if(s)return s;let o=pc(e,[],!1).filter(f=>ft(f)&&Vn(f)!=="body"),l=null;const c=ra(e).position==="fixed";let d=c?Is(e):e;for(;ft(d)&&!zs(d);){const f=ra(d),p=yx(d);!p&&f.position==="fixed"&&(l=null),(c?!p&&!l:!p&&f.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Rr(d)&&!p&&e2(e,d))?o=o.filter(g=>g!==d):l=f,d=Is(d)}return n.set(e,o),o}function G3(e){let{element:n,boundary:s,rootBoundary:o,strategy:l}=e;const d=[...s==="clippingAncestors"?df(n)?[]:$3(n,this._c):[].concat(s),o],f=p_(n,d[0],l);let p=f.top,m=f.right,g=f.bottom,b=f.left;for(let v=1;v<d.length;v++){const S=p_(n,d[v],l);p=ba(S.top,p),m=jl(S.right,m),g=jl(S.bottom,g),b=ba(S.left,b)}return{width:m-b,height:g-p,x:b,y:p}}function F3(e){const{width:n,height:s}=ZS(e);return{width:n,height:s}}function Y3(e,n,s){const o=Gt(n),l=os(n),c=s==="fixed",d=co(e,!0,c,n);let f={scrollLeft:0,scrollTop:0};const p=as(0);function m(){p.x=yf(l)}if(o||!o&&!c)if((Vn(n)!=="body"||Rr(l))&&(f=pf(n)),o){const S=co(n,!0,c,n);p.x=S.x+n.clientLeft,p.y=S.y+n.clientTop}else l&&m();c&&!o&&l&&m();const g=l&&!o&&!c?JS(l,f):as(0),b=d.left+f.scrollLeft-p.x-g.x,v=d.top+f.scrollTop-p.y-g.y;return{x:b,y:v,width:d.width,height:d.height}}function cg(e){return ra(e).position==="static"}function m_(e,n){if(!Gt(e)||ra(e).position==="fixed")return null;if(n)return n(e);let s=e.offsetParent;return os(e)===s&&(s=s.ownerDocument.body),s}function t2(e,n){const s=Qt(e);if(df(e))return s;if(!Gt(e)){let l=Is(e);for(;l&&!zs(l);){if(ft(l)&&!cg(l))return l;l=Is(l)}return s}let o=m_(e,n);for(;o&&cM(o)&&cg(o);)o=m_(o,n);return o&&zs(o)&&cg(o)&&!yx(o)?s:o||fM(e)||s}const X3=async function(e){const n=this.getOffsetParent||t2,s=this.getDimensions,o=await s(e.floating);return{reference:Y3(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function K3(e){return ra(e).direction==="rtl"}const n2={convertOffsetParentRelativeRectToViewportRelativeRect:B3,getDocumentElement:os,getClippingRect:G3,getOffsetParent:t2,getElementRects:X3,getClientRects:U3,getDimensions:F3,getScale:ml,isElement:ft,isRTL:K3};function a2(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function Q3(e,n){let s=null,o;const l=os(e);function c(){var f;clearTimeout(o),(f=s)==null||f.disconnect(),s=null}function d(f,p){f===void 0&&(f=!1),p===void 0&&(p=1),c();const m=e.getBoundingClientRect(),{left:g,top:b,width:v,height:S}=m;if(f||n(),!v||!S)return;const C=ao(b),j=ao(l.clientWidth-(g+v)),w=ao(l.clientHeight-(b+S)),k=ao(g),R={rootMargin:-C+"px "+-j+"px "+-w+"px "+-k+"px",threshold:ba(0,jl(1,p))||1};let N=!0;function T(M){const O=M[0].intersectionRatio;if(O!==p){if(!N)return d();O?d(!1,O):o=setTimeout(()=>{d(!1,1e-7)},1e3)}O===1&&!a2(m,e.getBoundingClientRect())&&d(),N=!1}try{s=new IntersectionObserver(T,{...R,root:l.ownerDocument})}catch{s=new IntersectionObserver(T,R)}s.observe(e)}return d(!0),c}function g_(e,n,s,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:p=!1}=o,m=Dx(e),g=l||c?[...m?pc(m):[],...n?pc(n):[]]:[];g.forEach(k=>{l&&k.addEventListener("scroll",s,{passive:!0}),c&&k.addEventListener("resize",s)});const b=m&&f?Q3(m,s):null;let v=-1,S=null;d&&(S=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&S&&n&&(S.unobserve(n),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var R;(R=S)==null||R.observe(n)})),s()}),m&&!p&&S.observe(m),n&&S.observe(n));let C,j=p?co(e):null;p&&w();function w(){const k=co(e);j&&!a2(j,k)&&s(),j=k,C=requestAnimationFrame(w)}return s(),()=>{var k;g.forEach(E=>{l&&E.removeEventListener("scroll",s),c&&E.removeEventListener("resize",s)}),b?.(),(k=S)==null||k.disconnect(),S=null,p&&cancelAnimationFrame(C)}}const Z3=O3,W3=z3,J3=T3,e5=L3,t5=A3,n5=D3,a5=(e,n,s)=>{const o=new Map,l={platform:n2,...s},c={...l.platform,_c:o};return R3(e,n,{...l,platform:c})};var s5=typeof document<"u",r5=function(){},wd=s5?x.useLayoutEffect:r5;function Vd(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let s,o,l;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==n.length)return!1;for(o=s;o--!==0;)if(!Vd(e[o],n[o]))return!1;return!0}if(l=Object.keys(e),s=l.length,s!==Object.keys(n).length)return!1;for(o=s;o--!==0;)if(!{}.hasOwnProperty.call(n,l[o]))return!1;for(o=s;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!Vd(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function s2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function h_(e,n){const s=s2(e);return Math.round(n*s)/s}function ug(e){const n=x.useRef(e);return wd(()=>{n.current=e}),n}function o5(e){e===void 0&&(e={});const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:p,open:m}=e,[g,b]=x.useState({x:0,y:0,strategy:s,placement:n,middlewareData:{},isPositioned:!1}),[v,S]=x.useState(o);Vd(v,o)||S(o);const[C,j]=x.useState(null),[w,k]=x.useState(null),E=x.useCallback(Z=>{Z!==M.current&&(M.current=Z,j(Z))},[]),R=x.useCallback(Z=>{Z!==O.current&&(O.current=Z,k(Z))},[]),N=c||C,T=d||w,M=x.useRef(null),O=x.useRef(null),P=x.useRef(g),B=p!=null,L=ug(p),D=ug(l),z=ug(m),H=x.useCallback(()=>{if(!M.current||!O.current)return;const Z={placement:n,strategy:s,middleware:v};D.current&&(Z.platform=D.current),a5(M.current,O.current,Z).then(G=>{const X={...G,isPositioned:z.current!==!1};q.current&&!Vd(P.current,X)&&(P.current=X,Er.flushSync(()=>{b(X)}))})},[v,n,s,D,z]);wd(()=>{m===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,b(Z=>({...Z,isPositioned:!1})))},[m]);const q=x.useRef(!1);wd(()=>(q.current=!0,()=>{q.current=!1}),[]),wd(()=>{if(N&&(M.current=N),T&&(O.current=T),N&&T){if(L.current)return L.current(N,T,H);H()}},[N,T,H,L,B]);const Y=x.useMemo(()=>({reference:M,floating:O,setReference:E,setFloating:R}),[E,R]),V=x.useMemo(()=>({reference:N,floating:T}),[N,T]),$=x.useMemo(()=>{const Z={position:s,left:0,top:0};if(!V.floating)return Z;const G=h_(V.floating,g.x),X=h_(V.floating,g.y);return f?{...Z,transform:"translate("+G+"px, "+X+"px)",...s2(V.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:G,top:X}},[s,f,V.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:H,refs:Y,elements:V,floatingStyles:$}),[g,H,Y,V,$])}const l5=(e,n)=>{const s=Z3(e);return{name:s.name,fn:s.fn,options:[e,n]}},i5=(e,n)=>{const s=W3(e);return{name:s.name,fn:s.fn,options:[e,n]}},c5=(e,n)=>({fn:n5(e).fn,options:[e,n]}),u5=(e,n)=>{const s=J3(e);return{name:s.name,fn:s.fn,options:[e,n]}},d5=(e,n)=>{const s=e5(e);return{name:s.name,fn:s.fn,options:[e,n]}},f5=(e,n)=>{const s=t5(e);return{name:s.name,fn:s.fn,options:[e,n]}},ze=(e,n,s,o,l,c,...d)=>{if(d.length>0)throw new Error(On(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var dg={exports:{}},fg={};/**
561
+ * @license React
562
+ * use-sync-external-store-shim.production.js
563
+ *
564
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
565
+ *
566
+ * This source code is licensed under the MIT license found in the
567
+ * LICENSE file in the root directory of this source tree.
568
+ */var x_;function p5(){if(x_)return fg;x_=1;var e=wc();function n(b,v){return b===v&&(b!==0||1/b===1/v)||b!==b&&v!==v}var s=typeof Object.is=="function"?Object.is:n,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function f(b,v){var S=v(),C=o({inst:{value:S,getSnapshot:v}}),j=C[0].inst,w=C[1];return c(function(){j.value=S,j.getSnapshot=v,p(j)&&w({inst:j})},[b,S,v]),l(function(){return p(j)&&w({inst:j}),b(function(){p(j)&&w({inst:j})})},[b]),d(S),S}function p(b){var v=b.getSnapshot;b=b.value;try{var S=v();return!s(b,S)}catch{return!0}}function m(b,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return fg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,fg}var b_;function r2(){return b_||(b_=1,dg.exports=p5()),dg.exports}var qd=r2(),pg={exports:{}},mg={};/**
569
+ * @license React
570
+ * use-sync-external-store-shim/with-selector.production.js
571
+ *
572
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
573
+ *
574
+ * This source code is licensed under the MIT license found in the
575
+ * LICENSE file in the root directory of this source tree.
576
+ */var v_;function m5(){if(v_)return mg;v_=1;var e=wc(),n=r2();function s(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var o=typeof Object.is=="function"?Object.is:s,l=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,f=e.useMemo,p=e.useDebugValue;return mg.useSyncExternalStoreWithSelector=function(m,g,b,v,S){var C=c(null);if(C.current===null){var j={hasValue:!1,value:null};C.current=j}else j=C.current;C=f(function(){function k(M){if(!E){if(E=!0,R=M,M=v(M),S!==void 0&&j.hasValue){var O=j.value;if(S(O,M))return N=O}return N=M}if(O=N,o(R,M))return O;var P=v(M);return S!==void 0&&S(O,P)?(R=M,O):(R=M,N=P)}var E=!1,R,N,T=b===void 0?null:b;return[function(){return k(g())},T===null?void 0:function(){return k(T())}]},[g,b,v,S]);var w=l(m,C[0],C[1]);return d(function(){j.hasValue=!0,j.value=w},[w]),p(w),w},mg}var y_;function g5(){return y_||(y_=1,pg.exports=m5()),pg.exports}var h5=g5();const x5=Tx(19),b5=x5?y5:_5;function tt(e,n,s,o,l){return b5(e,n,s,o,l)}function v5(e,n,s,o,l){const c=x.useCallback(()=>n(e.getSnapshot(),s,o,l),[e,n,s,o,l]);return qd.useSyncExternalStore(e.subscribe,c,c)}ZA({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let n=!1;for(let s=0;s<e.syncHooks.length;s+=1){const o=e.syncHooks[s],l=o.selector(o.store.state,o.a1,o.a2,o.a3);(o.didChange||!Object.is(o.value,l))&&(n=!0,o.value=l,o.didChange=!1)}return n&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=n=>{const s=new Set;for(const l of e.syncHooks)s.add(l.store);const o=[];for(const l of s)o.push(l.subscribe(n));return()=>{for(const l of o)l()}}),qd.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function y5(e,n,s,o,l){const c=QA();if(!c)return v5(e,n,s,o,l);const d=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[d],(f.store!==e||f.selector!==n||!Object.is(f.a1,s)||!Object.is(f.a2,o)||!Object.is(f.a3,l))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=n,f.a1=s,f.a2=o,f.a3=l,f.didChange=!0)):(f={store:e,selector:n,a1:s,a2:o,a3:l,value:n(e.getSnapshot(),s,o,l),didChange:!1},c.syncHooks.push(f)),f.value}function _5(e,n,s,o,l){return h5.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,o,l))}class o2{constructor(n){this.state=n,this.listeners=new Set,this.updateTick=0}subscribe=n=>(this.listeners.add(n),()=>{this.listeners.delete(n)});getSnapshot=()=>this.state;setState(n){if(this.state===n)return;this.state=n,this.updateTick+=1;const s=this.updateTick;for(const o of this.listeners){if(s!==this.updateTick)return;o(n)}}update(n){for(const s in n)if(!Object.is(this.state[s],n[s])){this.setState({...this.state,...n});return}}set(n,s){Object.is(this.state[n],s)||this.setState({...this.state,[n]:s})}notifyAll(){const n={...this.state};this.setState(n)}use(n,s,o,l){return tt(this,n,s,o,l)}}class Lx extends o2{constructor(n,s={},o){super(n),this.context=s,this.selectors=o}useSyncedValue(n,s){x.useDebugValue(n);const o=this;Oe(()=>{o.state[n]!==s&&o.set(n,s)},[o,n,s])}useSyncedValueWithCleanup(n,s){const o=this;Oe(()=>(o.state[n]!==s&&o.set(n,s),()=>{o.set(n,void 0)}),[o,n,s])}useSyncedValues(n){const s=this,o=Object.values(n);Oe(()=>{s.update(n)},[s,...o])}useControlledProp(n,s){x.useDebugValue(n);const o=this,l=s!==void 0;Oe(()=>{l&&!Object.is(o.state[n],s)&&o.setState({...o.state,[n]:s})},[o,n,s,l])}select(n,s,o,l){const c=this.selectors[n];return c(this.state,s,o,l)}useState(n,s,o,l){return x.useDebugValue(n),tt(this,this.selectors[n],s,o,l)}useContextCallback(n,s){x.useDebugValue(n);const o=Le(s??Un);this.context[n]=o}useStateSetter(n){const s=x.useRef(void 0);return s.current===void 0&&(s.current=o=>{this.set(n,o)}),s.current}observe(n,s){let o;typeof n=="function"?o=n:o=this.selectors[n];let l=o(this.state);return s(l,l,this),this.subscribe(c=>{const d=o(c);if(!Object.is(l,d)){const f=l;l=d,s(d,f,this)}})}}const j5={open:ze(e=>e.open),transitionStatus:ze(e=>e.transitionStatus),domReferenceElement:ze(e=>e.domReferenceElement),referenceElement:ze(e=>e.positionReference??e.referenceElement),floatingElement:ze(e=>e.floatingElement),floatingId:ze(e=>e.floatingId)};class _f extends Lx{constructor(n){const{syncOnly:s,nested:o,onOpenChange:l,triggerElements:c,...d}=n;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:g3(),nested:o,triggerElements:c},j5),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&iM(s))&&(this.context.dataRef.current.openEvent=n?s:void 0)};dispatchOpenChange=(n,s)=>{this.syncOpenEvent(n,s.event);const o={open:n,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",o)};setOpen=(n,s)=>{if(this.syncOnly){this.context.onOpenChange?.(n,s);return}this.dispatchOpenChange(n,s),this.context.onOpenChange?.(n,s)}}function w5(e){const{popupStore:n,treatPopupAsFloatingElement:s=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:d}=e,f=n.useState("open"),p=n.useState("activeTriggerElement"),m=n.useState(s?"popupElement":"positionerElement"),g=n.context.triggerElements,b=d,v=x.useRef(null);o===void 0&&v.current===null&&(v.current=new _f({open:f,transitionStatus:void 0,referenceElement:p,floatingElement:m,triggerElements:g,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const S=o??v.current;return n.useSyncedValue("floatingId",l),Oe(()=>{const C={open:f,floatingId:l,referenceElement:p,floatingElement:m};ft(p)&&(C.domReferenceElement=p),S.state.positionReference===S.state.referenceElement&&(C.positionReference=p),S.update(C)},[f,l,p,m,S]),S.context.onOpenChange=b,S.context.nested=c,S}function Tc(e,n=!1,s=!1){const[o,l]=x.useState(e&&n?"idle":void 0),[c,d]=x.useState(e);return e&&!c&&(d(!0),l("starting")),!e&&c&&o!=="ending"&&!s&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),Oe(()=>{if(!e&&c&&o!=="ending"&&s){const f=Wa.request(()=>{l("ending")});return()=>{Wa.cancel(f)}}},[e,c,o,s]),Oe(()=>{if(!e||n)return;const f=Wa.request(()=>{l(void 0)});return()=>{Wa.cancel(f)}},[n,e]),Oe(()=>{if(!e||!n)return;e&&c&&o!=="idle"&&l("starting");const f=Wa.request(()=>{l("idle")});return()=>{Wa.cancel(f)}},[n,e,c,o]),{mounted:c,setMounted:d,transitionStatus:o}}let uo=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const S5={[uo.startingStyle]:""},C5={[uo.endingStyle]:""},Il={transitionStatus(e){return e==="starting"?S5:e==="ending"?C5:null}};function k5(e,n=!1,s=!0){const o=_l();return Le((l,c=null)=>{o.cancel();const d=As(e);if(d==null)return;const f=d,p=()=>{Er.flushSync(l)};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function m(){Promise.all(f.getAnimations().map(g=>g.finished)).then(()=>{c?.aborted||p()}).catch(()=>{if(s){c?.aborted||p();return}const g=f.getAnimations();!c?.aborted&&g.length>0&&g.some(b=>b.pending||b.playState!=="finished")&&m()})}if(n){const g=uo.startingStyle;if(!f.hasAttribute(g)){o.request(m);return}const b=new MutationObserver(()=>{f.hasAttribute(g)||(b.disconnect(),m())});b.observe(f,{attributes:!0,attributeFilter:[g]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(m)})}function Ar(e){const{enabled:n=!0,open:s,ref:o,onComplete:l}=e,c=Le(l),d=k5(o,s,!1);x.useEffect(()=>{if(!n)return;const f=new AbortController;return d(c,f.signal),()=>{f.abort()}},[n,s,c,d])}const jf={tabIndex:-1,[bh]:""};function l2(e,n,s=!1){const o=bf(),l=vf()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=n(o,l));const d=e??c.current;return w5({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function E5(e,n){const s=x.useRef(null),o=x.useRef(null);return x.useCallback(l=>{if(e===void 0)return;let c=!1;if(s.current!==null){const d=s.current,f=o.current,p=n.context.triggerElements.getById(d);f&&p===f&&(n.context.triggerElements.delete(d),c=!0),s.current=null,o.current=null}if(l!==null&&(s.current=e,o.current=l,n.context.triggerElements.add(e,l),c=!0),c){const d=n.context.triggerElements.size;n.select("open")&&n.state.triggerCount!==d&&n.set("triggerCount",d)}},[n,e])}function i2(e,n,s){const o=s?.id??null;(o||n)&&(e.activeTriggerId=o,e.activeTriggerElement=s??null)}function N5(e,n,s,o){const l=s.useState("isMountedByTrigger",e),c=E5(e,s),d=Le(f=>{if(c(f),!f)return;const p=s.select("open"),m=s.select("activeTriggerId");if(m===e){s.update({activeTriggerElement:f,...p?o:null});return}m==null&&p&&s.update({activeTriggerId:e,activeTriggerElement:f,...o})});return Oe(()=>{l&&s.update({activeTriggerElement:n.current,...o})},[l,s,n,...Object.values(o)]),{registerTrigger:d,isMountedByThisTrigger:l}}function c2(e){const n=e.useState("open"),s=e.useState("triggerCount");Oe(()=>{if(!n){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,l={};if(e.state.triggerCount!==o&&(l.triggerCount=o),!e.select("activeTriggerId")&&o===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[d,f]=c.value;l.activeTriggerId=d,l.activeTriggerElement=f}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0)&&e.update(l)},[n,e,s])}function u2(e,n,s){const{mounted:o,setMounted:l,transitionStatus:c}=Tc(e);n.useSyncedValues({mounted:o,transitionStatus:c});const d=Le(()=>{l(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n.context.onOpenChangeComplete?.(!1)}),f=n.useState("preventUnmountingOnClose");return Ar({enabled:o&&!e&&!f,open:e,ref:n.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:c}}function d2(e,n){e.useSyncedValues(n),Oe(()=>()=>{e.update({activeTriggerProps:cn,inactiveTriggerProps:cn,popupProps:cn})},[e])}function R5(e,n){Oe(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Oe(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class wf{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(n,s){const o=this.idMap.get(n);o!==s&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(s),this.idMap.set(n,s))}delete(n){const s=this.idMap.get(n);s&&(this.elementsSet.delete(s),this.idMap.delete(n))}hasElement(n){return this.elementsSet.has(n)}hasMatchingElement(n){for(const s of this.elementsSet)if(n(s))return!0;return!1}getById(n){return this.idMap.get(n)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function T5(){return new _f({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new wf,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function f2(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:T5(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:cn,inactiveTriggerProps:cn,popupProps:cn}}function p2(e,n,s=!1){return new _f({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const sc=ze(e=>e.triggerIdProp??e.activeTriggerId),Px=ze(e=>e.openProp??e.open),__=ze(e=>(e.popupElement?.id??e.floatingId)||void 0);function m2(e,n){return n!==void 0&&Px(e)&&sc(e)===n}function A5(e,n){return m2(e,n)?!0:n!==void 0&&Px(e)&&sc(e)==null&&e.triggerCount===1}const g2={open:Px,mounted:ze(e=>e.mounted),transitionStatus:ze(e=>e.transitionStatus),floatingRootContext:ze(e=>e.floatingRootContext),triggerCount:ze(e=>e.triggerCount),preventUnmountingOnClose:ze(e=>e.preventUnmountingOnClose),payload:ze(e=>e.payload),activeTriggerId:sc,activeTriggerElement:ze(e=>e.mounted?e.activeTriggerElement:null),popupId:__,isTriggerActive:ze((e,n)=>n!==void 0&&sc(e)===n),isOpenedByTrigger:ze((e,n)=>m2(e,n)),isMountedByTrigger:ze((e,n)=>n!==void 0&&sc(e)===n&&e.mounted),triggerProps:ze((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:ze((e,n)=>A5(e,n)?__(e):void 0),popupProps:ze(e=>e.popupProps),popupElement:ze(e=>e.popupElement),positionerElement:ze(e=>e.positionerElement)};function h2(e){const{open:n=!1,onOpenChange:s,elements:o={}}=e,l=bf(),c=vf()!=null,d=va(()=>new _f({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new wf,floatingId:l,syncOnly:!1,nested:c})).current;return Oe(()=>{const f={open:n,floatingId:l};o.reference!==void 0&&(f.referenceElement=o.reference,f.domReferenceElement=ft(o.reference)?o.reference:null),o.floating!==void 0&&(f.floatingElement=o.floating),d.update(f)},[n,l,o.reference,o.floating,d]),d.context.onOpenChange=s,d.context.nested=c,d}function M5(e={}){const{nodeId:n,externalTree:s}=e,o=h2(e),l=e.rootContext||o,c=l.useState("referenceElement"),d=l.useState("floatingElement"),f=l.useState("domReferenceElement"),p=l.useState("open"),m=l.useState("floatingId"),[g,b]=x.useState(null),[v,S]=x.useState(void 0),[C,j]=x.useState(void 0),w=x.useRef(null),k=Pl(s),E=x.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),R=o5({...e,elements:{...E,...g&&{reference:g}}}),N=ft(v)?v:null,T=C===void 0?l.state.floatingElement:C;l.useSyncedValue("referenceElement",v??null),l.useSyncedValue("domReferenceElement",v===void 0?f:N),l.useSyncedValue("floatingElement",T);const M=x.useCallback(z=>{const H=ft(z)?{getBoundingClientRect:()=>z.getBoundingClientRect(),getClientRects:()=>z.getClientRects(),contextElement:z}:z;b(H),R.refs.setReference(H)},[R.refs]),O=x.useCallback(z=>{(ft(z)||z===null)&&(w.current=z,S(z)),(ft(R.refs.reference.current)||R.refs.reference.current===null||z!==null&&!ft(z))&&R.refs.setReference(z)},[R.refs,S]),P=x.useCallback(z=>{j(z),R.refs.setFloating(z)},[R.refs]),B=x.useMemo(()=>({...R.refs,setReference:O,setFloating:P,setPositionReference:M,domReference:w}),[R.refs,O,P,M]),L=x.useMemo(()=>({...R.elements,domReference:f}),[R.elements,f]),D=x.useMemo(()=>({...R,dataRef:l.context.dataRef,open:p,onOpenChange:l.setOpen,events:l.context.events,floatingId:m,refs:B,elements:L,nodeId:n,rootStore:l}),[R,B,L,n,l,p,m]);return Oe(()=>{f&&(w.current=f)},[f]),Oe(()=>{l.context.dataRef.current.floatingContext=D;const z=k?.nodesRef.current.find(H=>H.id===n);z&&(z.context=D)}),x.useMemo(()=>({...R,context:D,refs:B,elements:L,rootStore:l}),[R,B,L,D,l])}const gg=aM&&dS;function O5(e,n={}){const{enabled:s=!0,delay:o}=n,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=l.context,f=x.useRef(!1),p=x.useRef(null),m=x.useRef(!0),g=aa();x.useEffect(()=>{const v=l.select("domReferenceElement");if(!s)return;const S=Qt(v);function C(){const k=l.select("domReferenceElement");!l.select("open")&&Gt(k)&&k===In(yt(k))&&(f.current=!0)}function j(){m.current=!0}function w(){m.current=!1}return ns(pt(S,"blur",C),gg&&pt(S,"keydown",j,!0),gg&&pt(S,"pointerdown",w,!0))},[l,s]),x.useEffect(()=>{if(!s)return;function v(S){if(S.reason===gc||S.reason===wx){const C=l.select("domReferenceElement");ft(C)&&(p.current=C,f.current=!0)}}return c.on("openchange",v),()=>{c.off("openchange",v)}},[c,s,l]);const b=x.useMemo(()=>{function v(){f.current=!1,p.current=null}return{onMouseLeave(){v()},onFocus(S){const C=S.currentTarget;if(f.current){if(p.current===C)return;v()}const j=Tn(S.nativeEvent);if(ft(j)){if(gg&&!S.relatedTarget){if(!m.current&&!mf(j))return}else if(!gM(j))return}const w=zd(S.relatedTarget,l.context.triggerElements),{nativeEvent:k,currentTarget:E}=S,R=typeof o=="function"?o():o;if(l.select("open")&&w||R===0||R===void 0){l.setOpen(!0,lt(yd,k,E));return}g.start(R,()=>{f.current||l.setOpen(!0,lt(yd,k,E))})},onBlur(S){v();const C=S.relatedTarget,j=S.nativeEvent,w=ft(C)&&C.hasAttribute(bc("focus-guard"))&&C.getAttribute("data-type")==="outside";g.start(0,()=>{const k=l.select("domReferenceElement"),E=In(yt(k));!C&&E===k||Ze(d.current.floatingContext?.refs.floating.current,E)||Ze(k,E)||w||zd(C??E,l.context.triggerElements)||l.setOpen(!1,lt(yd,j))})}}},[d,o,l,g]);return x.useMemo(()=>s?{reference:b,trigger:b}:{},[s,b])}class Ix{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Ga,this.restTimeout=new Ga,this.handleCloseOptions=void 0}static create(){return new Ix}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const $d=new WeakMap;function Gd(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&$d.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),$d.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function x2(e,n){const{scopeElement:s,referenceElement:o,floatingElement:l}=n,c=$d.get(s);c&&c!==e&&Gd(c),Gd(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,$d.set(s,e),s.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Bx(e){const n=e.context.dataRef.current,s=va(()=>n.hoverInteractionState??Ix.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),hx(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function z5(e,n={}){const{enabled:s=!0,closeDelay:o=0,nodeId:l}=n,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),{dataRef:m}=c.context,g=Pl(),b=vf(),v=Bx(c),S=aa(),C=Le(()=>hS(m.current.openEvent?.type,v.interactedInside)),j=Le(()=>xM(m.current.openEvent?.type)),w=Le(()=>{Gd(v)});Oe(()=>{d||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,w())},[d,v,w]),x.useEffect(()=>w,[w]),Oe(()=>{if(s&&d&&v.handleCloseOptions?.blockPointerEvents&&j()&&ft(p)&&f){const k=p,E=f,R=yt(f),N=g?.nodesRef.current.find(P=>P.id===b)?.context?.elements.floating;N&&(N.style.pointerEvents="");const T=v.pointerEventsScopeElement!==E?v.pointerEventsScopeElement:null,M=N!==E?N:null,O=v.handleCloseOptions?.getScope?.()??T??M??k.closest("[data-rootownerid]")??R.body;return x2(v,{scopeElement:O,referenceElement:k,floatingElement:E}),()=>{w()}}},[s,d,p,f,v,j,g,b,w]),x.useEffect(()=>{if(!s)return;function k(){return!!(g&&b&&Cr(g.nodesRef.current,b).length>0)}function E(P){const B=Ld(o,"close",v.pointerType),L=()=>{c.setOpen(!1,lt($n,P)),g?.events.emit("floating.closed",P)};B?v.openChangeTimeout.start(B,L):(v.openChangeTimeout.clear(),L())}function R(P){const B=Tn(P);if(!mM(B)){v.interactedInside=!1;return}v.interactedInside=B?.closest("[aria-haspopup]")!=null}function N(){v.openChangeTimeout.clear(),S.clear(),g?.events.off("floating.closed",M),w()}function T(P){if(k()&&g){g.events.on("floating.closed",M);return}if(zd(P.relatedTarget,c.context.triggerElements))return;const B=m.current.floatingContext?.nodeId??l,L=P.relatedTarget;if(!(g&&B&&ft(L)&&Cr(g.nodesRef.current,B,!1).some(z=>Ze(z.context?.elements.floating,L)))){if(v.handler){v.handler(P);return}w(),C()||E(P)}}function M(P){!g||!b||k()||S.start(0,()=>{g.events.off("floating.closed",M),c.setOpen(!1,lt($n,P)),g.events.emit("floating.closed",P)})}const O=f;return ns(O&&pt(O,"mouseenter",N),O&&pt(O,"mouseleave",T),O&&pt(O,"pointerdown",R,!0),()=>{g?.events.off("floating.closed",M)})},[s,f,c,m,o,l,C,w,v,g,b,S])}const D5={current:null};function L5(e,n={}){const{enabled:s=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:d=0,move:f=!0,triggerElementRef:p=D5,externalTree:m,isActiveTrigger:g=!0,getHandleCloseContext:b,isClosing:v,shouldOpen:S}=n,C="rootStore"in e?e.rootStore:e,{dataRef:j,events:w}=C.context,k=Pl(m),E=Bx(C),R=x.useRef(!1),N=mn(l),T=mn(o),M=mn(d),O=mn(s),P=mn(S),B=mn(v),L=Le(()=>hS(j.current.openEvent?.type,E.interactedInside)),D=Le(()=>P.current?.()!==!1),z=Le((Y,V,$)=>{const Z=C.context.triggerElements;if(Z.hasElement(V))return!Y||!Ze(Y,V);if(!ft($))return!1;const G=$;return Z.hasMatchingElement(X=>Ze(X,G))&&(!Y||!Ze(Y,G))}),H=Le(()=>{if(!E.handler)return;yt(C.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),q=Le(()=>{Gd(E)});return g&&(E.handleCloseOptions=N.current?.__options),x.useEffect(()=>H,[H]),x.useEffect(()=>{if(!s)return;function Y(V){V.open?R.current=!1:(R.current=V.reason===$n,H(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return w.on("openchange",Y),()=>{w.off("openchange",Y)}},[s,w,E,H]),x.useEffect(()=>{if(!s)return;function Y(G,X=!0){const U=Ld(T.current,"close",E.pointerType);U?E.openChangeTimeout.start(U,()=>{C.setOpen(!1,lt($n,G)),k?.events.emit("floating.closed",G)}):X&&(E.openChangeTimeout.clear(),C.setOpen(!1,lt($n,G)),k?.events.emit("floating.closed",G))}const V=p.current??(g?C.select("domReferenceElement"):null);if(!ft(V))return;function $(G){if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,c&&!io(E.pointerType))return;const X=G1(M.current),U=Ld(T.current,"open",E.pointerType),K=Tn(G),F=G.currentTarget??null,J=C.select("domReferenceElement");let ie=F;if(ft(K)&&!C.context.triggerElements.hasElement(K)){for(const Ne of C.context.triggerElements.elements())if(Ze(Ne,K)){ie=Ne;break}}ft(F)&&ft(J)&&!C.context.triggerElements.hasElement(F)&&Ze(F,J)&&(ie=J);const re=ie==null?!1:z(J,ie,K),oe=C.select("open"),ce=B.current?.()??C.select("transitionStatus")==="ending",ee=!oe&&ce&&R.current,Te=!re&&ft(ie)&&ft(J)&&Ze(J,ie)&&ee,Fe=X>0&&!U,ve=re&&(oe||ee)||Te,Ce=!oe||re;if(ve){D()&&C.setOpen(!0,lt($n,G,ie));return}Fe||(U?E.openChangeTimeout.start(U,()=>{Ce&&D()&&C.setOpen(!0,lt($n,G,ie))}):Ce&&D()&&C.setOpen(!0,lt($n,G,ie)))}function Z(G){if(L()){q();return}H();const X=C.select("domReferenceElement"),U=yt(X);E.restTimeout.clear(),E.restTimeoutPending=!1;const K=j.current.floatingContext??b?.();if(zd(G.relatedTarget,C.context.triggerElements))return;if(N.current&&K){C.select("open")||E.openChangeTimeout.clear();const J=p.current;E.handler=N.current({...K,tree:k,x:G.clientX,y:G.clientY,onClose(){q(),H(),O.current&&!L()&&J===C.select("domReferenceElement")&&Y(G,!0)}}),U.addEventListener("mousemove",E.handler),E.handler(G);return}(E.pointerType==="touch"?!Ze(C.select("floatingElement"),G.relatedTarget):!0)&&Y(G)}return f?ns(pt(V,"mousemove",$,{once:!0}),pt(V,"mouseenter",$),pt(V,"mouseleave",Z)):ns(pt(V,"mouseenter",$),pt(V,"mouseleave",Z))},[H,q,j,T,C,s,N,E,g,z,L,c,f,M,p,k,O,b,B,D]),x.useMemo(()=>{if(!s)return;function Y(V){E.pointerType=V.pointerType}return{onPointerDown:Y,onPointerEnter:Y,onMouseMove(V){const{nativeEvent:$}=V,Z=V.currentTarget,G=C.select("domReferenceElement"),X=C.select("open"),U=z(G,Z,V.target);if(c&&!io(E.pointerType))return;if(X&&U&&E.handleCloseOptions?.blockPointerEvents){const J=C.select("floatingElement");if(J){const ie=E.handleCloseOptions?.getScope?.()??Z.ownerDocument.body;x2(E,{scopeElement:ie,referenceElement:Z,floatingElement:J})}}const K=G1(M.current);if(X&&!U||K===0||!U&&E.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;E.restTimeout.clear();function F(){if(E.restTimeoutPending=!1,L())return;const J=C.select("open");!E.blockMouseMove&&(!J||U)&&D()&&C.setOpen(!0,lt($n,$,Z))}E.pointerType==="touch"?Er.flushSync(()=>{F()}):U&&X?F():(E.restTimeoutPending=!0,E.restTimeout.start(K,F))}}},[s,E,L,z,c,C,M,D])}const P5="Escape";function Sf(e,n,s){switch(e){case"vertical":return n;case"horizontal":return s;default:return n||s}}function Ju(e,n){return Sf(n,e===_x||e===Rc,e===yr||e===_r)}function hg(e,n,s){return Sf(n,e===Rc,s?e===yr:e===_r)||e==="Enter"||e===" "||e===""}function I5(e,n,s){return Sf(n,s?e===yr:e===_r,e===Rc)}function B5(e,n,s,o){const l=s?e===_r:e===yr,c=e===_x;return n==="both"||n==="horizontal"&&o&&o>1?e===P5:Sf(n,l,c)}function U5(e,n){const{listRef:s,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:g=!1,virtual:b=!1,focusItemOnOpen:v="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:j=void 0,orientation:w="vertical",parentOrientation:k,cols:E=1,id:R,resetOnPointerLeave:N=!0,externalTree:T}=n,M="rootStore"in e?e.rootStore:e,O=M.useState("open"),P=M.useState("floatingElement"),B=M.useState("domReferenceElement"),L=M.context.dataRef,D=Dd(P),z=vh(B),H=mn(D),q=vf(),Y=Pl(T),V=x.useRef(v),$=x.useRef(d??-1),Z=x.useRef(null),G=x.useRef(!0),X=Le(ye=>{l($.current===-1?null:$.current,ye)}),U=x.useRef(X),K=x.useRef(!!P),F=x.useRef(O),J=x.useRef(!1),ie=x.useRef(!1),re=x.useRef(null),oe=mn(j),ce=mn(O),ee=mn(d),Te=mn(N),Fe=_l(),ve=_l(),Ce=Le(()=>{function ye(Ue){b?Y?.events.emit("virtualfocus",Ue):re.current=jd(Ue,{sync:J.current,preventScroll:!0})}const le=s.current[$.current],_e=ie.current;le&&ye(le),(J.current?Ue=>Ue():Ue=>Fe.request(Ue))(()=>{const Ue=s.current[$.current]||le;if(!Ue)return;le||ye(Ue),we&&(_e||!G.current)&&Ue.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Oe(()=>{L.current.orientation=w},[L,w]),Oe(()=>{c&&(O&&P?($.current=d??-1,V.current&&d!=null&&(ie.current=!0,X())):K.current&&($.current=-1,U.current()))},[c,O,P,d,X]),Oe(()=>{if(c){if(!O){J.current=!1;return}if(P)if(o==null){if(J.current=!1,ee.current!=null)return;if(K.current&&($.current=-1,Ce()),(!F.current||!K.current)&&V.current&&(Z.current!=null||V.current===!0&&Z.current==null)){let ye=0;const le=()=>{s.current[0]==null?(ye<2&&(ye?Se=>ve.request(Se):queueMicrotask)(le),ye+=1):($.current=Z.current==null||hg(Z.current,w,g)||m?_d(s):jh(s),Z.current=null,X())};le()}}else xc(s.current,o)||($.current=o,Ce(),ie.current=!1)}},[c,O,P,o,ee,m,s,w,g,X,Ce,ve]),Oe(()=>{if(!c||P||!Y||b||!K.current)return;const ye=Y.nodesRef.current,le=ye.find(Ue=>Ue.id===q)?.context?.elements.floating,_e=In(yt(P)),Se=ye.some(Ue=>Ue.context&&Ze(Ue.context.elements.floating,_e));le&&!Se&&G.current&&le.focus({preventScroll:!0})},[c,P,Y,q,b]),Oe(()=>{U.current=X,F.current=O,K.current=!!P}),Oe(()=>{O||(Z.current=null,V.current=v)},[O,v]);const Ne=o!=null,Pe=Le(ye=>{if(!ce.current)return;const le=s.current.indexOf(ye.currentTarget);le!==-1&&($.current!==le||o!==le)&&($.current=le,X(ye))}),Ie=Le(()=>k??Y?.nodesRef.current.find(ye=>ye.id===q)?.context?.dataRef?.current.orientation),be=Le(()=>_d(s,oe.current)),Ae=Le(ye=>{if(G.current=!1,J.current=!0,ye.which===229||!ce.current&&ye.currentTarget===H.current)return;if(m&&B5(ye.key,w,g,E)){Ju(ye.key,Ie())||xa(ye),M.setOpen(!1,lt(F1,ye.nativeEvent)),Gt(B)&&(b?Y?.events.emit("virtualfocus",B):B.focus());return}const le=$.current,_e=_d(s,j),Se=jh(s,j);if(z||(ye.key==="Home"&&(xa(ye),$.current=_e,X(ye)),ye.key==="End"&&(xa(ye),$.current=Se,X(ye))),E>1){const Ue=Array.from({length:s.current.length},()=>({width:1,height:1})),Je=kS(Ue,E,!1),_t=Je.findIndex(ke=>ke!=null&&!Ds(s.current,ke,j)),zt=Je.reduce((ke,Re,Ve)=>Re!=null&&!Ds(s.current,Re,j)?Ve:ke,-1),pe=Je[CS(Je.map(ke=>ke!=null?s.current[ke]:null),{event:ye,orientation:w,loopFocus:p,rtl:g,cols:E,disabledIndices:NS([...(typeof j!="function"?j:null)||s.current.map((ke,Re)=>Ds(s.current,Re,j)?Re:void 0),void 0],Je),minIndex:_t,maxIndex:zt,prevIndex:ES($.current>Se?_e:$.current,Ue,Je,E,ye.key===Rc?"bl":ye.key===(g?yr:_r)?"tr":"tl"),stopEvent:!0})];if(pe!=null&&($.current=pe,X(ye)),w==="both")return}if(Ju(ye.key,w)){if(xa(ye),O&&!b&&In(ye.currentTarget.ownerDocument)===ye.currentTarget){$.current=hg(ye.key,w,g)?_e:Se,X(ye);return}hg(ye.key,w,g)?p?le>=Se?f&&le!==s.current.length?$.current=-1:(J.current=!1,$.current=_e):$.current=Pn(s.current,{startingIndex:le,disabledIndices:j}):$.current=Math.min(Se,Pn(s.current,{startingIndex:le,disabledIndices:j})):p?le<=_e?f&&le!==-1?$.current=s.current.length:(J.current=!1,$.current=Se):$.current=Pn(s.current,{startingIndex:le,decrement:!0,disabledIndices:j}):$.current=Math.max(_e,Pn(s.current,{startingIndex:le,decrement:!0,disabledIndices:j})),xc(s.current,$.current)&&($.current=-1),X(ye)}}),we=x.useMemo(()=>({onFocus(le){J.current=!0,Pe(le)},onClick:({currentTarget:le})=>le.focus({preventScroll:!0}),onMouseMove(le){J.current=!0,ie.current=!1,S&&Pe(le)},onPointerLeave(le){if(!ce.current||!G.current||le.pointerType==="touch")return;J.current=!0;const _e=le.relatedTarget;if(!(!S||s.current.includes(_e))&&Te.current&&(re.current?.(),re.current=null,$.current=-1,X(le),!b)){const Se=H.current,Ue=In(yt(Se));Se&&Ze(Se,Ue)&&Se.focus({preventScroll:!0})}}}),[Pe,ce,H,S,s,X,Te,b]),Be=x.useMemo(()=>b&&O&&Ne&&{"aria-activedescendant":`${R}-${o}`},[b,O,Ne,R,o]),Xe=x.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...z?{}:Be,onKeyDown(ye){if(ye.key==="Tab"&&ye.shiftKey&&O&&!b){const le=Tn(ye.nativeEvent);if(le&&!Ze(H.current,le))return;xa(ye),M.setOpen(!1,lt(gf,ye.nativeEvent)),Gt(B)&&B.focus();return}Ae(ye)},onPointerMove(){G.current=!0}}),[Be,Ae,H,w,z,M,O,b,B]),Ye=x.useMemo(()=>{function ye(Se){M.setOpen(!0,lt(F1,Se.nativeEvent,Se.currentTarget))}function le(Se){v==="auto"&&bx(Se.nativeEvent)&&(V.current=!b)}function _e(Se){V.current=v,v==="auto"&&pS(Se.nativeEvent)&&(V.current=!0)}return{onKeyDown(Se){const Ue=M.select("open");G.current=!1;const Je=Se.key.startsWith("Arrow"),_t=I5(Se.key,Ie(),g),zt=Ju(Se.key,w),pe=(m?_t:zt)||Se.key==="Enter"||Se.key.trim()==="";if(b&&Ue)return Ae(Se);if(!(!Ue&&!C&&Je)){if(pe){const ke=Ju(Se.key,Ie());Z.current=m&&ke?null:Se.key}if(m){_t&&(xa(Se),Ue?($.current=be(),X(Se)):ye(Se));return}zt&&(ee.current!=null&&($.current=ee.current),xa(Se),!Ue&&C?ye(Se):Ae(Se),Ue&&X(Se))}},onFocus(Se){M.select("open")&&!b&&($.current=-1,X(Se))},onPointerDown:_e,onPointerEnter:_e,onMouseDown:le,onClick:le}},[Ae,v,be,m,X,M,C,w,Ie,g,ee,b]),De=x.useMemo(()=>({...Be,...Ye}),[Be,Ye]);return x.useMemo(()=>c?{reference:De,floating:Xe,item:we,trigger:Ye}:{},[c,De,Xe,Ye,we])}function H5(e,n){const{listRef:s,elementsRef:o,activeIndex:l,onMatch:c,onTyping:d,enabled:f=!0,resetMs:p=750,selectedIndex:m=null}=n,g="rootStore"in e?e.rootStore:e,b=g.useState("open"),v=aa(),S=x.useRef(""),C=x.useRef(m??l??-1),j=x.useRef(null),w=Le(R=>{function N(z){const H=o?.current[z];return!H||hf(H)}function T(z,H,q=0){if(z.length===0)return-1;const Y=(q%z.length+z.length)%z.length,V=H.toLocaleLowerCase();for(let $=0;$<z.length;$+=1){const Z=(Y+$)%z.length;if(!(!z[Z]?.toLocaleLowerCase().startsWith(V)||!N(Z)))return Z}return-1}const M=s.current;if(S.current.length>0&&R.key===" "&&(xa(R),d?.(!0)),S.current.length>0&&S.current[0]!==" "&&T(M,S.current)===-1&&R.key!==" "&&d?.(!1),M==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;b&&R.key!==" "&&(xa(R),d?.(!0));const O=S.current==="";O&&(C.current=m??l??-1),M.every(z=>z?z[0]?.toLocaleLowerCase()!==z[1]?.toLocaleLowerCase():!0)&&S.current===R.key&&(S.current="",C.current=j.current),S.current+=R.key,v.start(p,()=>{S.current="",C.current=j.current,d?.(!1)});const L=((O?m??l??-1:C.current)??0)+1,D=T(M,S.current,L);D!==-1?(c?.(D),j.current=D):R.key!==" "&&(S.current="",d?.(!1))}),k=Le(R=>{const N=R.relatedTarget,T=g.select("domReferenceElement"),M=g.select("floatingElement");Ze(T,N)||Ze(M,N)||(v.clear(),S.current="",C.current=j.current,d?.(!1))});Oe(()=>{!b&&m!==null||(v.clear(),j.current=null,S.current!==""&&(S.current=""))},[b,m,v]),Oe(()=>{b&&S.current===""&&(C.current=m??l??-1)},[b,m,l]);const E=x.useMemo(()=>({onKeyDown:w,onBlur:k}),[w,k]);return x.useMemo(()=>f?{reference:E,floating:E}:{},[f,E])}const j_=.1,V5=j_*j_,Bt=.5;function ed(e,n,s,o,l,c){return o>=n!=c>=n&&e<=(l-s)*(n-o)/(c-o)+s}function td(e,n,s,o,l,c,d,f,p,m){let g=!1;return ed(e,n,s,o,l,c)&&(g=!g),ed(e,n,l,c,d,f)&&(g=!g),ed(e,n,d,f,p,m)&&(g=!g),ed(e,n,p,m,s,o)&&(g=!g),g}function q5(e,n,s){return e>=s.x&&e<=s.x+s.width&&n>=s.y&&n<=s.y+s.height}function nd(e,n,s,o,l,c){const d=Math.min(s,l),f=Math.max(s,l),p=Math.min(o,c),m=Math.max(o,c);return e>=d&&e<=f&&n>=p&&n<=m}function $5(e={}){const{blockPointerEvents:n=!1}=e,s=new Ga,o=({x:l,y:c,placement:d,elements:f,onClose:p,nodeId:m,tree:g})=>{const b=d?.split("-")[0];let v=!1,S=null,C=null,j=typeof performance<"u"?performance.now():0;function w(E,R){const N=performance.now(),T=N-j;if(S===null||C===null||T===0)return S=E,C=R,j=N,!1;const M=E-S,O=R-C,P=M*M+O*O,B=T*T*V5;return S=E,C=R,j=N,P<B}function k(){s.clear(),p()}return function(R){s.clear();const N=f.domReference,T=f.floating;if(!N||!T||b==null||l==null||c==null)return;const{clientX:M,clientY:O}=R,P=Tn(R),B=R.type==="mouseleave",L=Ze(T,P),D=Ze(N,P);if(L&&(v=!0,!B))return;if(D&&(v=!1,!B)){v=!0;return}if(B&&ft(R.relatedTarget)&&Ze(T,R.relatedTarget))return;function z(){return!!(g&&Cr(g.nodesRef.current,m).length>0)}function H(){z()||k()}if(z())return;const q=N.getBoundingClientRect(),Y=T.getBoundingClientRect(),V=l>Y.right-Y.width/2,$=c>Y.bottom-Y.height/2,Z=Y.width>q.width,G=Y.height>q.height,X=(Z?q:Y).left,U=(Z?q:Y).right,K=(G?q:Y).top,F=(G?q:Y).bottom;if(b==="top"&&c>=q.bottom-1||b==="bottom"&&c<=q.top+1||b==="left"&&l>=q.right-1||b==="right"&&l<=q.left+1){H();return}let J=!1;switch(b){case"top":J=nd(M,O,X,q.top+1,U,Y.bottom-1);break;case"bottom":J=nd(M,O,X,Y.top+1,U,q.bottom-1);break;case"left":J=nd(M,O,Y.right-1,F,q.left+1,K);break;case"right":J=nd(M,O,q.right-1,F,Y.left+1,K);break}if(J)return;if(v&&!q5(M,O,q)){H();return}if(!B&&w(M,O)){H();return}let ie=!1;switch(b){case"top":{const re=Z?Bt/2:Bt*4,oe=Z||V?l+re:l-re,ce=Z?l-re:V?l+re:l-re,ee=c+Bt+1,Te=V||Z?Y.bottom-Bt:Y.top,Fe=V?Z?Y.bottom-Bt:Y.top:Y.bottom-Bt;ie=td(M,O,oe,ee,ce,ee,Y.left,Te,Y.right,Fe);break}case"bottom":{const re=Z?Bt/2:Bt*4,oe=Z||V?l+re:l-re,ce=Z?l-re:V?l+re:l-re,ee=c-Bt,Te=V||Z?Y.top+Bt:Y.bottom,Fe=V?Z?Y.top+Bt:Y.bottom:Y.top+Bt;ie=td(M,O,oe,ee,ce,ee,Y.left,Te,Y.right,Fe);break}case"left":{const re=G?Bt/2:Bt*4,oe=G||$?c+re:c-re,ce=G?c-re:$?c+re:c-re,ee=l+Bt+1,Te=$||G?Y.right-Bt:Y.left,Fe=$?G?Y.right-Bt:Y.left:Y.right-Bt;ie=td(M,O,Te,Y.top,Fe,Y.bottom,ee,oe,ee,ce);break}case"right":{const re=G?Bt/2:Bt*4,oe=G||$?c+re:c-re,ce=G?c-re:$?c+re:c-re,ee=l-Bt,Te=$||G?Y.left+Bt:Y.right,Fe=$?G?Y.left+Bt:Y.right:Y.left+Bt;ie=td(M,O,ee,oe,ee,ce,Te,Y.top,Fe,Y.bottom);break}}ie?v||s.start(40,H):H()}};return o.__options={...e,blockPointerEvents:n},o}const G5={...g2,disabled:ze(e=>e.disabled),instantType:ze(e=>e.instantType),isInstantPhase:ze(e=>e.isInstantPhase),trackCursorAxis:ze(e=>e.trackCursorAxis),disableHoverablePopup:ze(e=>e.disableHoverablePopup),lastOpenChangeReason:ze(e=>e.openChangeReason),closeOnClick:ze(e=>e.closeOnClick),closeDelay:ze(e=>e.closeDelay),hasViewport:ze(e=>e.hasViewport)};class Ux extends Lx{constructor(n,s,o=!1){const l=new wf,c={...F5(),...n};c.floatingRootContext=p2(l,s,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},G5)}setOpen=(n,s)=>{const o=s.reason,l=o===$n,c=n&&o===yd,d=!n&&(o===gc||o===wx);if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const f=()=>{const p={open:n,openChangeReason:o};c?p.instantType="focus":d?p.instantType="dismiss":o===$n&&(p.instantType=void 0),i2(p,n,s.trigger),this.update(p)};l?Er.flushSync(f):f()};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,lt(gc,n))}static useStore(n,s){return l2(n,(l,c)=>new Ux(s,l,c)).store}}function F5(){return{...f2(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const Y5=oS(function(n){const{disabled:s=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:f,onOpenChange:p,onOpenChangeComplete:m,handle:g,triggerId:b,defaultTriggerId:v=null,children:S}=n,C=Ux.useStore(g?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:b});gx(()=>{l===void 0&&C.state.open===!1&&o===!0&&C.update({open:!0,activeTriggerId:v})}),C.useControlledProp("openProp",l),C.useControlledProp("triggerIdProp",b),C.useContextCallback("onOpenChange",p),C.useContextCallback("onOpenChangeComplete",m);const j=C.useState("open"),w=!s&&j,k=C.useState("activeTriggerId"),E=C.useState("mounted"),R=C.useState("payload");C.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c}),C.useSyncedValue("disabled",s),c2(C);const{forceUnmount:N,transitionStatus:T}=u2(w,C),M=C.useState("isInstantPhase"),O=C.useState("instantType"),P=C.useState("lastOpenChangeReason"),B=x.useRef(null);Oe(()=>{j&&s&&C.setOpen(!1,lt(xS))},[j,s,C]),Oe(()=>{T==="ending"&&P===Bs||T!=="ending"&&M?(O!=="delay"&&(B.current=O),C.set("instantType","delay")):B.current!==null&&(C.set("instantType",B.current),B.current=null)},[T,M,P,O,C]),Oe(()=>{w&&k==null&&C.set("payload",void 0)},[C,k,w]);const L=x.useCallback(()=>{C.setOpen(!1,lt(bS))},[C]);x.useImperativeHandle(f,()=>({unmount:N,close:L}),[N,L]);const D=w||E||!s&&d!=="none";return r.jsxs(lS.Provider,{value:C,children:[D&&r.jsx(X5,{store:C,disabled:s,trackCursorAxis:d}),typeof S=="function"?S({payload:R}):S]})});function X5({store:e,disabled:n,trackCursorAxis:s}){const o=e.useState("floatingRootContext"),l=zx(o,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),c=w3(o,{enabled:!n&&s!=="none",axis:s==="none"?void 0:s}),d=x.useMemo(()=>Oa(c.reference,l.reference),[c.reference,l.reference]),f=x.useMemo(()=>Oa(c.trigger,l.trigger),[c.trigger,l.trigger]),p=x.useMemo(()=>Oa(jf,c.floating,l.floating),[c.floating,l.floating]);return d2(e,{activeTriggerProps:d,inactiveTriggerProps:f,popupProps:p}),null}let so=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=uo.startingStyle]="startingStyle",e[e.endingStyle=uo.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Fd=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const K5={[Fd.popupOpen]:""},Q5={[Fd.popupOpen]:"",[Fd.pressed]:""},Z5={[so.open]:""},W5={[so.closed]:""},J5={[so.anchorHidden]:""},b2={open(e){return e?K5:null}},e4={open(e){return e?Q5:null}},Bl={open(e){return e?Z5:W5},anchorHidden(e){return e?J5:null}};function Mr(e){return bf(e,"base-ui")}const v2=x.createContext(void 0);function t4(){return x.useContext(v2)}let n4=(function(e){return e[e.popupOpen=Fd.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const a4=600,y2="data-base-ui-tooltip-trigger";function w_(e){if("composedPath"in e){const s=e.composedPath();for(let o=0;o<s.length;o+=1){const l=s[o];if(ft(l))return l}}const n=e.target;return ft(n)?n:null}function s4(e){let n=e;for(;n;){if(n.hasAttribute(y2))return n;const s=n.parentElement;if(s){n=s;continue}const o=n.getRootNode();n="host"in o&&ft(o.host)?o.host:null}return null}const r4=WA(function(n,s){const{render:o,className:l,style:c,handle:d,payload:f,disabled:p,delay:m,closeOnClick:g=!0,closeDelay:b,id:v,...S}=n,C=Nc(!0),j=d?.store??C;if(!j)throw new Error(On(82));const w=Mr(v),k=j.useState("isTriggerActive",w),E=j.useState("isOpenedByTrigger",w),R=j.useState("floatingRootContext"),N=x.useRef(null),T=m??a4,M=b??0,{registerTrigger:O,isMountedByThisTrigger:P}=N5(w,N,j,{payload:f,closeOnClick:g,closeDelay:M}),B=t4(),{delayRef:L,isInstantPhase:D,hasProvider:z}=jM(R,{open:E}),H=Bx(R);j.useSyncedValue("isInstantPhase",D);const q=j.useState("disabled"),Y=p??q,V=mn(Y),$=j.useState("trackCursorAxis"),Z=j.useState("disableHoverablePopup"),G=x.useRef(!1),X=aa(),U=x.useRef(void 0);function K(){const ve=B?.delay,Ce=typeof L.current=="object"?L.current.open:void 0;let Ne=T;return z&&(Ce!==0?Ne=m??ve??T:Ne=0),Ne}function F(ve){const Ce=N.current;if(!Ce||!ve)return!1;const Ne=s4(ve);return Ne!==null&&Ne!==Ce&&Ze(Ce,Ne)}function J(ve){const Ce=F(ve);return G.current=Ce,Ce&&(H.openChangeTimeout.clear(),H.restTimeout.clear(),H.restTimeoutPending=!1,X.clear()),Ce}const ie=L5(R,{enabled:!Y,mouseOnly:!0,move:!1,handleClose:!Z&&$!=="both"?$5():null,restMs:K,delay(){const ve=typeof L.current=="object"?L.current.close:void 0;let Ce=M;return b==null&&z&&(Ce=ve),{close:Ce}},triggerElementRef:N,isActiveTrigger:k,isClosing:()=>j.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),re=O5(R,{enabled:!Y}).reference,oe=ve=>{const Ce=G.current,Ne=w_(ve),Pe=J(Ne),Ie=N.current,be=Ie&&Ne&&Ze(Ie,Ne);if(Pe&&j.select("open")&&j.select("lastOpenChangeReason")===$n){j.setOpen(!1,lt($n,ve));return}if(Ce&&!Pe&&be&&!V.current&&!j.select("open")&&Ie&&io(U.current)){const Ae=()=>{!G.current&&!V.current&&!j.select("open")&&j.setOpen(!0,lt($n,ve,Ie))},we=K();we===0?(X.clear(),Ae()):X.start(we,Ae)}},ce=j.useState("triggerProps",P);return Ht("button",n,{state:{open:E},ref:[s,O,N],props:[ie,re,P||$!=="none"?ce:void 0,{onMouseOver(ve){oe(ve.nativeEvent)},onFocus(ve){F(w_(ve.nativeEvent))&&ve.preventBaseUIHandler()},onMouseLeave(){G.current=!1,X.clear(),U.current=void 0},onPointerEnter(ve){U.current=ve.pointerType},onPointerDown(ve){U.current=ve.pointerType,j.set("closeOnClick",g),g&&!j.select("open")&&j.cancelPendingOpen(ve.nativeEvent)},onClick(ve){g&&!j.select("open")&&j.cancelPendingOpen(ve.nativeEvent)},id:w,[n4.triggerDisabled]:Y?"":void 0,[y2]:Y?void 0:""},S],stateAttributesMapping:b2})}),_2=x.createContext(void 0);function o4(){const e=x.useContext(_2);if(e===void 0)throw new Error(On(70));return e}const l4=x.forwardRef(function(n,s){const{children:o,container:l,className:c,render:d,style:f,...p}=n,{portalNode:m,portalSubtree:g}=YS({container:l,ref:s,componentProps:n,elementProps:p});return!g&&!m?null:r.jsxs(x.Fragment,{children:[g,m&&Er.createPortal(o,m)]})}),i4=x.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n;return Nc().useState("mounted")||o?r.jsx(_2.Provider,{value:o,children:r.jsx(l4,{ref:s,...l})}):null}),j2=x.createContext(void 0);function w2(){const e=x.useContext(j2);if(e===void 0)throw new Error(On(71));return e}const c4=x.createContext(void 0);function Hx(){return x.useContext(c4)?.direction??"ltr"}const u4=e=>({name:"arrow",options:e,async fn(n){const{x:s,y:o,placement:l,rects:c,platform:d,elements:f,middlewareData:p}=n,{element:m,padding:g=0,offsetParent:b="real"}=Hs(e,n)||{};if(m==null)return{};const v=SS(g),S={x:s,y:o},C=Nx(l),j=Ex(C),w=await d.getDimensions(m),k=C==="y",E=k?"top":"left",R=k?"bottom":"right",N=k?"clientHeight":"clientWidth",T=c.reference[j]+c.reference[C]-S[C]-c.floating[j],M=S[C]-c.reference[C],O=b==="real"?await d.getOffsetParent?.(m):f.floating;let P=f.floating[N]||c.floating[j];(!P||!await d.isElement?.(O))&&(P=f.floating[N]||c.floating[j]);const B=T/2-M/2,L=P/2-w[j]/2-1,D=Math.min(v[E],L),z=Math.min(v[R],L),H=D,q=P-w[j]-z,Y=P/2-w[j]/2+B,V=yh(H,Y,q),$=!p.arrow&&Tr(l)!=null&&Y!==V&&c.reference[j]/2-(Y<H?D:z)-w[j]/2<0,Z=$?Y<H?Y-H:Y-q:0;return{[C]:S[C]+Z,data:{[C]:V,centerOffset:Y-V-Z,...$&&{alignmentOffset:Z}},reset:$}}}),d4=(e,n)=>({...u4(e),options:[e,n]}),f4={name:"hide",async fn(e){const{width:n,height:s,x:o,y:l}=e.rects.reference,c=n===0&&s===0&&o===0&&l===0;return{data:{referenceHidden:(await f5().fn(e)).data?.referenceHidden||c}}}},Sd={sideX:"left",sideY:"top"},p4={name:"adaptiveOrigin",async fn(e){const{x:n,y:s,rects:{floating:o},elements:{floating:l},platform:c,strategy:d,placement:f}=e,p=Qt(l),m=p.getComputedStyle(l);if(!(m.transitionDuration!=="0s"&&m.transitionDuration!==""))return{x:n,y:s,data:Sd};const b=await c.getOffsetParent?.(l);let v={width:0,height:0};if(d==="fixed"&&p?.visualViewport)v={width:p.visualViewport.width,height:p.visualViewport.height};else if(b===p){const E=yt(l);v={width:E.documentElement.clientWidth,height:E.documentElement.clientHeight}}else await c.isElement?.(b)&&(v=await c.getDimensions(b));const S=sa(f);let C=n,j=s;S==="left"&&(C=v.width-(n+o.width)),S==="top"&&(j=v.height-(s+o.height));const w=S==="left"?"right":Sd.sideX,k=S==="top"?"bottom":Sd.sideY;return{x:C,y:j,data:{sideX:w,sideY:k}}}};function S2(e,n,s){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?s?"inline-start":"inline-end":"right",bottom:"bottom",left:o?s?"inline-end":"inline-start":"left"}[n]}function S_(e,n,s){const{rects:o,placement:l}=e;return{side:S2(n,sa(l),s),align:Tr(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function C2(e){const{anchor:n,positionMethod:s="absolute",side:o="bottom",sideOffset:l=0,align:c="center",alignOffset:d=0,collisionBoundary:f,collisionPadding:p=5,sticky:m=!1,arrowPadding:g=5,disableAnchorTracking:b=!1,inline:v,keepMounted:S=!1,floatingRootContext:C,mounted:j,collisionAvoidance:w,shiftCrossAxis:k=!1,nodeId:E,adaptiveOrigin:R,lazyFlip:N=!1,externalTree:T}=e,[M,O]=x.useState(null);!j&&M!==null&&O(null);const P=w.side||"flip",B=w.align||"flip",L=w.fallbackAxisSide||"end",D=typeof n=="function"?n:void 0,z=Le(D),H=D?z:n,q=mn(n),Y=mn(j),$=Hx()==="rtl",Z=M||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":$?"left":"right","inline-start":$?"right":"left"}[o],G=c==="center"?Z:`${Z}-${c}`;let X=p;const U=1,K=o==="bottom"?U:0,F=o==="top"?U:0,J=o==="right"?U:0,ie=o==="left"?U:0;typeof X=="number"?X={top:X+K,right:X+ie,bottom:X+F,left:X+J}:X&&(X={top:(X.top||0)+K,right:(X.right||0)+ie,bottom:(X.bottom||0)+F,left:(X.left||0)+J});const re={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:X},oe=x.useRef(null),ce=mn(l),ee=mn(d),Te=typeof l!="function"?l:0,Fe=typeof d!="function"?d:0,ve=[];v&&ve.push(v),ve.push(l5(mt=>{const Nt=S_(mt,o,$),Zt=typeof ce.current=="function"?ce.current(Nt):ce.current,St=typeof ee.current=="function"?ee.current(Nt):ee.current;return{mainAxis:Zt,crossAxis:St,alignmentAxis:St}},[Te,Fe,$,o]));const Ce=B==="none"&&P!=="shift",Ne=!Ce&&(m||k||P==="shift"),Pe=P==="none"?null:u5({...re,padding:{top:X.top+U,right:X.right+U,bottom:X.bottom+U,left:X.left+U},mainAxis:!k&&P==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),Ie=Ce?null:i5(mt=>{const Nt=yt(mt.elements.floating).documentElement;return{...re,rootBoundary:k?{x:0,y:0,width:Nt.clientWidth,height:Nt.clientHeight}:void 0,mainAxis:B!=="none",crossAxis:Ne,limiter:m||k?void 0:c5(Zt=>{if(!oe.current)return{};const{width:St,height:an}=oe.current.getBoundingClientRect(),Ft=Aa(sa(Zt.placement)),dn=Ft==="y"?St:an,zn=Ft==="y"?X.left+X.right:X.top+X.bottom;return{offset:dn/2+zn/2}})}},[re,m,k,X,B]);P==="shift"||B==="shift"||c==="center"?ve.push(Ie,Pe):ve.push(Pe,Ie),ve.push(d5({...re,apply({elements:{floating:mt},availableWidth:Nt,availableHeight:Zt,rects:St}){if(!Y.current)return;const an=mt.style;an.setProperty("--available-width",`${Nt}px`),an.setProperty("--available-height",`${Zt}px`);const Ft=Qt(mt).devicePixelRatio||1,{x:dn,y:zn,width:Xn,height:ia}=St.reference,Kn=(Math.round((dn+Xn)*Ft)-Math.round(dn*Ft))/Ft,is=(Math.round((zn+ia)*Ft)-Math.round(zn*Ft))/Ft;an.setProperty("--anchor-width",`${Kn}px`),an.setProperty("--anchor-height",`${is}px`)}}),d4(mt=>({element:oe.current||yt(mt.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(mt){const{elements:Nt,middlewareData:Zt,placement:St,rects:an,y:Ft}=mt,dn=sa(St),zn=Aa(dn),Xn=oe.current,ia=Zt.arrow?.x||0,Kn=Zt.arrow?.y||0,is=Xn?.clientWidth||0,Dn=Xn?.clientHeight||0,ca=ia+is/2,Pa=Kn+Dn/2,cs=Math.abs(Zt.shift?.y||0),ct=an.reference.height/2,Dt=typeof l=="function"?l(S_(mt,o,$)):l,Sn=cs>Dt,sn={top:`${ca}px calc(100% + ${Dt}px)`,bottom:`${ca}px ${-Dt}px`,left:`calc(100% + ${Dt}px) ${Pa}px`,right:`${-Dt}px ${Pa}px`}[dn],Rt=`${ca}px ${an.reference.y+ct-Ft}px`;return Nt.floating.style.setProperty("--transform-origin",Ne&&zn==="y"&&Sn?Rt:sn),{}}},f4,R),Oe(()=>{!j&&C&&C.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[j,C]);const be=x.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Ae,elements:we,x:Be,y:Xe,middlewareData:Ye,update:De,placement:ye,context:le,isPositioned:_e,floatingStyles:Se}=M5({rootContext:C,open:S?j:void 0,placement:G,middleware:ve,strategy:s,whileElementsMounted:S?void 0:(...mt)=>g_(...mt,be),nodeId:E,externalTree:T}),{sideX:Ue,sideY:Je}=Ye.adaptiveOrigin||Sd,_t=_e?s:"fixed",zt=x.useMemo(()=>{const mt=R?{position:_t,[Ue]:Be,[Je]:Xe}:{position:_t,...Se};return _e||(mt.opacity=0),mt},[R,_t,Ue,Be,Je,Xe,Se,_e]),pe=x.useRef(null);Oe(()=>{if(!j)return;const mt=q.current,Nt=typeof mt=="function"?mt():mt,St=(C_(Nt)?Nt.current:Nt)||null||null;St!==pe.current&&(Ae.setPositionReference(St),pe.current=St)},[j,Ae,H,q]),x.useEffect(()=>{if(!j)return;const mt=q.current;typeof mt!="function"&&C_(mt)&&mt.current!==pe.current&&(Ae.setPositionReference(mt.current),pe.current=mt.current)},[j,Ae,H,q]),x.useEffect(()=>{if(S&&j&&we.domReference&&we.floating)return g_(we.domReference,we.floating,De,be)},[S,j,we,De,be]);const ke=sa(ye),Re=S2(o,ke,$),Ve=Tr(ye)||"center",at=!!Ye.hide?.referenceHidden;Oe(()=>{N&&j&&_e&&O(ke)},[N,j,_e,ke]);const nn=x.useMemo(()=>({position:"absolute",top:Ye.arrow?.y,left:Ye.arrow?.x}),[Ye.arrow]),Vt=Ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:zt,arrowStyles:nn,arrowRef:oe,arrowUncentered:Vt,side:Re,align:Ve,physicalSide:ke,anchorHidden:at,refs:Ae,context:le,isPositioned:_e,update:De}),[zt,nn,oe,Vt,Re,Ve,ke,at,Ae,le,_e,De])}function C_(e){return e!=null&&"current"in e}function Vx(e){return e==="starting"?c3:cn}function k2(e,n,{styles:s,transitionStatus:o,props:l,refs:c,hidden:d,inert:f=!1}){const p={...s};return f&&(p.pointerEvents="none"),Ht("div",e,{state:n,ref:c,props:[{role:"presentation",hidden:d,style:p},Vx(o),l],stateAttributesMapping:Bl})}const m4=x.forwardRef(function(n,s){const{render:o,className:l,anchor:c,positionMethod:d="absolute",side:f="top",align:p="center",sideOffset:m=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:S=5,sticky:C=!1,disableAnchorTracking:j=!1,collisionAvoidance:w=f3,style:k,...E}=n,R=Nc(),N=o4(),T=R.useState("open"),M=R.useState("mounted"),O=R.useState("trackCursorAxis"),P=R.useState("disableHoverablePopup"),B=R.useState("floatingRootContext"),L=R.useState("instantType"),D=R.useState("transitionStatus"),z=R.useState("hasViewport"),H=C2({anchor:c,positionMethod:d,floatingRootContext:B,mounted:M,side:f,sideOffset:m,align:p,alignOffset:g,collisionBoundary:b,collisionPadding:v,sticky:C,arrowPadding:S,disableAnchorTracking:j,keepMounted:N,collisionAvoidance:w,adaptiveOrigin:z?p4:void 0}),q=x.useMemo(()=>({open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,instant:O!=="none"?"tracking-cursor":L}),[T,H.side,H.align,H.anchorHidden,O,L]),Y=k2(n,q,{styles:H.positionerStyles,transitionStatus:D,props:E,refs:[s,R.useStateSetter("positionerElement")],hidden:!M,inert:!T||O==="both"||P});return r.jsx(j2.Provider,{value:H,children:Y})}),g4={...Bl,...Il},h4=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=Nc(),{side:p,align:m}=w2(),g=f.useState("open"),b=f.useState("instantType"),v=f.useState("transitionStatus"),S=f.useState("popupProps"),C=f.useState("floatingRootContext"),j=f.useState("disabled"),w=f.useState("closeDelay");Ar({open:g,ref:f.context.popupRef,onComplete(){g&&f.context.onOpenChangeComplete?.(!0)}}),z5(C,{enabled:!j,closeDelay:w});const k=f.useStateSetter("popupElement");return Ht("div",n,{state:{open:g,side:p,align:m,instant:b,transitionStatus:v},ref:[s,f.context.popupRef,k],props:[S,Vx(v),d],stateAttributesMapping:g4})}),x4=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=Nc(),{arrowRef:p,side:m,align:g,arrowUncentered:b,arrowStyles:v}=w2(),S=f.useState("open"),C=f.useState("instantType");return Ht("div",n,{state:{open:S,side:m,align:g,uncentered:b,instant:C},ref:[s,p],props:[{style:v,"aria-hidden":!0},d],stateAttributesMapping:Bl})}),b4=function(n){const{delay:s,closeDelay:o,timeout:l=400}=n,c=x.useMemo(()=>({delay:s,closeDelay:o}),[s,o]),d=x.useMemo(()=>({open:s,close:o}),[s,o]);return r.jsx(v2.Provider,{value:c,children:r.jsx(_M,{delay:d,timeoutMs:l,children:n.children})})};function qx(e){return Tx(19)?e:e?"true":void 0}function v4(e){const[n,s]=x.useState({current:e,previous:null});return e!==n.current&&s({current:e,previous:n.current}),n.previous}function Ot(...e){return rS(px(e))}function y4({delay:e=0,...n}){return r.jsx(b4,{"data-slot":"tooltip-provider",delay:e,...n})}function $x({...e}){return r.jsx(Y5,{"data-slot":"tooltip",...e})}function Gx({...e}){return r.jsx(r4,{"data-slot":"tooltip-trigger",...e})}function Fx({className:e,side:n="top",sideOffset:s=4,align:o="center",alignOffset:l=0,children:c,...d}){return r.jsx(i4,{children:r.jsx(m4,{align:o,alignOffset:l,side:n,sideOffset:s,className:"isolate z-50",children:r.jsxs(h4,{"data-slot":"tooltip-content",className:Ot("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[c,r.jsx(x4,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}function Pi({label:e,active:n,onClick:s,isAdd:o,isSettings:l,isDefault:c,icon:d,title:f,testId:p}){const m=e.trim()||"·",{initials:g,subLabel:b}=_4(m),v=o||l?"indigo":w4(m),S=b&&!o&&!l&&!c;return r.jsxs($x,{children:[r.jsx(Gx,{render:r.jsxs("button",{type:"button",onClick:s,"data-testid":p,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Me("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",n&&"ring-2 ring-foreground ring-offset-2 ring-offset-card",o&&"border border-dashed border-muted-fg/50 bg-transparent text-muted-fg hover:bg-accent/60 hover:text-foreground",l&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",c&&"overflow-hidden bg-muted",!o&&!l&&!c&&n&&E4(v),!o&&!l&&!c&&!n&&k4(v)),children:d??g}),S&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),r.jsx(Fx,{side:"right",children:f||e})]})}function _4(e){const n=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!n)return{initials:"·",subLabel:null};const s=n.split(" ");if(s.length>=2)return{initials:(s[0][0]+s[1][0]).toUpperCase(),subLabel:j4(n)};const o=s[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function j4(e){return e.length>6?e.slice(0,5)+"…":e}function w4(e){let n=0;for(let s=0;s<e.length;s++)n=n*31+e.charCodeAt(s)|0;return H1[Math.abs(n)%H1.length]}const S4={sky:"bg-sky-500/15 text-sky-300 hover:bg-sky-500/25",violet:"bg-violet-500/15 text-violet-300 hover:bg-violet-500/25",emerald:"bg-emerald-500/15 text-emerald-300 hover:bg-emerald-500/25",amber:"bg-amber-500/15 text-amber-300 hover:bg-amber-500/25",rose:"bg-rose-500/15 text-rose-300 hover:bg-rose-500/25",indigo:"bg-indigo-500/15 text-indigo-300 hover:bg-indigo-500/25",teal:"bg-teal-500/15 text-teal-300 hover:bg-teal-500/25",fuchsia:"bg-fuchsia-500/15 text-fuchsia-300 hover:bg-fuchsia-500/25"},C4={sky:"bg-sky-500/30 text-sky-100",violet:"bg-violet-500/30 text-violet-100",emerald:"bg-emerald-500/30 text-emerald-100",amber:"bg-amber-500/30 text-amber-100",rose:"bg-rose-500/30 text-rose-100",indigo:"bg-indigo-500/30 text-indigo-100",teal:"bg-teal-500/30 text-teal-100",fuchsia:"bg-fuchsia-500/30 text-fuchsia-100"};function k4(e){return S4[e]}function E4(e){return C4[e]}function Mt({content:e,side:n="top",children:s}){return e?r.jsxs($x,{children:[r.jsx(Gx,{render:s}),r.jsx(Fx,{side:n,children:e})]}):s}const E2=0,N2=1,R2=2,k_=3;var E_=Object.prototype.hasOwnProperty;function kh(e,n){var s,o;if(e===n)return!0;if(e&&n&&(s=e.constructor)===n.constructor){if(s===Date)return e.getTime()===n.getTime();if(s===RegExp)return e.toString()===n.toString();if(s===Array){if((o=e.length)===n.length)for(;o--&&kh(e[o],n[o]););return o===-1}if(!s||typeof e=="object"){o=0;for(s in e)if(E_.call(e,s)&&++o&&!E_.call(n,s)||!(s in n)||!kh(e[s],n[s]))return!1;return Object.keys(n).length===o}}return e!==e&&n!==n}const Ms=new WeakMap,Os=()=>{},Hn=Os(),Eh=Object,vt=e=>e===Hn,Ja=e=>typeof e=="function",kr=(e,n)=>({...e,...n}),T2=e=>Ja(e.then),xg={},ad={},Yx="undefined",Ac=typeof window!=Yx,Nh=typeof document!=Yx,N4=Ac&&"Deno"in window,R4=()=>Ac&&typeof window.requestAnimationFrame!=Yx,A2=(e,n)=>{const s=Ms.get(e);return[()=>!vt(n)&&e.get(n)||xg,o=>{if(!vt(n)){const l=e.get(n);n in ad||(ad[n]=l),s[5](n,kr(l,o),l||xg)}},s[6],()=>!vt(n)&&n in ad?ad[n]:!vt(n)&&e.get(n)||xg]};let Rh=!0;const T4=()=>Rh,[Th,Ah]=Ac&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Os,Os],A4=()=>{const e=Nh&&document.visibilityState;return vt(e)||e!=="hidden"},M4=e=>(Nh&&document.addEventListener("visibilitychange",e),Th("focus",e),()=>{Nh&&document.removeEventListener("visibilitychange",e),Ah("focus",e)}),O4=e=>{const n=()=>{Rh=!0,e()},s=()=>{Rh=!1};return Th("online",n),Th("offline",s),()=>{Ah("online",n),Ah("offline",s)}},z4={isOnline:T4,isVisible:A4},D4={initFocus:M4,initReconnect:O4},N_=!Sc.useId,gl=!Ac||N4,L4=e=>R4()?window.requestAnimationFrame(e):setTimeout(e,1),bg=gl?x.useEffect:x.useLayoutEffect,vg=typeof navigator<"u"&&navigator.connection,R_=!gl&&vg&&(["slow-2g","2g"].includes(vg.effectiveType)||vg.saveData),sd=new WeakMap,P4=e=>Eh.prototype.toString.call(e),yg=(e,n)=>e===`[object ${n}]`;let I4=0;const Mh=e=>{const n=typeof e,s=P4(e),o=yg(s,"Date"),l=yg(s,"RegExp"),c=yg(s,"Object");let d,f;if(Eh(e)===e&&!o&&!l){if(d=sd.get(e),d)return d;if(d=++I4+"~",sd.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Mh(e[f])+",";sd.set(e,d)}if(c){d="#";const p=Eh.keys(e).sort();for(;!vt(f=p.pop());)vt(e[f])||(d+=f+":"+Mh(e[f])+",");sd.set(e,d)}}else d=o?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return d},Xx=e=>{if(Ja(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Mh(e):"",[e,n]};let B4=0;const Oh=()=>++B4;async function M2(...e){const[n,s,o,l]=e,c=kr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let d=c.populateCache;const f=c.rollbackOnError;let p=c.optimisticData;const m=v=>typeof f=="function"?f(v):f!==!1,g=c.throwOnError;if(Ja(s)){const v=s,S=[],C=n.keys();for(const j of C)!/^\$(inf|sub)\$/.test(j)&&v(n.get(j)._k)&&S.push(j);return Promise.all(S.map(b))}return b(s);async function b(v){const[S]=Xx(v);if(!S)return;const[C,j]=A2(n,S),[w,k,E,R]=Ms.get(n),N=()=>{const q=w[S];return(Ja(c.revalidate)?c.revalidate(C().data,v):c.revalidate!==!1)&&(delete E[S],delete R[S],q&&q[0])?q[0](R2).then(()=>C().data):C().data};if(e.length<3)return N();let T=o,M,O=!1;const P=Oh();k[S]=[P,0];const B=!vt(p),L=C(),D=L.data,z=L._c,H=vt(z)?D:z;if(B&&(p=Ja(p)?p(H,D):p,j({data:p,_c:H})),Ja(T))try{T=T(H)}catch(q){M=q,O=!0}if(T&&T2(T))if(T=await T.catch(q=>{M=q,O=!0}),P!==k[S][0]){if(O)throw M;return T}else O&&B&&m(M)&&(d=!0,j({data:H,_c:Hn}));if(d&&!O)if(Ja(d)){const q=d(T,H);j({data:q,error:Hn,_c:Hn})}else j({data:T,error:Hn,_c:Hn});if(k[S][1]=Oh(),Promise.resolve(N()).then(()=>{j({_c:Hn})}),O){if(g)throw M;return}return T}}const T_=(e,n)=>{for(const s in e)e[s][0]&&e[s][0](n)},U4=(e,n)=>{if(!Ms.has(e)){const s=kr(D4,n),o=Object.create(null),l=M2.bind(Hn,e);let c=Os;const d=Object.create(null),f=(g,b)=>{const v=d[g]||[];return d[g]=v,v.push(b),()=>v.splice(v.indexOf(b),1)},p=(g,b,v)=>{e.set(g,b);const S=d[g];if(S)for(const C of S)C(b,v)},m=()=>{if(!Ms.has(e)&&(Ms.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,p,f]),!gl)){const g=s.initFocus(setTimeout.bind(Hn,T_.bind(Hn,o,E2))),b=s.initReconnect(setTimeout.bind(Hn,T_.bind(Hn,o,N2)));c=()=>{g&&g(),b&&b(),Ms.delete(e)}}};return m(),[e,l,m,c]}return[e,Ms.get(e)[4]]},H4=(e,n,s,o,l)=>{const c=s.errorRetryCount,d=l.retryCount,f=~~((Math.random()+.5)*(1<<(d<8?d:8)))*s.errorRetryInterval;!vt(c)&&d>c||setTimeout(o,f,l)},V4=kh,[O2,q4]=U4(new Map),$4=kr({onLoadingSlow:Os,onSuccess:Os,onError:Os,onErrorRetry:H4,onDiscarded:Os,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:R_?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:R_?5e3:3e3,compare:V4,isPaused:()=>!1,cache:O2,mutate:q4,fallback:{}},z4),G4=(e,n)=>{const s=kr(e,n);if(n){const{use:o,fallback:l}=e,{use:c,fallback:d}=n;o&&c&&(s.use=o.concat(c)),l&&d&&(s.fallback=kr(l,d))}return s},F4=x.createContext({}),Y4="$inf$",z2=Ac&&window.__SWR_DEVTOOLS_USE__,X4=z2?window.__SWR_DEVTOOLS_USE__:[],K4=()=>{z2&&(window.__SWR_DEVTOOLS_REACT__=Sc)},Q4=e=>Ja(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],D2=()=>{const e=x.useContext(F4);return x.useMemo(()=>kr($4,e),[e])},Z4=e=>(n,s,o)=>e(n,s&&((...c)=>{const[d]=Xx(n),[,,,f]=Ms.get(O2);if(d.startsWith(Y4))return s(...c);const p=f[d];return vt(p)?s(...c):(delete f[d],p)}),o),W4=X4.concat(Z4),J4=e=>function(...s){const o=D2(),[l,c,d]=Q4(s),f=G4(o,d);let p=e;const{use:m}=f,g=(m||[]).concat(W4);for(let b=g.length;b--;)p=g[b](p);return p(l,c||f.fetcher||null,f)},eO=(e,n,s)=>{const o=n[e]||(n[e]=[]);return o.push(s),()=>{const l=o.indexOf(s);l>=0&&(o[l]=o[o.length-1],o.pop())}};K4();const _g=Sc.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),jg={dedupe:!0},A_=Promise.resolve(Hn),tO=()=>Os,nO=(e,n,s)=>{const{cache:o,compare:l,suspense:c,fallbackData:d,revalidateOnMount:f,revalidateIfStale:p,refreshInterval:m,refreshWhenHidden:g,refreshWhenOffline:b,keepPreviousData:v,strictServerPrefetchWarning:S}=s,[C,j,w,k]=Ms.get(o),[E,R]=Xx(e),N=x.useRef(!1),T=x.useRef(!1),M=x.useRef(E),O=x.useRef(n),P=x.useRef(s),B=()=>P.current,L=()=>B().isVisible()&&B().isOnline(),[D,z,H,q]=A2(o,E),Y=x.useRef({}).current,V=vt(d)?vt(s.fallback)?Hn:s.fallback[E]:d,$=(be,Ae)=>{for(const we in Y){const Be=we;if(Be==="data"){if(!l(be[Be],Ae[Be])&&(!vt(be[Be])||!l(re,Ae[Be])))return!1}else if(Ae[Be]!==be[Be])return!1}return!0},Z=!N.current,G=x.useMemo(()=>{const be=D(),Ae=q(),we=De=>{const ye=kr(De);return delete ye._k,(()=>{if(!E||!n||B().isPaused())return!1;if(Z&&!vt(f))return f;const _e=vt(V)?ye.data:V;return vt(_e)||p})()?{isValidating:!0,isLoading:!0,...ye}:ye},Be=we(be),Xe=be===Ae?Be:we(Ae);let Ye=Be;return[()=>{const De=we(D());return $(De,Ye)?(Ye.data=De.data,Ye.isLoading=De.isLoading,Ye.isValidating=De.isValidating,Ye.error=De.error,Ye):(Ye=De,De)},()=>Xe]},[o,E]),X=qd.useSyncExternalStore(x.useCallback(be=>H(E,(Ae,we)=>{$(we,Ae)||be()}),[o,E]),G[0],G[1]),U=C[E]&&C[E].length>0,K=X.data,F=vt(K)?V&&T2(V)?_g(V):V:K,J=X.error,ie=x.useRef(F),re=v?vt(K)?vt(ie.current)?F:ie.current:K:F,oe=E&&vt(F),ce=x.useRef(null);!gl&&qd.useSyncExternalStore(tO,()=>(ce.current=!1,ce),()=>(ce.current=!0,ce));const ee=ce.current;S&&ee&&!c&&oe&&console.warn(`Missing pre-initiated data for serialized key "${E}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Te=!E||!n||B().isPaused()||U&&!vt(J)?!1:Z&&!vt(f)?f:c?vt(F)?!1:p:vt(F)||p,Fe=Z&&Te,ve=vt(X.isValidating)?Fe:X.isValidating,Ce=vt(X.isLoading)?Fe:X.isLoading,Ne=x.useCallback(async be=>{const Ae=O.current;if(!E||!Ae||T.current||B().isPaused())return!1;let we,Be,Xe=!0;const Ye=be||{},De=!w[E]||!Ye.dedupe,ye=()=>N_?!T.current&&E===M.current&&N.current:E===M.current,le={isValidating:!1,isLoading:!1},_e=()=>{z(le)},Se=()=>{const Je=w[E];Je&&Je[1]===Be&&delete w[E]},Ue={isValidating:!0};vt(D().data)&&(Ue.isLoading=!0);try{if(De&&(z(Ue),s.loadingTimeout&&vt(D().data)&&setTimeout(()=>{Xe&&ye()&&B().onLoadingSlow(E,s)},s.loadingTimeout),w[E]=[Ae(R),Oh()]),[we,Be]=w[E],we=await we,De&&setTimeout(Se,s.dedupingInterval),!w[E]||w[E][1]!==Be)return De&&ye()&&B().onDiscarded(E),!1;le.error=Hn;const Je=j[E];if(!vt(Je)&&(Be<=Je[0]||Be<=Je[1]||Je[1]===0))return _e(),De&&ye()&&B().onDiscarded(E),!1;const _t=D().data;le.data=l(_t,we)?_t:we,De&&ye()&&B().onSuccess(we,E,s)}catch(Je){Se();const _t=B(),{shouldRetryOnError:zt}=_t;_t.isPaused()||(le.error=Je,De&&ye()&&(_t.onError(Je,E,_t),(zt===!0||Ja(zt)&&zt(Je))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||L())&&_t.onErrorRetry(Je,E,_t,pe=>{const ke=C[E];ke&&ke[0]&&ke[0](k_,pe)},{retryCount:(Ye.retryCount||0)+1,dedupe:!0})))}return Xe=!1,_e(),!0},[E,o]),Pe=x.useCallback((...be)=>M2(o,M.current,...be),[]);if(bg(()=>{O.current=n,P.current=s,vt(K)||(ie.current=K)}),bg(()=>{if(!E)return;const be=Ne.bind(Hn,jg);let Ae=0;B().revalidateOnFocus&&(Ae=Date.now()+B().focusThrottleInterval);const Be=eO(E,C,(Xe,Ye={})=>{if(Xe==E2){const De=Date.now();B().revalidateOnFocus&&De>Ae&&L()&&(Ae=De+B().focusThrottleInterval,be())}else if(Xe==N2)B().revalidateOnReconnect&&L()&&be();else{if(Xe==R2)return Ne();if(Xe==k_)return Ne(Ye)}});return T.current=!1,M.current=E,N.current=!0,z({_k:R}),Te&&(w[E]||(vt(F)||gl?be():L4(be))),()=>{T.current=!0,Be()}},[E]),bg(()=>{let be;function Ae(){const Be=Ja(m)?m(D().data):m;Be&&be!==-1&&(be=setTimeout(we,Be))}function we(){!D().error&&(g||B().isVisible())&&(b||B().isOnline())?Ne(jg).then(Ae):Ae()}return Ae(),()=>{be&&(clearTimeout(be),be=-1)}},[m,g,b,E]),x.useDebugValue(re),c){if(!N_&&gl&&oe)throw new Error("Fallback data is required when using Suspense in SSR.");oe&&(O.current=n,P.current=s,T.current=!1);const be=k[E],Ae=!vt(be)&&oe?Pe(be):A_;if(_g(Ae),!vt(J)&&oe)throw J;const we=oe?Ne(jg):A_;!vt(re)&&oe&&(we.status="fulfilled",we.value=!0),_g(we)}return{mutate:Pe,get data(){return Y.data=!0,re},get error(){return Y.error=!0,J},get isValidating(){return Y.isValidating=!0,ve},get isLoading(){return Y.isLoading=!0,Ce}}},Qe=J4(nO);let wl=null;function no(e){wl=e}function Kx(){return wl}class Mc extends Error{status;body;constructor(n,s,o){super(s),this.status=n,this.body=o}}async function Ii(e,n,s,o={}){const l={"content-type":"application/json",...wl?{authorization:`Bearer ${wl}`}:{},...o.headers||{}},c=await fetch(n,{...o,method:e,headers:l,body:s!==void 0?JSON.stringify(s):void 0});if(!c.ok){let d="",f=null;try{f=await c.json(),d=f?.error||JSON.stringify(f)}catch{d=await c.text()}throw new Mc(c.status,`${e} ${n} → ${c.status}: ${d}`,f)}if(c.status!==204)return await c.json()}const ge={get:e=>Ii("GET",e),post:(e,n)=>Ii("POST",e,n),put:(e,n)=>Ii("PUT",e,n),patch:(e,n)=>Ii("PATCH",e,n),del:e=>Ii("DELETE",e)};async function L2(e,n,s,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...wl?{authorization:`Bearer ${wl}`}:{}},body:JSON.stringify(n)});if(!l.ok||!l.body){const p=await l.text().catch(()=>"");throw new Mc(l.status,`POST ${e} → ${l.status}: ${p||"stream failed"}`)}const c=l.body.getReader(),d=new TextDecoder("utf-8");let f="";for(;;){const{value:p,done:m}=await c.read();if(m)break;f+=d.decode(p,{stream:!0});let g=f.indexOf(`
577
+ `);for(;g>=0;){const b=f.slice(0,g).trim();if(f=f.slice(g+1),b)try{s(JSON.parse(b))}catch{}g=f.indexOf(`
578
+ `)}}if(f.trim())try{s(JSON.parse(f.trim()))}catch{}}const aO={get:()=>ge.get("/health")},na={list:()=>ge.get("/projects"),register:e=>ge.post("/projects",{path:e}),remove:e=>ge.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>ge.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ge.get(`/projects/${e}/config`),set:(e,n)=>ge.patch(`/projects/${e}/config`,{set:n}),unset:(e,n)=>ge.patch(`/projects/${e}/config`,{unset:n}),put:(e,n)=>ge.put(`/projects/${e}/config`,n)},apcProject:{set:(e,n,s)=>ge.patch(`/projects/${e}/apc-project`,{set:n,unset:s}),put:(e,n)=>ge.put(`/projects/${e}/apc-project`,n)},memory:{get:e=>ge.get(`/projects/${e}/memory`),put:(e,n)=>ge.put(`/projects/${e}/memory`,{body:n})}},Jt={list:e=>ge.get(`/projects/${e}/agents`),get:(e,n)=>ge.get(`/projects/${e}/agents/${n}`),create:(e,n)=>ge.post(`/projects/${e}/agents`,n),update:(e,n,s)=>ge.patch(`/projects/${e}/agents/${encodeURIComponent(n)}`,s),remove:(e,n)=>ge.del(`/projects/${e}/agents/${encodeURIComponent(n)}`),chat:(e,n,s)=>ge.post(`/projects/${e}/agents/${encodeURIComponent(n)}/chat`,s),memory:{get:(e,n)=>ge.get(`/projects/${e}/agents/${n}/memory`),put:(e,n,s)=>ge.put(`/projects/${e}/agents/${n}/memory`,{body:s})},vault:e=>ge.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,n={},s="")=>ge.post("/agents/vault",{slug:e,fields:n,body:s}),vaultPatch:(e,n)=>ge.patch(`/agents/vault/${encodeURIComponent(e)}`,n),vaultRemove:e=>ge.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ge.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,n)=>ge.post(`/projects/${e}/agents/import`,{slug:n})},Qx={list:(e,n)=>ge.get(`/projects/${e}/agents/${n}/conversations`),get:(e,n,s)=>ge.get(`/projects/${e}/agents/${n}/conversations/${s}`),compact:(e,n,s)=>ge.post(s?`/projects/${e}/agents/${n}/conversations/${s}/compact`:`/projects/${e}/agents/${n}/compact`,{})},gr={list:e=>ge.get(`/projects/${e}/routines`),get:(e,n)=>ge.get(`/projects/${e}/routines/${n}`),run:(e,n)=>ge.post(`/projects/${e}/routines/${n}/run`),enable:(e,n)=>ge.post(`/projects/${e}/routines/${n}/enable`),disable:(e,n)=>ge.post(`/projects/${e}/routines/${n}/disable`),upsert:(e,n)=>ge.post(`/projects/${e}/routines`,n),remove:(e,n)=>ge.del(`/projects/${e}/routines/${encodeURIComponent(n)}`)},hr={list:(e,n="open")=>ge.get(`/projects/${e}/tasks?state=${n}`),global:(e="open")=>ge.get(`/tasks?state=${e}`),add:(e,n)=>ge.post(`/projects/${e}/tasks`,n),done:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/done`),drop:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/drop`),reopen:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/reopen`)},xr={list:e=>ge.get(`/projects/${e}/mcps`),check:e=>ge.get(`/projects/${e}/mcps/check`),add:(e,n,s)=>ge.post(`/projects/${e}/mcps?scope=${n}`,s),remove:(e,n,s="shared")=>ge.del(`/projects/${e}/mcps/${encodeURIComponent(n)}?scope=${s}`),test:(e,n)=>ge.post(`/projects/${e}/mcps/${encodeURIComponent(n)}/test`,{}),logs:(e,n)=>ge.get(`/projects/${e}/mcps/${encodeURIComponent(n)}/logs`)},vc={list:(e,n={})=>ge.get(`/projects/${e}/vars${n.reveal?"?reveal=1":""}`),get:(e,n,s={})=>ge.get(`/projects/${e}/vars/${encodeURIComponent(n)}${s.reveal?"?reveal=1":""}`),upsert:(e,n)=>ge.post(`/projects/${e}/vars`,n),remove:(e,n,s="project")=>ge.del(`/projects/${e}/vars/${encodeURIComponent(n)}?scope=${s}`)},wg=e=>{const n=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(o,String(l));const s=n.toString();return s?`?${s}`:""},zh={global:(e={})=>ge.get(`/messages/global${wg(e)}`),project:(e,n={})=>ge.get(`/projects/${e}/messages${wg(n)}`),search:(e,n,s=50)=>ge.get(`/projects/${e}/messages/search${wg({q:n,limit:s})}`)},sO={global:e=>ge.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},rO={list:()=>ge.get("/tools")},An={channels:{list:()=>ge.get("/telegram/channels"),upsert:e=>ge.post("/telegram/channels",e),patch:(e,n)=>ge.patch(`/telegram/channels/${e}`,n),remove:e=>ge.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ge.get("/telegram/contacts"),patch:(e,n)=>ge.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,n),remove:e=>ge.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ge.get("/telegram/roles"),set:(e,n)=>ge.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:n}),remove:e=>ge.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ge.get("/telegram/status"),start:()=>ge.post("/telegram/start"),stop:()=>ge.post("/telegram/stop"),send:e=>ge.post("/telegram/send",e)},Yd={list:()=>ge.get("/engines"),models:e=>ge.post("/engines/models",e)},Sl={reload:()=>ge.post("/admin/reload"),shutdown:()=>ge.post("/admin/shutdown"),config:{get:()=>ge.get("/admin/config"),patch:e=>ge.patch("/admin/config",e)},superAgent:()=>ge.get("/admin/super-agent"),logs:(e="errors",n=200)=>ge.get(`/admin/logs?file=${e}&limit=${n}`)},Cl={list:()=>ge.get("/pair/list"),revoke:e=>ge.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>ge.post("/pair/init",{}),status:e=>ge.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>ge.post("/pair/confirm",e)},M_={get:()=>ge.get("/identity"),patch:e=>ge.patch("/identity",e)},P2={send:(e,n)=>ge.post(`/projects/${e}/super-agent/chat`,n),stream:(e,n,s,o)=>L2(`/projects/${e}/super-agent/chat/stream`,n,s,o),summarize:e=>ge.post("/super-agent/summarize",e)},oO={dirs:e=>ge.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`)},lO=["alloy","echo","fable","onyx","nova","shimmer"],iO=["Kore","Puck","Charon","Fenrir","Aoede"],cO=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],uO=["tts-1","tts-1-hd"],dO=["tiny","base","small","medium","large-v2","large-v3"],Xd={piper:{name:"Piper",note:"Local, offline (CLI + modelo .onnx). Sin API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingüe. Requiere API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd). Usa la key de OpenAI."},gemini:{name:"Gemini",note:"Cloud (preview). Usa la key de Gemini."},mock:{name:"Mock",note:"Silencio de prueba. Fallback siempre disponible.",local:!0}};async function fO(e){const n=Kx(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:n?{authorization:`Bearer ${n}`}:{}});if(!s.ok){const l=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${l.slice(0,160)}`)}const o=await s.blob();return URL.createObjectURL(o)}const I2={providers:()=>ge.get("/tts/providers"),say:e=>ge.post("/tts/say",e),turn:e=>ge.post("/voice/turn",e)},O_={manifest:()=>ge.get("/deck/manifest"),setWidget:(e,n)=>ge.patch(`/deck/widgets/${encodeURIComponent(e)}`,n),exec:e=>ge.post("/deck/exec",e)},Jr=e=>`/projects/${e}/code/sessions`,Rs={sessions:{list:e=>ge.get(Jr(e)).then(n=>n.sessions),get:(e,n)=>ge.get(`${Jr(e)}/${n}`),create:(e,n={})=>ge.post(Jr(e),n),update:(e,n,s)=>ge.patch(`${Jr(e)}/${n}`,s),remove:(e,n)=>ge.del(`${Jr(e)}/${n}`)},changes:(e,n)=>ge.get(`${Jr(e)}/${n}/changes`),stream:(e,n,s,o,l)=>L2(`${Jr(e)}/${n}/chat/stream`,s,o,l)},hl={list:e=>ge.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,n)=>ge.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),run:(e,n,s=[])=>ge.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}/run`,{args:s}),remove:(e,n)=>ge.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),write:(e,n,s)=>ge.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`,{content:s}),rename:(e,n,s)=>ge.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`,{newName:s})},pO={list:e=>ge.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills")};function Oc(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/projects",()=>na.list(),{refreshInterval:cf.projects});return{projects:(e||[]).slice().sort((c,d)=>{const f=Number(c.id),p=Number(d.id);return f===0&&p!==0?-1:p===0&&f!==0?1:f-p}),error:n,isLoading:s,mutate:o}}function Zx(e){const{projects:n,isLoading:s,mutate:o}=Oc();return{project:n.find(c=>String(c.id)===e)??null,isLoading:s,mutate:o}}const mO={common:{loading:"Cargando…",saving:"Guardando…",cancel:"Cancelar",save:"Guardar",delete:"Borrar",edit:"Editar",create:"Crear",add:"Agregar",remove:"Quitar",reload:"Recargar",shutdown:"Apagar",enabled:"Habilitado",disabled:"Deshabilitado",enable:"Habilitar",disable:"Deshabilitar",open:"Abrir",close:"Cerrar",confirm:"Confirmar",optional:"(opcional)",none:"—",none_yet:"Todavía no hay nada.",error_generic:"Algo salió mal.",search:"Buscar",new:"Nuevo",restore:"Restaurar",show:"Mostrar",hide:"Ocultar",copy:"Copiar",run:"Ejecutar"},daemon:{connecting:"Conectando con el daemon…",unreachable:"No pude llegar al daemon en localhost:7430.",unreachable_hint:"Arrancá APX con `apx daemon start` y refrescá.",version:"Versión",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — relee ~/.apx/config.json sin reiniciar.",shutdown_confirm:"¿Apagar el daemon? Las próximas requests fallarán hasta levantarlo de nuevo.",shutdown_done:"Daemon detenido."},pairing:{title:"Vincular este equipo",subtitle:"Estás entrando desde fuera de esta máquina. Por seguridad, vinculá este navegador con un código de pairing.",steps_title:"Cómo obtener el código",step_1:"En la PC donde corre APX, abrí una terminal.",step_2:"Ejecutá `apx pair` (o escaneá el QR con APX Deck).",step_3:"Copiá el código que aparece debajo del QR y pegalo acá.",code_label:"Código de pairing",code_ph:"p. ej. 7f3a1c9e-…",label_label:"Nombre de este equipo",label_ph:"p. ej. Notebook del living",submit:"Vincular",linking:"Vinculando…",success:"Equipo vinculado ✓",err_required:"Pegá el código de pairing.",err_expired:"El código expiró. Volvé a correr `apx pair` y probá de nuevo.",err_unknown:"Código desconocido o ya usado. Generá uno nuevo con `apx pair`.",err_generic:"No se pudo vincular. Revisá el código e intentá otra vez.",revoke_hint:"Podés revocar este equipo cuando quieras desde Settings o con `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Proyecto",add_project:"Agregar proyecto",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Proyecto",breadcrumb_base:"Base",breadcrumb_projects:"Proyectos",light:"Cambiar a claro",dark:"Cambiar a oscuro",lang_toggle:"Idioma"},admin:{title:"APX",subtitle:"Panel general. Configuración global, canales y proyectos.",engines_title:"Engines",engines_subtitle:"Adaptadores LLM disponibles. Las API keys viven en ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Canales configurados. Cada uno puede estar pineado a un proyecto.",telegram_polling_on:"Polling activo",telegram_polling_off:"Deshabilitado",telegram_add_channel:"Canal",telegram_send_test:"Probar",telegram_send_test_title:"Enviar a",telegram_default_message:"Mensaje de prueba desde el panel de APX ✅",projects_title:"Proyectos registrados",projects_subtitle:"Click en un proyecto para abrir su panel.",unregister:"Desregistrar",unregister_confirm:"¿Quitar {label} de APX? La carpeta no se borra; sólo se desregistra.",reload_success:"Config recargada.",telegram_polling_started:"Polling iniciado.",telegram_polling_stopped:"Polling detenido.",telegram_channel_removed:"Canal eliminado.",agents_badge:"agents",engine_badge:"sí",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Agregar proyecto",subtitle:"APX indexará .apc/, agents y AGENTS.md en esa carpeta.",path_label:"Ruta absoluta",path_hint:"Equivalente a apx project add /ruta/al/proyecto",path_placeholder:"/Volumes/SSDT7Shield/proyectos_varios/mi-proyecto",register:"Registrar",path_required:"Ruta requerida.",registered:"Proyecto #{id} registrado.",search_btn:"Buscar",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",language:"Idioma",daemon:"Daemon",daemon_sub:"Estado del proceso local que sirve esta web y orquesta los agentes.",engines:"Engines disponibles",engines_sub:"Adaptadores LLM compilados con el daemon.",token:"Token para esta sesión",token_sub:"Si esta web no logró auto-cargar el token, pegalo acá.",token_active:"(ya hay token activo)",token_paste:"Pegá el bearer del daemon",token_saved:"Token guardado.",devices:"Dispositivos pareados",devices_sub:"GET /pair/list. Revocar invalida ese bearer en el daemon.",devices_empty:"No hay clientes pareados todavía.",devices_revoke_confirm:"Revocar cliente {id}?",devices_revoke_success:"Cliente revocado.",devices_pair_btn:"Vincular dispositivo",devices_pair_title:"Vincular dispositivo",devices_pair_desc:"Escaneá el QR con la cámara del celu para entrar directo, o pegá el código en la otra PC.",devices_pair_scan:"Escaneá con la cámara del teléfono — te abre la web ya vinculada.",devices_pair_code:"O pegá este código en la pantalla de pairing:",devices_pair_url:"URL de acceso",devices_pair_link:"O copiá este link y abrilo en el otro dispositivo (entra solo):",devices_pair_copy:"Copiar",devices_pair_copied:"Link copiado al portapapeles.",devices_pair_copied_code:"Código copiado.",devices_pair_expires:"Expira en {s}s",devices_pair_expired:"El código expiró.",devices_pair_regen:"Generar otro",devices_pair_waiting:"Esperando que el dispositivo confirme…",devices_pair_done:"Dispositivo vinculado ✓",devices_pair_localhost_only:"Solo se pueden generar códigos desde la PC del daemon (localhost).",devices_last_seen:"visto:",devices_never:"nunca",devices_revoke:"Revocar",account_section:"Cuenta",agents_section:"Agentes & modelos",channels_section:"Canales & dispositivos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},identity:{title:"Identidad",subtitle:"Datos del usuario. Configuración del agente va en Super-agente.",agent_name:"Nombre del agente",owner_name:"Tu nombre",personality:"Personalidad",owner_context:"Contexto del dueño",owner_context_hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",language:"Idioma preferido",timezone:"Timezone (IANA)",timezone_hint:"ej. America/Argentina/Buenos_Aires",saved:"Identidad guardada."},super_agent:{title:"Super-agente",subtitle:"Personalidad, modelo, prompt y modos del super-agente.",personality:"Personalidad",model:"Modelo activo",model_hint:"Ej: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Prompt extra (system)",system_hint:"Texto que se prepende al system prompt base.",fallback_title:"Fallback chain",fallback_hint:"Si el modelo activo falla, prueba estos en orden.",fallback_add:"Agregar modelo a la cadena",saved:"Super-agente guardado.",enabled_label:"Super-agente habilitado",model_active:"Modelo activo (router)",model_configure:"Configurar en Modelos",behavior_subtitle:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos."},engines_keys:{title:"API keys de modelos",subtitle:"Cada engine guarda su key en ~/.apx/config.json. Los valores ya seteados muestran sufijo seguro.",ollama_url:"Ollama URL",ollama_hint:"Por defecto: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(no seteada)",clear:"Borrar key",saved:"Key guardada.",cleared:"Key borrada."},telegram_global:{title:"Telegram (default)",subtitle:"Canal default — los proyectos pueden overridear con su propio canal.",bot_token:"Bot token",chat_id:"Chat ID por defecto",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling habilitado",saved:"Telegram guardado."},advanced:{title:"Avanzado",subtitle:"Editor raw del ~/.apx/config.json. Los secretos se ven *** set *** pero podés escribir uno nuevo.",write:"Aplicar cambios",written:"Config aplicada y daemon recargado.",reload_success:"Config recargada."}},project:{not_found:"Proyecto {pid} no encontrado.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",danger:{title:"Zona peligrosa",subtitle:"Acciones que afectan el registro del proyecto en APX. No tocan archivos del repo.",rebuild_desc:"Re-escanea .apc/, MCPs y agents y regenera el contexto del super-agente para este proyecto.",unregister_desc:"Quita el proyecto del registry de APX. La carpeta del disco se mantiene intacta.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerar contexto de {label}.",rebuild_long:"Vuelve a leer la config APC, lista MCPs y agents disponibles, y reconstruye el system prompt del super-agente. Es seguro de correr — no borra nada. Usalo después de tocar .apc/ a mano o si los cambios no se reflejan.",unregister_confirm_title:"Desregistrar proyecto",unregister_long:"El proyecto deja de aparecer en `apx`. Los archivos del disco (.apc/, código, todo) se mantienen. Podés volver a registrarlo con `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",vars:"Variables",threads:"Chats",logs:"Logs",memories:"Memorias"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"abrir"},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",empty:"Mandá un mensaje para arrancar la conversación.",placeholder:"Escribí algo y enter para enviar (shift+enter = nueva línea)",send:"Enviar",stop:"Stop",clear:"Limpiar",copy:"copiar",copied:"Copiado.",stopped_marker:" [detenido]",create_agent:"Crear agente",create_agent_title:"Crear agente",create_agent_desc:"Necesario para iniciar chat en proyecto.",role_label:"rol",model_label:"modelo",model_hint:"ej. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Agente master"},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL en ~/.apx/projects/<id>/tasks/.",add:"agregar",add_label:"Nueva task",add_placeholder:"ej. revisar bug del scroll",empty:"No hay tasks {state}.",empty_open:"No hay tasks abiertas.",created:"Task creada.",create_error:"no pude crear la task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"vence",via:"via",aria_done:"marcar done",aria_drop:"descartar task",aria_reopen:"reabrir task"},global_tasks:{title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Cada rutina dispara un agente o un shell.",empty:"Sin rutinas. Creá una arriba.",new:"nueva",new_btn:"Nueva",delete_confirm:"Borrar rutina {name}?",saved:"Rutina guardada.",paused:"pausada",next_run:"próxima:",last_run:"última:",enabled_hint:"Activa · corre según el intervalo",disabled_hint:"Pausada · solo con el botón Run",enabled_label:"Habilitada",new_title:"Nueva rutina",edit_title:"Editar {name}",dialog_desc:"Se guarda en .apc/routines.json. La rutina corre mientras el daemon está activo.",name_field:"Nombre (name)",name_no_edit:"No se puede cambiar al editar.",kind_field:"Acción (kind)",schedule_field:"Intervalo (schedule)",schedule_hint:"Elegí un preset o escribilo a mano. Manual = solo corre con el botón Run.",vars_title:"Variables disponibles",what_happens:"Qué va a pasar",agent_field:"Agente (spec.agent)",agent_hint:"Quién ejecuta la rutina.",agent_loading:"cargando…",agent_pick:"— elegí un agente —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"qué pendiente hay para hoy?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"resumí el estado del proyecto",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell ANTES del prompt. Uno por línea.",post_field:"Post-commands (post_commands)",post_hint:"Shell DESPUÉS del prompt. Uno por línea.",tg_channel:"Canal (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Texto (spec.text)",tg_text_hint:"Mensaje fijo a enviar. No usa modelo.",shell_field:"Comando (spec.command)",shell_hint:"Corre tal cual en el shell. Sin prompt ni pre/post.",hb_channel:"Canal (spec.channel)",hb_message:"Mensaje (spec.message)",name_required:"name requerido",save_error:"save falló",run_error:"run falló",toggle_error:"toggle falló",delete_error:"delete falló",run_success:"{name} disparada.",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en AGENTS.md + .apc/agents/<slug>.md.",subtitle_full:"Definidos en AGENTS.md + .apc/agents/<slug>.md. La memoria runtime vive en ~/.apx/projects/<id>/agents/<slug>/.",empty:"Sin agents. Agregá uno con <code>apx agent add</code> o el botón.",empty_text:"Sin agents. Agregá uno con `apx agent add` o el botón de arriba.",new:"Agente",created:"Agent {slug} creado.",slug_invalid:"slug debe matchear /^[a-z][a-z0-9_-]*$/",hierarchy:"Jerarquía",list_view:"Lista",import:"Importar",chat:"Chat",view:"Ver",orchestrator:"Orquestador",new_title:"Nuevo agent",new_desc:"POST /projects/:pid/agents — escribe .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (opcional)",role_ph:"code refactor",model_label:"model (opcional)",model_hint:"ej. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (opcional)",desc_label:"description (opcional)",desc_ph:"Qué hace este agente…",skills_label:"skills (coma)",skills_ph:"skill-a, skill-b",tools_label:"tools (coma)",tools_ph:"tool-a, tool-b",parent_label:"reporta a (parent, opcional)",parent_hint:"Subagente de un orquestador.",none_parent:"— ninguno —",master_label:"Orquestador (master)",create_success:"Agent {slug} creado.",create_error:"create falló",import_title:"Importar del vault",import_desc:"Plantillas en ~/.apx/agents. Se registran en este proyecto (.apc/agents/<slug>.md).",import_empty:"Sin plantillas en el vault.",import_success:"Importado: {slug}",import_already:"ya está",import_btn:"Importar"},agent_detail:{not_found:"Agente no encontrado.",chat_btn:"Chat con {slug}",reports_to:"↳ reporta a",no_threads:"Sin threads.",no_activity:"Sin actividad registrada.",threads_recent:"Threads recientes",subagents:"Subagentes",subagents_desc:"Agentes que reportan a este orquestador.",config_title:"Configuración del agente",type_label:"Tipología (type)",area_label:"Área",area_hint:"ej. operaciones, marketing",area_ph:"operaciones",role_label:"Role",parent_label:"Reporta a (parent)",none_parent:"— ninguno —",model_label:"Modelo base",model_hint:"Vacío = usa el modelo del Router (default). Setealo solo para forzar un modelo a este agente.",model_ph:"(vacío = router default)",skills_label:"Skills (coma)",bio_label:"Bio / descripción",system_label:"System prompt",system_hint:"Define personalidad y comportamiento (cuerpo del AGENT.md).",master_label:"Orquestador (master)",delete_btn:"Borrar agente",save_btn:"Guardar cambios",delete_confirm:'Borrar el agente "{slug}"? Se elimina .apc/agents/{slug}.md y sus datos runtime locales.',update_success:"Agente actualizado.",delete_success:"Agente borrado.",tools_hint:"Qué tools puede usar el agente. Tocá para activar/desactivar; o editá la lista abajo.",tools_custom_ph:"lista (coma): echo, http_fetch",memory_title:"Memoria del agente",memory_empty:"(memoria vacía)",memory_saved:"Memoria guardada.",records_title:"Records",records_desc:"Log de actividad del agente (mensajes/acciones). Lo más nuevo primero.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Estado de ejecución del agente, derivado de sus rutinas.",sleep_deep:"Deep sleep · sin heartbeat",sleep_deep_desc:"Este agente no tiene ninguna rutina que lo dispare. No se ejecuta de forma autónoma; solo responde cuando lo invocás (chat / tarea).",brain_title:"Brain",brain_desc:"Grafo de relaciones reales del agente: memoria, threads, tasks, heartbeats y jerarquía. (primera versión — lo refinamos)",brain_empty:"Aún no hay relaciones para graficar (sin memoria, threads, tasks ni rutinas).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: Runtime > Shared > Global. Conflictos arriba si los hay.",empty:"Sin MCPs configurados.",new:"MCP",delete_confirm:"Borrar MCP {name} de scope {scope}?",conflicts:"⚠ Conflictos: {names}",new_title:"Nuevo MCP",edit_title:"Editar MCP",new_desc:"Se guarda según el scope elegido. Los valores con ${var.X} se resuelven al arrancar el MCP.",scope_label:"Scope",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"Solo este proyecto · con secrets · no se commitea (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"Solo este proyecto · committeable · sin secrets (.apc/mcps.json)",scope_global_desc:"Todos los proyectos de esta máquina (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Proceso local — `command` + args",transport_http_desc:"Endpoint remoto — URL + headers",transport_label:"Transport",name_label:"Nombre",name_ph:"my-mcp",cmd_label:"Comando",cmd_ph:"npx",args_label:"Args",args_hint_tokens:"Una entrada por argumento. Usá el botón + para insertar variables.",env_label:"Env",env_hint_tokens:"Pares clave/valor. Los valores aceptan ${var.NOMBRE} (botón + a la derecha).",env_empty:"Sin variables de entorno.",url_label:"URL",url_ph:"https://example.com/v2/mcp",headers_label:"Headers",headers_hint:"Pares clave/valor — típicamente Authorization: Bearer ${var.TOKEN}.",headers_empty:"Sin headers.",enabled_label:"Habilitado",add_btn:"Agregar",save_btn:"Guardar",add_arg:"Agregar arg",edit_btn:"Editar",test_btn:"Probar",logs_btn:"Logs",testing:"Probando…",test_ok:"OK · {n} tools disponibles",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos."},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
579
+
580
+ Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",defaults_title:"Agent defaults",defaults_desc:"Plantillas globales del vault. Las bundled vienen con APX y siempre están; las que crees o edites quedan en ~/.apx/agents y se superponen. Importalas a un proyecto desde Agents › Importar.",defaults_show_removed:"Mostrar removidos",defaults_new:"Nuevo",defaults_empty:"Sin plantillas en el vault.",defaults_hide:"Ocultar",defaults_restore:"Restaurar",defaults_edit:"Editar",defaults_remove:"Ocultar",defaults_delete:"Borrar",defaults_tombstone_msg:'Ocultar el default "{slug}"? Es bundled — quedá tombstoneado y lo recuperás con Restaurar.',defaults_delete_msg:'Borrar el template "{slug}"?',defaults_hidden:"Ocultado.",defaults_deleted:"Borrado.",defaults_restored:"Restaurado.",defaults_new_title:"Nuevo template",defaults_new_desc:"POST /agents/vault — se guarda en ~/.apx/agents/<slug>.md",defaults_edit_title:'Editar "{slug}"',defaults_bundled_desc:"Es un default bundled. Al guardar se hace copy-on-write a ~/.apx/agents/<slug>.md (queda como override).",defaults_user_desc:"PATCH /agents/vault/:slug — edita el archivo en ~/.apx/agents.",defaults_master_label:"Agente master",defaults_slug_invalid:"slug inválido (debe matchear /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" creado.',defaults_saved:'Template "{slug}" guardado.'},logs:{title:"Logs",desc_global:"Actividad del daemon (canales globales: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Actividad del proyecto. ~/.apx/projects/<id>/messages/.",filter_channel:"filtrar canal (ej. telegram)",filter_dir:"dirección",all_directions:"Todas las direcciones",in:"Entrada (in)",out:"Salida (out)",filter_type:"tipo",all_types:"Todos los tipos",search_text:"buscar en el texto…",count_of:"de",no_activity:"Sin actividad.",no_activity_ch:'Sin actividad en el canal "{ch}".',error:"No pude leer los mensajes: {msg}",show_more:"ver más",show_less:"ver menos",daemon_errors:"Errores del daemon (~/.apx/logs/errors.jsonl)",no_errors:"Sin errores registrados. 🎉"},telegram_contacts:{title:"Contactos de Telegram",desc:"Quién le escribe a los bots. El rol define qué herramientas puede usar; un invitado no tiene permisos hasta que le asignes un rol.",empty:"Todavía no hay contactos — se registran solos cuando alguien escribe a un bot.",owner_badge:"dueño",assign_role:"Asignar rol",owner_hint:"Es dueño de un canal — cambialo desde el canal",removed:"Contacto eliminado.",delete_confirm:"¿Borrar el contacto {name}?",last_seen:"visto:",tools_all:"tools: todas",tools_none:"tools: ninguna",tools_label:"tools:"},telegram_channels:{title:"Canales",desc:"Cada canal es un bot que el daemon polea. Acá podés añadir/quitar canales, cambiar el agente que contesta, el proyecto al que pertenece y su dueño.",new_btn:"Nuevo canal",empty:"Todavía no hay canales — agregá el primero.",removed:"Canal eliminado.",delete_confirm:"¿Borrar el canal {name}?",no_owner:"sin dueño (se reclama al primer DM)",owner_label:"dueño:"},telegram_channel_dialog:{new_title:"Nuevo canal de Telegram",edit_title:"Editar canal: {name}",name_label:"name (slug interno)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug o id del proyecto al que pinear este canal (opcional).",route_label:"route_to_agent",route_hint:"Agente que contesta; vacío = super-agent APX.",owner_label:"owner_user_id",owner_hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",owner_ph:"889721252",respond_label:"Responder con engine (no echo)",name_required:"name requerido",saved:"Canal guardado."},telegram_send_dialog:{title:"Enviar a {name}",default_msg:"Mensaje de prueba desde el panel de APX ✅"},telegram_roles:{title:"Roles",desc:"Cada rol define qué herramientas del super-agent puede usar quien lo tenga asignado. 'owner' siempre = todas; 'guest' siempre = ninguna (solo chat).",empty:"No hay roles definidos.",tools_all:"todas las herramientas",tools_none:"ninguna herramienta",builtin:"built-in",delete_confirm:'¿Borrar el rol "{name}"?',removed:"Rol eliminado.",saved:'Rol "{name}" guardado.',name_required:"Nombre requerido.",builtin_error:'"{name}" es un rol built-in.',new_title:"Nuevo rol o reemplazar uno custom",name_label:"Nombre",name_ph:"editor",tools_label:"Tools (separadas por coma)",tools_hint:"Vacío = ninguna. Ejemplos: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Acceso total (todas las tools)",save_btn:"Guardar rol",delete_btn:"Borrar"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Conversación rápida con tu super-agente. Tiene acceso a tools (proyectos, tasks, mcps, agentes); para un hilo más largo y persistente, abrí Chats.",empty:"Mandale un mensaje a {persona} para arrancar.",thinking:"{persona} está pensando…",talk:"Hablar con {persona}",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Esa ruta no existe."},ask_panel:{answers_header:"Respuestas",other:"Otro",other_placeholder:"Escribí tu propia respuesta acá",text_placeholder:"Escribí tu respuesta…",back:"Atrás",skip:"Omitir",next:"Siguiente",submit:"Enviar",status_waiting:"Esperando respuesta…",status_received:"Respuestas recibidas"},code_module:{title:"Code",badge:"super-agent",desc:"Sesiones de código estilo OpenCode. Elegí un proyecto, abrí una sesión y pedile que lea, planifique, edite o ejecute.",no_projects:"No hay proyectos registrados. Registrá uno con `apx project add` para usar Code.",sessions:"Sesiones",new_session:"Nueva sesión",untitled:"Nueva sesión",no_sessions:"Todavía no hay sesiones — creá una para empezar a codear.",pick_project:"Elegí un proyecto para ver sus sesiones.",rename:"Renombrar",delete:"Eliminar",delete_confirm:"¿Eliminar esta sesión? Se borra la transcripción; tus archivos quedan intactos.",empty_chat:"Mandá una instrucción de código para arrancar.",placeholder:"Pedí un cambio… (enter envía, shift+enter = nueva línea)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edita archivos y ejecuta comandos",mode_plan_hint:"Plan — solo lectura, propone cambios sin tocar archivos",tab_context:"Contexto",tab_changes:"Cambios",tab_artifacts:"Artifacts",artifacts_none:"Todavía no hay artifacts. Pedile al agente que cree un script en `artifacts/<nombre>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copiar path",artifacts_run:"Run",artifacts_run_hint:"Para ejecutarlo desde la terminal:",artifacts_delete:"Eliminar",artifacts_delete_confirm:"¿Eliminar este artifact? El archivo se borra del disco.",ctx_model:"Modelo",ctx_tokens:"Tokens",ctx_input:"Entrada",ctx_output:"Salida",ctx_messages:"Mensajes",ctx_breakdown:"Desglose de contexto",ctx_none:"Sin uso todavía — mandá un turno para ver tokens.",seg_system:"Sistema",seg_user:"Usuario",seg_assistant:"Asistente",seg_tool:"Tools",seg_other:"Otro",changes_none:"Todavía no hay cambios en esta sesión.",changes_no_git:"Los cambios necesitan un repo git. Este proyecto no lo es.",changes_files:"{n} archivo(s) cambiados",stopped:"[detenido]",close:"Cerrar",reload:"Recargar",discard_changes:"Descartar cambios",save_shortcut_hint:"Guardar (Cmd/Ctrl+S)",artifacts_rename:"Renombrar",artifacts_view:"Ver contenido",artifacts_edit:"Editar contenido",tree_collapse_all:"Colapsar todo",terminal_clear:"Limpiar",terminal_close:"Cerrar terminal"},desktop_screen:{status_title:"Estado",autostart_title:"Arranque automático",shortcut_title:"Atajo de teclado",appearance_title:"Apariencia",activation_title:"Activación + transcripción",last_conv_title:"Última conversación"},voice_screen:{providers_title:"Proveedores de voz (TTS)",test_title:"Probar voz",stt_title:"Transcripción (STT)",configure_provider:"Configurar {name}"},deck_screen:{widgets_title:"Widgets",context_title:"Contexto APX",reload_manifest:"Recargar manifest",widget_native:"Widget nativo APX",widget_external:"Widget externo"},memory_panel:{embeddings_title:"Embeddings (RAG)",ollama_title:"Ollama (local)",openai_title:"OpenAI",gemini_title:"Gemini"},router_panel:{title:"Router de modelos"},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"}},gO={common:{loading:"Loading…",saving:"Saving…",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",add:"Add",remove:"Remove",reload:"Reload",shutdown:"Shut down",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",open:"Open",close:"Close",confirm:"Confirm",optional:"(optional)",none:"—",none_yet:"Nothing here yet.",error_generic:"Something went wrong.",search:"Search",new:"New",restore:"Restore",show:"Show",hide:"Hide",copy:"Copy",run:"Run"},daemon:{connecting:"Connecting to the daemon…",unreachable:"Could not reach the daemon at localhost:7430.",unreachable_hint:"Start APX with `apx daemon start` and refresh.",version:"Version",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — reloads ~/.apx/config.json without restarting.",shutdown_confirm:"Shut down the daemon? Upcoming requests will fail until it restarts.",shutdown_done:"Daemon stopped."},pairing:{title:"Pair this device",subtitle:"You are connecting from outside this machine. For security, pair this browser with a pairing code.",steps_title:"How to get the code",step_1:"On the PC where APX is running, open a terminal.",step_2:"Run `apx pair` (or scan the QR with APX Deck).",step_3:"Copy the code shown below the QR and paste it here.",code_label:"Pairing code",code_ph:"e.g. 7f3a1c9e-…",label_label:"Device name",label_ph:"e.g. Living room laptop",submit:"Pair",linking:"Pairing…",success:"Device paired ✓",err_required:"Paste the pairing code.",err_expired:"The code expired. Run `apx pair` again and try again.",err_unknown:"Unknown or already-used code. Generate a new one with `apx pair`.",err_generic:"Could not pair. Check the code and try again.",revoke_hint:"You can revoke this device at any time from Settings or with `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Project",add_project:"Add project",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Project",breadcrumb_base:"Base",breadcrumb_projects:"Projects",light:"Switch to light",dark:"Switch to dark",lang_toggle:"Language"},admin:{title:"APX",subtitle:"Admin panel. Global config, channels and projects.",engines_title:"Engines",engines_subtitle:"Available LLM adapters. API keys live in ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Configured channels. Each one can be pinned to a project.",telegram_polling_on:"Polling active",telegram_polling_off:"Disabled",telegram_add_channel:"Channel",telegram_send_test:"Test",telegram_send_test_title:"Send to",telegram_default_message:"Test message from APX panel ✅",projects_title:"Registered projects",projects_subtitle:"Click a project to open its panel.",unregister:"Unregister",unregister_confirm:"Remove {label} from APX? The folder is not deleted; only unregistered.",reload_success:"Config reloaded.",telegram_polling_started:"Polling started.",telegram_polling_stopped:"Polling stopped.",telegram_channel_removed:"Channel deleted.",agents_badge:"agents",engine_badge:"yes",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Add project",subtitle:"APX will index .apc/, agents and AGENTS.md in that folder.",path_label:"Absolute path",path_hint:"Equivalent to apx project add /path/to/project",path_placeholder:"/path/to/my-project",register:"Register",path_required:"Path required.",registered:"Project #{id} registered.",search_btn:"Browse",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",language:"Language",daemon:"Daemon",daemon_sub:"Status of the local process that serves this web and orchestrates agents.",engines:"Available engines",engines_sub:"LLM adapters compiled with the daemon.",token:"Session token",token_sub:"If this web could not auto-load the token, paste it here.",token_active:"(token already active)",token_paste:"Paste daemon bearer",token_saved:"Token saved.",devices:"Paired devices",devices_sub:"GET /pair/list. Revoking invalidates that bearer on the daemon.",devices_empty:"No paired clients yet.",devices_revoke_confirm:"Revoke client {id}?",devices_revoke_success:"Client revoked.",devices_pair_btn:"Pair device",devices_pair_title:"Pair device",devices_pair_desc:"Scan the QR with your phone camera to open the web already paired, or paste the code on another PC.",devices_pair_scan:"Scan with your phone camera — opens the web already paired.",devices_pair_code:"Or paste this code on the pairing screen:",devices_pair_url:"Access URL",devices_pair_link:"Or copy this link and open it on the other device (enters automatically):",devices_pair_copy:"Copy",devices_pair_copied:"Link copied to clipboard.",devices_pair_copied_code:"Code copied.",devices_pair_expires:"Expires in {s}s",devices_pair_expired:"The code expired.",devices_pair_regen:"Generate another",devices_pair_waiting:"Waiting for device to confirm…",devices_pair_done:"Device paired ✓",devices_pair_localhost_only:"Codes can only be generated from the daemon's PC (localhost).",devices_last_seen:"seen:",devices_never:"never",devices_revoke:"Revoke",account_section:"Account",agents_section:"Agents & models",channels_section:"Channels & devices",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},identity:{title:"Identity",subtitle:"User data. Agent configuration goes in Super-agent.",agent_name:"Agent name",owner_name:"Your name",personality:"Personality",owner_context:"Owner context",owner_context_hint:"Who you are, what you work on, what the agent should know about you.",language:"Preferred language",timezone:"Timezone (IANA)",timezone_hint:"e.g. America/New_York",saved:"Identity saved."},super_agent:{title:"Super-agent",subtitle:"Personality, model, prompt and modes of the super-agent.",personality:"Personality",model:"Active model",model_hint:"E.g.: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Extra prompt (system)",system_hint:"Text prepended to the base system prompt.",fallback_title:"Fallback chain",fallback_hint:"If the active model fails, these are tried in order.",fallback_add:"Add model to chain",saved:"Super-agent saved.",enabled_label:"Super-agent enabled",model_active:"Active model (router)",model_configure:"Configure in Models",behavior_subtitle:"Super-agent behavior. Model and fallback chain are configured in the Model Router."},engines_keys:{title:"Model API keys",subtitle:"Each engine stores its key in ~/.apx/config.json. Already-set values show a safe suffix.",ollama_url:"Ollama URL",ollama_hint:"Default: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(not set)",clear:"Clear key",saved:"Key saved.",cleared:"Key cleared."},telegram_global:{title:"Telegram (default)",subtitle:"Default channel — projects can override with their own channel.",bot_token:"Bot token",chat_id:"Default chat ID",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling enabled",saved:"Telegram saved."},advanced:{title:"Advanced",subtitle:"Raw editor for ~/.apx/config.json. Secrets show as *** set *** but you can write a new one.",write:"Apply changes",written:"Config applied and daemon reloaded.",reload_success:"Config reloaded."}},project:{not_found:"Project {pid} not found.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",danger:{title:"Danger zone",subtitle:"Actions that affect APX's project registry. They do not touch repo files.",rebuild_desc:"Re-scans .apc/, MCPs and agents and regenerates the super-agent context for this project.",unregister_desc:"Removes the project from APX's registry. The folder on disk stays intact.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerate context for {label}.",rebuild_long:"Re-reads APC config, lists available MCPs and agents, and rebuilds the super-agent system prompt. Safe to run — nothing is deleted. Use it after editing .apc/ by hand or if changes are not being picked up.",unregister_confirm_title:"Unregister project",unregister_long:"The project disappears from `apx`. Files on disk (.apc/, code, everything) stay. You can re-register it with `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",vars:"Variables",threads:"Chats",logs:"Logs",memories:"Memories"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"open"},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",superagent_title:"Chat with {persona}",superagent_subtitle:"Chat with {persona} — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",clear:"Clear",copy:"copy",copied:"Copied.",stopped_marker:" [stopped]",create_agent:"Create agent",create_agent_title:"Create agent",create_agent_desc:"Required to start a chat in this project.",role_label:"role",model_label:"model",model_hint:"e.g. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Master agent"},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",saved:"Routine saved.",paused:"paused",next_run:"next:",last_run:"last:",enabled_hint:"Active · runs on schedule",disabled_hint:"Paused · only via Run button",enabled_label:"Enabled",new_title:"New routine",edit_title:"Edit {name}",dialog_desc:"Saved in .apc/routines.json. The routine runs while the daemon is active.",name_field:"Name",name_no_edit:"Cannot be changed when editing.",kind_field:"Action (kind)",schedule_field:"Interval (schedule)",schedule_hint:"Choose a preset or type manually. Manual = only runs via Run button.",vars_title:"Available variables",what_happens:"What will happen",agent_field:"Agent (spec.agent)",agent_hint:"Who executes the routine.",agent_loading:"loading…",agent_pick:"— pick an agent —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"what is pending for today?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"summarize the project status",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell BEFORE the prompt. One per line.",post_field:"Post-commands (post_commands)",post_hint:"Shell AFTER the prompt. One per line.",tg_channel:"Channel (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Text (spec.text)",tg_text_hint:"Fixed message to send. Does not use a model.",shell_field:"Command (spec.command)",shell_hint:"Runs as-is in the shell. No prompt, no pre/post.",hb_channel:"Channel (spec.channel)",hb_message:"Message (spec.message)",name_required:"name required",save_error:"save failed",run_error:"run failed",toggle_error:"toggle failed",delete_error:"delete failed",run_success:"{name} fired.",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in AGENTS.md + .apc/agents/<slug>.md.",subtitle_full:"Defined in AGENTS.md + .apc/agents/<slug>.md. Runtime memory lives under ~/.apx/projects/<id>/agents/<slug>/.",empty:"No agents. Add one with <code>apx agent add</code> or the button.",empty_text:"No agents. Add one with `apx agent add` or the button above.",new:"Agent",created:"Agent {slug} created.",slug_invalid:"slug must match /^[a-z][a-z0-9_-]*$/",hierarchy:"Hierarchy",list_view:"List",import:"Import",chat:"Chat",view:"View",orchestrator:"Orchestrator",new_title:"New agent",new_desc:"POST /projects/:pid/agents — writes .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (optional)",role_ph:"code refactor",model_label:"model (optional)",model_hint:"e.g. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (optional)",desc_label:"description (optional)",desc_ph:"What does this agent do…",skills_label:"skills (comma)",skills_ph:"skill-a, skill-b",tools_label:"tools (comma)",tools_ph:"tool-a, tool-b",parent_label:"reports to (parent, optional)",parent_hint:"Sub-agent of an orchestrator.",none_parent:"— none —",master_label:"Orchestrator (master)",create_success:"Agent {slug} created.",create_error:"create failed",import_title:"Import from vault",import_desc:"Templates in ~/.apx/agents. Registered in this project (.apc/agents/<slug>.md).",import_empty:"No templates in the vault.",import_success:"Imported: {slug}",import_already:"already here",import_btn:"Import"},agent_detail:{not_found:"Agent not found.",chat_btn:"Chat with {slug}",reports_to:"↳ reports to",no_threads:"No threads.",no_activity:"No recorded activity.",threads_recent:"Recent threads",subagents:"Sub-agents",subagents_desc:"Agents that report to this orchestrator.",config_title:"Agent configuration",type_label:"Type",area_label:"Area",area_hint:"e.g. operations, marketing",area_ph:"operations",role_label:"Role",parent_label:"Reports to (parent)",none_parent:"— none —",model_label:"Base model",model_hint:"Empty = uses the Router model (default). Set only to force a model for this agent.",model_ph:"(empty = router default)",skills_label:"Skills (comma)",bio_label:"Bio / description",system_label:"System prompt",system_hint:"Defines personality and behavior (body of AGENT.md).",master_label:"Orchestrator (master)",delete_btn:"Delete agent",save_btn:"Save changes",delete_confirm:'Delete agent "{slug}"? Removes .apc/agents/{slug}.md and local runtime data.',update_success:"Agent updated.",delete_success:"Agent deleted.",tools_hint:"Which tools this agent can use. Tap to toggle; or edit the list below.",tools_custom_ph:"list (comma): echo, http_fetch",memory_title:"Agent memory",memory_empty:"(empty memory)",memory_saved:"Memory saved.",records_title:"Records",records_desc:"Agent activity log (messages/actions). Newest first.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Agent execution status, derived from its routines.",sleep_deep:"Deep sleep · no heartbeat",sleep_deep_desc:"This agent has no routine that triggers it. It does not run autonomously; it only responds when invoked (chat / task).",brain_title:"Brain",brain_desc:"Real relationship graph of the agent: memory, threads, tasks, heartbeats and hierarchy. (first version — will be refined)",brain_empty:"No relationships to graph yet (no memory, threads, tasks or routines).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: runtime > shared > global. Conflicts shown above if any.",empty:"No MCPs configured.",new:"MCP",delete_confirm:"Delete MCP {name} from scope {scope}?",conflicts:"⚠ Conflicts: {names}",new_title:"New MCP",new_desc:"POST /projects/:pid/mcps?scope=…",scope_label:"Scope",transport_label:"Transport",name_label:"Name",name_ph:"filesystem",cmd_label:"Command",cmd_ph:"npx",args_label:"Args",args_hint:"space-separated",args_ph:"-y @modelcontextprotocol/server-filesystem /tmp",env_label:"Env (JSON, optional)",url_label:"URL",url_ph:"https://example.com/mcp",enabled_label:"Enabled",add_btn:"Add",name_required:"name required",env_invalid:"env must be valid JSON",removed:"removed",added:"MCP added.",updated:"MCP updated.",edit_title:"Edit MCP",save_btn:"Save",add_arg:"Add arg",edit_btn:"Edit",test_btn:"Test",logs_btn:"Logs",testing:"Testing…",test_ok:"OK · {n} tools available",logs_title:"Logs · {name}",logs_empty:"No logs yet. Start the MCP by calling a tool or running Test.",logs_events:"Recent events",logs_stderr:"stderr (last 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"pick an MCP",logs_panel_hint:"Click an MCP in the list to see what's happening live.",logs_panel_idle:"No activity. Hit Test to spin it up.",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"This project only · with secrets · not committed (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"This project only · committeable · no secrets (.apc/mcps.json)",scope_global_desc:"All projects on this machine (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Local process — `command` + args",transport_http_desc:"Remote endpoint — URL + headers",args_hint_tokens:"One entry per arg. Use the + button to insert a variable.",env_hint_tokens:"Key/value pairs. Values accept ${var.NAME} (+ button on the right).",env_empty:"No env vars.",headers_label:"Headers",headers_hint:"Key/value pairs — typically Authorization: Bearer ${var.TOKEN}.",headers_empty:"No headers."},vars:{title:"Variables",subtitle_project:"Replace ${var.NAME} when loading MCPs and templates. Project vars beat globals. Stored outside the repo (~/.apx/, chmod 0600).",subtitle_base:"Global variables — available to every project. Stored in ~/.apx/vars.json (chmod 0600).",empty:"No variables yet.",new:"Variable",new_title:"New variable",edit_title:"Edit variable",new_desc:"Referenced as ${var.NAME} in any field that supports interpolation.",reveal_all:"Show values",reveal:"Show",hide:"Hide",filter_label:"Show:",filter_all:"All",filter_project:"Project only",filter_global:"Globals only",scope_label:"Scope",scope_project:"project",scope_project_desc:"This project only. Beats the global with the same name.",scope_global:"global",scope_global_desc:"Available to every project.",name_label:"Name",name_hint:"Uppercase, digits and _. E.g. MY_API_KEY, GITHUB_TOKEN.",value_label:"Value",value_hint:"Stored on disk with 0600 perms. Never committed.",value_edit_ph:"(leave empty to keep current… not yet supported, paste the value again)",add_btn:"Add",save_btn:"Save",edit_btn:"Edit",delete_btn:"Delete",delete_confirm:"Delete {name} ({scope})?",removed:"Variable removed.",added:"Variable added.",updated:"Variable updated.",name_required:"Name required.",value_required:"Value required."},threads:{title:"Chats",subtitle:"Conversations per agent (empty = no logs persisted yet).",no_agents:"No agents. Conversations require a configured agent.",pick:"Pick an agent to view its conversations.",empty:"No conversations for {slug}.",conversation_title:"Conversation {id}",messages:"messages",via:"via"},config:{title:"Quick config",subtitle:"Project override. Written to {path}.",model:"super_agent.model",model_hint:"e.g. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug of the agent that handles this project by default.",use_global:"(uses global)",saved:"Saved.",nothing:"Nothing to save.",raw_title:"Config (raw JSON)",raw_subtitle:"Paste the entire object — equivalent to PUT the file.",raw_save:"Replace config",raw_done:"Config overwritten.",effective:"Effective config (read-only)",effective_sub:"What the daemon actually sees (global ⊕ override).",section_title:"Project config",section_desc:"APC metadata and overrides separated. General APX lives in Settings > Config.",effective_read:"Read: global APX + project override.",save_project:".apc/project.json saved.",save_override:".apc/config.json saved.",save_fields_success:"Overrides saved.",save_meta_success:"Project metadata saved.",no_data:"No data."},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
581
+
582
+ Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",defaults_title:"Agent defaults",defaults_desc:"Global vault templates. Bundled ones come with APX and are always present; ones you create or edit go in ~/.apx/agents and override. Import them into a project from Agents › Import.",defaults_show_removed:"Show removed",defaults_new:"New",defaults_empty:"No templates in the vault.",defaults_hide:"Hide",defaults_restore:"Restore",defaults_edit:"Edit",defaults_remove:"Hide",defaults_delete:"Delete",defaults_tombstone_msg:`Hide the default "{slug}"? It's bundled — tombstoned and recoverable with Restore.`,defaults_delete_msg:'Delete the template "{slug}"?',defaults_hidden:"Hidden.",defaults_deleted:"Deleted.",defaults_restored:"Restored.",defaults_new_title:"New template",defaults_new_desc:"POST /agents/vault — saved to ~/.apx/agents/<slug>.md",defaults_edit_title:'Edit "{slug}"',defaults_bundled_desc:"This is a bundled default. Saving does a copy-on-write to ~/.apx/agents/<slug>.md (becomes an override).",defaults_user_desc:"PATCH /agents/vault/:slug — edits the file in ~/.apx/agents.",defaults_master_label:"Master agent",defaults_slug_invalid:"invalid slug (must match /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" created.',defaults_saved:'Template "{slug}" saved.'},logs:{title:"Logs",desc_global:"Daemon activity (global channels: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Project activity. ~/.apx/projects/<id>/messages/.",filter_channel:"filter channel (e.g. telegram)",filter_dir:"direction",all_directions:"All directions",in:"Incoming (in)",out:"Outgoing (out)",filter_type:"type",all_types:"All types",search_text:"search text…",count_of:"of",no_activity:"No activity.",no_activity_ch:'No activity in channel "{ch}".',error:"Could not read messages: {msg}",show_more:"show more",show_less:"show less",daemon_errors:"Daemon errors (~/.apx/logs/errors.jsonl)",no_errors:"No errors recorded. 🎉"},telegram_contacts:{title:"Telegram contacts",desc:"Who writes to the bots. The role defines which tools they can use; a guest has no permissions until you assign a role.",empty:"No contacts yet — they register automatically when someone writes to a bot.",owner_badge:"owner",assign_role:"Assign role",owner_hint:"Channel owner — change it from the channel",removed:"Contact deleted.",delete_confirm:"Delete contact {name}?",last_seen:"seen:",tools_all:"tools: all",tools_none:"tools: none",tools_label:"tools:"},telegram_channels:{title:"Channels",desc:"Each channel is a bot the daemon polls. Here you can add/remove channels, change the answering agent, the project it belongs to and its owner.",new_btn:"New channel",empty:"No channels yet — add the first one.",removed:"Channel deleted.",delete_confirm:"Delete channel {name}?",no_owner:"no owner (claimed on first DM)",owner_label:"owner:"},telegram_channel_dialog:{new_title:"New Telegram channel",edit_title:"Edit channel: {name}",name_label:"name (internal slug)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug or id of the project to pin this channel to (optional).",route_label:"route_to_agent",route_hint:"Answering agent; empty = APX super-agent.",owner_label:"owner_user_id",owner_hint:"Telegram user_id of the channel owner. Overrides global role to 'owner' here. Leave empty — first private message claims it.",owner_ph:"889721252",respond_label:"Respond with engine (not echo)",name_required:"name required",saved:"Channel saved."},telegram_send_dialog:{title:"Send to {name}",default_msg:"Test message from APX panel ✅"},telegram_roles:{title:"Roles",desc:"Each role defines which super-agent tools the assigned user can invoke. 'owner' always = all; 'guest' always = none (chat only).",empty:"No roles defined.",tools_all:"all tools",tools_none:"no tools",builtin:"built-in",delete_confirm:'Delete role "{name}"?',removed:"Role deleted.",saved:'Role "{name}" saved.',name_required:"Name required.",builtin_error:'"{name}" is a built-in role.',new_title:"New role or replace a custom one",name_label:"Name",name_ph:"editor",tools_label:"Tools (comma-separated)",tools_hint:"Empty = none. Examples: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Full access (all tools)",save_btn:"Save role",delete_btn:"Delete"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Quick chat with your super-agent. Has access to tools (projects, tasks, mcps, agents); for a longer persistent thread, open Chats.",empty:"Send {persona} a message to get started.",thinking:"{persona} is thinking…",talk:"Talk to {persona}",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"That route does not exist."},ask_panel:{answers_header:"Answers",other:"Other",other_placeholder:"Write your own answer here",text_placeholder:"Type your answer…",back:"Back",skip:"Skip",next:"Next",submit:"Send",status_waiting:"Waiting for your answer…",status_received:"Answers received"},code_module:{title:"Code",badge:"super-agent",desc:"OpenCode-style coding sessions. Pick a project, open a session, and ask it to read, plan, edit or run.",no_projects:"No registered projects. Register one with `apx project add` to use Code.",sessions:"Sessions",new_session:"New session",untitled:"New session",no_sessions:"No sessions yet — create one to start coding.",pick_project:"Pick a project to see its sessions.",rename:"Rename",delete:"Delete",delete_confirm:"Delete this session? The transcript is removed; your files are untouched.",empty_chat:"Send a coding instruction to get started.",placeholder:"Ask for a change… (enter sends, shift+enter = new line)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edits files and runs commands",mode_plan_hint:"Plan — read-only, proposes changes without touching files",tab_context:"Context",tab_changes:"Changes",tab_artifacts:"Artifacts",artifacts_none:"No artifacts yet. Ask the agent to create a script under `artifacts/<name>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copy path",artifacts_run:"Run",artifacts_run_hint:"Run it from your terminal:",artifacts_delete:"Delete",artifacts_delete_confirm:"Delete this artifact? The file will be removed from disk.",ctx_model:"Model",ctx_tokens:"Tokens",ctx_input:"Input",ctx_output:"Output",ctx_messages:"Messages",ctx_breakdown:"Context breakdown",ctx_none:"No usage yet — send a turn to see tokens.",seg_system:"System",seg_user:"User",seg_assistant:"Assistant",seg_tool:"Tools",seg_other:"Other",changes_none:"No changes in this session yet.",changes_no_git:"Changes need a git repository. This project isn't one.",changes_files:"{n} file(s) changed",stopped:"[stopped]",close:"Close",reload:"Reload",discard_changes:"Discard changes",save_shortcut_hint:"Save (Cmd/Ctrl+S)",artifacts_rename:"Rename",artifacts_view:"View contents",artifacts_edit:"Edit contents",tree_collapse_all:"Collapse all",terminal_clear:"Clear",terminal_close:"Close terminal"},desktop_screen:{status_title:"Status",autostart_title:"Auto-start",shortcut_title:"Keyboard shortcut",appearance_title:"Appearance",activation_title:"Activation + transcription",last_conv_title:"Last conversation"},voice_screen:{providers_title:"Voice providers (TTS)",test_title:"Test voice",stt_title:"Transcription (STT)",configure_provider:"Configure {name}"},deck_screen:{widgets_title:"Widgets",context_title:"APX context",reload_manifest:"Reload manifest",widget_native:"Native APX widget",widget_external:"External widget"},memory_panel:{embeddings_title:"Embeddings (RAG)",ollama_title:"Ollama (local)",openai_title:"OpenAI",gemini_title:"Gemini"},router_panel:{title:"Model router"},engines_panel:{title:"Providers",new_btn:"New provider"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"}},Wx={es:mO,en:gO};function hO(){try{const e=localStorage.getItem(Rn.language);if(e&&e in Wx)return e}catch{}return"es"}let Cf=hO();function xO(e){Cf=e;try{localStorage.setItem(Rn.language,e)}catch{}}const bO=[{value:"es",label:"Español"},{value:"en",label:"English"}];function vO(){return Cf}function yO(e){const n=Wx[Cf],s=e.split(".");let o=n;for(const l of s)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function _O(e,n){return n?e.replace(/\{(\w+)\}/g,(s,o)=>o in n?String(n[o]):`{${o}}`):e}function jO(e){const n=yO(e);if(n!==void 0)return n;if(Cf!=="es"){const s=Wx.es,o=e.split(".");let l=s;for(const c of o)if(l&&typeof l=="object"&&c in l)l=l[c];else return;return typeof l=="string"?l:void 0}}function _(e,n){const s=jO(e);return s===void 0?e:_O(s,n)}function Jx(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/identity",()=>M_.get());return{identity:e||{},error:n,isLoading:s,mutate:o,save:async c=>{const d=await M_.patch(c);return await o(d,{revalidate:!1}),d}}}function eb(){const{identity:e}=Jx();return e?.agent_name?.trim()||"APX"}function wO(){return[{id:"voice",label:_("nav.modules.voice"),href:"/m/voice",icon:JT},{id:"desktop",label:_("nav.modules.desktop"),href:"/m/desktop",icon:eA},{id:"deck",label:_("nav.modules.deck"),href:"/m/deck",icon:QT},{id:"code",label:_("nav.modules.code"),href:"/m/code",icon:Sr}]}function SO({onSelect:e,onOpenRoby:n}){const{projects:s,isLoading:o}=Oc(),l=oa(),c=wO(),d=eb(),f=g=>l.pathname===g||l.pathname.startsWith(`${g}/`),p=s.find(g=>String(g.id)==="0"),m=s.filter(g=>String(g.id)!=="0");return r.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-y-auto bg-transparent py-3",children:[r.jsx(Mt,{content:_("nav.apx_admin"),side:"right",children:r.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:r.jsx(bA,{size:36})})}),o&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),p&&r.jsx(Pi,{label:_("base.title"),testId:"project-avatar-0",title:_("base.subtitle"),active:f("/p/0"),isDefault:!0,icon:r.jsx("img",{src:"/modules/superagent.png",alt:_("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),c.map(g=>r.jsx(Pi,{label:g.label,testId:`module-avatar-${g.id}`,title:g.label,active:f(g.href),icon:r.jsx(g.icon,{size:18}),onClick:()=>e(g.href)},g.id)),m.length>0&&r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),m.map(g=>{const b=g.name||g.path.split("/").pop()||String(g.id),v=`/p/${g.id}`;return r.jsx(Pi,{label:b,testId:`project-avatar-${g.id}`,title:`${b} — ${g.path}`,active:f(v),onClick:()=>e(v)},g.id)}),r.jsx(Pi,{label:"Add",isAdd:!0,testId:"nav-add-project",icon:r.jsx(un,{size:18}),active:!1,onClick:()=>e("/?action=add-project"),title:_("nav.add_project")}),r.jsx("div",{className:"flex-1"}),r.jsx(Pi,{label:"Settings",isSettings:!0,testId:"nav-settings",icon:r.jsx(Od,{size:16}),active:l.pathname==="/settings"||l.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:_("nav.settings")}),r.jsx(Mt,{content:_("superagent.talk",{persona:d}),side:"right",children:r.jsx("button",{type:"button",onClick:n,"data-testid":"nav-roby","aria-label":_("superagent.talk",{persona:d}),className:"mt-1 flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(yn,{size:18})})})]})}function B2(e){switch(e){case"personal":return"Personal";case"company":return"Company";case"app":return"App";case"software":return"Software";case"default":return"Default";case"other":return"Other";default:return _("nav.project")}}function $e({title:e,description:n,action:s,className:o,children:l}){return r.jsxs("section",{className:Me("rounded-xl border border-border bg-card p-5",o),children:[r.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),n&&r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:n})]}),s]}),r.jsx("div",{children:l})]})}function z_({children:e}){return r.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-fg",children:e})}function kf({ok:e}){return r.jsx("span",{className:Me("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const U2=x.createContext(void 0);function H2(e=!1){const n=x.useContext(U2);if(n===void 0&&!e)throw new Error(On(16));return n}function CO(e){const{focusableWhenDisabled:n,disabled:s,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,d=o&&n!==!1,f=o&&n===!1;return{props:x.useMemo(()=>{const m={onKeyDown(g){s&&n&&g.key!=="Tab"&&g.preventDefault()}};return o||(m.tabIndex=l,!c&&s&&(m.tabIndex=n?l:-1)),(c&&(n||d)||!c&&s)&&(m["aria-disabled"]=s),c&&(!n||f)&&(m.disabled=s),m},[o,s,n,d,f,c,l])}}function Ul(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:o=0,native:l=!0,composite:c}=e,d=x.useRef(null),f=H2(!0),p=c??f!==void 0,{props:m}=CO({focusableWhenDisabled:s,disabled:n,composite:p,tabIndex:o,isNativeButton:l}),g=x.useCallback(()=>{const S=d.current;Sg(S)&&p&&n&&m.disabled===void 0&&S.disabled&&(S.disabled=!1)},[n,m.disabled,p]);Oe(g,[g]);const b=x.useCallback((S={})=>{const{onClick:C,onMouseDown:j,onKeyUp:w,onKeyDown:k,onPointerDown:E,...R}=S;return Oa({onClick(N){if(n){N.preventDefault();return}C?.(N)},onMouseDown(N){n||j?.(N)},onKeyDown(N){if(n||(Hd(N),k?.(N),N.baseUIHandlerPrevented))return;const T=N.target===N.currentTarget,M=N.currentTarget,O=Sg(M),P=!l&&kO(M),B=T&&(l?O:!P),L=N.key==="Enter",D=N.key===" ",z=M.getAttribute("role"),H=z?.startsWith("menuitem")||z==="option"||z==="gridcell";if(T&&p&&D){if(N.defaultPrevented&&H)return;N.preventDefault(),P||l&&O?(M.click(),N.preventBaseUIHandler()):B&&(C?.(N),N.preventBaseUIHandler());return}B&&(!l&&(D||L)&&N.preventDefault(),!l&&L&&C?.(N))},onKeyUp(N){if(!n){if(Hd(N),w?.(N),N.target===N.currentTarget&&l&&p&&Sg(N.currentTarget)&&N.key===" "){N.preventDefault();return}N.baseUIHandlerPrevented||N.target===N.currentTarget&&!l&&!p&&N.key===" "&&C?.(N)}},onPointerDown(N){if(n){N.preventDefault();return}E?.(N)}},l?{type:"button"}:{role:"button"},m,R)},[n,m,p,l]),v=Le(S=>{d.current=S,g()});return{getButtonProps:b,buttonRef:v}}function Sg(e){return Gt(e)&&e.tagName==="BUTTON"}function kO(e){return!!(e?.tagName==="A"&&e?.href)}const EO=x.forwardRef(function(n,s){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:f=!0,style:p,...m}=n,{getButtonProps:g,buttonRef:b}=Ul({disabled:c,focusableWhenDisabled:d,native:f});return Ht("button",n,{state:{disabled:c},ref:[s,b],props:[m,g]})}),D_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,L_=px,tb=(e,n)=>s=>{var o;if(n?.variants==null)return L_(e,s?.class,s?.className);const{variants:l,defaultVariants:c}=n,d=Object.keys(l).map(m=>{const g=s?.[m],b=c?.[m];if(g===null)return null;const v=D_(g)||D_(b);return l[m][v]}),f=s&&Object.entries(s).reduce((m,g)=>{let[b,v]=g;return v===void 0||(m[b]=v),m},{}),p=n==null||(o=n.compoundVariants)===null||o===void 0?void 0:o.reduce((m,g)=>{let{class:b,className:v,...S}=g;return Object.entries(S).every(C=>{let[j,w]=C;return Array.isArray(w)?w.includes({...c,...f}[j]):{...c,...f}[j]===w})?[...m,b,v]:m},[]);return L_(e,d,p,s?.class,s?.className)},NO=tb("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function fo({className:e,variant:n="default",size:s="default",...o}){return r.jsx(EO,{"data-slot":"button",className:Ot(NO({variant:n,size:s,className:e})),...o})}let P_=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const RO={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Qi={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},TO={disabled:!1,...Qi},nb={valid(e){return e===null?null:e?{[P_.valid]:""}:{[P_.invalid]:""}}},AO={invalid:void 0,name:void 0,validityData:{state:RO,errors:[],error:"",value:"",initialValue:null},setValidityData:Un,disabled:void 0,touched:Qi.touched,setTouched:Un,dirty:Qi.dirty,setDirty:Un,filled:Qi.filled,setFilled:Un,focused:Qi.focused,setFocused:Un,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:TO,markedDirtyRef:{current:!1},registerFieldControl:Un,validation:{getValidationProps:(e=cn)=>e,getInputValidationProps:(e=cn)=>e,inputRef:{current:null},commit:async()=>{}}},MO=x.createContext(AO);function zc(e=!0){const n=x.useContext(MO);if(n.setValidityData===Un&&!e)throw new Error(On(28));return n}const OO=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Un,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function V2(){return x.useContext(OO)}const zO=x.createContext({controlId:void 0,registerControlId:Un,labelId:void 0,setLabelId:Un,messageIds:[],setMessageIds:Un,getDescriptionProps:e=>e});function Ef(){return x.useContext(zO)}function DO(e,n,s,o=!0,l){const[c,d]=x.useState(),f=Mr(l?`${l}-label`:void 0),p=e??n??c;return Oe(()=>{const m=e||n||!o?void 0:LO(s.current,f);c!==m&&d(m)}),p}function LO(e,n){const s=PO(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function PO(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const s=e.id;if(s){const l=e.nextElementSibling;if(l&&l.htmlFor===s)return l}const o=e.labels;return o&&o[0]}function Nf(e={}){const{id:n,implicit:s=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=Ef(),d=Mr(n),f=s?l:void 0,p=va(()=>Symbol("labelable-control")),m=x.useRef(!1),g=x.useRef(n!=null),b=Le(()=>{!m.current||c===Un||(m.current=!1,c(p.current,void 0))});return Oe(()=>{if(c===Un)return;let v;if(s){const S=o?.current;ft(S)&&S.closest("label")!=null?v=n??null:v=f??d}else if(n!=null)g.current=!0,v=n;else if(g.current)v=d;else{b();return}if(v===void 0){b();return}m.current=!0,c(p.current,v)},[n,o,f,c,s,d,p,b]),x.useEffect(()=>b,[b]),l??d}function yc({controlled:e,default:n,name:s,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,d]=x.useState(n),f=l?e:c,p=x.useCallback(m=>{l||d(m)},[]);return[f,p]}function ab(e,n,s,o,l=!0){const{registerFieldControl:c}=zc(),d=x.useRef(null);d.current||(d.current=Symbol()),Oe(()=>{const f=d.current;return!f||!l?void 0:(c(f,{controlRef:e,getValue:o,id:n,value:s}),()=>{c(f,void 0)})},[e,l,o,n,c,s])}const IO=x.forwardRef(function(n,s){const{render:o,className:l,id:c,name:d,value:f,disabled:p=!1,onValueChange:m,defaultValue:g,autoFocus:b=!1,style:v,...S}=n,{state:C,name:j,disabled:w,setTouched:k,setDirty:E,validityData:R,setFocused:N,setFilled:T,validationMode:M,validation:O}=zc(),P=w||p,B=j??d,L={...C,disabled:P},{labelId:D}=Ef(),z=Nf({id:c});Oe(()=>{const G=f!=null;O.inputRef.current?.value||G&&f!==""?T(!0):G&&f===""&&T(!1)},[O.inputRef,T,f]);const H=x.useRef(null);Oe(()=>{b&&H.current===In(yt(H.current))&&N(!0)},[b,N]);const[q]=yc({controlled:f,default:g,name:"FieldControl",state:"value"}),Y=f!==void 0,V=Y?q:void 0,$=Le(()=>O.inputRef.current?.value);return ab(O.inputRef,z,V,$),Ht("input",n,{ref:[s,H],state:L,props:[{id:z,disabled:P,name:B,ref:O.inputRef,"aria-labelledby":D,autoFocus:b,...Y?{value:V}:{defaultValue:g},onChange(G){const X=G.currentTarget.value;m?.(X,lt(Bs,G.nativeEvent)),E(X!==R.initialValue),T(X!=="")},onFocus(){N(!0)},onBlur(G){k(!0),N(!1),M==="onBlur"&&O.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(k(!0),O.commit(G.currentTarget.value))}},O.getInputValidationProps(),S],stateAttributesMapping:nb})}),BO=x.forwardRef(function(n,s){return r.jsx(IO,{ref:s,...n})});function UO({className:e,type:n,...s}){return r.jsx(BO,{type:n,"data-slot":"input",className:Ot("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}function HO({className:e,...n}){return r.jsx("textarea",{"data-slot":"textarea",className:Ot("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function VO(e){return Ht(e.defaultTagName??"div",e,e)}const qO=tb("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function $O({className:e,variant:n="default",render:s,...o}){return VO({defaultTagName:"span",props:Oa({className:Ot(qO({variant:n}),e)},o),render:s,state:{slot:"badge",variant:n}})}const q2=x.createContext(void 0);function GO(){const e=x.useContext(q2);if(e===void 0)throw new Error(On(63));return e}let I_=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const $2={...nb,checked(e){return e?{[I_.checked]:""}:{[I_.unchecked]:""}}};function sb(e,n){const s=x.useRef(e),o=Le(n);Oe(()=>{s.current!==e&&o(s.current)},[e,o]),Oe(()=>{s.current=e},[e])}const FO=x.forwardRef(function(n,s){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":d,form:f,id:p,inputRef:m,name:g,nativeButton:b=!1,onCheckedChange:v,readOnly:S=!1,required:C=!1,disabled:j=!1,render:w,uncheckedValue:k,value:E,style:R,...N}=n,{clearErrors:T}=V2(),{state:M,setTouched:O,setDirty:P,validityData:B,setFilled:L,setFocused:D,shouldValidateOnChange:z,validationMode:H,disabled:q,name:Y,validation:V}=zc(),{labelId:$}=Ef(),Z=q||j,G=Y??g,X=x.useRef(null),U=Us(X,m,V.inputRef),K=x.useRef(null),F=Mr(),J=Nf({id:p,implicit:!1,controlRef:K}),ie=b?void 0:J,[re,oe]=yc({controlled:o,default:!!c,name:"Switch",state:"checked"});ab(K,F,re),Oe(()=>{X.current&&L(X.current.checked)},[X,L]),sb(re,()=>{T(G),P(re!==B.initialValue),L(re),z()?V.commit(re):V.commit(re,!0)});const{getButtonProps:ce,buttonRef:ee}=Ul({disabled:Z,native:b}),Te=DO(d,$,X,!b,ie),Fe={id:b?J:F,role:"switch","aria-checked":re,"aria-readonly":S||void 0,"aria-required":C||void 0,"aria-labelledby":Te,onFocus(){Z||D(!0)},onBlur(){const Pe=X.current;!Pe||Z||(O(!0),D(!1),H==="onBlur"&&V.commit(Pe.checked))},onClick(Pe){if(S||Z)return;Pe.preventDefault();const Ie=X.current;Ie&&Ie.dispatchEvent(new(Qt(Ie)).PointerEvent("click",{bubbles:!0,shiftKey:Pe.shiftKey,ctrlKey:Pe.ctrlKey,altKey:Pe.altKey,metaKey:Pe.metaKey}))}},ve=Oa({checked:re,disabled:Z,form:f,id:ie,name:G,required:C,style:G?wS:Cx,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:U,onChange(Pe){if(Pe.nativeEvent.defaultPrevented)return;if(S){Pe.preventDefault();return}const Ie=Pe.currentTarget.checked,be=lt(Bs,Pe.nativeEvent);v?.(Ie,be),!be.isCanceled&&oe(Ie)},onFocus(){K.current?.focus()}},V.getInputValidationProps,E!==void 0?{value:E}:cn),Ce=x.useMemo(()=>({...M,checked:re,disabled:Z,readOnly:S,required:C}),[M,re,Z,S,C]),Ne=Ht("span",n,{state:Ce,ref:[s,K,ee],props:[Fe,V.getValidationProps,N,ce],stateAttributesMapping:$2});return r.jsxs(q2.Provider,{value:Ce,children:[Ne,!re&&G&&k!==void 0&&r.jsx("input",{type:"hidden",form:f,name:G,value:k}),r.jsx("input",{...ve,suppressHydrationWarning:!0})]})}),YO=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,f=GO();return Ht("span",n,{state:f,ref:s,stateAttributesMapping:$2,props:d})});function XO({className:e,size:n="default",...s}){return r.jsx(FO,{"data-slot":"switch","data-size":n,className:Ot("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:r.jsx(YO,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function KO({className:e,...n}){return r.jsx(of,{role:"status","aria-label":"Loading",className:Ot("size-4 animate-spin",e),...n})}const G2=x.createContext(!1),F2=x.createContext(void 0);function vo(e){const n=x.useContext(F2);if(e===!1&&n===void 0)throw new Error(On(27));return n}const QO={...Bl,...Il},Y2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,forceRender:d=!1,...f}=n,{store:p}=vo(),m=p.useState("open"),g=p.useState("nested"),b=p.useState("mounted"),v=p.useState("transitionStatus");return Ht("div",n,{state:{open:m,transitionStatus:v},ref:[p.context.backdropRef,s],stateAttributesMapping:QO,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!g})}),Rf=x.forwardRef(function(n,s){const{render:o,className:l,style:c,disabled:d=!1,nativeButton:f=!0,...p}=n,{store:m}=vo(),g=m.useState("open"),{getButtonProps:b,buttonRef:v}=Ul({disabled:d,native:f}),S={disabled:d};function C(j){g&&m.setOpen(!1,lt(bM,j.nativeEvent))}return Ht("button",n,{state:S,ref:[s,v],props:[{onClick:C},p,b]})}),X2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...f}=n,{store:p}=vo(),m=Mr(d);return p.useSyncedValueWithCleanup("descriptionElementId",m),Ht("p",n,{ref:s,props:[{id:m},f]})});let ZO=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),WO=(function(e){return e[e.open=so.open]="open",e[e.closed=so.closed]="closed",e[e.startingStyle=so.startingStyle]="startingStyle",e[e.endingStyle=so.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const K2=x.createContext(void 0);function JO(){const e=x.useContext(K2);if(e===void 0)throw new Error(On(26));return e}const rc="ArrowUp",dl="ArrowDown",Kd="ArrowLeft",oc="ArrowRight",Tf="Home",Af="End",Q2=new Set([Kd,oc]),ez=new Set([Kd,oc,Tf,Af]),Z2=new Set([rc,dl]),tz=new Set([rc,dl,Tf,Af]),W2=new Set([...Q2,...Z2]),rb=new Set([...W2,Tf,Af]),nz="Shift",az="Control",sz="Alt",rz="Meta",oz=new Set([nz,az,sz,rz]);function lz(e){return Gt(e)&&e.tagName==="INPUT"}function B_(e){return!!(lz(e)&&e.selectionStart!=null||Gt(e)&&e.tagName==="TEXTAREA")}function U_(e,n,s,o){if(!e||!n||!n.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(d&&o!=="vertical"){const p=H_(e,n,"left"),m=rd(e),g=rd(n);s==="ltr"&&(p+n.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight?l=p+n.offsetWidth+g.scrollMarginRight-e.clientWidth+m.scrollPaddingRight:p-g.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft&&(l=p-g.scrollMarginLeft-m.scrollPaddingLeft)),s==="rtl"&&(p-g.scrollMarginRight<e.scrollLeft+m.scrollPaddingLeft?l=p-g.scrollMarginLeft-m.scrollPaddingLeft:p+n.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight&&(l=p+n.offsetWidth+g.scrollMarginRight-e.clientWidth+m.scrollPaddingRight))}if(f&&o!=="horizontal"){const p=H_(e,n,"top"),m=rd(e),g=rd(n);p-g.scrollMarginTop<e.scrollTop+m.scrollPaddingTop?c=p-g.scrollMarginTop-m.scrollPaddingTop:p+n.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-m.scrollPaddingBottom&&(c=p+n.offsetHeight+g.scrollMarginBottom-e.clientHeight+m.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function H_(e,n,s){const o=s==="left"?"offsetLeft":"offsetTop";let l=0;for(;n.offsetParent&&(l+=n[o],n.offsetParent!==e);)n=n.offsetParent;return l}function rd(e){const n=getComputedStyle(e);return{scrollMarginTop:parseFloat(n.scrollMarginTop)||0,scrollMarginRight:parseFloat(n.scrollMarginRight)||0,scrollMarginBottom:parseFloat(n.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(n.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(n.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(n.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(n.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(n.scrollPaddingLeft)||0}}const iz={...Bl,...Il,nestedDialogOpen(e){return e?{[WO.nestedDialogOpen]:""}:null}},J2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,finalFocus:d,initialFocus:f,...p}=n,{store:m}=vo(),g=m.useState("descriptionElementId"),b=m.useState("disablePointerDismissal"),v=m.useState("floatingRootContext"),S=m.useState("popupProps"),C=m.useState("modal"),j=m.useState("mounted"),w=m.useState("nested"),k=m.useState("nestedOpenDialogCount"),E=m.useState("open"),R=m.useState("openMethod"),N=m.useState("titleElementId"),T=m.useState("transitionStatus"),M=m.useState("role"),O=v.useState("floatingId"),P=p.id??O;JO(),Ar({open:E,ref:m.context.popupRef,onComplete(){E&&m.context.onOpenChangeComplete?.(!0)}});function B(Y){return Y==="touch"?m.context.popupRef.current:!0}const L=f===void 0?B:f,D=k>0,z=m.useStateSetter("popupElement"),q=Ht("div",n,{state:{open:E,nested:w,transitionStatus:T,nestedDialogOpen:D},props:[S,{id:P,"aria-labelledby":N??void 0,"aria-describedby":g??void 0,role:M,...jf,hidden:!j,onKeyDown(Y){rb.has(Y.key)&&Y.stopPropagation()},style:{[ZO.nestedDialogs]:k}},p],ref:[s,m.context.popupRef,z],stateAttributesMapping:iz});return r.jsx(KS,{context:v,openInteractionType:R,disabled:!j,closeOnFocusOut:!b,initialFocus:L,returnFocus:d,modal:C!==!1,restoreFocus:"popup",children:q})}),eC=x.forwardRef(function(n,s){const{cutout:o,...l}=n;let c;if(o){const d=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${d.left}px ${d.top}px,${d.left}px ${d.bottom}px,${d.right}px ${d.bottom}px,${d.right}px ${d.top}px,${d.left}px ${d.top}px)`}return r.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),tC=x.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n,{store:c}=vo(),d=c.useState("mounted"),f=c.useState("modal"),p=c.useState("open");return d||o?r.jsx(K2.Provider,{value:o,children:r.jsxs(XS,{ref:s,...l,children:[d&&f===!0&&r.jsx(eC,{ref:c.context.internalBackdropRef,inert:qx(!p)}),n.children]})}):null});let V_={},q_={},$_="";function cz(e){if(typeof document>"u")return!1;const n=yt(e);return Qt(n).innerWidth-n.documentElement.clientWidth>0}function uz(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=yt(e),o=s.documentElement,l=s.body,c=Rr(o)?o:l,d=c.style.overflowY,f=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",c.style.overflowY="scroll";const p=c.offsetWidth;c.style.overflowY="hidden";const m=c.offsetWidth;return c.style.overflowY=d,o.style.scrollbarGutter=f,p===m}function dz(e){const n=yt(e),s=n.documentElement,o=n.body,l=Rr(s)?s:o,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function fz(e){const n=yt(e),s=n.documentElement,o=n.body,l=Qt(s);let c=0,d=0,f=!1;const p=Wa.create();if(xx&&(l.visualViewport?.scale??1)!==1)return()=>{};function m(){const S=l.getComputedStyle(s),C=l.getComputedStyle(o),k=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,d=s.scrollLeft,V_={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},$_=s.style.scrollBehavior,q_={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const E=s.scrollHeight>s.clientHeight,R=s.scrollWidth>s.clientWidth,N=S.overflowY==="scroll"||C.overflowY==="scroll",T=S.overflowX==="scroll"||C.overflowX==="scroll",M=Math.max(0,l.innerWidth-o.clientWidth),O=Math.max(0,l.innerHeight-o.clientHeight),P=parseFloat(C.marginTop)+parseFloat(C.marginBottom),B=parseFloat(C.marginLeft)+parseFloat(C.marginRight),L=Rr(s)?s:o;if(f=uz(e),f){s.style.scrollbarGutter=k,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:k,overflowY:"hidden",overflowX:"hidden"}),(E||N)&&(s.style.overflowY="scroll"),(R||T)&&(s.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:P||O?`calc(100dvh - ${P+O}px)`:"100dvh",width:B||M?`calc(100vw - ${B+M}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=d,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function g(){Object.assign(s.style,V_),Object.assign(o.style,q_),f||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=$_)}function b(){g(),p.request(m)}m();const v=pt(l,"resize",b);return()=>{p.cancel(),g(),typeof l.removeEventListener=="function"&&v()}}class pz{lockCount=0;restore=null;timeoutLock=Ga.create();timeoutUnlock=Ga.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(n){if(this.lockCount===0||this.restore!==null)return;const o=yt(n).documentElement,l=Qt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=Un;return}const c=uS||!cz(n);this.restore=c?dz(n):fz(n)}}const mz=new pz;function nC(e=!0,n=null){Oe(()=>{if(e)return mz.acquire(n)},[e,n])}function gz(e){const{store:n,parentContext:s,actionsRef:o,isDrawer:l}=e,c=n.useState("open");R5(n,c),c2(n);const{forceUnmount:d}=u2(c,n),f=x.useCallback(()=>{n.setOpen(!1,lt(bS))},[n]);return x.useImperativeHandle(o,()=>({unmount:d,close:f}),[d,f]),{parentContext:s,isDrawer:l}}function hz({store:e,dialogRoot:n}){const{parentContext:s,isDrawer:o}=n,l=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[m,g]=x.useState(0),[b,v]=x.useState(0),S=m===0,C=zx(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if(!e.context.outsidePressEnabledRef.current||"button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const R=Tn(E);if(S&&!c){const N=R;return d&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===N||e.context.backdropRef.current===N||Ze(N,f)&&!N?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:S});nC(l&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(E,R)=>{g(E),v(R)}),e.useContextCallback("onNestedDialogClose",()=>{g(0),v(0)}),x.useEffect(()=>(s?.onNestedDialogOpen&&l&&s.onNestedDialogOpen(m+1,b+(o?1:0)),s?.onNestedDialogClose&&!l&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&l&&s.onNestedDialogClose()}),[o,l,m,b,s]);const j=C.reference??cn,w=C.trigger??cn,k=x.useMemo(()=>Oa(jf,C.floating),[C.floating]);return d2(e,{activeTriggerProps:j,inactiveTriggerProps:w,popupProps:k,nestedOpenDialogCount:m,nestedOpenDrawerCount:b}),null}const xz={...g2,modal:ze(e=>e.modal),nested:ze(e=>e.nested),nestedOpenDialogCount:ze(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:ze(e=>e.nestedOpenDrawerCount),disablePointerDismissal:ze(e=>e.disablePointerDismissal),openMethod:ze(e=>e.openMethod),descriptionElementId:ze(e=>e.descriptionElementId),titleElementId:ze(e=>e.titleElementId),viewportElement:ze(e=>e.viewportElement),role:ze(e=>e.role)};class ob extends Lx{constructor(n,s,o=!1){const l=new wf,c=bz(n);c.floatingRootContext=p2(l,s,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},xz)}setOpen=(n,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const o={open:n};i2(o,n,s.trigger),this.update(o)};static useStore(n,s){return l2(n,(l,c)=>new ob(s,l,c),!0).store}}function bz(e={}){return{...f2(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function vz(e,n="dialog"){const{children:s,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:f=!1,modal:p=!0,actionsRef:m,handle:g,triggerId:b,defaultTriggerId:v=null}=e,S=n==="drawer",C=n==="alert-dialog",j=C?!0:p,w=C||f,k=C?"alertdialog":"dialog",E=vo(!0),N={modal:j,disablePointerDismissal:w,nested:!!E,role:k},T=ob.useStore(g?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:b,...N});gx(()=>{const z=o===void 0&&T.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;C?T.update(z?{...N,...z}:N):z&&T.update(z)}),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",b),T.useSyncedValues(N),T.useContextCallback("onOpenChange",c),T.useContextCallback("onOpenChangeComplete",d);const M=T.useState("open"),O=T.useState("mounted"),P=T.useState("payload"),B=gz({store:T,actionsRef:m,parentContext:E?.store.context,isDrawer:S}),L=M||O,D=x.useMemo(()=>({store:T}),[T]);return r.jsx(G2.Provider,{value:!1,children:r.jsxs(F2.Provider,{value:D,children:[L&&r.jsx(hz,{store:T,dialogRoot:B}),typeof s=="function"?s({payload:P}):s]})})}function aC(e){const n=x.useContext(G2)?"drawer":"dialog";return vz(e,n)}const sC=x.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...f}=n,{store:p}=vo(),m=Mr(d);return p.useSyncedValueWithCleanup("titleElementId",m),Ht("h2",n,{ref:s,props:[{id:m},f]})});function yz(e){const n=x.useRef(""),s=x.useCallback(l=>{l.defaultPrevented||(n.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:x.useCallback(l=>{if(l.detail===0){e(l,"keyboard");return}"pointerType"in l?e(l,l.pointerType):e(l,n.current),n.current=""},[e]),onPointerDown:s}}function _z(e,n){const s=Le((c,d)=>{(typeof e=="function"?e():e)||n(d||(uS?"touch":""))}),{onClick:o,onPointerDown:l}=yz(s);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function jz(e){const[n,s]=x.useState(null),o=_z(e,s);return sb(e,l=>{l&&!e&&s(null)}),x.useMemo(()=>({openMethod:n,triggerProps:o}),[n,o])}function Dh({...e}){return r.jsx(aC,{"data-slot":"dialog",...e})}function wz({...e}){return r.jsx(tC,{"data-slot":"dialog-portal",...e})}function Sz({...e}){return r.jsx(Rf,{"data-slot":"dialog-close",...e})}function Cz({className:e,...n}){return r.jsx(Y2,{"data-slot":"dialog-overlay",className:Ot("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...n})}function Lh({className:e,children:n,showCloseButton:s=!0,...o}){return r.jsxs(wz,{children:[r.jsx(Cz,{}),r.jsxs(J2,{"data-slot":"dialog-content",className:Ot("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[n,s&&r.jsxs(Rf,{"data-slot":"dialog-close",render:r.jsx(fo,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(bo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ph({className:e,...n}){return r.jsx("div",{"data-slot":"dialog-header",className:Ot("flex flex-col gap-2",e),...n})}function G_({className:e,showCloseButton:n=!1,children:s,...o}){return r.jsxs("div",{"data-slot":"dialog-footer",className:Ot("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...o,children:[s,n&&r.jsx(Rf,{render:r.jsx(fo,{variant:"outline"}),children:"Close"})]})}function Ih({className:e,...n}){return r.jsx(sC,{"data-slot":"dialog-title",className:Ot("font-heading text-base leading-none font-medium",e),...n})}function kz({className:e,...n}){return r.jsx(X2,{"data-slot":"dialog-description",className:Ot("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...n})}const Ez={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},Nz={sm:"sm",md:"default"};function me({variant:e="secondary",size:n="md",loading:s,className:o,children:l,disabled:c,type:d="button",...f}){return r.jsxs(fo,{type:d,variant:Ez[e],size:Nz[n],disabled:c||s,className:o,...f,children:[s?r.jsx(za,{size:14}):null,l]})}function Ee(e){return r.jsx(UO,{...e})}function ln(e){return r.jsx(HO,{...e})}function Rz(e){return r.jsx("select",{...e,className:Me("h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",e.className)})}function de({label:e,hint:n,badge:s,children:o}){return r.jsxs("label",{className:"block space-y-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&r.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),o,n&&r.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:n})]})}function en({checked:e,onChange:n,label:s,disabled:o}){return r.jsxs("label",{className:Me("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(XO,{checked:e,onCheckedChange:n,disabled:o}),s&&r.jsx("span",{className:"text-sm",children:s})]})}function Ge({children:e,tone:n="muted",className:s}){const o=n==="danger"?"destructive":n==="muted"?"secondary":"outline",l={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return r.jsx($O,{variant:o,className:Me("rounded-md",l[n],s),children:e})}function Mn({open:e,onClose:n,title:s,description:o,children:l,footer:c,size:d="md"}){const f={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return r.jsx(Dh,{open:e,onOpenChange:p=>{p||n()},children:r.jsxs(Lh,{className:Me("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(s||o)&&r.jsxs(Ph,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&r.jsx(Ih,{children:s}),o&&r.jsx(kz,{children:o})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function za({size:e=14}){return r.jsx(KO,{style:{width:e,height:e}})}function it({children:e}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/20 px-4 py-6 text-center text-sm text-muted-foreground",children:e})}function nt({label:e="Cargando…"}){return r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(za,{})," ",e]})}const rC=x.createContext(null);let Tz=1;function Az({children:e}){const[n,s]=x.useState([]),o=x.useCallback((c,d)=>{const f=Tz++;s(p=>[...p,{id:f,kind:c,message:d}]),setTimeout(()=>{s(p=>p.filter(m=>m.id!==f))},4500)},[]),l=x.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return x.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),r.jsxs(rC.Provider,{value:l,children:[e,r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[100] flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",children:n.map(c=>r.jsx("div",{className:Me("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",c.kind==="success"&&"border-emerald-500/40",c.kind==="error"&&"border-destructive/60",c.kind==="info"&&"border-border"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:Me("mt-1 size-2 shrink-0 rounded-full",c.kind==="success"&&"bg-emerald-500",c.kind==="error"&&"bg-destructive",c.kind==="info"&&"bg-sky-500")}),r.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function st(){const e=x.useContext(rC);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function oC(){const{data:e,error:n,isLoading:s}=Qe("/health",()=>aO.get(),{refreshInterval:cf.health});return{health:e,error:n,isLoading:s,isUp:!n&&!!e}}function Mz(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/engines",()=>Yd.list());return{engines:e?.engines||[],error:n,isLoading:s,mutate:o}}function Oz(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/status",()=>An.status(),{refreshInterval:cf.telegramStatus});return{status:e,error:n,isLoading:s,mutate:o}}function lb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/channels",()=>An.channels.list());return{channels:e?.channels||[],error:n,isLoading:s,mutate:o}}function ib(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/contacts",()=>An.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:n,isLoading:s,mutate:o}}function Va(e){return typeof e=="string"&&e.startsWith("*** set ***")}function jr(e,n="(no seteada)"){return Va(e)?e:n}function kl(e){if(typeof e!="string")return null;const n=e.match(/\(\.\.\.([^)]+)\)/);return n?n[1]:null}function lC({channel:e,onClose:n,onSaved:s}){const o=st(),[l,c]=x.useState(!1),[d,f]=x.useState({name:""});x.useEffect(()=>{f(e?{...e,bot_token:""}:{name:""})},[e?.name]);const p=async()=>{if(!d.name?.trim()){o.error("name requerido");return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await An.channels.patch(e.name,d):await An.channels.upsert(d),o.success("Canal guardado."),s()}catch(m){o.error(m.message)}finally{c(!1)}};return r.jsx(Mn,{open:!!e,onClose:n,title:e?.name?_("telegram_channel_dialog.edit_title",{name:e.name}):_("telegram_channel_dialog.new_title"),description:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:l,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:p,loading:l,children:_("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"name (slug interno)",children:r.jsx(Ee,{value:d.name,onChange:m=>f({...d,name:m.target.value}),disabled:!!e?.name})}),r.jsx(de,{label:"bot_token",hint:e?.bot_token?jr(e.bot_token):"Token del BotFather. Se guarda en ~/.apx/config.json.",children:r.jsx(Ee,{type:"password",value:d.bot_token||"",onChange:m=>f({...d,bot_token:m.target.value}),placeholder:e?.bot_token?jr(e.bot_token):""})}),r.jsx(de,{label:"chat_id",children:r.jsx(Ee,{value:d.chat_id||"",onChange:m=>f({...d,chat_id:m.target.value})})}),r.jsx(de,{label:"project",hint:"Slug o id del proyecto al que pinear este canal (opcional).",children:r.jsx(Ee,{value:d.project||"",onChange:m=>f({...d,project:m.target.value})})}),r.jsx(de,{label:"route_to_agent",hint:"Agente que contesta; vacío = super-agent APX.",children:r.jsx(Ee,{value:d.route_to_agent||"",onChange:m=>f({...d,route_to_agent:m.target.value})})}),r.jsx(de,{label:"owner_user_id",hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",children:r.jsx(Ee,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:m=>{const g=m.target.value.trim();f({...d,owner_user_id:g===""?void 0:/^\d+$/.test(g)?Number(g):g})},placeholder:"889721252"})}),r.jsx(en,{checked:!!d.respond_with_engine,onChange:m=>f({...d,respond_with_engine:m}),label:"Responder con engine (no echo)"})]})})}function iC({channel:e,onClose:n}){const s=st(),[o,l]=x.useState(_("admin.telegram_default_message")),[c,d]=x.useState(!1),f=async()=>{if(!(!o.trim()||!e)){d(!0);try{await An.send({text:o,channel:e.name}),s.success("Mensaje enviado."),n()}catch(p){s.error(p.message)}finally{d(!1)}}};return r.jsx(Mn,{open:!!e,onClose:n,title:e?`${_("admin.telegram_send_test_title")} ${e.name}`:"",description:e?`chat_id: ${e.chat_id||"—"}`:"",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:c,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:f,loading:c,children:"Enviar"})]}),children:r.jsx(de,{label:"Texto",children:r.jsx(ln,{rows:4,value:o,onChange:p=>l(p.target.value)})})})}function cC({bare:e=!1}){const n=st(),{contacts:s,roles:o,channelOwners:l,isLoading:c,mutate:d}=ib(),f=new Set(l.filter(v=>v.owner_user_id!=null).map(v=>String(v.owner_user_id))),p=Array.from(new Set(["owner","guest",...Object.keys(o)])),m=async(v,S)=>{try{await An.contacts.patch(v.user_id,{role:S}),n.success(`${v.name||v.user_id} → ${S}`),d()}catch(C){n.error(C.message)}},g=async v=>{if(confirm(_("telegram_contacts.delete_confirm",{name:v.name||String(v.user_id)})))try{await An.contacts.remove(v.user_id),n.success(_("telegram_contacts.removed")),d()}catch(S){n.error(S.message)}},b=r.jsxs(r.Fragment,{children:[c&&r.jsx(nt,{}),!c&&s.length===0&&r.jsx(it,{children:_("telegram_contacts.empty")}),s.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:s.map(v=>{const S=f.has(String(v.user_id)),C=S?"owner":v.role||"guest";return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:v.name||"—"}),v.username&&r.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",v.username]}),S&&r.jsx(Ge,{tone:"success",children:_("telegram_contacts.owner_badge")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rz,{value:C,disabled:S,onChange:j=>m(v,j.target.value),title:_(S?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:p.map(j=>r.jsx("option",{value:j,children:j},j))}),r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>g(v),children:_("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["user_id: ",String(v.user_id)]}),r.jsxs("span",{children:[_("telegram_contacts.last_seen")," ",v.last_seen?v.last_seen.slice(0,10):"—"]}),r.jsx("span",{children:zz(o[C])})]})]},String(v.user_id))})})]});return e?b:r.jsx($e,{title:_("telegram_contacts.title"),description:_("telegram_contacts.desc"),children:b})}function zz(e){return!e||e.tools===void 0?"":e.tools==="*"?_("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${_("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:_("telegram_contacts.tools_none"):""}function Dz(){const e=La(),n=st(),{health:s,isUp:o}=oC(),{projects:l,isLoading:c,mutate:d}=Oc(),{engines:f,isLoading:p}=Mz(),{status:m,mutate:g}=Oz(),{channels:b,isLoading:v,mutate:S}=lb(),[C,j]=x.useState(null),[w,k]=x.useState(null),E=async()=>{try{await Sl.reload(),n.success(_("admin.reload_success"))}catch(M){n.error(M.message)}},R=async()=>{try{m?.enabled?(await An.stop(),n.info(_("admin.telegram_polling_stopped"))):(await An.start(),n.success(_("admin.telegram_polling_started"))),g()}catch(M){n.error(M.message)}},N=async M=>{if(confirm(_("telegram_channels.delete_confirm",{name:M})))try{await An.channels.remove(M),n.success(_("admin.telegram_channel_removed")),S()}catch(O){n.error(O.message)}},T=async(M,O)=>{if(confirm(_("admin.unregister_confirm",{label:O})))try{await na.remove(M),n.success(_("project.unregistered")),d()}catch(P){n.error(P.message)}};return r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[r.jsxs("header",{className:"flex items-end justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:_("admin.title")}),r.jsx("p",{className:"text-sm text-muted-fg",children:_("admin.subtitle")})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(me,{size:"sm",onClick:E,title:_("daemon.reload_hint"),children:[_("common.reload")," config"]}),r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>e("/?action=add-project"),children:[r.jsx(un,{size:14})," ",_("nav.project")]})]})]}),r.jsx($e,{title:_("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Cg,{label:_("daemon.version"),value:s?.version||"—"}),r.jsx(Cg,{label:_("daemon.uptime"),value:s?`${s.uptime_s}s`:"—"}),r.jsx(Cg,{label:_("daemon.status"),value:_(o?"daemon.running":"daemon.down"),ok:o})]})}),r.jsxs($e,{title:_("admin.engines_title"),description:_("admin.engines_subtitle"),children:[p&&r.jsx(nt,{}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(M=>r.jsx(Ge,{tone:"info",children:M},M))})]}),r.jsxs($e,{title:_("admin.telegram_title"),description:_("admin.telegram_subtitle"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(en,{checked:!!m?.enabled,onChange:R,label:m?.enabled?_("admin.telegram_polling_on"):_("admin.telegram_polling_off")}),r.jsxs(me,{size:"sm",onClick:()=>j({name:""}),children:[r.jsx(un,{size:14})," ",_("admin.telegram_add_channel")]})]}),children:[v&&r.jsx(nt,{}),b.length===0&&r.jsx(it,{children:_("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:b.map(M=>r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:M.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[M.project&&r.jsxs(Ge,{tone:"success",children:["project = ",M.project]}),r.jsxs(me,{size:"sm",variant:"ghost",onClick:()=>k(M),children:[r.jsx(rs,{size:13})," ",_("admin.telegram_send_test")]}),r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>j(M),children:_("common.edit")}),r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>N(M.name),children:_("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",M.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",M.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",M.respond_with_engine?_("admin.engine_badge"):_("admin.engine_badge_no")]})]})]},M.name))})]}),r.jsx(cC,{}),r.jsxs($e,{title:_("admin.projects_title"),description:_("admin.projects_subtitle"),children:[c&&r.jsx(nt,{}),r.jsx("ul",{className:"divide-y divide-border",children:l.map(M=>r.jsxs("li",{className:"flex items-center gap-3 py-2",children:[r.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",M.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${M.id}`),children:[r.jsx("span",{className:"font-medium",children:M.name||M.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:M.path})]}),r.jsxs(Ge,{children:[M.agents??0," ",_("admin.agents_badge")]}),Number(M.id)!==0&&r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>T(String(M.id),M.name||M.path),children:_("admin.unregister")})]},M.id))})]}),r.jsx(lC,{channel:C,onClose:()=>j(null),onSaved:()=>{j(null),S()}}),r.jsx(iC,{channel:w,onClose:()=>k(null)})]})}function Cg({label:e,value:n,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(kf,{ok:s}),r.jsx("span",{children:n})]})]})}function uC(e){const[n,s]=x.useState(!1);x.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>s(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:n,toggle:o}}function Lz({collapsed:e,onToggle:n}){return r.jsx(Mt,{content:e?"Expandir menú":"Colapsar menú",side:"bottom",children:r.jsx("button",{type:"button",onClick:n,"aria-label":e?"Expandir menú":"Colapsar menú",className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(Yw,{className:Me("size-4 transition-transform",e&&"rotate-180")})})})}function Pz({sections:e,active:n,onChange:s,collapsed:o=!1}){return r.jsx("nav",{className:Me("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",o?"w-12 items-center px-1":"w-52 px-2"),children:e.map((l,c)=>r.jsxs("div",{className:Me("w-full",c>0&&"mt-2"),children:[!o&&l.title&&r.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),r.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:d,label:f,icon:p,badge:m})=>{const g=n===d,b=r.jsxs("button",{type:"button",onClick:()=>s(d),"data-testid":`tabnav-${d||"index"}`,className:Me("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",g?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[r.jsx(p,{className:"size-4 shrink-0"}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate text-left text-xs",children:f}),m!==void 0&&r.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:m})]})]});return o?r.jsx(Mt,{content:f,side:"right",children:b},d):r.jsx(x.Fragment,{children:b},d)})})]},c))})}const dC=x.createContext(null),fC=x.createContext(null),pC=x.createContext(""),mC=x.createContext(null),gC=x.createContext(null),hC=x.createContext(null);function Iz({children:e}){const[n,s]=x.useState(null),[o,l]=x.useState(""),[c,d]=x.useState(null);return r.jsx(fC.Provider,{value:s,children:r.jsx(dC.Provider,{value:n,children:r.jsx(mC.Provider,{value:l,children:r.jsx(pC.Provider,{value:o,children:r.jsx(hC.Provider,{value:d,children:r.jsx(gC.Provider,{value:c,children:e})})})})})})}function Bz(){return x.useContext(dC)}function Uz(e,n){const s=x.useContext(fC);x.useEffect(()=>(s?.({collapsed:e,toggle:n}),()=>s?.(null)),[e,n,s])}function Hz(){return x.useContext(pC)}function Vz(e){const n=x.useContext(mC);x.useEffect(()=>(n?.(e),()=>n?.("")),[e,n])}function qz(){return x.useContext(gC)}function $z(e){const n=x.useContext(hC);x.useEffect(()=>(n?.(e),()=>n?.(null)),[e,n])}function xC({sections:e,active:n,onChange:s,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:d,testId:f,children:p}){return Uz(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx(Pz,{sections:e,active:n,onChange:s,collapsed:o}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,r.jsx("div",{className:Me("flex-1 min-h-0 overflow-y-auto",d),"data-testid":f,children:p})]})]})}function F_({pid:e}){const n=Qe(`/projects/${e}/tasks?state=open`,()=>hr.list(e)),s=Qe(`/projects/${e}/routines`,()=>gr.list(e)),o=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),l=Qe(`/projects/${e}/mcps`,()=>xr.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(Bi,{title:_("project.overview.tasks_open"),value:n.data?.length??"…",href:`/p/${e}/tasks`,icon:fc}),r.jsx(Bi,{title:_("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:vl}),r.jsx(Bi,{title:_("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:yn}),r.jsx(Bi,{title:_("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:fh}),r.jsx(Bi,{title:_("project.overview.chat"),value:_("project.overview.chat_value"),href:`/p/${e}/chat`,icon:nc})]})}function Bi({title:e,value:n,href:s,icon:o}){return r.jsxs(Aw,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[r.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:r.jsx(o,{size:20})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"text-2xl font-semibold",children:n})]})]})}function Gz(){const e=La(),{projects:n,isLoading:s}=Oc();return r.jsxs($e,{title:_("base.workspaces_title"),description:_("base.workspaces_desc"),action:r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[r.jsx(un,{size:14})," ",_("base.workspaces_new")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(it,{children:_("base.workspaces_empty")}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(o=>{const l=String(o.id)==="0",c=l?_("base.title"):o.name||o.path.split("/").pop()||String(o.id);return r.jsxs("button",{type:"button",onClick:()=>e(`/p/${o.id}`),className:"flex cursor-pointer flex-col gap-2 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-muted-fg/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vw,{className:"size-4 text-muted-fg"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:c}),r.jsx(Ge,{tone:l?"success":"info",children:l?_("base.title"):B2(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const bC=x.createContext(null),vC=x.createContext(null);function ls(){const e=x.useContext(bC);if(e===null)throw new Error(On(60));return e}function yC(){const e=x.useContext(vC);if(e===null)throw new Error(On(61));return e}const Fz=(e,n)=>Object.is(e,n);function El(e,n,s){return e==null||n==null?Object.is(e,n):s(e,n)}function Yz(e,n,s){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:El(n,o,s))}function lc(e,n,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:El(o,n,s))}function Xz(e,n,s){return e.filter(o=>!El(n,o,s))}function Bh(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function _C(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Kz(e){if(!Array.isArray(e))return e!=null&&"null"in e;const n=e;if(_C(n)){for(const s of n)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of n)if(s&&s.value==null&&s.label!=null)return!0;return!1}function jC(e,n){if(n&&e!=null)return n(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Bh(e)}function cl(e,n){return n&&e!=null?n(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Bh(e.value):Bh(e)}function wC(e,n,s){function o(){return jC(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(n&&!Array.isArray(n))return n[e]??o();if(Array.isArray(n)){const l=n,c=_C(l)?l.flatMap(d=>d.items):l;if(e==null||typeof e!="object"){const d=c.find(f=>f.value===e);return d&&d.label!=null?d.label:o()}if("value"in e){const d=c.find(f=>f&&f.value===e.value);if(d&&d.label!=null)return d.label}}return o()}function Qz(e,n,s){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(x.Fragment,{children:wC(l,n,s)},c)),o),[])}const We={id:ze(e=>e.id),labelId:ze(e=>e.labelId),modal:ze(e=>e.modal),multiple:ze(e=>e.multiple),items:ze(e=>e.items),itemToStringLabel:ze(e=>e.itemToStringLabel),itemToStringValue:ze(e=>e.itemToStringValue),isItemEqualToValue:ze(e=>e.isItemEqualToValue),value:ze(e=>e.value),hasSelectedValue:ze(e=>{const{value:n,multiple:s,itemToStringValue:o}=e;return n==null?!1:s&&Array.isArray(n)?n.length>0:cl(n,o)!==""}),hasNullItemLabel:ze((e,n)=>n?Kz(e.items):!1),open:ze(e=>e.open),mounted:ze(e=>e.mounted),forceMount:ze(e=>e.forceMount),transitionStatus:ze(e=>e.transitionStatus),openMethod:ze(e=>e.openMethod),activeIndex:ze(e=>e.activeIndex),selectedIndex:ze(e=>e.selectedIndex),isActive:ze((e,n)=>e.activeIndex===n),isSelected:ze((e,n,s)=>{const o=e.isItemEqualToValue,l=e.value;return e.multiple?Array.isArray(l)&&l.some(c=>El(s,c,o)):e.selectedIndex===n&&e.selectedIndex!==null?!0:El(s,l,o)}),isSelectedByFocus:ze((e,n)=>e.selectedIndex===n),popupProps:ze(e=>e.popupProps),triggerProps:ze(e=>e.triggerProps),triggerElement:ze(e=>e.triggerElement),positionerElement:ze(e=>e.positionerElement),listElement:ze(e=>e.listElement),popupSide:ze(e=>e.popupSide),scrollUpArrowVisible:ze(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ze(e=>e.scrollDownArrowVisible),hasScrollArrows:ze(e=>e.hasScrollArrows)};function Zi(e,n=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(e,s))}const Ha=1;function cb(e,n){return Math.max(0,e-n)}function Qd(e,n){if(n<=0)return 0;const s=Zi(e,0,n),o=s,l=n-s,c=o<=Ha,d=l<=Ha;return c&&d?o<=l?0:n:c?0:d?n:s}function Zz(e){const{id:n,value:s,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:d=!1,onOpenChange:f,name:p,form:m,autoComplete:g,disabled:b=!1,readOnly:v=!1,required:S=!1,modal:C=!0,actionsRef:j,inputRef:w,onOpenChangeComplete:k,items:E,multiple:R=!1,itemToStringLabel:N,itemToStringValue:T,isItemEqualToValue:M=Fz,highlightItemOnHover:O=!0,children:P}=e,{clearErrors:B}=V2(),{setDirty:L,setTouched:D,setFocused:z,shouldValidateOnChange:H,validityData:q,setFilled:Y,name:V,disabled:$,validation:Z,validationMode:G}=zc(),X=Nf({id:n}),U=$||b,K=V??p,[F,J]=yc({controlled:s,default:R?o??mc:o,name:"Select",state:"value"}),[ie,re]=yc({controlled:c,default:d,name:"Select",state:"open"}),oe=x.useRef([]),ce=x.useRef([]),ee=x.useRef(null),Te=x.useRef(null),Fe=x.useRef(0),ve=x.useRef(null),Ce=x.useRef([]),Ne=x.useRef(!1),Pe=x.useRef(!1),Ie=x.useRef(null),be=x.useRef(null),Ae=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=x.useRef(!1),{mounted:Be,setMounted:Xe,transitionStatus:Ye}=Tc(ie),{openMethod:De,triggerProps:ye}=jz(ie),le=va(()=>new o2({id:X,labelId:void 0,modal:C,multiple:R,itemToStringLabel:N,itemToStringValue:T,isItemEqualToValue:M,value:F,open:ie,mounted:Be,transitionStatus:Ye,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,_e=tt(le,We.activeIndex),Se=tt(le,We.selectedIndex),Ue=tt(le,We.triggerElement),Je=tt(le,We.positionerElement),_t=v4(De),zt=De??_t,pe=x.useMemo(()=>R&&Array.isArray(F)&&F.length===0?"":cl(F,T),[R,F,T]),ke=x.useMemo(()=>R&&Array.isArray(F)?F.map(ct=>cl(ct,T)):cl(F,T),[R,F,T]),Re=mn(le.state.triggerElement),Ve=Le(()=>ke);ab(Re,X,F,Ve);const at=x.useRef(F),nn=R?Array.isArray(F)&&F.length>0:F!=null;Oe(()=>{F!==at.current&&le.set("forceMount",!0)},[le,F]),Oe(()=>{Y(nn)},[nn,Y]),Oe(function(){const Dt=Ce.current;let Sn;if(R){const sn=Array.isArray(F)?F:[];if(sn.length===0)Sn=null;else{const Rt=sn[sn.length-1],gn=lc(Dt,Rt,M);Sn=gn===-1?null:gn}}else{const sn=lc(Dt,F,M);Sn=sn===-1?null:sn}Sn===null&&(be.current=null),!ie&&le.set("selectedIndex",Sn)},[nn,R,ie,F,Ce,M,le,be]),sb(F,()=>{B(K),L(F!==q.initialValue),H()?Z.commit(F):Z.commit(F,!0)});const Vt=Le((ct,Dt)=>{if(f?.(ct,Dt),!Dt.isCanceled&&(re(ct),!ct&&(Dt.reason===gf||Dt.reason===jx)&&(D(!0),z(!1),G==="onBlur"&&Z.commit(F)),!ct&&le.state.activeIndex!==null)){const Sn=oe.current[le.state.activeIndex];queueMicrotask(()=>{Sn?.setAttribute("tabindex","-1")})}}),mt=Le(()=>{Xe(!1),le.update({activeIndex:null,openMethod:null}),k?.(!1)});Ar({enabled:!j,open:ie,ref:ee,onComplete(){ie||mt()}}),x.useImperativeHandle(j,()=>({unmount:mt}),[mt]);const Nt=Le((ct,Dt)=>{l?.(ct,Dt),!Dt.isCanceled&&J(ct)}),Zt=Le(()=>{const ct=le.state.listElement||ee.current;if(!ct)return;const Dt=cb(ct.scrollHeight,ct.clientHeight),Sn=Qd(ct.scrollTop,Dt),sn=Sn>0,Rt=Sn<Dt;le.state.scrollUpArrowVisible!==sn&&le.set("scrollUpArrowVisible",sn),le.state.scrollDownArrowVisible!==Rt&&le.set("scrollDownArrowVisible",Rt)}),St=h2({open:ie,onOpenChange:Vt,elements:{reference:Ue,floating:Je}}),an=_3(St,{enabled:!v&&!U,event:"mousedown"}),Ft=zx(St),dn=U5(St,{enabled:!v&&!U,listRef:oe,activeIndex:_e,selectedIndex:Se,disabledIndices:mc,onNavigate(ct){ct===null&&!ie||le.set("activeIndex",ct)},focusItemOnHover:O}),zn=H5(St,{enabled:!v&&!U&&(ie||!R),listRef:ce,activeIndex:_e,selectedIndex:Se,onMatch(ct){ie?le.set("activeIndex",ct):Nt(Ce.current[ct],lt("none"))},onTyping(ct){Ne.current=ct}}),Xn=x.useMemo(()=>{const ct=Oa(zn.reference,dn.reference,Ft.reference,an.reference,ye);return X&&(ct.id=X),ct},[an.reference,zn.reference,dn.reference,Ft.reference,ye,X]),ia=x.useMemo(()=>Oa(jf,zn.floating,dn.floating,Ft.floating),[zn.floating,dn.floating,Ft.floating]),Kn=dn.item??cn;gx(()=>{le.update({popupProps:ia,triggerProps:Xn})}),Oe(()=>{le.update({id:X,modal:C,multiple:R,value:F,open:ie,mounted:Be,transitionStatus:Ye,popupProps:ia,triggerProps:Xn,items:E,itemToStringLabel:N,itemToStringValue:T,isItemEqualToValue:M,openMethod:zt})},[le,X,C,R,F,ie,Be,Ye,ia,Xn,E,N,T,M,zt]);const is=x.useMemo(()=>({store:le,name:K,required:S,disabled:U,readOnly:v,multiple:R,highlightItemOnHover:O,setValue:Nt,setOpen:Vt,listRef:oe,popupRef:ee,scrollHandlerRef:Te,handleScrollArrowVisibility:Zt,scrollArrowsMountedCountRef:Fe,itemProps:Kn,events:St.context.events,valueRef:ve,valuesRef:Ce,labelsRef:ce,typingRef:Ne,selectionRef:Ae,firstItemTextRef:Ie,selectedItemTextRef:be,validation:Z,onOpenChangeComplete:k,keyboardActiveRef:Pe,alignItemWithTriggerActiveRef:we,initialValueRef:at}),[le,K,S,U,v,R,O,Nt,Vt,Kn,St.context.events,Z,k,Zt]),Dn=Us(w,Z.inputRef),ca=R&&Array.isArray(F)&&F.length>0,Pa=R?void 0:K,cs=x.useMemo(()=>!R||!Array.isArray(F)||!K?null:F.map(ct=>{const Dt=cl(ct,T);return r.jsx("input",{type:"hidden",form:m,name:K,value:Dt},Dt)}),[R,F,m,K,T]);return r.jsx(bC.Provider,{value:is,children:r.jsxs(vC.Provider,{value:St,children:[P,r.jsx("input",{...Z.getInputValidationProps({onFocus(){le.state.triggerElement?.focus({focusVisible:!0})},onChange(ct){if(ct.nativeEvent.defaultPrevented||U||v){ct.preventBaseUIHandler?.();return}const Dt=ct.currentTarget.value,Sn=lt(Bs,ct.nativeEvent);function sn(){if(R)return;const Rt=Ce.current.find(gn=>cl(gn,T).toLowerCase()===Dt.toLowerCase()||jC(gn,N).toLowerCase()===Dt.toLowerCase());Rt!=null&&(L(Rt!==q.initialValue),Nt(Rt,Sn),H()&&Z.commit(Rt))}le.set("forceMount",!0),queueMicrotask(sn)}}),id:X&&Pa==null?`${X}-hidden-input`:void 0,form:m,name:Pa,autoComplete:g,value:pe,disabled:U,required:S&&!ca,readOnly:v,ref:Dn,style:K?wS:Cx,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),cs]})})}function Wz(e,n){return e??n}function Jz(e){const n=e.getBoundingClientRect(),s=Qt(e),o=s.getComputedStyle(e,"::before"),l=s.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return n;const d=parseFloat(o.width)||0,f=parseFloat(o.height)||0,p=parseFloat(l.width)||0,m=parseFloat(l.height)||0,g=Math.max(n.width,d,p),b=Math.max(n.height,f,m),v=g-n.width,S=b-n.height;return{left:n.left-v/2,right:n.right+v/2,top:n.top-S/2,bottom:n.bottom+S/2}}const od=2,eD=400,tD={...e4,...nb,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},nD=x.forwardRef(function(n,s){const{render:o,className:l,id:c,disabled:d=!1,nativeButton:f=!0,style:p,...m}=n,{setTouched:g,setFocused:b,validationMode:v,state:S,disabled:C}=zc(),{labelId:j}=Ef(),{store:w,setOpen:k,selectionRef:E,validation:R,readOnly:N,required:T,alignItemWithTriggerActiveRef:M,disabled:O,keyboardActiveRef:P}=ls(),B=C||O||d,L=tt(w,We.open),D=tt(w,We.mounted),z=tt(w,We.value),H=tt(w,We.triggerProps),q=tt(w,We.positionerElement),Y=tt(w,We.listElement),V=tt(w,We.popupSide),$=tt(w,We.id),Z=tt(w,We.labelId),G=tt(w,We.hasSelectedValue),X=D&&q?V:null,U=c??$,K=Wz(j,Z);Nf({id:U});const F=mn(q),J=x.useRef(null),{getButtonProps:ie,buttonRef:re}=Ul({disabled:B,native:f}),oe=Le(Ne=>{w.set("triggerElement",Ne)}),ce=Us(s,J,re,oe),ee=aa(),Te=aa(),Fe=aa();x.useEffect(()=>{if(L)return Fe.start(eD,()=>{E.current.allowUnselectedMouseUp=!0,E.current.allowSelectedMouseUp=!0}),()=>{Fe.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Te.clear()},[L,E,Te,Fe]);const ve=Oa(H,{id:U,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?Y?.id??Dd(q)?.id:void 0,"aria-labelledby":K,"aria-readonly":N||void 0,"aria-required":T||void 0,tabIndex:B?-1:0,ref:ce,onFocus(Ne){b(!0),L&&M.current&&k(!1,lt(Bs,Ne.nativeEvent)),ee.start(0,()=>{w.set("forceMount",!0)})},onBlur(Ne){Ze(q,Ne.relatedTarget)||(g(!0),b(!1),v==="onBlur"&&R.commit(z))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(Ne){if(L)return;const Pe=yt(Ne.currentTarget);function Ie(be){if(!J.current)return;const Ae=be.target;if(Ze(J.current,Ae)||Ze(F.current,Ae)||Ae===J.current)return;const we=Jz(J.current);be.clientX>=we.left-od&&be.clientX<=we.right+od&&be.clientY>=we.top-od&&be.clientY<=we.bottom+od||k(!1,lt(vM,be))}Te.start(0,()=>{Pe.addEventListener("mouseup",Ie,{once:!0})})}},R.getValidationProps,m,ie);ve.role="combobox";const Ce={...S,open:L,disabled:B,value:z,readOnly:N,popupSide:X,placeholder:!G};return Ht("button",n,{ref:[s,J],state:Ce,stateAttributesMapping:tD,props:ve})}),aD={value:()=>null},sD=x.forwardRef(function(n,s){const{className:o,render:l,children:c,placeholder:d,style:f,...p}=n,{store:m,valueRef:g}=ls(),b=tt(m,We.value),v=tt(m,We.items),S=tt(m,We.itemToStringLabel),C=tt(m,We.hasSelectedValue),j=!C&&d!=null&&c==null,w=tt(m,We.hasNullItemLabel,j),k={value:b,placeholder:!C};let E=null;return typeof c=="function"?E=c(b):c!=null?E=c:!C&&d!=null&&!w?E=d:Array.isArray(b)?E=Qz(b,v,S):E=wC(b,v,S),Ht("span",n,{state:k,ref:[s,g],props:[{children:E},p],stateAttributesMapping:aD})}),rD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:f}=ls(),m={open:tt(f,We.open)};return Ht("span",n,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:b2})}),oD=x.createContext(void 0),lD=x.forwardRef(function(n,s){const{store:o}=ls(),l=tt(o,We.mounted),c=tt(o,We.forceMount);return l||c?r.jsx(oD.Provider,{value:!0,children:r.jsx(XS,{ref:s,...n})}):null}),SC=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function iD(){return x.useContext(SC)}function ub(e){const{children:n,elementsRef:s,labelsRef:o,onMapChange:l}=e,c=Le(l),d=x.useRef(0),f=va(uD).current,p=va(cD).current,[m,g]=x.useState(0),b=x.useRef(m),v=Le((k,E)=>{p.set(k,E??null),b.current+=1,g(b.current)}),S=Le(k=>{p.delete(k),b.current+=1,g(b.current)}),C=x.useMemo(()=>{const k=new Map;return Array.from(p.keys()).filter(R=>R.isConnected).sort(dD).forEach((R,N)=>{const T=p.get(R)??{};k.set(R,{...T,index:N})}),k},[p,m]);Oe(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const k=new MutationObserver(E=>{const R=new Set,N=T=>R.has(T)?R.delete(T):R.add(T);E.forEach(T=>{T.removedNodes.forEach(N),T.addedNodes.forEach(N)}),R.size===0&&(b.current+=1,g(b.current))});return C.forEach((E,R)=>{R.parentElement&&k.observe(R.parentElement,{childList:!0})}),()=>{k.disconnect()}},[C]),Oe(()=>{b.current===m&&(s.current.length!==C.size&&(s.current.length=C.size),o&&o.current.length!==C.size&&(o.current.length=C.size),d.current=C.size),c(C)},[c,C,s,o,m]),Oe(()=>()=>{s.current=[]},[s]),Oe(()=>()=>{o&&(o.current=[])},[o]);const j=Le(k=>(f.add(k),()=>{f.delete(k)}));Oe(()=>{f.forEach(k=>k(C))},[f,C]);const w=x.useMemo(()=>({register:v,unregister:S,subscribeMapChange:j,elementsRef:s,labelsRef:o,nextIndexRef:d}),[v,S,j,s,o,d]);return r.jsx(SC.Provider,{value:w,children:n})}function cD(){return new Map}function uD(){return new Set}function dD(e,n){const s=e.compareDocumentPosition(n);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const CC=x.createContext(void 0);function db(){const e=x.useContext(CC);if(!e)throw new Error(On(59));return e}function Zd(e,n){e&&Object.assign(e.style,n)}const kC={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},fD=20;function pD(e,n,s,o){const[l,c]=x.useState(!1);Oe(()=>{if(!e||!n||s==null){c(!1);return}const d=yt(s).documentElement.clientWidth,f=s.offsetWidth;c(d>0&&f>0&&f>=d-fD)},[e,n,s]),nC(e&&(!n||l),o)}const mD={position:"fixed"},gD=x.forwardRef(function(n,s){const{anchor:o,positionMethod:l="absolute",className:c,render:d,side:f="bottom",align:p="center",sideOffset:m=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:S=5,sticky:C=!1,disableAnchorTracking:j,alignItemWithTrigger:w=!0,collisionAvoidance:k=d3,style:E,...R}=n,{store:N,listRef:T,labelsRef:M,alignItemWithTriggerActiveRef:O,selectedItemTextRef:P,valuesRef:B,initialValueRef:L,popupRef:D,setValue:z}=ls(),H=yC(),q=tt(N,We.open),Y=tt(N,We.mounted),V=tt(N,We.modal),$=tt(N,We.value),Z=tt(N,We.openMethod),G=tt(N,We.positionerElement),X=tt(N,We.triggerElement),U=tt(N,We.isItemEqualToValue),K=tt(N,We.transitionStatus),F=x.useRef(null),J=x.useRef(null),[ie,re]=x.useState(w),oe=Y&&ie&&Z!=="touch";!Y&&ie!==w&&re(w),Oe(()=>{Y||(We.scrollUpArrowVisible(N.state)&&N.set("scrollUpArrowVisible",!1),We.scrollDownArrowVisible(N.state)&&N.set("scrollDownArrowVisible",!1))},[N,Y]),x.useImperativeHandle(O,()=>oe),pD((oe||V)&&q,Z==="touch",G,X);const ce=C2({anchor:o,floatingRootContext:H,positionMethod:l,mounted:Y,side:f,sideOffset:m,align:p,alignOffset:g,arrowPadding:S,collisionBoundary:b,collisionPadding:v,sticky:C,disableAnchorTracking:j??oe,collisionAvoidance:k,keepMounted:!0}),ee=oe?"none":ce.side,Te=oe?mD:ce.positionerStyles,Fe={open:q,side:ee,align:ce.align,anchorHidden:ce.anchorHidden};Oe(()=>{N.set("popupSide",ce.side)},[N,ce.side]);const ve=Le(be=>{N.set("positionerElement",be)}),Ce=k2(n,Fe,{styles:Te,transitionStatus:K,props:R,refs:[s,ve],hidden:!Y,inert:!q}),Ne=x.useRef(0),Pe=Le(be=>{if(be.size===0&&Ne.current===0||B.current.length===0)return;const Ae=Ne.current;if(Ne.current=be.size,be.size===Ae)return;const we=lt(Bs);if(Ae!==0&&!N.state.multiple&&$!==null&&lc(B.current,$,U)===-1){const Xe=L.current,De=Xe!=null&&lc(B.current,Xe,U)!==-1?Xe:null;z(De,we),De===null&&(N.set("selectedIndex",null),P.current=null)}if(Ae!==0&&N.state.multiple&&Array.isArray($)){const Be=Ye=>lc(B.current,Ye,U)!==-1,Xe=$.filter(Ye=>Be(Ye));(Xe.length!==$.length||Xe.some(Ye=>!Yz($,Ye,U)))&&(z(Xe,we),Xe.length===0&&(N.set("selectedIndex",null),P.current=null))}if(q&&oe){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Be={height:""};Zd(G,Be),Zd(D.current,Be)}}),Ie=x.useMemo(()=>({...ce,side:ee,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:re,scrollUpArrowRef:F,scrollDownArrowRef:J}),[ce,ee,oe,re]);return r.jsx(ub,{elementsRef:T,labelsRef:M,onMapChange:Pe,children:r.jsxs(CC.Provider,{value:Ie,children:[Y&&V&&r.jsx(eC,{inert:qx(!q),cutout:X}),Ce]})})}),ld="base-ui-disable-scrollbar",Uh={className:ld,getElement(e){return r.jsx("style",{nonce:e,href:ld,precedence:"base-ui:low",children:`.${ld}{scrollbar-width:none}.${ld}::-webkit-scrollbar{display:none}`})}},hD=x.createContext(void 0);function xD(e){return x.useContext(hD)}const bD=x.createContext(void 0),vD={disableStyleElements:!1};function yD(){return x.useContext(bD)??vD}const _D={...Bl,...Il},jD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,finalFocus:d,...f}=n,{store:p,popupRef:m,onOpenChangeComplete:g,setOpen:b,valueRef:v,firstItemTextRef:S,selectedItemTextRef:C,keyboardActiveRef:j,multiple:w,handleScrollArrowVisibility:k,scrollHandlerRef:E,listRef:R,highlightItemOnHover:N}=ls(),{side:T,align:M,alignItemWithTriggerActive:O,isPositioned:P,setControlledAlignItemWithTrigger:B,scrollDownArrowRef:L,scrollUpArrowRef:D}=db(),z=xD()!=null,H=yC(),q=Hx(),{nonce:Y,disableStyleElements:V}=yD(),$=tt(p,We.id),Z=tt(p,We.open),G=tt(p,We.mounted),X=tt(p,We.popupProps),U=tt(p,We.transitionStatus),K=tt(p,We.triggerElement),F=tt(p,We.positionerElement),J=tt(p,We.listElement),ie=x.useRef(!1),re=x.useRef(!1),oe=x.useRef({}),ce=_l(),ee=Le(Ce=>{if(!F||!m.current||!re.current)return;if(ie.current||!O){k();return}const Ne=F.style.top==="0px",Pe=F.style.bottom==="0px";if(!Ne&&!Pe){k();return}const Ie=X_(F),be=Wi(F.getBoundingClientRect().height,"y",Ie),Ae=yt(F),we=getComputedStyle(F),Be=parseFloat(we.marginTop),Xe=parseFloat(we.marginBottom),Ye=Y_(getComputedStyle(m.current)),De=Math.min(Ae.documentElement.clientHeight-Be-Xe,Ye),ye=Ce.scrollTop,le=id(Ce);let _e=0,Se=null,Ue=!1,Je=!1;const _t=Re=>{F.style.height=`${Re}px`},zt=(Re,Ve)=>{const at=Zi(Re,0,De-be);at>0&&_t(be+at),Ce.scrollTop=Ve,De-(be+at)<=Ha&&(ie.current=!0),k()},pe=Ne?le-ye:ye,ke=Math.min(be+pe,De);if(_e=ke,pe<=Ha){zt(pe,Ne?le:0);return}if(De-ke>Ha)Ne?Je=!0:Se=0;else if(Ue=!0,Pe&&ye<le){const Re=be+pe-De;Se=ye-(pe-Re)}if(_e=Math.ceil(_e),_e!==0&&_t(_e),Je||Se!=null){const Re=id(Ce),Ve=Je?Re:Zi(Se,0,Re);Math.abs(Ce.scrollTop-Ve)>Ha&&(Ce.scrollTop=Ve)}(Ue||_e>=De-Ha)&&(ie.current=!0),k()});x.useImperativeHandle(E,()=>ee,[ee]),Ar({open:Z,ref:m,onComplete(){Z&&g?.(!0)}});const Te={open:Z,transitionStatus:U,side:T,align:M};Oe(()=>{!F||!m.current||Object.keys(oe.current).length||(oe.current={top:F.style.top||"0",left:F.style.left||"0",right:F.style.right,height:F.style.height,bottom:F.style.bottom,minHeight:F.style.minHeight,maxHeight:F.style.maxHeight,marginTop:F.style.marginTop,marginBottom:F.style.marginBottom})},[m,F]),Oe(()=>{Z||O||(re.current=!1,ie.current=!1,Zd(F,oe.current))},[Z,O,F,m]),Oe(()=>{const Ce=m.current;if(!Z||!K||!F||!Ce||O&&!P||p.state.transitionStatus==="ending")return;if(!O){re.current=!0,ce.request(k),Ce.style.removeProperty("--transform-origin");return}const Ne=wD(Ce);Ce.style.removeProperty("--transform-origin");try{let Pe=C.current;Pe?.isConnected||(Pe=!We.hasSelectedValue(p.state)&&S.current?.isConnected?S.current:null);const Ie=v.current,be=getComputedStyle(F),Ae=getComputedStyle(Ce),we=yt(K),Be=Qt(F),Xe=X_(K),Ye=cd(K.getBoundingClientRect(),Xe),De=cd(F.getBoundingClientRect(),Xe),ye=Ye.height,le=J||Ce,_e=le.scrollHeight,Se=parseFloat(Ae.borderBottomWidth),Ue=parseFloat(be.marginTop)||10,Je=parseFloat(be.marginBottom)||10,_t=parseFloat(be.minHeight)||100,zt=Y_(Ae),pe=5,ke=5,Re=20,Ve=we.documentElement.clientHeight-Ue-Je,at=we.documentElement.clientWidth,nn=Ve-Ye.bottom+ye;let Vt,mt=q==="rtl"?Ye.right-De.width:Ye.left,Nt=0;if(Pe&&Ie){const Dn=cd(Ie.getBoundingClientRect(),Xe);Vt=cd(Pe.getBoundingClientRect(),Xe),mt=De.left+(q==="rtl"?Dn.right-Vt.right:Dn.left-Vt.left);const ca=Dn.top-Ye.top+Dn.height/2;Nt=Vt.top-De.top+Vt.height/2-ca}const Zt=nn+Nt+Je+Se;let St=Math.min(Ve,Zt);const an=Ve-Ue-Je,Ft=Zt-St,dn=at-ke;F.style.left=`${Zi(mt,pe,dn-De.width)}px`,F.style.height=`${St}px`,F.style.maxHeight="auto",F.style.marginTop=`${Ue}px`,F.style.marginBottom=`${Je}px`,Ce.style.height="100%";const zn=id(le),Xn=Ft>=zn-Ha;Xn&&(St=Math.min(Ve,De.height)-(Ft-zn));const ia=Ye.top<Re||Ye.bottom>Ve-Re||Math.ceil(St)+Ha<Math.min(_e,_t),Kn=(Be.visualViewport?.scale??1)!==1&&xx;if(ia||Kn){re.current=!0,Zd(F,oe.current),B(!1);return}const is=Math.max(_t,St);if(Xn){const Dn=Math.max(0,Ve-Zt);F.style.top=De.height>=an?"0":`${Dn}px`,F.style.height=`${St}px`,le.scrollTop=id(le)}else F.style.bottom="0",le.scrollTop=Ft;if(Vt){const Dn=De.top,ca=De.height,Pa=Vt.top+Vt.height/2,cs=ca>0?(Pa-Dn)/ca*100:50,ct=Zi(cs,0,100);Ce.style.setProperty("--transform-origin",`50% ${ct}%`)}(is===Ve||St>=zt)&&(ie.current=!0),k(),N&&p.state.selectedIndex===null&&p.state.activeIndex===null&&R.current[0]!=null&&p.set("activeIndex",0),re.current=!0}finally{Ne()}},[p,Z,F,K,v,S,C,m,k,O,B,ce,L,D,J,R,N,q,P]),x.useEffect(()=>{if(!O||!F||!Z)return;const Ce=Qt(F);function Ne(Pe){b(!1,lt(yM,Pe))}return pt(Ce,"resize",Ne)},[b,O,F,Z]);const Fe={...J?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${$}-list`},onKeyDown(Ce){j.current=!0,z&&rb.has(Ce.key)&&Ce.stopPropagation()},onMouseMove(){j.current=!1},onScroll(Ce){J||ee(Ce.currentTarget)},...O&&{style:J?{height:"100%"}:kC}},ve=Ht("div",n,{ref:[s,m],state:Te,stateAttributesMapping:_D,props:[X,Fe,Vx(U),{className:!J&&O?Uh.className:void 0},f]});return r.jsxs(x.Fragment,{children:[!V&&Uh.getElement(Y),r.jsx(KS,{context:H,modal:!1,disabled:!G,returnFocus:d,restoreFocus:!0,children:ve})]})});function Y_(e){const n=e.maxHeight||"";return n.endsWith("px")&&parseFloat(n)||1/0}function id(e){return cb(e.scrollHeight,e.clientHeight)}function X_(e){return n2.getScale(e)}function Wi(e,n,s){return e/s[n]}function cd(e,n){return hc({x:Wi(e.x,"x",n),y:Wi(e.y,"y",n),width:Wi(e.width,"x",n),height:Wi(e.height,"y",n)})}const K_=[["transform","none"],["scale","1"],["translate","0 0"]];function wD(e){const{style:n}=e,s={};for(const[o,l]of K_)s[o]=n.getPropertyValue(o),n.setProperty(o,l,"important");return()=>{for(const[o]of K_){const l=s[o];l?n.setProperty(o,l):n.removeProperty(o)}}}const SD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:f,scrollHandlerRef:p}=ls(),{alignItemWithTriggerActive:m}=db(),g=tt(f,We.hasScrollArrows),b=tt(f,We.openMethod),v=tt(f,We.multiple),C={id:`${tt(f,We.id)}-list`,role:"listbox","aria-multiselectable":v||void 0,onScroll(w){p.current?.(w.currentTarget)},...m&&{style:kC},className:g&&b!=="touch"?Uh.className:void 0},j=Le(w=>{f.set("listElement",w)});return Ht("div",n,{ref:[s,j],props:[C,d]})});let EC=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function fb(e={}){const{label:n,metadata:s,textRef:o,indexGuessBehavior:l,index:c}=e,{register:d,unregister:f,subscribeMapChange:p,elementsRef:m,labelsRef:g,nextIndexRef:b}=iD(),v=x.useRef(-1),[S,C]=x.useState(c??(l===EC.GuessFromOrder?()=>{if(v.current===-1){const k=b.current;b.current+=1,v.current=k}return v.current}:-1)),j=x.useRef(null),w=x.useCallback(k=>{if(j.current=k,S!==-1&&k!==null&&(m.current[S]=k,g)){const E=n!==void 0;g.current[S]=E?n:o?.current?.textContent??k.textContent}},[S,m,g,n,o]);return Oe(()=>{if(c!=null)return;const k=j.current;if(k)return d(k,s),()=>{f(k)}},[c,d,f,s]),Oe(()=>{if(c==null)return p(k=>{const E=j.current?k.get(j.current)?.index:null;E!=null&&C(E)})},[c,p,C]),x.useMemo(()=>({ref:w,index:S}),[S,w])}const NC=x.createContext(void 0);function pb(){const e=x.useContext(NC);if(!e)throw new Error(On(57));return e}const CD=x.memo(x.forwardRef(function(n,s){const{render:o,className:l,style:c,value:d=null,label:f,disabled:p=!1,nativeButton:m=!1,...g}=n,b=x.useRef(null),v=fb({label:f,textRef:b,indexGuessBehavior:EC.GuessFromOrder}),{store:S,itemProps:C,setOpen:j,setValue:w,selectionRef:k,typingRef:E,valuesRef:R,multiple:N,selectedItemTextRef:T}=ls(),M=tt(S,We.isActive,v.index),O=tt(S,We.isSelected,v.index,d),P=tt(S,We.isSelectedByFocus,v.index),B=tt(S,We.isItemEqualToValue),L=v.index,D=L!==-1,z=x.useRef(null);Oe(()=>{if(!D)return;const J=R.current;return J[L]=d,()=>{delete J[L]}},[D,L,d,R]),Oe(()=>{if(!D)return;const J=S.state.value;let ie=J;N&&Array.isArray(J)&&J.length>0&&(ie=J[J.length-1]),ie!==void 0&&El(d,ie,B)&&(S.set("selectedIndex",L),b.current&&(T.current=b.current))},[D,L,N,B,S,d,T]);const H=x.useRef(null),q=x.useRef("mouse"),Y=x.useRef(!1),{getButtonProps:V,buttonRef:$}=Ul({disabled:p,focusableWhenDisabled:!0,native:m,composite:!0}),Z={disabled:p,selected:O,highlighted:M};function G(J){const ie=S.state.value;if(N){const re=Array.isArray(ie)?ie:[],oe=O?Xz(re,d,B):[...re,d];w(oe,lt(ng,J))}else w(d,lt(ng,J)),j(!1,lt(ng,J))}function X(){k.current.dragY=0}const U={role:"option","aria-selected":O,tabIndex:M?0:-1,onKeyDown(J){H.current=J.key,S.set("activeIndex",L),J.key===" "&&E.current&&J.preventDefault()},onClick(J){const ie=J.type==="click"&&q.current!=="touch",re=J.nativeEvent.pointerType,oe=ie&&bx(J.nativeEvent)&&(re!==void 0||M),ce=ie&&!oe&&!Y.current;Y.current=!1,!(J.type==="keydown"&&H.current===null)&&(p||J.type==="keydown"&&H.current===" "&&E.current||ce||(H.current=null,G(J.nativeEvent)))},onPointerEnter(J){q.current=J.pointerType},onPointerMove(J){if(J.pointerType==="mouse"&&J.buttons===1){const ie=k.current;ie.dragY+=J.movementY,ie.dragY**2>=64&&(ie.allowUnselectedMouseUp=!0)}},onPointerDown(J){q.current=J.pointerType,Y.current=!0,X()},onMouseUp(){if(X(),p||q.current==="touch"||Y.current)return;const J=!k.current.allowSelectedMouseUp&&O,ie=!k.current.allowUnselectedMouseUp&&!O;J||ie||(Y.current=!0,z.current?.click(),Y.current=!1)}},K=Ht("div",n,{ref:[$,s,v.ref,z],state:Z,props:[C,U,g,V]}),F=x.useMemo(()=>({selected:O,index:L,textRef:b,selectedByFocus:P,hasRegistered:D}),[O,L,b,P,D]);return r.jsx(NC.Provider,{value:F,children:K})})),kD=x.forwardRef(function(n,s){const o=n.keepMounted??!1,{selected:l}=pb();return o||l?r.jsx(ED,{...n,ref:s}):null}),ED=x.memo(x.forwardRef((e,n)=>{const{render:s,className:o,style:l,keepMounted:c,...d}=e,{selected:f}=pb(),p=x.useRef(null),{transitionStatus:m,setMounted:g}=Tc(f),v=Ht("span",e,{ref:[n,p],state:{selected:f,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:Il});return Ar({open:f,ref:p,onComplete(){f||g(!1)}}),v})),ND=x.memo(x.forwardRef(function(n,s){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:d}=pb(),{firstItemTextRef:f,selectedItemTextRef:p}=ls(),{render:m,className:g,style:b,...v}=n,S=x.useCallback(j=>{j&&(d&&o===0&&(f.current=j),d&&c&&(p.current=j))},[f,p,o,c,d]);return Ht("div",n,{ref:[S,s,l],props:v})})),RC=x.forwardRef(function(n,s){const{render:o,className:l,style:c,direction:d,keepMounted:f=!1,...p}=n,m=d==="up",{store:g,popupRef:b,listRef:v,handleScrollArrowVisibility:S,scrollArrowsMountedCountRef:C}=ls(),{side:j,scrollDownArrowRef:w,scrollUpArrowRef:k}=db(),E=m?We.scrollUpArrowVisible:We.scrollDownArrowVisible,R=tt(g,E),N=tt(g,We.openMethod),T=R&&N!=="touch",M=aa(),O=m?k:w,{transitionStatus:P,setMounted:B}=Tc(T);Oe(()=>(C.current+=1,g.state.hasScrollArrows||g.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&g.state.hasScrollArrows&&g.set("hasScrollArrows",!1)}),[g,C]),Ar({open:T,ref:O,onComplete(){T||B(!1)}});const z=Ht("div",n,{ref:[s,O],state:{direction:d,visible:T,side:j,transitionStatus:P},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(q){if(q.movementX===0&&q.movementY===0||M.isStarted())return;g.set("activeIndex",null);function Y(){const V=g.state.listElement??b.current;if(!V)return;g.set("activeIndex",null),S();const $=cb(V.scrollHeight,V.clientHeight),Z=Qd(V.scrollTop,$),G=Z===(m?0:$),X=v.current;if(Z!==V.scrollTop&&(V.scrollTop=Z),X.length===0&&g.set(m?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){M.clear();return}if(X.length>0){const U=O.current?.offsetHeight||0;V.scrollTop=RD(X,m,Z,V.clientHeight,U,$)}M.start(40,Y)}M.start(40,Y)},onMouseLeave(){M.clear()}},p]});return T||f?z:null});function RD(e,n,s,o,l,c){if(n){let g=0;const b=s+l-Ha;for(let C=0;C<e.length;C+=1){const j=e[C];if(j&&j.offsetTop>=b){g=C;break}}const v=Math.max(0,g-1),S=e[v];return v<g&&S?Qd(S.offsetTop-l,c):0}let d=e.length-1;const f=s+o-l+Ha;for(let g=0;g<e.length;g+=1){const b=e[g];if(b&&b.offsetTop+b.offsetHeight>f){d=Math.max(0,g-1);break}}const p=Math.min(e.length-1,d+1),m=e[p];return p>d&&m?Qd(m.offsetTop+m.offsetHeight-o+l,c):c}const TD=x.forwardRef(function(n,s){return r.jsx(RC,{...n,ref:s,direction:"down"})}),AD=x.forwardRef(function(n,s){return r.jsx(RC,{...n,ref:s,direction:"up"})}),MD=Zz;function OD({className:e,...n}){return r.jsx(sD,{"data-slot":"select-value",className:Ot("flex flex-1 text-left",e),...n})}function zD({className:e,size:n="default",children:s,...o}){return r.jsxs(nD,{"data-slot":"select-trigger","data-size":n,className:Ot("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,r.jsx(rD,{render:r.jsx(xo,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function DD({className:e,children:n,side:s="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...f}){return r.jsx(lD,{children:r.jsx(gD,{side:s,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:r.jsxs(jD,{"data-slot":"select-content","data-align-trigger":d,className:Ot("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[r.jsx(PD,{}),r.jsx(SD,{children:n}),r.jsx(ID,{})]})})})}function LD({className:e,children:n,...s}){return r.jsxs(CD,{"data-slot":"select-item",className:Ot("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground 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),...s,children:[r.jsx(ND,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:n}),r.jsx(kD,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(dc,{className:"pointer-events-none"})})]})}function PD({className:e,...n}){return r.jsx(AD,{"data-slot":"select-scroll-up-button",className:Ot("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:r.jsx(Bw,{})})}function ID({className:e,...n}){return r.jsx(TD,{"data-slot":"select-scroll-down-button",className:Ot("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:r.jsx(xo,{})})}function wt({value:e,onChange:n,options:s,placeholder:o="— elegir —",disabled:l,className:c,showIcon:d=!1}){return r.jsxs(MD,{value:e,onValueChange:f=>n(f??""),disabled:l,children:[r.jsx(zD,{className:Me("h-9 w-full",c),children:r.jsx(OD,{placeholder:o,children:f=>{const p=s.find(g=>g.value===f),m=d?p?.icon:void 0;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m&&r.jsx(m,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:p?.label??f})]})}})}),r.jsx(DD,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:s.map(f=>{const p=f.icon;return r.jsx(LD,{value:f.value,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p?r.jsx(p,{className:"size-4 shrink-0 text-muted-fg"}):null,f.description?r.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[r.jsx("span",{className:"truncate font-medium",children:f.label}),r.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:f.description})]}):r.jsx("span",{className:"truncate",children:f.label})]})},f.value)})})]})}const Q_=320;function BD(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function UD(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function HD({m:e}){const[n,s]=x.useState(!1),o=(e.body?.length||0)>Q_,l=!o||n?e.body:`${e.body.slice(0,Q_)}…`;return r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?r.jsx(Lw,{size:14,className:"text-blue-400"}):r.jsx(Iw,{size:14,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:BD(e.ts)}),r.jsx(Ge,{tone:"info",children:e.channel}),e.type&&r.jsx(Ge,{children:e.type}),r.jsx("span",{className:"font-medium text-foreground",children:UD(e)})]}),e.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&r.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:_(n?"logs.show_less":"logs.show_more")})]})]})}function VD(){const[e,n]=x.useState(!1),s=Qe(e?"/admin/logs?errors":null,()=>Sl.logs("errors",200)),o=s.data?.entries||[];return r.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>n(l.target.open),children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[_("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),r.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&r.jsx(nt,{}),e&&!s.isLoading&&o.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:_("logs.no_errors")}),r.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>r.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&r.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&r.jsx("span",{className:"text-destructive",children:l.level})]}),r.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(l.msg??l.message??l.error??l.raw??JSON.stringify(l)).slice(0,500)})]},c))})]})]})}function qD({pid:e}){const n=!e||String(e)==="0",[s,o]=x.useState(""),[l,c]=x.useState(""),[d,f]=x.useState(""),[p,m]=x.useState(""),g=s.trim()||void 0,b=n?`/messages/global?channel=${g??""}`:`/projects/${e}/messages?channel=${g??""}`,v=Qe(b,()=>n?zh.global({channel:g,limit:300}):zh.project(e,{channel:g,limit:300})),S=x.useMemo(()=>[...v.data||[]].sort((w,k)=>(k.ts||"").localeCompare(w.ts||"")),[v.data]),C=x.useMemo(()=>Array.from(new Set(S.map(w=>w.type).filter(Boolean))),[S]),j=x.useMemo(()=>S.filter(w=>!(l&&w.direction!==l||d&&w.type!==d||p&&!(w.body||"").toLowerCase().includes(p.toLowerCase()))),[S,l,d,p]);return r.jsxs($e,{title:_("logs.title"),description:_(n?"logs.desc_global":"logs.desc_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ee,{placeholder:_("logs.filter_channel"),value:s,onChange:w=>o(w.target.value),className:"w-44"}),r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),children:r.jsx(Nr,{size:13})})]}),children:[n&&r.jsx(VD,{}),r.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"w-36",children:r.jsx(wt,{value:l,onChange:c,placeholder:_("logs.filter_dir"),options:[{value:"",label:_("logs.all_directions")},{value:"in",label:_("logs.in")},{value:"out",label:_("logs.out")}]})}),r.jsx("div",{className:"w-40",children:r.jsx(wt,{value:d,onChange:f,placeholder:_("logs.filter_type"),options:[{value:"",label:_("logs.all_types")},...C.map(w=>({value:w,label:w}))]})}),r.jsx(Ee,{placeholder:_("logs.search_text"),value:p,onChange:w=>m(w.target.value),className:"w-56"}),r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[j.length," ",_("logs.count_of")," ",S.length]})]}),v.isLoading&&r.jsx(nt,{}),v.error&&r.jsx(it,{children:_("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&j.length===0&&r.jsx(it,{children:g?_("logs.no_activity_ch",{ch:g}):_("logs.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:j.map((w,k)=>r.jsx(HD,{m:w},`${w.ts}-${k}`))})]})}function TC({value:e,onChange:n,options:s,placeholder:o="elegí o escribí un modelo…",invalid:l,invalidHint:c,className:d}){const[f,p]=x.useState(!1),[m,g]=x.useState(e),b=x.useRef(null),v=x.useRef(null),[S,C]=x.useState(null);x.useEffect(()=>{g(e)},[e]),x.useLayoutEffect(()=>{if(!f)return;const R=()=>{const N=b.current;if(!N)return;const T=N.getBoundingClientRect();C({top:T.bottom+4,left:T.left,width:T.width})};return R(),window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[f]),x.useEffect(()=>{if(!f)return;const R=N=>{const T=N.target;b.current?.contains(T)||v.current?.contains(T)||p(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[f]);const j=m.trim().toLowerCase(),k=j&&!(m===e)?s.filter(R=>R.toLowerCase().includes(j)):s,E=R=>{n(R),g(R),p(!1)};return r.jsxs("div",{ref:b,className:Me("relative",d),children:[r.jsxs("div",{className:Me("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",l?"border-amber-500/60":"border-border"),children:[l&&r.jsx("span",{title:c||_("models_ui.invalid_hint"),children:r.jsx(Qw,{className:"size-3.5 shrink-0 text-amber-400"})}),r.jsx("input",{value:m,placeholder:o,onChange:R=>{g(R.target.value),n(R.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(R=>!R),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(xo,{className:"size-4"})})]}),f&&k.length>0&&S&&Er.createPortal(r.jsx("ul",{ref:v,style:{position:"fixed",top:S.top,left:S.left,width:S.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:k.map(R=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:N=>{N.preventDefault(),E(R)},className:Me("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",R===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:R})})},R))}),document.body)]})}function Or(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/admin/config",()=>Sl.config.get()),l=async(c,d)=>{const f=await Sl.config.patch({set:c,unset:d});return await o({config:f.config},{revalidate:!1}),f.config};return{config:e?.config||{},error:n,isLoading:s,mutate:o,patch:l}}function AC(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/admin/super-agent",()=>Sl.superAgent());return{superAgent:e,error:n,isLoading:s,mutate:o}}const $D={anthropic:"from-orange-600 to-amber-600",openai:"from-emerald-600 to-teal-600",gemini:"from-blue-600 to-indigo-600",groq:"from-cyan-600 to-teal-600",openrouter:"from-violet-600 to-indigo-600",ollama:"from-amber-600 to-orange-600",azure:"from-blue-600 to-cyan-600",mock:"from-slate-600 to-gray-600",custom:"from-slate-600 to-gray-600"},GD={anthropic:"bg-orange-500/20 text-orange-300 border border-orange-500/40",openai:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40",gemini:"bg-blue-500/20 text-blue-300 border border-blue-500/40",groq:"bg-cyan-500/20 text-cyan-300 border border-cyan-500/40",openrouter:"bg-violet-500/20 text-violet-300 border border-violet-500/40",ollama:"bg-amber-500/20 text-amber-300 border border-amber-500/40",azure:"bg-blue-500/20 text-blue-300 border border-blue-500/40",mock:"bg-slate-500/20 text-slate-300 border border-slate-500/40",custom:"bg-slate-500/20 text-slate-300 border border-slate-500/40"},ic=[{value:"anthropic",label:"Anthropic"},{value:"openai",label:"OpenAI-compatible"},{value:"gemini",label:"Gemini"},{value:"groq",label:"Groq"},{value:"openrouter",label:"OpenRouter"},{value:"ollama",label:"Ollama"},{value:"azure",label:"Azure OpenAI"},{value:"mock",label:"Mock (test)"},{value:"custom",label:"Custom"}];function kg(e,n){return n&&n in e?e[n]:e.custom}const Wd={anthropic:Ol,openai:yn,gemini:qT,groq:fc,openrouter:ix,ollama:Xw,azure:TT,mock:Hw,custom:zl},ro={anthropic:{base_url:"",default_model:"claude-sonnet-4.6",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-sonnet-4.6","claude-sonnet-4.5","claude-haiku-4.5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-4o-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-pro","gemini-3.5-flash","gemini-3.1-pro","gemini-3.1-flash","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"llama-3.3-70b-versatile",api_key_env:"GROQ_API_KEY",known_models:["llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","openai/gpt-oss-120b","openai/gpt-oss-20b","groq/compound","groq/compound-mini","qwen/qwen3-32b","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","deepseek/deepseek-r1:free","meta-llama/llama-3.3-70b-instruct:free","google/gemini-2.0-flash-exp:free","qwen/qwen3-235b-a22b:free","anthropic/claude-sonnet-4.5","openai/gpt-4o-mini"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"gpt-4o-mini",api_key_env:"AZURE_OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini"]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};function MC(e){const n=e.indexOf(":");return n<0?{provider:e,model:""}:{provider:e.slice(0,n),model:e.slice(n+1)}}function Eg({value:e,onChange:n,providers:s}){const{provider:o,model:l}=MC(e),c=s.find(g=>g.slug===o),d=!!o&&!c,f=x.useMemo(()=>{const g=c?ro[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...g]))},[c]),p=g=>{const b=s.find(S=>S.slug===g),v=b?.default_model||ro[b?.engine]?.default_model||"";n(v?`${g}:${v}`:`${g}:`)},m=g=>n(`${o}:${g}`);return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(wt,{value:o,onChange:p,placeholder:d?`⚠ ${o} (no existe)`:"— proveedor —",options:s.map(g=>({value:g.slug,label:g.slug,icon:Wd[g.engine]}))}),r.jsx(TC,{value:l,onChange:m,options:f,invalid:d,invalidHint:`El proveedor "${o}" no está configurado.`})]})}function FD(){const e=st(),{superAgent:n,isLoading:s,mutate:o}=AC(),{config:l,patch:c}=Or(),[d,f]=x.useState(""),[p,m]=x.useState([]),[g,b]=x.useState(""),[v,S]=x.useState(null),[C,j]=x.useState(!1),[w,k]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!n)return;const L=n.model_fallback?.models||[],D=Array.isArray(L)?L:[];f(n.model||""),m(D),k({model:n.model||"",fallback:D})},[n]);const E=x.useMemo(()=>{const L=l.engines||{};return Object.entries(L).map(([D,z])=>({slug:D,engine:z?.engine||D,default_model:z?.default_model||ro[z?.engine||D]?.default_model}))},[l.engines]),R=L=>{const{provider:D}=MC(L);return E.some(z=>z.slug===D)};if(s||!n)return r.jsx(nt,{});const N=d!==w.model||JSON.stringify(p)!==JSON.stringify(w.fallback),T=async()=>{j(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":p.length>0,"super_agent.model_fallback.models":p}),e.success("Router guardado."),k({model:d,fallback:p}),o()}catch(L){e.error(L.message)}finally{j(!1)}},M=()=>{const L=g.trim().replace(/:$/,"");!L||!L.includes(":")||p.includes(L)||(m([...p,L]),b(""))},O=(L,D)=>{const z=[...p];z[L]=D,m(z)},P=L=>{m(p.filter((D,z)=>z!==L)),v===L&&S(null)},B=(L,D)=>{const z=L+D;if(z<0||z>=p.length)return;const H=[...p];[H[L],H[z]]=[H[z],H[L]],m(H)};return r.jsx($e,{title:_("router_panel.title"),description:"Un solo router general (sin casos por tarea). Elegí proveedor y modelo; si el activo falla, prueba la cadena de fallback en orden.",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs(Ge,{tone:"success",children:[r.jsx(ix,{size:11})," default"]}),r.jsx("span",{className:`font-mono text-xs ${!R(d)&&d?"text-amber-400":""}`,children:d||"—"}),p.map(L=>r.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[r.jsx(Pw,{size:12}),r.jsx("span",{className:`font-mono text-xs ${R(L)?"":"text-amber-400"}`,children:L})]},L))]}),E.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:"Agregá un proveedor abajo para poder elegir modelos."}):r.jsx(de,{label:"Modelo activo (default)",hint:"Proveedor + modelo. Se guarda como provider:model.",children:r.jsx(Eg,{value:d,onChange:f,providers:E})}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-sm font-medium",children:"Cadena de fallback"}),r.jsx("div",{className:"text-xs text-muted-fg",children:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo."})]}),r.jsxs("ul",{className:"mb-3 space-y-1",children:[p.map((L,D)=>{const z=!R(L),H=v===D;return r.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"w-6 text-muted-fg",children:["#",D+1]}),H?r.jsx("div",{className:"flex-1",children:r.jsx(Eg,{value:L,onChange:q=>O(D,q),providers:E})}):r.jsxs("button",{type:"button",onClick:()=>S(D),className:"flex flex-1 items-center gap-1.5 text-left",children:[z&&r.jsx(Qw,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${z?"text-amber-400":""}`,children:L})]}),H?r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>S(null),children:"listo"}):r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>S(D),children:r.jsx(Ml,{size:12})}),r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>B(D,-1),disabled:D===0,children:"↑"}),r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>B(D,1),disabled:D===p.length-1,children:"↓"}),r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>P(D),children:r.jsx(la,{size:12})})]})},`${D}-${L}`)}),p.length===0&&r.jsx("li",{className:"text-xs text-muted-fg",children:"Sin fallback configurado."})]}),E.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-muted-fg",children:"Agregar a la cadena"}),r.jsx(Eg,{value:g,onChange:b,providers:E}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:M,disabled:!g.includes(":")||g.endsWith(":"),children:[r.jsx(un,{size:13})," Agregar a la cadena"]})]})]}),r.jsx(me,{variant:"primary",loading:C,disabled:!N,onClick:T,children:N?"Guardar router":"Guardado"})]})})}function YD({provider:e,onEdit:n,onDelete:s,onToggle:o}){const l=kg($D,e.engine),c=kg(GD,e.engine),d=kg(Wd,e.engine),f=ic.find(b=>b.value===e.engine)?.label||e.engine,p=typeof e.api_key=="string"&&e.api_key.length>0,m=kl(e.api_key),g=e.is_active!==!1;return r.jsxs("div",{className:"group flex h-full cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4 transition-colors hover:border-muted-fg/50",onClick:n,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:Me("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:r.jsx(d,{className:"size-5 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),r.jsxs("span",{className:Me("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[r.jsx(d,{className:"size-3"})," ",f]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Mt,{content:_(g?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:r.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:Me("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",g?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[r.jsx("span",{className:Me("size-1.5 rounded-full",g?"bg-emerald-400":"bg-muted-fg/40")}),g?"Active":"Off"]})}),r.jsx(Mt,{content:_("providers_modal.delete"),children:r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:r.jsx(la,{className:"size-3.5"})})})]})]}),r.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[r.jsx(Ui,{label:"Modelo",value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(Ui,{label:"Base URL",value:e.base_url,mono:!0,truncate:!0}),r.jsx(Ui,{label:"API key",value:p?m?`…${m}`:"✓ seteada":"—",mono:!!m}),e.default_temperature!==void 0&&r.jsx(Ui,{label:"Temp",value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(Ui,{label:"$ in/out (1M)",value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function Ui({label:e,value:n,mono:s,truncate:o}){return r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:e}),r.jsx("span",{className:Me("text-foreground",s&&"font-mono",o&&"max-w-[180px] truncate"),children:n})]})}const Z_={name:"",slug:"",engine:"anthropic",base_url:"",api_key_value:"",default_model:"",default_temperature:.7,default_max_tokens:4096,is_active:!0,context_limit_tokens:2e5,model_context_limits_json:"",p_input:"",p_output:"",p_cache_read:"",p_cache_write:""},XD=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function Hi(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ud(e){if(e==null)return"";const n=Number(e);return Number.isFinite(n)?String(n):""}function KD(e){return{name:e.name||e.slug,slug:e.slug,engine:e.engine||"custom",base_url:e.base_url||"",api_key_value:"",default_model:e.default_model||"",default_temperature:e.default_temperature??.7,default_max_tokens:e.default_max_tokens??4096,is_active:e.is_active!==!1,context_limit_tokens:e.context_limit_tokens??2e5,model_context_limits_json:e.model_context_limits?JSON.stringify(e.model_context_limits,null,2):"",p_input:ud(e.pricing?.input_per_million),p_output:ud(e.pricing?.output_per_million),p_cache_read:ud(e.pricing?.cache_read_per_million),p_cache_write:ud(e.pricing?.cache_write_per_million)}}function QD({open:e,initial:n,existingSlugs:s,onClose:o,onSave:l}){const c=!!n,[d,f]=x.useState(Z_),[p,m]=x.useState(!1),[g,b]=x.useState(null),[v,S]=x.useState([]),[C,j]=x.useState(!1),[w,k]=x.useState(null),[E,R]=x.useState(!1),[N,T]=x.useState("");x.useEffect(()=>{if(!e)return;const G=n?KD(n):Z_;f(G),b(null),k(null),R(!1);const X=ro[G.engine];S(X?.known_models||[])},[e,n]);const M=G=>f(X=>({...X,...G})),O=G=>{const X=ro[G];M({engine:G,name:G==="custom"?d.name:ic.find(U=>U.value===G)?.label||G,slug:G==="custom"?d.slug:G,base_url:X.base_url,default_model:X.default_model}),S(X.known_models),k(null)},P=G=>{const X=ro[G];M({engine:G,base_url:d.base_url||X.base_url,default_model:d.default_model||X.default_model}),S(X.known_models)},B=async()=>{j(!0),k(null);try{const G=await Yd.models({engine:d.engine,slug:d.slug||Hi(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(G.error){k(G.error);return}S(G.models),G.models.length===0&&k("Sin modelos. ¿Key/URL correctas?")}catch(G){k(G.message||"No se pudo listar modelos.")}finally{j(!1)}},L=x.useMemo(()=>d.default_model&&!v.includes(d.default_model)?[d.default_model,...v]:v,[v,d.default_model]),D=()=>{const G=(d.slug||Hi(d.name)).trim();if(!G)return b("Slug requerido."),null;if(!c&&s.includes(G))return b(`Ya existe un provider "${G}".`),null;let X;if(d.model_context_limits_json.trim())try{const F=JSON.parse(d.model_context_limits_json);if(!F||typeof F!="object"||Array.isArray(F))throw new Error;X=F}catch{return b("Límites de contexto por modelo: JSON inválido."),null}const K=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map(F=>F.trim()).some(Boolean)?{input_per_million:Number(d.p_input||0),output_per_million:Number(d.p_output||0),cache_read_per_million:Number(d.p_cache_read||0),cache_write_per_million:Number(d.p_cache_write||0)}:void 0;return{provider:{slug:G,name:d.name.trim()||G,engine:d.engine,base_url:d.base_url.trim()||void 0,default_model:d.default_model.trim()||void 0,default_temperature:d.default_temperature,default_max_tokens:d.default_max_tokens,is_active:d.is_active,context_limit_tokens:d.context_limit_tokens||void 0,model_context_limits:X,pricing:K},modelLimits:X}},z=()=>{const G=D();if(!G)return;const{provider:X}=G,U={name:X.name,engine:X.engine,is_active:X.is_active!==!1,default_temperature:X.default_temperature,default_max_tokens:X.default_max_tokens};X.base_url&&(U.base_url=X.base_url),X.default_model&&(U.default_model=X.default_model),X.context_limit_tokens&&(U.context_limit_tokens=X.context_limit_tokens),X.model_context_limits&&(U.model_context_limits=X.model_context_limits),X.pricing&&(U.pricing=X.pricing),d.api_key_value.trim()&&(U.api_key=d.api_key_value.trim()),T(JSON.stringify(U,null,2)),b(null),R(!0)},H=async()=>{m(!0),b(null);try{if(E){const X=(d.slug||Hi(d.name)).trim();if(!X){b("Slug requerido (en el formulario).");return}let U;try{U=JSON.parse(N)}catch{b("JSON inválido: revisá la sintaxis.");return}if(!U||typeof U!="object"||Array.isArray(U)){b("El JSON debe ser un objeto con la config del provider.");return}const K=U;if(!K.engine||typeof K.engine!="string"){b('Falta "engine" (ej. "anthropic", "ollama").');return}const F={slug:X,name:typeof K.name=="string"?K.name:X,engine:String(K.engine),base_url:typeof K.base_url=="string"?K.base_url:void 0,default_model:typeof K.default_model=="string"?K.default_model:void 0,is_active:K.is_active!==!1};await l({provider:F,raw:K,originalSlug:n?.slug}),o();return}const G=D();if(!G)return;await l({provider:G.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:n?.slug}),o()}catch(G){b(G.message||"Error al guardar.")}finally{m(!1)}},q=c&&Va(n?.api_key),Y=kl(n?.api_key),V=q?`…${Y??""} (ya seteada)`:"sk-…",$=d.engine==="ollama",Z=ro[d.engine]?.api_key_env;return r.jsx(Mn,{open:e,onClose:o,title:c?_("providers_modal.edit_title",{name:n?.name||n?.slug||""}):_("providers_modal.new_title"),description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:o,disabled:p,children:"Cancelar"}),r.jsx(me,{variant:"primary",onClick:H,loading:p,children:c?"Guardar":"Crear"})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[c?r.jsx("span",{}):r.jsx("div",{className:"flex flex-wrap gap-1.5",children:XD.map(G=>{const X=Wd[G],U=G==="custom"?"Custom":ic.find(F=>F.value===G)?.label||G,K=d.engine===G;return r.jsxs("button",{type:"button",onClick:()=>O(G),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${K?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:border-muted-fg/60 hover:text-foreground"}`,children:[r.jsx(X,{className:"size-3.5"})," ",U]},G)})}),r.jsxs("button",{type:"button",onClick:()=>E?R(!1):z(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${E?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[r.jsx(CT,{className:"size-3.5"})," ",E?"Volver al formulario":"JSON"]})]}),E?r.jsxs("div",{className:"space-y-2",children:[r.jsx(de,{label:"Config del provider (JSON)",hint:`Se guarda como engines.${d.slug||Hi(d.name)||"<slug>"} en config.json`,children:r.jsx(ln,{rows:14,className:"font-mono text-xs",value:N,onChange:G=>T(G.target.value),spellCheck:!1})}),r.jsxs("p",{className:"text-[11px] text-muted-fg",children:["Debe ser un objeto JSON válido con al menos ",r.jsx("code",{children:"engine"}),". El slug se toma del formulario."]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"Nombre",children:r.jsx(Ee,{value:d.name,onChange:G=>M({name:G.target.value,slug:c?d.slug:Hi(G.target.value)}),placeholder:"Mi provider"})}),r.jsx(de,{label:"Motor (engine)",children:r.jsx(wt,{value:d.engine,onChange:G=>P(G),options:ic.map(G=>({value:G.value,label:G.label,icon:Wd[G.value]}))})})]}),r.jsx(de,{label:"URL base (base_url)",hint:"Se completa sola al elegir un proveedor.",children:r.jsx(Ee,{value:d.base_url,onChange:G=>M({base_url:G.target.value}),placeholder:"https://api.openai.com/v1"})}),!$&&r.jsx(de,{label:"API key",hint:q?"Dejá en blanco para mantener la actual.":Z?`Se guarda como secreto. Env sugerida: ${Z}`:"Se guarda como secreto.",children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:G=>M({api_key_value:G.target.value}),placeholder:V})}),r.jsx(de,{label:"Modelo por defecto",children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(TC,{value:d.default_model,onChange:G=>M({default_model:G}),options:L,className:"flex-1"}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:B,disabled:C,title:_("providers_modal.list_models_hint"),"aria-label":_("providers_modal.list_models_hint"),children:[C?r.jsx(of,{className:"size-3.5 animate-spin"}):r.jsx(Nr,{className:"size-3.5"}),"Cargar modelos"]})]}),w&&r.jsx("p",{className:"text-[11px] text-amber-400",children:w})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"Máx. tokens (max_tokens)",children:r.jsx(Ee,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:G=>M({default_max_tokens:parseInt(G.target.value)||4096})})}),r.jsx(de,{label:`Temperatura: ${d.default_temperature.toFixed(1)}`,children:r.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:G=>M({default_temperature:parseFloat(G.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),r.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:"Análisis de tokens / pricing (opcional)"}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx(de,{label:"Límite de contexto (tokens)",children:r.jsx(Ee,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:G=>M({context_limit_tokens:parseInt(G.target.value)||0})})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"$ entrada / 1M",children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:G=>M({p_input:G.target.value}),placeholder:"0.15"})}),r.jsx(de,{label:"$ salida / 1M",children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:G=>M({p_output:G.target.value}),placeholder:"0.60"})}),r.jsx(de,{label:"$ cache read / 1M",children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:G=>M({p_cache_read:G.target.value}),placeholder:"0.03"})}),r.jsx(de,{label:"$ cache write / 1M",children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:G=>M({p_cache_write:G.target.value}),placeholder:"0.00"})})]}),r.jsx(de,{label:"Límites de contexto por modelo (JSON)",hint:'{"gpt-4o-mini":128000}',children:r.jsx(ln,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:G=>M({model_context_limits_json:G.target.value})})})]})]}),r.jsx(en,{checked:d.is_active,onChange:G=>M({is_active:G}),label:"Activo (los agentes pueden usarlo)"})]}),g&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:g})]})})}const ZD=new Set(ic.map(e=>e.value));function WD(e,n){const s=typeof n.engine=="string"&&n.engine||(ZD.has(e)?e:"custom");return{slug:e,name:typeof n.name=="string"?n.name:void 0,engine:s,base_url:typeof n.base_url=="string"?n.base_url:void 0,api_key:typeof n.api_key=="string"?n.api_key:void 0,default_model:typeof n.default_model=="string"?n.default_model:void 0,default_temperature:typeof n.default_temperature=="number"?n.default_temperature:void 0,default_max_tokens:typeof n.default_max_tokens=="number"?n.default_max_tokens:void 0,is_active:typeof n.is_active=="boolean"?n.is_active:void 0,context_limit_tokens:typeof n.context_limit_tokens=="number"?n.context_limit_tokens:void 0,model_context_limits:n.model_context_limits||void 0,pricing:n.pricing||void 0}}function JD(){const e=st(),{config:n,isLoading:s,patch:o,mutate:l}=Or(),[c,d]=x.useState(!1),[f,p]=x.useState(null);if(s)return r.jsx(nt,{});const m=n.engines||{},g=Object.entries(m).map(([k,E])=>WD(k,E||{})),b=g.map(k=>k.slug),v=()=>{p(null),d(!0)},S=k=>{p(k),d(!0)},C=async({provider:k,apiKeyValue:E,raw:R})=>{if(R){await o({[`engines.${k.slug}`]:R}),e.success("Provider guardado (JSON)."),l();return}const N=`engines.${k.slug}`,T={[`${N}.name`]:k.name,[`${N}.engine`]:k.engine,[`${N}.is_active`]:k.is_active!==!1,[`${N}.default_temperature`]:k.default_temperature,[`${N}.default_max_tokens`]:k.default_max_tokens},M=[],O=(P,B)=>{B===void 0||B===""?M.push(`${N}.${P}`):T[`${N}.${P}`]=B};O("base_url",k.base_url),O("default_model",k.default_model),O("context_limit_tokens",k.context_limit_tokens),O("pricing",k.pricing),O("model_context_limits",k.model_context_limits),E&&(T[`${N}.api_key`]=E),await o(T,M),e.success("Provider guardado."),l()},j=async k=>{try{await o({[`engines.${k.slug}.is_active`]:k.is_active===!1}),l()}catch(E){e.error(E.message)}},w=async k=>{if(confirm(`Borrar provider ${k.name||k.slug}?`))try{await o(void 0,[`engines.${k.slug}`]),e.success("Provider borrado."),l()}catch(E){e.error(E.message)}};return r.jsxs($e,{title:_("engines_panel.title"),description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",action:r.jsxs(me,{size:"sm",variant:"primary",onClick:v,children:[r.jsx(un,{size:14})," ",_("engines_panel.new_btn")]}),children:[g.length===0?r.jsx(it,{children:"Sin providers. Agregá uno con el botón de arriba."}):r.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[g.map(k=>r.jsx(YD,{provider:k,onEdit:()=>S(k),onDelete:()=>w(k),onToggle:()=>j(k)},k.slug)),r.jsxs("button",{type:"button",onClick:v,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[r.jsx(un,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:"Agregar provider"})]})]}),r.jsx(QD,{open:c,initial:f,existingSlugs:b,onClose:()=>{d(!1),p(null)},onSave:C})]})}function OC(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(FD,{}),r.jsx(JD,{})]})}function e6(){const e=st(),[n,s]=x.useState(!1),l=Qe(n?"/agents/vault?include_removed=1":"/agents/vault",()=>Jt.vault({includeRemoved:n})),c=l.data||[],[d,f]=x.useState(null),p=async g=>{const b=g.source!=="user",v=b?_("base.defaults_tombstone_msg",{slug:g.slug}):_("base.defaults_delete_msg",{slug:g.slug});if(confirm(v))try{await Jt.vaultRemove(g.slug),e.success(_(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(S){e.error(S.message)}},m=async g=>{try{await Jt.vaultRestore(g),e.success(_("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return r.jsxs($e,{title:_("base.defaults_title"),description:_("base.defaults_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(en,{checked:n,onChange:s,label:_("base.defaults_show_removed")}),r.jsxs(me,{size:"sm",onClick:()=>f("new"),children:[r.jsx(un,{size:14})," ",_("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(nt,{}),!l.isLoading&&c.length===0&&r.jsx(it,{children:_("base.defaults_empty")}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(g=>{const b=n&&g.tombstoned;return r.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${b?"border-dashed border-border opacity-60":"border-border"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:g.is_master?r.jsx(Ps,{className:"size-4 text-white"}):r.jsx(yn,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:g.slug}),r.jsx(t6,{source:g.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?r.jsx(Ng,{label:_("base.defaults_restore"),onClick:()=>m(g.slug),variant:"secondary",children:r.jsx(ux,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(Ng,{label:_("base.defaults_edit"),onClick:()=>f(g),variant:"ghost",children:r.jsx(Ml,{size:13})}),r.jsx(Ng,{label:g.source==="user"?_("base.defaults_delete"):_("base.defaults_hide"),onClick:()=>p(g),variant:"ghost-destructive",children:r.jsx(la,{size:13})})]})})]}),g.model?r.jsx(Ge,{tone:"info",children:g.model}):r.jsx("span",{className:"text-[10px] text-muted-fg",children:"modelo: default del router"}),g.description&&r.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:g.description}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.role&&r.jsx(Ge,{children:g.role}),g.skills?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Ol,{size:9})," ",v]},v)),g.tools?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(zl,{size:9})," ",v]},v))]})]},g.slug)})}),d!==null&&r.jsx(n6,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),l.mutate()}})]})}function t6({source:e}){return e==="user"?r.jsx(Ge,{tone:"success",children:"user"}):e==="user-override"?r.jsx(Ge,{tone:"warning",children:"override"}):r.jsx(Ge,{tone:"muted",children:"bundled"})}function Ng({label:e,onClick:n,variant:s="ghost",children:o}){const l="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",c={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return r.jsxs($x,{children:[r.jsx(Gx,{render:r.jsx("button",{type:"button",onClick:n,"aria-label":e,className:`${l} ${c[s]}`,children:o})}),r.jsx(Fx,{children:e})]})}function n6({agent:e,onClose:n,onSaved:s}){const o=st(),[l,c]=x.useState(!1),d=!e,[f,p]=x.useState(e?.slug??""),[m,g]=x.useState(e?.role??""),[b,v]=x.useState(e?.model??""),[S,C]=x.useState(e?.description??""),[j,w]=x.useState(e?.language??"es"),[k,E]=x.useState((e?.skills??[]).join(", ")),[R,N]=x.useState((e?.tools??[]).join(", ")),[T,M]=x.useState(!!e?.is_master),[O,P]=x.useState(e?.body??""),B=async()=>{const L={role:m||void 0,model:b||void 0,description:S||void 0,language:j||void 0,skills:k,tools:R,is_master:T};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(f))throw new Error(_("base.defaults_slug_invalid"));await Jt.vaultCreate(f,L,O),o.success(_("base.defaults_created",{slug:f}))}else await Jt.vaultPatch(e.slug,{fields:L,body:O}),o.success(_("base.defaults_saved",{slug:e.slug}));s()}catch(D){o.error(D.message)}finally{c(!1)}};return r.jsx(Mn,{open:!0,onClose:n,title:d?_("base.defaults_new_title"):_("base.defaults_edit_title",{slug:e.slug}),description:d?_("base.defaults_new_desc"):e.source==="bundled"?_("base.defaults_bundled_desc"):_("base.defaults_user_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:l,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:B,loading:l,children:_("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[d&&r.jsx(de,{label:"slug",hint:"kebab-case, ej. reviewer, my-agent, content-writer",children:r.jsx(Ee,{autoFocus:!0,value:f,onChange:L=>p(L.target.value),placeholder:"reviewer"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"role",children:r.jsx(Ee,{value:m,onChange:L=>g(L.target.value),placeholder:"Code reviewer"})}),r.jsx(de,{label:"model",children:r.jsx(Ee,{value:b,onChange:L=>v(L.target.value),placeholder:"openrouter:..."})}),r.jsx(de,{label:"language",children:r.jsx(Ee,{value:j,onChange:L=>w(L.target.value),placeholder:"es"})}),r.jsx(de,{label:"is_master",children:r.jsx("div",{className:"flex h-9 items-center",children:r.jsx(en,{checked:T,onChange:M,label:_("base.defaults_master_label")})})})]}),r.jsx(de,{label:"description",children:r.jsx(Ee,{value:S,onChange:L=>C(L.target.value)})}),r.jsx(de,{label:"skills",hint:"separadas por coma",children:r.jsx(Ee,{value:k,onChange:L=>E(L.target.value),placeholder:"code-review, git"})}),r.jsx(de,{label:"tools",hint:"separadas por coma",children:r.jsx(Ee,{value:R,onChange:L=>N(L.target.value),placeholder:"read, write, run"})}),r.jsx(de,{label:"body",hint:"markdown — extiende el system prompt del agente",children:r.jsx(ln,{value:O,onChange:L=>P(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const a6={apx:"success",claude:"info",codex:"warning"};function s6(){const[e,n]=x.useState(""),s=Qe(`/sessions?engine=${e}`,()=>sO.global(e||void 0)),o=s.data?.sessions||[];return r.jsxs($e,{title:_("base.sessions_title"),description:_("base.sessions_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-40",children:r.jsx(wt,{value:e,onChange:n,options:[{value:"",label:_("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>s.mutate(),children:r.jsx(Nr,{size:13})})]}),children:[s.isLoading&&r.jsx(nt,{}),s.error&&r.jsx(it,{children:_("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&o.length===0&&r.jsx(it,{children:_("base.sessions_empty")}),r.jsx("ul",{className:"space-y-1 text-sm",children:o.map((l,c)=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx(Ge,{tone:a6[l.engine]||"muted",children:l.engine}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate",children:l.title||l.id}),r.jsx("div",{className:"truncate font-mono text-[10px] text-muted-fg",children:l.cwd})]}),l.mtime>0&&r.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(l.mtime).toLocaleString()})]},`${l.engine}-${l.id}-${c}`))})]})}function r6(){const e=La(),[n,s]=x.useState("open"),o=Qe(`/tasks?state=${n}`,()=>hr.global(n));return r.jsxs($e,{title:_("project.global_tasks.title"),description:_("project.global_tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>r.jsx(me,{size:"sm",variant:n===l?"primary":"ghost",onClick:()=>s(l),children:l},l))}),children:[o.isLoading&&r.jsx(nt,{}),!o.isLoading&&(o.data?.length??0)===0&&r.jsx(it,{children:_("project.global_tasks.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(o.data||[]).map(l=>r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:_("project.global_tasks.go_project"),children:r.jsx(Ge,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-medium",children:l.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{children:l.state}),l.agent&&r.jsxs(Ge,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>r.jsxs("span",{children:["#",c]},c)),l.due&&r.jsxs("span",{children:[_("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})]})}const zC=x.createContext(void 0);function mb(){const e=x.useContext(zC);if(e===void 0)throw new Error(On(64));return e}let o6=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const gb={tabActivationDirection:e=>({[o6.activationDirection]:e})},l6=x.forwardRef(function(n,s){const{className:o,defaultValue:l=0,onValueChange:c,orientation:d="horizontal",render:f,value:p,style:m,...g}=n,b=n.defaultValue!==void 0,v=x.useRef([]),[S,C]=x.useState(()=>new Map),[j,w]=yc({controlled:p,default:l,name:"Tabs",state:"value"}),k=p!==void 0,[E,R]=x.useState(()=>new Map),N=x.useCallback(oe=>{if(oe===void 0)return null;for(const[ce,ee]of E.entries())if(ee!=null&&oe===(ee.value??ee.index))return ce;return null},[E]),[T,M]=x.useState(()=>({previousValue:j,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:P}=T;let B=P,L=!1;O!==j&&(B=W_(O,j,d,E),L=O!=null&&j!=null&&N(j)==null);const D=L?O:j,z=O!==D||P!==B;Oe(()=>{z&&M({previousValue:D,tabActivationDirection:B})},[D,z,B]);const H=Le((oe,ce)=>{const ee=W_(j,oe,d,E);ce.activationDirection=ee,c?.(oe,ce),!ce.isCanceled&&w(oe)}),q=Le((oe,ce)=>{c?.(oe,lt(ce,void 0,void 0,{activationDirection:"none"}))}),Y=Le((oe,ce)=>{C(ee=>{if(ee.get(oe)===ce)return ee;const Te=new Map(ee);return Te.set(oe,ce),Te})}),V=Le((oe,ce)=>{C(ee=>{if(!ee.has(oe)||ee.get(oe)!==ce)return ee;const Te=new Map(ee);return Te.delete(oe),Te})}),$=x.useCallback(oe=>S.get(oe),[S]),Z=x.useCallback(oe=>{for(const ce of E.values())if(oe===ce?.value)return ce?.id},[E]),G=x.useMemo(()=>({getTabElementBySelectedValue:N,getTabIdByPanelValue:Z,getTabPanelIdByValue:$,onValueChange:H,orientation:d,registerMountedTabPanel:Y,setTabMap:R,unregisterMountedTabPanel:V,tabActivationDirection:B,value:j}),[N,Z,$,H,d,Y,R,V,B,j]),X=x.useMemo(()=>{for(const oe of E.values())if(oe!=null&&oe.value===j)return oe},[E,j]),U=x.useMemo(()=>{for(const oe of E.values())if(oe!=null&&!oe.disabled)return oe.value},[E]),K=x.useRef(!b),F=x.useRef(b),J=x.useRef(!1);Oe(()=>{if(k)return;function oe(Fe,ve){w(Fe),M(Ce=>Ce.previousValue===Fe&&Ce.tabActivationDirection==="none"?Ce:{previousValue:Fe,tabActivationDirection:"none"}),q(Fe,ve),K.current=!1}if(E.size===0){if(!J.current||j===null)return;oe(null,Y1);return}J.current=!0;const ce=X?.disabled,ee=X==null&&j!==null;if(!ce&&j===l&&(F.current=!1),F.current&&ce&&j===l)return;const Te=K.current;if(ce||ee){const Fe=U??null;if(j===Fe){K.current=!1;return}let ve=Y1;Te?ve=X1:ce&&(ve=xS),oe(Fe,ve);return}Te&&X!=null&&(q(j,X1),K.current=!1)},[l,U,k,q,X,w,E,j]);const re=Ht("div",n,{state:{orientation:d,tabActivationDirection:B},ref:s,props:g,stateAttributesMapping:gb});return r.jsx(zC.Provider,{value:G,children:r.jsx(ub,{elementsRef:v,children:re})})});function W_(e,n,s,o){if(e==null||n==null)return"none";let l=null,c=null;for(const[p,m]of o.entries()){if(m==null)continue;const g=m.value??m.index;if(e===g&&(l=p),n===g&&(c=p),l!=null&&c!=null)break}if(l==null||c==null)return l!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof n?s==="horizontal"?n>e?"right":"left":n>e?"down":"up":"none";const d=l.getBoundingClientRect(),f=c.getBoundingClientRect();if(s==="horizontal"){if(f.left<d.left)return"left";if(f.left>d.left)return"right"}else{if(f.top<d.top)return"up";if(f.top>d.top)return"down"}return"none"}const DC="data-composite-item-active";function i6(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:o}=H2(),{ref:l,index:c}=fb(e),d=s===c,f=x.useRef(null),p=Us(l,f);return{compositeProps:x.useMemo(()=>({tabIndex:d?0:-1,onFocus(){o(c)},onMouseMove(){const g=f.current;if(!n||!g)return;const b=g.hasAttribute("disabled")||g.ariaDisabled==="true";!d&&!b&&g.focus()}}),[d,o,c,n]),compositeRef:p,index:c}}const LC=x.createContext(void 0);function c6(){const e=x.useContext(LC);if(e===void 0)throw new Error(On(65));return e}const u6=x.forwardRef(function(n,s){const{className:o,disabled:l=!1,render:c,value:d,id:f,nativeButton:p=!0,style:m,...g}=n,{value:b,getTabPanelIdByValue:v,orientation:S}=mb(),{activateOnFocus:C,highlightedTabIndex:j,onTabActivation:w,registerTabResizeObserverElement:k,setHighlightedTabIndex:E,tabsListElement:R}=c6(),N=Mr(f),T=x.useMemo(()=>({disabled:l,id:N,value:d}),[l,N,d]),{compositeProps:M,compositeRef:O,index:P}=i6({metadata:T}),B=d===b,L=x.useRef(!1),D=x.useRef(null);x.useEffect(()=>{const K=D.current;if(K)return k(K)},[k]),Oe(()=>{if(L.current){L.current=!1;return}if(!(B&&P>-1&&j!==P))return;const K=R;if(K!=null){const F=In(yt(K));if(F&&Ze(K,F))return}l||E(P)},[B,P,j,E,l,R]);const{getButtonProps:z,buttonRef:H}=Ul({disabled:l,native:p,focusableWhenDisabled:!0}),q=v(d),Y=x.useRef(!1),V=x.useRef(!1);function $(K){B||l||w(d,lt(Bs,K.nativeEvent,void 0,{activationDirection:"none"}))}function Z(K){B||(P>-1&&!l&&E(P),!l&&C&&(!Y.current||Y.current&&V.current)&&w(d,lt(Bs,K.nativeEvent,void 0,{activationDirection:"none"})))}function G(K){if(B||l)return;Y.current=!0;function F(){Y.current=!1,V.current=!1}(!K.button||K.button===0)&&(V.current=!0,yt(K.currentTarget).addEventListener("pointerup",F,{once:!0}))}return Ht("button",n,{state:{disabled:l,active:B,orientation:S},ref:[s,H,O,D],props:[M,{role:"tab","aria-controls":q,"aria-selected":B,id:N,onClick:$,onFocus:Z,onPointerDown:G,[DC]:B?"":void 0,onKeyDownCapture(){L.current=!0}},g,z]})});let d6=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=uo.startingStyle]="startingStyle",e[e.endingStyle=uo.endingStyle]="endingStyle",e})({});const f6={...gb,...Il},p6=x.forwardRef(function(n,s){const{className:o,value:l,render:c,keepMounted:d=!1,style:f,...p}=n,{value:m,getTabIdByPanelValue:g,orientation:b,tabActivationDirection:v,registerMountedTabPanel:S,unregisterMountedTabPanel:C}=mb(),j=Mr(),w=x.useMemo(()=>({id:j,value:l}),[j,l]),{ref:k,index:E}=fb({metadata:w}),R=l===m,{mounted:N,transitionStatus:T,setMounted:M}=Tc(R),O=!N,P=g(l),B={hidden:O,orientation:b,tabActivationDirection:v,transitionStatus:T},L=x.useRef(null),D=Ht("div",n,{state:B,ref:[s,k,L],props:[{"aria-labelledby":P,hidden:O,id:j,role:"tabpanel",tabIndex:R?0:-1,inert:qx(!R),[d6.index]:E},p],stateAttributesMapping:f6});return Ar({open:R,ref:L,onComplete(){R||M(!1)}}),Oe(()=>{if(!(O&&!d)&&j!=null)return S(l,j),()=>{C(l,j)}},[O,d,l,j,S,C]),d||N?D:null});function m6(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const g6=[];function h6(e){const{itemSizes:n,cols:s=1,loopFocus:o=!0,onLoop:l,dense:c=!1,orientation:d="both",direction:f,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:g,enableHomeAndEndKeys:b=!1,stopEventPropagation:v=!1,disabledIndices:S,modifierKeys:C=g6}=e,[j,w]=x.useState(0),k=s>1,E=x.useRef(null),R=Us(E,g),N=x.useRef([]),T=x.useRef(!1),M=p??j,O=Le((D,z=!1)=>{if((m??w)(D),z){const H=N.current[D];U_(E.current,H,f,d)}}),P=Le(D=>{if(D.size===0||T.current)return;T.current=!0;const z=Array.from(D.keys()),H=z.find(Y=>Y?.hasAttribute(DC))??null,q=H?z.indexOf(H):-1;q!==-1&&O(q),U_(E.current,H,f,d)}),B=Le((D,z,H)=>l?l?.(D,z,H,N):H),L=x.useMemo(()=>({"aria-orientation":d==="both"?void 0:d,ref:R,onFocus(D){const z=E.current,H=Tn(D.nativeEvent);!z||H==null||!B_(H)||H.setSelectionRange(0,H.value.length??0)},onKeyDown(D){const z=b?rb:W2;if(!z.has(D.key)||x6(D,C)||!E.current)return;const q=f==="rtl",Y=q?Kd:oc,V={horizontal:Y,vertical:dl,both:Y}[d],$=q?oc:Kd,Z={horizontal:$,vertical:rc,both:$}[d],G=Tn(D.nativeEvent);if(G!=null&&B_(G)&&!m6(G)){const re=G.selectionStart,oe=G.selectionEnd,ce=G.value??"";if(re==null||D.shiftKey||re!==oe||D.key!==Z&&re<ce.length||D.key!==V&&re>0)return}let X=M;const U=_d(N,S),K=jh(N,S);if(k){const re=n||Array.from({length:N.current.length},()=>({width:1,height:1})),oe=kS(re,s,c),ce=oe.findIndex(Te=>Te!=null&&!Ds(N.current,Te,S)),ee=oe.reduce((Te,Fe,ve)=>Fe!=null&&!Ds(N.current,Fe,S)?ve:Te,-1);X=oe[CS(oe.map(Te=>Te!=null?N.current[Te]:null),{event:D,orientation:d,loopFocus:o,onLoop:B,cols:s,disabledIndices:NS([...S||N.current.map((Te,Fe)=>Ds(N.current,Fe)?Fe:void 0),void 0],oe),minIndex:ce,maxIndex:ee,prevIndex:ES(M>K?U:M,re,oe,s,D.key===dl?"bl":D.key===oc?"tr":"tl"),rtl:q})]}const F={horizontal:[Y],vertical:[dl],both:[Y,dl]}[d],J={horizontal:[$],vertical:[rc],both:[$,rc]}[d],ie=k?z:{horizontal:b?ez:Q2,vertical:b?tz:Z2,both:z}[d];b&&(D.key===Tf?X=U:D.key===Af&&(X=K)),X===M&&(F.includes(D.key)||J.includes(D.key))&&(o&&X===K&&F.includes(D.key)?(X=U,l&&(X=l(D,M,X,N))):o&&X===U&&J.includes(D.key)?(X=K,l&&(X=l(D,M,X,N))):X=Pn(N.current,{startingIndex:X,decrement:J.includes(D.key),disabledIndices:S})),X!==M&&!xc(N.current,X)&&(v&&D.stopPropagation(),ie.has(D.key)&&D.preventDefault(),O(X,!0),queueMicrotask(()=>{N.current[X]?.focus()}))}}),[s,c,f,S,N,b,M,k,n,o,l,B,R,C,O,d,v]);return x.useMemo(()=>({props:L,highlightedIndex:M,onHighlightedIndexChange:O,elementsRef:N,disabledIndices:S,onMapChange:P,relayKeyboardEvent:L.onKeyDown}),[L,M,O,N,S,P])}function x6(e,n){for(const s of oz.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function b6(e){const{render:n,className:s,style:o,refs:l=mc,props:c=mc,state:d=cn,stateAttributesMapping:f,highlightedIndex:p,onHighlightedIndexChange:m,orientation:g,dense:b,itemSizes:v,loopFocus:S,onLoop:C,cols:j,enableHomeAndEndKeys:w,onMapChange:k,stopEventPropagation:E=!0,rootRef:R,disabledIndices:N,modifierKeys:T,highlightItemOnHover:M=!1,tag:O="div",...P}=e,B=Hx(),{props:L,highlightedIndex:D,onHighlightedIndexChange:z,elementsRef:H,onMapChange:q,relayKeyboardEvent:Y}=h6({itemSizes:v,cols:j,loopFocus:S,onLoop:C,dense:b,orientation:g,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:R,stopEventPropagation:E,enableHomeAndEndKeys:w,direction:B,disabledIndices:N,modifierKeys:T}),V=Ht(O,e,{state:d,ref:l,props:[L,...c,P],stateAttributesMapping:f}),$=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:z,highlightItemOnHover:M,relayKeyboardEvent:Y}),[D,z,M,Y]);return r.jsx(U2.Provider,{value:$,children:r.jsx(ub,{elementsRef:H,onMapChange:Z=>{k?.(Z),q(Z)},children:V})})}const v6=x.forwardRef(function(n,s){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:d,style:f,...p}=n,{onValueChange:m,orientation:g,value:b,setTabMap:v,tabActivationDirection:S}=mb(),[C,j]=x.useState(0),[w,k]=x.useState(null),E=x.useRef(new Set),R=x.useRef(new Set),N=x.useRef(null);x.useEffect(()=>{if(typeof ResizeObserver>"u")return;const D=new ResizeObserver(()=>{E.current.forEach(z=>{z()})});return N.current=D,w&&D.observe(w),R.current.forEach(z=>{D.observe(z)}),()=>{D.disconnect(),N.current=null}},[w]);const T=Le(D=>(E.current.add(D),()=>{E.current.delete(D)})),M=Le(D=>(R.current.add(D),N.current?.observe(D),()=>{R.current.delete(D),N.current?.unobserve(D)})),O=Le((D,z)=>{D!==b&&m(D,z)}),P={orientation:g,tabActivationDirection:S},B={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:C,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:M,onTabActivation:O,setHighlightedTabIndex:j,tabsListElement:w}),[o,C,T,M,O,j,w]);return r.jsx(LC.Provider,{value:L,children:r.jsx(b6,{render:d,className:l,style:f,state:P,refs:[s,k],props:[B,p],stateAttributesMapping:gb,highlightedIndex:C,enableHomeAndEndKeys:!0,loopFocus:c,orientation:g,onHighlightedIndexChange:j,onMapChange:v,disabledIndices:mc})})});function Mf({className:e,...n}){return r.jsx(l6,{"data-slot":"tabs",className:Ot("flex flex-col gap-4",e),...n})}const y6=tb("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground data-[variant=line]:h-8 data-[variant=line]:gap-1 data-[variant=line]:rounded-none data-[variant=line]:bg-transparent data-[variant=line]:p-0",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Of({className:e,variant:n="default",...s}){return r.jsx(v6,{"data-slot":"tabs-list","data-variant":n,className:Ot(y6({variant:n}),e),...s})}function es({className:e,...n}){return r.jsx(u6,{"data-slot":"tabs-trigger",className:Ot("inline-flex h-7 items-center justify-center gap-1.5 rounded-md border border-transparent px-3 py-1 text-sm font-medium whitespace-nowrap text-muted-fg transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-active:bg-background data-active:text-foreground data-active:shadow-sm dark:data-active:border-input dark:data-active:bg-input/30 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function Ma({className:e,...n}){return r.jsx(p6,{"data-slot":"tabs-content",className:Ot("text-sm outline-none",e),...n})}function J_(e,n){let s=e;for(const o of n.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[o]}return s}function hb(e,n=""){const s={};for(const[o,l]of Object.entries(e)){const c=n?`${n}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(s,hb(l,c)):s[c]=l}return s}function _6(e){const n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("JSON debe ser objeto.");return n}function Hh({sections:e,source:n,placeholderSource:s,jsonTitle:o,jsonDescription:l,saveLabel:c="Guardar",onSaveFields:d,onSaveJson:f,busy:p}){const m=e[0]?.key||"json",[g,b]=x.useState({}),[v,S]=x.useState(""),[C,j]=x.useState("");x.useEffect(()=>{const R={};for(const N of e.flatMap(T=>T.fields))R[N.path]=J_(n,N.path)??"";b(R),S(JSON.stringify(n||{},null,2)),j("")},[n,e]);const w=x.useMemo(()=>new Set(e.flatMap(R=>R.fields.map(N=>N.path))),[e]),k=async()=>{const R={},N=[];for(const T of e.flatMap(M=>M.fields)){const M=g[T.path];if(!Va(M)){if(M===""||M===void 0||M===null){N.push(T.path);continue}if(T.kind==="number"){const O=Number(M);Number.isFinite(O)&&(R[T.path]=O)}else R[T.path]=M}}await d(R,N.filter(T=>w.has(T)))},E=async()=>{j("");try{await f(_6(v))}catch(R){j(R.message)}};return r.jsxs(Mf,{defaultValue:m,className:"space-y-4",children:[r.jsxs(Of,{className:"flex flex-wrap",children:[e.map(R=>r.jsx(es,{value:R.key,children:R.label},R.key)),r.jsx(es,{value:"json",children:"JSON"})]}),e.map(R=>r.jsx(Ma,{value:R.key,children:r.jsxs("div",{className:"space-y-4",children:[R.description&&r.jsx("p",{className:"text-sm text-muted-fg",children:R.description}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:R.fields.map(N=>r.jsx(j6,{field:N,value:g[N.path],inherited:J_(s,N.path),onChange:T=>b(M=>({...M,[N.path]:T}))},N.path))}),r.jsx(me,{variant:"primary",loading:p,onClick:k,children:c})]})},R.key)),r.jsx(Ma,{value:"json",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:o}),l&&r.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),r.jsx(ln,{rows:18,className:"font-mono text-xs",value:v,onChange:R=>S(R.target.value)}),C&&r.jsx("p",{className:"text-xs text-destructive",children:C}),r.jsx(me,{variant:"primary",loading:p,onClick:E,children:"Guardar JSON"})]})})]})}function j6({field:e,value:n,inherited:s,onChange:o}){const l=e.placeholder||ej(s)||(Va(n)?jr(n):""),c=e.hint||(s!==void 0?`Heredado: ${ej(s)}`:void 0);return e.kind==="boolean"?r.jsx("div",{className:"flex items-end pb-1",children:r.jsx(en,{checked:n===!0,onChange:o,label:e.label})}):r.jsx(de,{label:e.label,hint:c,children:e.kind==="select"?r.jsx(wt,{value:String(n||""),onChange:o,placeholder:l||"(sin override)",options:[{value:"",label:l||"(sin override)"},...(e.options||[]).map(d=>({value:String(d.value),label:d.label}))]}):e.kind==="textarea"?r.jsx(ln,{rows:4,value:String(n||""),placeholder:l,onChange:d=>o(d.target.value)}):r.jsx(Ee,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(Va(n)?"":n||""),placeholder:e.kind==="password"&&Va(n)?jr(n):e.kind==="password"&&Va(s)?jr(s):l,onChange:d=>o(d.target.value)})})}function ej(e){return e==null||e===""?"":Va(e)?jr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}const w6=[{key:"routing",label:"Overrides",description:".apc/config.json. Sólo valores propios del proyecto; vacío hereda global/effective.",fields:[{path:"route_to_agent",label:"Route to agent",placeholder:"master"},{path:"super_agent.model",label:"Super-agent model"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:dx.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.route_to_agent",label:"Route to agent"},{path:"telegram.chat_id",label:"Chat ID"},{path:"telegram.bot_token",label:"Bot token",kind:"password"},{path:"telegram.respond_with_engine",label:"Responder con engine",kind:"boolean"}]},{key:"engines",label:"Engines",fields:[{path:"engines.ollama.base_url",label:"Ollama URL"},{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"}]}],S6=[{key:"identity",label:"Proyecto",description:".apc/project.json. Metadata APC portable; no secrets, no runtime.",fields:[{path:"name",label:"Name"},{path:"version",label:"Version"},{path:"apf",label:"APC spec"},{path:"apx",label:"APX install state"},{path:"apx_id",label:"APX storage id"}]}];function C6({pid:e}){const n=st(),s=La(),{project:o,mutate:l}=Zx(e),c=Qe(`/projects/${e}/config`,()=>na.config.show(e)),d=String(e)==="0";if(c.isLoading)return r.jsx(nt,{});if(!c.data)return r.jsx(it,{children:_("project.config.no_data")});const f=async m=>{await na.apcProject.put(e,m),n.success(_("project.config.save_project")),c.mutate()},p=async m=>{await na.config.put(e,m),n.success(_("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:_("project.config.section_title"),description:_("project.config.section_desc"),children:r.jsxs(Mf,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(Of,{children:[r.jsx(es,{value:"override",children:"Override"}),r.jsx(es,{value:"project",children:"APC project"}),r.jsx(es,{value:"effective",children:"Effective"})]}),r.jsx(Ma,{value:"override",children:r.jsx(Hh,{sections:w6,source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(m,g)=>{await na.config.set(e,m),g.length&&await na.config.unset(e,g),n.success(_("project.config.save_fields_success")),c.mutate()},onSaveJson:p})}),r.jsx(Ma,{value:"project",children:r.jsx(Hh,{sections:S6,source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(m,g)=>{await na.apcProject.set(e,E6(m),g),n.success(_("project.config.save_meta_success")),c.mutate()},onSaveJson:f})}),r.jsx(Ma,{value:"effective",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:_("project.config.effective_read")}),r.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(c.data.effective,null,2)})]})})]})}),!d&&o?r.jsx(k6,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),s("/")}}):null]})}function k6({pid:e,label:n,onRebuilt:s,onUnregistered:o}){const l=st(),[c,d]=x.useState(null),[f,p]=x.useState(null),m=async()=>{d("rebuild");try{await na.rebuild(e),l.success(_("project.rebuild_done")),s()}catch(b){l.error(b.message)}finally{d(null),p(null)}},g=async()=>{d("unregister");try{await na.remove(e),l.success(_("project.unregistered")),o()}catch(b){l.error(b.message)}finally{d(null),p(null)}};return r.jsxs(r.Fragment,{children:[r.jsx($e,{title:_("project.danger.title"),description:_("project.danger.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:_("project.rebuild")}),r.jsx("div",{className:"text-xs text-muted-fg",children:_("project.danger.rebuild_desc")})]}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:()=>p("rebuild"),children:[r.jsx(Nr,{size:13})," ",_("project.rebuild")]})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-red-500/40 bg-red-500/5 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:_("admin.unregister")}),r.jsx("div",{className:"text-xs text-muted-fg",children:_("project.danger.unregister_desc")})]}),r.jsxs(me,{size:"sm",variant:"destructive",onClick:()=>p("unregister"),children:[r.jsx(la,{size:13})," ",_("admin.unregister")]})]})]})}),r.jsx(Mn,{open:f==="rebuild",onClose:()=>c?null:p(null),title:_("project.danger.rebuild_confirm_title"),description:_("project.danger.rebuild_confirm_desc",{label:n}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:()=>p(null),disabled:c!==null,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:m,loading:c==="rebuild",children:_("project.rebuild")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:_("project.danger.rebuild_long")})}),r.jsx(Mn,{open:f==="unregister",onClose:()=>c?null:p(null),title:_("project.danger.unregister_confirm_title"),description:_("project.unregister_confirm",{label:n}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:()=>p(null),disabled:c!==null,children:_("common.cancel")}),r.jsx(me,{variant:"destructive",onClick:g,loading:c==="unregister",children:_("admin.unregister")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:_("project.danger.unregister_long")})})]})}function E6(e){const n={};for(const[s,o]of Object.entries(hb(e)))Va(o)||(n[s]=o);return n}const N6=["","es","en","pt","fr","it","de"],tj=e=>e.split(",").map(n=>n.trim()).filter(Boolean);function PC(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Ps}:{gradient:"from-slate-600 to-gray-600",Icon:yn}}function R6(e){const n=e.filter(d=>d.is_master),s=n.length===1?n[0]:null,o=d=>d.parent?d.parent:s&&!d.is_master&&d.slug!==s.slug?s.slug:null,l=new Map,c=[];for(const d of e){const f=o(d);f&&e.some(p=>p.slug===f)?(l.has(f)||l.set(f,[]),l.get(f).push(d)):c.push(d)}return{roots:c,childrenByParent:l}}function T6({pid:e}){const n=La();st();const s=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),[o,l]=x.useState("hierarchy"),[c,d]=x.useState(!1),[f,p]=x.useState(!1),m=s.data||[],g=C=>n(`/p/${e}/agents/${C}`),b=C=>n(C?`/p/${e}/chat?agent=${C}`:`/p/${e}/chat`),{roots:v,childrenByParent:S}=x.useMemo(()=>R6(m),[m]);return r.jsxs($e,{title:_("project.agents.title"),description:_("project.agents.subtitle_full"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[r.jsxs("button",{onClick:()=>l("hierarchy"),className:Me("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(ix,{size:13})," ",_("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:Me("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(WT,{size:13})," ",_("project.agents.list_view")]})]}),r.jsxs(me,{size:"sm",variant:"ghost",onClick:()=>p(!0),children:[r.jsx(dA,{size:13})," ",_("project.agents.import")]}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:()=>b(),children:[r.jsx(rs,{size:13})," ",_("project.agents.chat")]}),r.jsxs(me,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[r.jsx(un,{size:14})," ",_("project.agents.new")]})]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&m.length===0&&r.jsx(it,{children:_("project.agents.empty_text")}),!s.isLoading&&m.length>0&&(o==="hierarchy"?r.jsx(M6,{roots:v,childrenByParent:S,onOpen:g,onChat:b}):r.jsx(O6,{agents:m,onOpen:g,onChat:b})),r.jsx(z6,{open:c,pid:e,agents:m,onClose:()=>d(!1),onCreated:()=>{d(!1),s.mutate()}}),r.jsx(A6,{open:f,pid:e,existing:m.map(C=>C.slug),onClose:()=>p(!1),onImported:()=>s.mutate()})]})}function A6({open:e,onClose:n,onImported:s,pid:o,existing:l}){const c=st(),d=Qe(e?"/agents/vault":null,()=>Jt.vault()),[f,p]=x.useState(""),m=d.data||[],g=async b=>{p(b);try{await Jt.import(o,b),c.success(_("project.agents.import_success",{slug:b})),s()}catch(v){c.error(v.message)}finally{p("")}};return r.jsxs(Mn,{open:e,onClose:n,title:_("project.agents.import_title"),description:_("project.agents.import_desc"),size:"lg",footer:r.jsx(me,{variant:"ghost",onClick:n,children:_("common.close")}),children:[d.isLoading&&r.jsx(nt,{}),!d.isLoading&&m.length===0&&r.jsx(it,{children:_("project.agents.import_empty")}),r.jsx("ul",{className:"space-y-2",children:m.map(b=>{const v=l.includes(b.slug);return r.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[r.jsx(yn,{size:16,className:"shrink-0 text-muted-fg"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&r.jsxs(Ge,{tone:"success",children:[r.jsx(Ps,{size:9})," ",_("project.agents.orchestrator")]}),b.model&&r.jsx(Ge,{tone:"info",children:b.model})]}),b.description&&r.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),r.jsx(me,{size:"sm",variant:"primary",disabled:v||f===b.slug,loading:f===b.slug,onClick:()=>g(b.slug),children:_(v?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function M6({roots:e,childrenByParent:n,onOpen:s,onChat:o}){return r.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=n.get(l.slug)||[];return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Rg,{agent:l,onOpen:s,onChat:o,wide:!0}),c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-5 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(d=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Rg,{agent:d,onOpen:s,onChat:o}),(n.get(d.slug)||[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(n.get(d.slug)||[]).map(f=>r.jsx(Rg,{agent:f,onOpen:s,onChat:o,compact:!0},f.slug))})]})]},d.slug))})]})]},l.slug)})})}function Rg({agent:e,onOpen:n,onChat:s,wide:o,compact:l}){const{gradient:c,Icon:d}=PC(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Me("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",o?"w-64":l?"w-44":"w-52"),onClick:()=>n(e.slug),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:Me("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:r.jsx(d,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&r.jsxs(Ge,{tone:"success",children:[r.jsx(Ps,{size:9})," ",_("project.agents.orchestrator")]}),e.role&&r.jsx(Ge,{children:e.role}),e.model&&!l&&r.jsx(Ge,{tone:"info",children:e.model})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[r.jsxs("button",{onClick:()=>n(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(sf,{size:12})," ",_("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(rs,{size:12})," ",_("project.agents.chat")]})]})]})}function O6({agents:e,onOpen:n,onChat:s}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return r.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:d}=PC(l);return r.jsxs("div",{"data-testid":`agent-card-${l.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>n(l.slug),children:[r.jsx("div",{className:Me("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:r.jsx(d,{className:"size-4 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&r.jsxs(Ge,{tone:"success",children:[r.jsx(Ps,{size:10})," ",_("project.agents.orchestrator")]}),l.role&&r.jsx(Ge,{children:l.role}),l.model&&r.jsx(Ge,{tone:"info",children:l.model}),l.parent&&r.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&r.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),r.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(f=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Ol,{size:9})," ",f]},f)),l.tools?.map(f=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(zl,{size:9})," ",f]},f))]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[r.jsxs("button",{onClick:()=>n(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(sf,{size:12})," ",_("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(rs,{size:12})," ",_("project.agents.chat")]})]})]},l.slug)})})}function z6({open:e,onClose:n,onCreated:s,pid:o,agents:l}){const c=st(),[d,f]=x.useState(""),[p,m]=x.useState(""),[g,b]=x.useState(""),[v,S]=x.useState(""),[C,j]=x.useState(""),[w,k]=x.useState(""),[E,R]=x.useState(""),[N,T]=x.useState(!1),[M,O]=x.useState(""),[P,B]=x.useState(!1),L=()=>{f(""),m(""),b(""),S(""),j(""),k(""),R(""),T(!1),O("")},D=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(_("project.agents.slug_invalid"));return}B(!0);try{await Jt.create(o,{slug:d,role:p||void 0,model:g||void 0,language:v||void 0,description:C||void 0,skills:tj(w),tools:tj(E),is_master:N,parent:M||void 0}),c.success(_("project.agents.create_success",{slug:d})),s(),L()}catch(z){c.error(z?.message||_("project.agents.create_error"))}finally{B(!1)}};return r.jsx(Mn,{open:e,onClose:n,title:_("project.agents.new_title"),description:_("project.agents.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:P,children:_("common.cancel")}),r.jsx(me,{variant:"primary","data-testid":"agent-create-submit",onClick:D,loading:P,children:_("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.agents.slug_label"),children:r.jsx(Ee,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:z=>f(z.target.value),placeholder:_("project.agents.slug_ph")})}),r.jsx(de,{label:_("project.agents.role_label"),children:r.jsx(Ee,{value:p,onChange:z=>m(z.target.value),placeholder:_("project.agents.role_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.agents.model_label"),hint:_("project.agents.model_hint"),children:r.jsx(Ee,{value:g,onChange:z=>b(z.target.value)})}),r.jsx(de,{label:_("project.agents.lang_label"),children:r.jsx(wt,{value:v,onChange:S,options:N6.map(z=>({value:z,label:z||"—"}))})})]}),r.jsx(de,{label:_("project.agents.desc_label"),children:r.jsx(ln,{rows:2,value:C,onChange:z=>j(z.target.value),placeholder:_("project.agents.desc_ph")})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.agents.skills_label"),children:r.jsx(Ee,{value:w,onChange:z=>k(z.target.value),placeholder:_("project.agents.skills_ph")})}),r.jsx(de,{label:_("project.agents.tools_label"),children:r.jsx(Ee,{value:E,onChange:z=>R(z.target.value),placeholder:_("project.agents.tools_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[r.jsx(de,{label:_("project.agents.parent_label"),hint:_("project.agents.parent_hint"),children:r.jsx(wt,{value:M,onChange:O,placeholder:_("project.agents.none_parent"),options:[{value:"",label:_("project.agents.none_parent")},...l.filter(z=>z.slug!==d).map(z=>({value:z.slug,label:z.slug}))]})}),r.jsx(en,{checked:N,onChange:T,label:_("project.agents.master_label")})]})]})})}function dd(e){return e.split(`
583
+ `).map(n=>n.trim()).filter(Boolean)}const oo={exec_agent:{label:"Agente del proyecto",desc:"Ejecuta un agente del proyecto con un prompt. Elegís cuál.",icon:yn},super_agent:{label:"Super-agente",desc:"Llama al super-agente de APX con un prompt.",icon:Ps},telegram:{label:"Telegram",desc:"Manda un mensaje fijo a un canal de Telegram. No usa modelo ni agente.",icon:rs},shell:{label:"Shell",desc:"Corre un comando de shell. Sin prompt ni pre/post — el comando es la acción.",icon:Sr},heartbeat:{label:"Latido (heartbeat)",desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",icon:vl}},D6=Object.keys(oo).map(e=>({value:e,label:oo[e].label,description:oo[e].desc,icon:oo[e].icon}));function IC(e){if(!e)return"—";if(e.startsWith("every:")){const n=e.slice(6),s=n.match(/^(\d+)(s|m|h|d)$/);if(s){const o=s[1],l={s:"segundos",m:"minutos",h:"horas",d:"días"}[s[2]]||s[2];return`cada ${o} ${l}`}return`cada ${n}`}return e.startsWith("once:")?`una vez · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}const L6=[{label:"cada 10 min",value:"every:10m"},{label:"cada hora",value:"every:1h"},{label:"diario 9am",value:"cron 0 9 * * *"},{label:"días hábiles 9am",value:"cron 0 9 * * 1-5"}],P6=[{v:"{{pre_output}}",where:"prompt",desc:"Salida de los pre-commands, inyectada en el prompt."},{v:"$APX_LLM_OUTPUT",where:"post",desc:"Respuesta del agente / super-agente."},{v:"$APX_STATUS",where:"post",desc:"ok | error."},{v:"$APX_SKIPPED",where:"post",desc:"1 si la acción se salteó."},{v:"$APX_PRE_OUTPUT",where:"post",desc:"Salida de los pre-commands."},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:"Archivo con la salida de pre (para outputs grandes)."},{v:"$APX_PRE_EXIT",where:"post",desc:"Exit code de los pre-commands."},{v:"$APX_ROUTINE",where:"pre/post",desc:"Nombre de la rutina."}];function I6(e,n){switch(e){case"exec_agent":return n.agent?`Ejecuta el agente "${n.agent}"`:"Ejecuta un agente (falta elegir)";case"super_agent":return"Llama al super-agente";case"telegram":return`Envía Telegram a "${n.channel||"default"}"`;case"shell":return n.command?`Corre: ${String(n.command).slice(0,40)}`:"Corre un comando shell";case"heartbeat":return"Deja un latido en logs"}}function B6({pid:e}){const n=st(),s=Qe(`/projects/${e}/routines`,()=>gr.list(e)),[o,l]=x.useState(null),c=async p=>{try{await(p.enabled?gr.disable:gr.enable)(e,p.name),s.mutate()}catch(m){n.error(m?.message||_("project.routines.toggle_error"))}},d=async p=>{try{await gr.run(e,p.name),n.success(_("project.routines.run_success",{name:p.name}))}catch(m){n.error(m?.message||_("project.routines.run_error"))}},f=async p=>{if(confirm(_("project.routines.delete_confirm",{name:p.name})))try{await gr.remove(e,p.name),n.success(_("project.routines.delete_success")),s.mutate()}catch(m){n.error(m?.message||_("project.routines.delete_error"))}};return r.jsxs($e,{title:_("project.routines.title"),description:_("project.routines.subtitle"),action:r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>l({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[r.jsx(un,{size:14})," ",_("project.routines.new_btn")]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(it,{children:_("project.routines.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(p=>{const m=oo[p.kind],g=m?.icon||fc,b=p.last_status==="error";return r.jsxs("li",{className:"cursor-pointer rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>l({...p}),children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Me("flex size-7 items-center justify-center rounded-lg",p.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(g,{size:14})}),r.jsx("span",{className:"font-medium",children:p.name}),r.jsx(Ge,{tone:p.kind==="shell"?"warning":"info",children:m?.label||p.kind}),!p.enabled&&r.jsx(Ge,{tone:"muted",children:_("project.routines.paused")})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:v=>v.stopPropagation(),children:[r.jsx(en,{checked:p.enabled,onChange:()=>c(p)}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:()=>d(p),children:[r.jsx(cx,{size:13})," Run"]}),r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>f(p),children:r.jsx(la,{size:13})})]})]}),r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[r.jsxs("span",{children:["⏱ ",IC(p.schedule)]}),r.jsx("span",{children:I6(p.kind,p.spec||{})}),p.next_run_at&&r.jsxs("span",{children:[_("project.routines.next_run")," ",new Date(p.next_run_at).toLocaleString()]}),r.jsxs("span",{className:Me(p.last_status==="ok"&&"text-emerald-500",b&&"text-destructive"),children:["última: ",p.last_status||"—"]})]}),p.last_error&&r.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:p.last_error})]},p.name)})}),r.jsx(U6,{draft:o,onClose:()=>l(null),onSaved:()=>{l(null),s.mutate()},pid:e})]})}function U6({draft:e,onClose:n,onSaved:s,pid:o}){const l=st(),c=Qe(e?`/projects/${o}/agents`:null,()=>Jt.list(o)),[d,f]=x.useState(!1),[p,m]=x.useState(""),[g,b]=x.useState("super_agent"),[v,S]=x.useState("every:10m"),[C,j]=x.useState(!0),[w,k]=x.useState(""),[E,R]=x.useState(""),[N,T]=x.useState("default"),[M,O]=x.useState(""),[P,B]=x.useState(""),[L,D]=x.useState(""),[z,H]=x.useState("heartbeat"),[q,Y]=x.useState(""),[V,$]=x.useState(""),[Z,G]=x.useState("");x.useEffect(()=>{if(!e)return;const ee=e.spec&&typeof e.spec=="object"?e.spec:{};m(e.name||""),b(e.kind||"super_agent"),S(e.schedule||"every:10m"),j(e.enabled??!0),k(ee.agent||""),R(ee.prompt||""),T(ee.channel||"default"),O(ee.chat_id?String(ee.chat_id):""),B(ee.text||""),D(ee.command||""),H(ee.channel||"heartbeat"),Y(ee.message||""),$((e.pre_commands||[]).join(`
584
+ `)),G((e.post_commands||[]).join(`
585
+ `))},[e]);const X=()=>{switch(g){case"exec_agent":return{agent:w,prompt:E};case"super_agent":return{prompt:E};case"telegram":return{channel:N,...M?{chat_id:M}:{},text:P};case"shell":return{command:L};case"heartbeat":return{channel:z,message:q}}},U=async()=>{if(!p){l.error(_("project.routines.name_required"));return}f(!0);try{const ee=g==="exec_agent"||g==="super_agent";await gr.upsert(o,{name:p,kind:g,schedule:v,enabled:C,spec:X(),pre_commands:ee?dd(V):[],post_commands:ee?dd(Z):[]}),l.success(_("project.routines.saved")),s()}catch(ee){l.error(ee?.message||_("project.routines.save_error"))}finally{f(!1)}},K=g==="exec_agent"||g==="super_agent",F=K?dd(V):[],J=K?dd(Z):[],ie=(()=>{switch(g){case"exec_agent":return w?`Agente "${w}" responde el prompt`:"Agente (elegí cuál) responde el prompt";case"super_agent":return"El super-agente responde el prompt";case"telegram":return`Manda Telegram al canal "${N}"`;case"shell":return L?`Corre: ${L.slice(0,48)}`:"Corre el comando shell";case"heartbeat":return"Deja un latido en logs"}})(),re=K,oe=oo[g].icon,ce=[...F.map((ee,Te)=>({id:`pre-${Te}`,icon:Sr,label:"Pre",detail:ee,action:!1})),{id:"action",icon:oe,label:ie,detail:re&&E?E.slice(0,90):void 0,action:!0},...J.map((ee,Te)=>({id:`post-${Te}`,icon:Sr,label:"Post",detail:ee,action:!1}))];return r.jsx(Mn,{open:!!e,onClose:n,title:e?.name?_("project.routines.edit_title",{name:e.name}):_("project.routines.new_title"),description:_("project.routines.dialog_desc"),size:"xl",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:d,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:U,loading:d,children:_("common.save")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[r.jsx(en,{checked:C,onChange:j,label:_("project.routines.enabled_label")}),r.jsx("span",{className:"text-[11px] text-muted-fg",children:_(C?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:_("project.routines.name_field"),hint:e?.name?_("project.routines.name_no_edit"):void 0,children:r.jsx(Ee,{value:p,disabled:!!e?.name,onChange:ee=>m(ee.target.value),placeholder:"resumen-diario"})}),r.jsx(de,{label:_("project.routines.kind_field"),children:r.jsx(wt,{value:g,onChange:ee=>b(ee),options:D6})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:oo[g].desc}),g==="exec_agent"&&r.jsx(de,{label:_("project.routines.agent_field"),hint:_("project.routines.agent_hint"),children:r.jsx(wt,{value:w,onChange:k,placeholder:c.isLoading?_("project.routines.agent_loading"):_("project.routines.agent_pick"),options:(c.data||[]).map(ee=>({value:ee.slug,label:ee.slug,description:[ee.role,ee.model].filter(Boolean).join(" · ")||void 0}))})}),r.jsx(de,{label:_("project.routines.schedule_field"),hint:_("project.routines.schedule_hint"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[L6.map(ee=>r.jsx("button",{type:"button",onClick:()=>S(ee.value),className:Me("rounded-md border px-2 py-0.5 text-[11px]",v===ee.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:ee.label},ee.value)),r.jsx("button",{type:"button",onClick:()=>S("manual"),className:Me("rounded-md border px-2 py-0.5 text-[11px]",v==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:"Manual"})]}),r.jsx(Ee,{value:v,onChange:ee=>S(ee.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})})]}),r.jsxs("div",{className:"space-y-3",children:[K&&r.jsx(de,{label:_("project.routines.pre_field"),hint:_("project.routines.pre_hint"),children:r.jsx(ln,{rows:2,className:"font-mono text-xs",value:V,onChange:ee=>$(ee.target.value),placeholder:"curl -s https://wttr.in/Bariloche"})}),g==="exec_agent"&&r.jsx(de,{label:_("project.routines.prompt_exec"),children:r.jsx(ln,{rows:4,value:E,onChange:ee=>R(ee.target.value),placeholder:_("project.routines.prompt_exec_ph")})}),g==="super_agent"&&r.jsx(de,{label:_("project.routines.prompt_super"),children:r.jsx(ln,{rows:4,value:E,onChange:ee=>R(ee.target.value),placeholder:_("project.routines.prompt_super_ph")})}),g==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.routines.tg_channel"),children:r.jsx(Ee,{value:N,onChange:ee=>T(ee.target.value),placeholder:"default"})}),r.jsx(de,{label:_("project.routines.tg_chat_id"),children:r.jsx(Ee,{value:M,onChange:ee=>O(ee.target.value),placeholder:"(usa el del canal)"})})]}),r.jsx(de,{label:_("project.routines.tg_text"),hint:_("project.routines.tg_text_hint"),children:r.jsx(ln,{rows:8,value:P,onChange:ee=>B(ee.target.value),placeholder:"mensaje a enviar"})})]}),g==="shell"&&r.jsx(de,{label:_("project.routines.shell_field"),hint:_("project.routines.shell_hint"),children:r.jsx(ln,{rows:11,className:"font-mono text-xs",value:L,onChange:ee=>D(ee.target.value),placeholder:"cd /repo && git pull && npm test"})}),g==="heartbeat"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.routines.hb_channel"),children:r.jsx(Ee,{value:z,onChange:ee=>H(ee.target.value),placeholder:"heartbeat"})}),r.jsx(de,{label:_("project.routines.hb_message"),children:r.jsx(Ee,{value:q,onChange:ee=>Y(ee.target.value),placeholder:"sigo vivo"})})]}),K&&r.jsx(de,{label:_("project.routines.post_field"),hint:_("project.routines.post_hint"),children:r.jsx(ln,{rows:2,className:"font-mono text-xs",value:Z,onChange:ee=>G(ee.target.value),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})})]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[r.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:_("project.routines.vars_title")}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:P6.map(ee=>r.jsxs("span",{title:ee.desc,className:"inline-flex items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[ee.v,r.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",ee.where]})]},ee.v))})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[_("project.routines.what_happens")," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",IC(v)]})]}),r.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ce.map((ee,Te)=>r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsxs("div",{className:Me("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",ee.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[r.jsxs("div",{className:Me("flex items-center gap-1.5 text-[11px] font-medium",ee.action?"text-emerald-400":"text-muted-fg"),children:[r.jsx(ee.icon,{size:12})," ",ee.label]}),ee.detail&&r.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:ee.detail})]}),Te<ce.length-1&&r.jsx(Pw,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ee.id))})]})]})})}function H6({pid:e}){const[n,s]=x.useState("open"),o=st(),l=Qe(`/projects/${e}/tasks?state=${n}`,()=>hr.list(e,n),{dedupingInterval:0,revalidateOnFocus:!0}),[c,d]=x.useState(""),[f,p]=x.useState(!1),m=async()=>{if(c.trim()){p(!0);try{await hr.add(e,{title:c.trim()}),d(""),o.success(_("project.tasks.created")),l.mutate()}catch(b){o.error(b?.message||_("project.tasks.create_error"))}finally{p(!1)}}},g=async(b,v)=>{try{await b(),o.success(v),l.mutate()}catch(S){o.error(S?.message||_("common.error_generic"))}};return r.jsxs($e,{title:_("project.tasks.title"),description:_("project.tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(b=>r.jsx(me,{size:"sm","data-testid":`task-filter-${b}`,variant:n===b?"primary":"ghost",onClick:()=>s(b),children:b},b))}),children:[r.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[r.jsx(de,{label:_("project.tasks.add_label"),children:r.jsx(Ee,{"data-testid":"task-input",placeholder:_("project.tasks.add_placeholder"),value:c,onChange:b=>d(b.target.value),onKeyDown:b=>{b.key==="Enter"&&m()}})}),r.jsxs(me,{variant:"primary","data-testid":"task-add",onClick:m,loading:f,children:[r.jsx(un,{size:14})," ",_("project.tasks.add")]})]}),l.isLoading&&r.jsx(nt,{}),!l.isLoading&&(l.data?.length??0)===0&&r.jsxs(it,{children:[n==="open"?_("project.tasks.empty_open"):_("project.tasks.empty",{state:n})," ",r.jsx("code",{children:'apx task add "…"'})]}),r.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:(l.data||[]).map(b=>r.jsxs("li",{"data-testid":`task-${b.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:b.id}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:b.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[b.tags?.map(v=>r.jsxs(Ge,{children:["#",v]},v)),b.agent&&r.jsxs(Ge,{tone:"info",children:["@",b.agent]}),b.source&&r.jsxs("span",{children:[_("project.tasks.via")," ",b.source]}),b.due&&r.jsxs("span",{children:[_("project.tasks.due")," ",b.due]})]})]}),r.jsxs("div",{className:"flex gap-1",children:[n==="open"&&r.jsxs(r.Fragment,{children:[r.jsx(me,{size:"sm",variant:"secondary","aria-label":_("project.tasks.aria_done"),"data-testid":`task-done-${b.id}`,onClick:()=>g(()=>hr.done(e,b.id),_("project.tasks.done")),children:r.jsx(dc,{size:13})}),r.jsx(me,{size:"sm",variant:"destructive","aria-label":_("project.tasks.aria_drop"),"data-testid":`task-drop-${b.id}`,onClick:()=>g(()=>hr.drop(e,b.id),_("project.tasks.drop")),children:r.jsx(la,{size:13})})]}),n!=="open"&&r.jsx(me,{size:"sm",variant:"ghost","aria-label":_("project.tasks.aria_reopen"),"data-testid":`task-reopen-${b.id}`,onClick:()=>g(()=>hr.reopen(e,b.id),_("project.tasks.reopen")),children:r.jsx(ux,{size:13})})]})]},b.id))})]})}const V6="\\$\\{var\\.([^}\\s]+)\\}";function BC(e="g"){return new RegExp(V6,e)}function UC(e){return BC("").test(e)}function q6(e){const n=[];let s=0;for(const o of e.matchAll(BC("g"))){const l=o.index??0;l>s&&n.push({type:"text",value:e.slice(s,l)}),n.push({type:"var",value:o[1]}),s=l+o[0].length}return s<e.length&&n.push({type:"text",value:e.slice(s)}),n}function Tg(e){let n="";for(const s of Array.from(e.childNodes))if(s.nodeType===Node.TEXT_NODE)n+=s.textContent??"";else if(s instanceof HTMLElement){const o=s.dataset.varName;o?n+=`\${var.${o}}`:s.tagName==="BR"?n+="":n+=s.textContent??""}return n.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function nj(e,n){e.replaceChildren();const s=q6(n);for(const o of s)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(HC(o.value));(s.length===0||s[s.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function HC(e){const n=document.createElement("span");return n.contentEditable="false",n.dataset.varName=e,n.className="inline-flex items-baseline px-1 rounded bg-primary/10 text-primary font-mono text-[12px] select-none cursor-default whitespace-nowrap",n.textContent=`$${e}`,n.title=`\${var.${e}}`,n}function $6(e,n){e.deleteContents(),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}function G6(e){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(n)}const xb=x.forwardRef(function({value:n,onChange:s,placeholder:o,className:l,varNames:c=[],onCreateVar:d},f){const p=x.useRef(null),m=x.useRef(null),[g,b]=x.useState(!1),[v,S]=x.useState(""),C=x.useRef(n);x.useEffect(()=>{const T=p.current;T&&(n===C.current&&T.childNodes.length>0||(nj(T,n),C.current=n))},[n]);const j=x.useCallback(()=>{const T=p.current;if(!T)return;const M=Tg(T);C.current=M,M!==n&&s(M)},[s,n]),w=x.useCallback(()=>{const T=p.current;if(!T)return;const M=Tg(T);if(UC(M)&&Y6(T)){const O=X6(T);nj(T,M),O!=null&&K6(T,O)}C.current=Tg(T),C.current!==n&&s(C.current)},[s,n]),k=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const M=T.getRangeAt(0),O=p.current;O&&O.contains(M.startContainer)&&(m.current=M.cloneRange())},[]),E=x.useCallback(T=>{if(T.key==="Enter"){T.preventDefault(),T.currentTarget.blur();return}if(T.key==="Backspace"){const M=window.getSelection();if(!M||M.rangeCount===0)return;const O=M.getRangeAt(0);if(!O.collapsed)return;const{startContainer:P,startOffset:B}=O;if(P.nodeType===Node.TEXT_NODE&&B===0){const L=P.previousSibling;if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),j();return}}else if(P===p.current){const L=P.childNodes[B-1];if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),j();return}}}},[j]),R=x.useCallback(T=>{const M=p.current;if(!M)return;const O=m.current;M.focus();let P;O&&M.contains(O.startContainer)?P=O:(P=document.createRange(),P.selectNodeContents(M),P.collapse(!1)),$6(P,HC(T)),m.current=null,j()},[j]);x.useImperativeHandle(f,()=>({insertVar:R,focus:()=>p.current?.focus()}),[R]);const N=c.filter(T=>T.toLowerCase().includes(v.toLowerCase()));return r.jsxs("div",{className:Me("group flex items-stretch w-full min-w-0 rounded-lg border border-input bg-transparent dark:bg-input/30 transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",l),children:[r.jsxs("div",{className:"relative flex-1 min-w-0",children:[r.jsx("div",{ref:p,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:w,onKeyDown:E,onBlur:j,onFocus:k,onMouseUp:k,onKeyUp:k,className:Me("h-8 w-full whitespace-nowrap overflow-x-auto px-2.5 py-1 text-sm rounded-l-lg","focus:outline-none font-mono leading-7","[&_*]:align-baseline"),"data-placeholder":o||"",style:{caretColor:"currentColor"}}),n===""&&o&&r.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground font-mono",children:o})]}),r.jsxs("div",{className:"relative flex",children:[r.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),k()},onClick:()=>b(T=>!T),"aria-label":_("chat_ui.insert_variable"),title:_("chat_ui.insert_variable"),className:Me("flex items-center justify-center px-2 min-w-8 border-l border-input text-muted-foreground rounded-r-lg","hover:bg-muted/60 hover:text-foreground transition-colors",g&&"bg-muted/60 text-foreground"),children:r.jsx(un,{size:14})}),g&&r.jsx(F6,{query:v,onQuery:S,varNames:N,onPick:T=>{R(T),b(!1),S("")},onClose:()=>{b(!1),S("")},onCreateVar:d})]})]})});function F6({query:e,onQuery:n,varNames:s,onPick:o,onClose:l,onCreateVar:c}){const d=x.useRef(null),f=x.useRef(null);return x.useEffect(()=>{f.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function p(m){d.current&&!d.current.contains(m.target)&&l()}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),r.jsxs("div",{ref:d,className:"absolute right-0 top-full z-50 mt-1 w-64 rounded-md border border-border bg-popover shadow-lg",children:[r.jsx("div",{className:"border-b border-border p-2",children:r.jsx("input",{ref:f,value:e,onChange:p=>n(p.target.value),placeholder:"buscar variable…",className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),r.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[s.length===0&&r.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:"sin coincidencias"}),s.map(p=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:m=>m.preventDefault(),onClick:()=>o(p),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:p})},p))]}),c&&r.jsx("div",{className:"border-t border-border p-1",children:r.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>{c(),l()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[r.jsx(un,{size:12})," Crear nueva variable…"]})})]})}function Y6(e){for(const n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE&&UC(n.textContent??""))return!0;return!1}function X6(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const s=n.getRangeAt(0);if(!e.contains(s.startContainer))return null;const o=s.cloneRange();return o.selectNodeContents(e),o.setEnd(s.startContainer,s.startOffset),o.toString().length}function K6(e,n){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=n,l=s.nextNode();for(;l;){const c=(l.textContent??"").length;if(o<=c){const d=document.createRange();d.setStart(l,o),d.collapse(!0);const f=window.getSelection();f?.removeAllRanges(),f?.addRange(d);return}o-=c,l=s.nextNode()}G6(e)}function aj(e){return e?Object.entries(e).map(([n,s])=>({key:n,value:String(s)})):[]}function sj(e){const n={};for(const s of e)s.key.trim()&&(n[s.key.trim()]=s.value);return n}function rj({rows:e,onChange:n,keyPlaceholder:s="KEY",valuePlaceholder:o="value",varNames:l,onCreateVar:c,emptyLabel:d}){const f=(g,b)=>{const v=e.slice();v[g]={...v[g],...b},n(v)},p=g=>n(e.filter((b,v)=>v!==g)),m=()=>n([...e,{key:"",value:""}]);return r.jsxs("div",{className:"space-y-2",children:[e.length===0&&d&&r.jsx("p",{className:"text-[11px] text-muted-foreground",children:d}),e.map((g,b)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ee,{value:g.key,onChange:v=>f(b,{key:v.target.value}),placeholder:s,className:"w-40 font-mono text-xs"}),r.jsx("div",{className:"flex-1",children:r.jsx(xb,{value:g.value,onChange:v=>f(b,{value:v}),placeholder:o,varNames:l,onCreateVar:c})}),r.jsx(me,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(b),"aria-label":"quitar fila",children:r.jsx(la,{size:13})})]},b)),r.jsxs(me,{type:"button",size:"sm",variant:"ghost",onClick:m,children:[r.jsx(un,{size:12})," Agregar fila"]})]})}const Q6={apc:"Shared",runtime:"Runtime",global:"Global"},Z6={apc:"info",runtime:"success",global:"muted"};function Vh(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function W6(e){return Q6[e]??e}function J6({pid:e}){const n=st(),s=Qe(`/projects/${e}/mcps`,()=>xr.list(e)),o=Qe(`/projects/${e}/mcps/check`,()=>xr.check(e)),l=Qe(`/projects/${e}/vars`,()=>vc.list(e)),[c,d]=x.useState(null),[f,p]=x.useState(null),[m,g]=x.useState(null),b=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),v=async(j,w)=>{if(confirm(_("project.mcps.delete_confirm",{name:j,scope:w})))try{await xr.remove(e,j,w),n.success(_("project.mcps.removed")),s.mutate(),f===j&&p(null)}catch(k){n.error(k?.message||_("common.error_generic"))}},S=async j=>{try{await xr.add(e,Vh(j.source),{name:j.name,enabled:!j.enabled}),s.mutate()}catch(w){n.error(w?.message||_("common.error_generic"))}},C=async j=>{p(j),g({name:j,busy:!0});try{const w=await xr.test(e,j);g({name:j,result:w})}catch(w){g({name:j,result:{ok:!1,error:w?.message||"error"}})}};return r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[r.jsx("div",{className:"lg:col-span-3",children:r.jsxs($e,{title:_("project.mcps.title"),description:_("project.mcps.subtitle"),action:r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>d({kind:"new"}),children:[r.jsx(un,{size:14})," ",_("project.mcps.new")]}),children:[o.data?.conflicts?.length?r.jsx("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:_("project.mcps.conflicts",{names:o.data.conflicts.map(j=>j.name).join(", ")})}):null,s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(it,{children:_("project.mcps.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(j=>{const w=j.source==="apc"||j.source==="runtime"||j.source==="global",k=Vh(j.source),E=f===j.name;return r.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(E?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>p(j.name),role:"button",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("span",{className:"font-medium",children:j.name}),r.jsx(Ge,{tone:Z6[j.source]??"muted",children:W6(j.source)}),r.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(j.transport||"stdio").toUpperCase()}),r.jsx("div",{onClick:R=>R.stopPropagation(),children:r.jsx(en,{checked:j.enabled!==!1,onChange:()=>S(j),label:""})}),r.jsx(me,{size:"sm",variant:"ghost",onClick:R=>{R.stopPropagation(),C(j.name)},"aria-label":_("project.mcps.test_btn"),title:_("project.mcps.test_btn"),children:r.jsx(Hw,{size:13})}),r.jsx(me,{size:"sm",variant:"ghost",onClick:R=>{R.stopPropagation(),p(j.name)},"aria-label":_("project.mcps.logs_btn"),title:_("project.mcps.logs_btn"),children:r.jsx(Md,{size:13})}),w&&r.jsx(me,{size:"sm",variant:"ghost",onClick:R=>{R.stopPropagation(),d({kind:"edit",entry:j})},"aria-label":_("project.mcps.edit_btn"),title:_("project.mcps.edit_btn"),children:r.jsx(Ml,{size:13})}),w&&r.jsx(me,{size:"sm",variant:"destructive",onClick:R=>{R.stopPropagation(),v(j.name,k)},children:r.jsx(la,{size:13})})]}),m?.name===j.name&&r.jsx(eL,{result:m.result,busy:!!m.busy,onClose:()=>g(null)})]},`${j.source}-${j.name}`)})}),c&&r.jsx(nL,{mode:c,pid:e,varNames:b,onClose:()=>d(null),onSaved:()=>{d(null),s.mutate()},onVarsChanged:()=>l.mutate()})]})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(tL,{pid:e,mcpName:f,runningTest:!!m?.busy})})]})}function eL({result:e,busy:n,onClose:s}){return r.jsxs("div",{className:"mt-2 rounded border border-border/60 bg-background/40 p-2 text-xs",children:[r.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[n&&r.jsx("span",{className:"text-muted-fg",children:_("project.mcps.testing")}),!n&&e?.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[r.jsx(ox,{size:12})," ",_("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!n&&e&&!e.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[r.jsx(ET,{size:12})," ",e.error]}),r.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:s,children:"×"})]}),!n&&e?.ok&&e.tools&&e.tools.length>0&&r.jsxs("ul",{className:"space-y-0.5 font-mono",children:[e.tools.slice(0,10).map(o=>r.jsxs("li",{className:"truncate",children:[r.jsx("span",{className:"text-primary",children:o.name}),o.description&&r.jsxs("span",{className:"ml-2 text-muted-fg",children:["— ",o.description]})]},o.name)),e.tools.length>10&&r.jsxs("li",{className:"text-muted-fg",children:["… +",e.tools.length-10]})]})]})}function tL({pid:e,mcpName:n,runningTest:s}){const[o,l]=x.useState(null),[c,d]=x.useState(null),f=x.useRef(null);x.useEffect(()=>{if(!n){l(null),d(null);return}f.current!==n&&(l(null),d(null),f.current=n);let m=!1;const g=async()=>{try{const S=await xr.logs(e,n);m||(l(S),d(null))}catch(S){m||d(S?.message||"error")}};g();const v=setInterval(g,s?1200:4e3);return()=>{m=!0,clearInterval(v)}},[e,n,s]);const p=x.useRef(null);return x.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),r.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[r.jsx(Sr,{size:13,className:"text-muted-fg"}),r.jsx("span",{className:"font-medium",children:_("project.mcps.logs_panel_title")}),n?r.jsx(Ge,{tone:"info",children:n}):r.jsxs("span",{className:"text-muted-fg",children:["— ",_("project.mcps.logs_panel_pick")]})]}),r.jsxs("div",{ref:p,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!n&&r.jsx("p",{className:"text-muted-fg",children:_("project.mcps.logs_panel_hint")}),n&&c&&r.jsx("p",{className:"text-red-400",children:c}),n&&!c&&o&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-2 text-muted-fg",children:[o.transport.toUpperCase(),o.url?` · ${o.url}`:o.command?` · ${o.command}`:"",o.last_error?` · last_error: ${o.last_error}`:""]}),o.note&&r.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&r.jsx("p",{className:"text-muted-fg",children:_("project.mcps.logs_panel_idle")}),o.events?.map((m,g)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:m.ts.slice(11,19)}),r.jsx("span",{className:m.level==="error"?"text-red-400":m.level==="stderr"?"text-amber-400":"text-emerald-400",children:m.level}),r.jsx("span",{className:"flex-1 break-all",children:m.msg})]},g)),o.stderr_tail&&r.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[r.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),r.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function nL({mode:e,pid:n,varNames:s,onClose:o,onSaved:l,onVarsChanged:c}){const d=st(),f=e.kind==="edit",p=f?e.entry:null,[m,g]=x.useState(!1),[b,v]=x.useState(p?Vh(p.source):"runtime"),[S,C]=x.useState(p?.name||""),[j,w]=x.useState(p?.transport==="http"||p?.url?"http":"stdio"),[k,E]=x.useState(p?.command||""),[R,N]=x.useState(p?.args&&p.args.length?p.args:[""]),[T,M]=x.useState(aj(p?.env)),[O,P]=x.useState(p?.url||""),[B,L]=x.useState(aj(p?.headers)),[D,z]=x.useState(p?.enabled!==!1),[H,q]=x.useState(!1),Y=async()=>{if(!S.trim()){d.error(_("project.mcps.name_required"));return}g(!0);try{const V=R.map(Z=>Z.trim()).filter(Boolean),$=j==="stdio"?{name:S.trim(),command:k.trim(),args:V.length?V:void 0,env:T.length?sj(T):void 0,enabled:D}:{name:S.trim(),url:O.trim(),headers:B.length?sj(B):void 0,enabled:D};await xr.add(n,b,$),d.success(_(f?"project.mcps.updated":"project.mcps.added")),l()}catch(V){d.error(V?.message||_("common.error_generic"))}finally{g(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(Mn,{open:!0,onClose:()=>m?null:o(),title:_(f?"project.mcps.edit_title":"project.mcps.new_title"),description:f?p?.name:_("project.mcps.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:o,disabled:m,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:Y,loading:m,children:_(f?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.mcps.scope_label"),children:r.jsx(wt,{value:b,onChange:V=>v(V),options:[{value:"runtime",label:_("project.mcps.scope_runtime"),description:_("project.mcps.scope_runtime_desc")},{value:"shared",label:_("project.mcps.scope_shared"),description:_("project.mcps.scope_shared_desc")},{value:"global",label:_("project.mcps.scope_global"),description:_("project.mcps.scope_global_desc")}]})}),r.jsx(de,{label:_("project.mcps.transport_label"),children:r.jsx(wt,{value:j,onChange:V=>w(V),options:[{value:"stdio",label:_("project.mcps.transport_stdio"),description:_("project.mcps.transport_stdio_desc")},{value:"http",label:_("project.mcps.transport_http"),description:_("project.mcps.transport_http_desc")}]})})]}),r.jsx(de,{label:_("project.mcps.name_label"),children:r.jsx(Ee,{value:S,onChange:V=>C(V.target.value),placeholder:_("project.mcps.name_ph"),disabled:f})}),j==="stdio"?r.jsxs(r.Fragment,{children:[r.jsx(de,{label:_("project.mcps.cmd_label"),children:r.jsx(Ee,{value:k,onChange:V=>E(V.target.value),placeholder:_("project.mcps.cmd_ph")})}),r.jsx(de,{label:_("project.mcps.args_label"),hint:_("project.mcps.args_hint_tokens"),children:r.jsx(aL,{args:R,onChange:N,varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(de,{label:_("project.mcps.env_label"),hint:_("project.mcps.env_hint_tokens"),children:r.jsx(rj,{rows:T,onChange:M,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:_("project.mcps.env_empty")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(de,{label:_("project.mcps.url_label"),children:r.jsx(xb,{value:O,onChange:P,placeholder:_("project.mcps.url_ph"),varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(de,{label:_("project.mcps.headers_label"),hint:_("project.mcps.headers_hint"),children:r.jsx(rj,{rows:B,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:_("project.mcps.headers_empty")})})]}),r.jsx(en,{checked:D,onChange:z,label:_("project.mcps.enabled_label")})]})}),H&&r.jsx(sL,{pid:n,onClose:()=>q(!1),onCreated:()=>{q(!1),c()}})]})}function aL({args:e,onChange:n,varNames:s,onCreateVar:o}){const l=(f,p)=>{const m=e.slice();m[f]=p,n(m)},c=f=>n(e.filter((p,m)=>m!==f)),d=()=>n([...e,""]);return r.jsxs("div",{className:"space-y-2",children:[e.map((f,p)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1",children:r.jsx(xb,{value:f,onChange:m=>l(p,m),placeholder:"--flag o valor",varNames:s,onCreateVar:o})}),r.jsx(me,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(p),"aria-label":"quitar arg",children:r.jsx(la,{size:13})})]},p)),r.jsxs(me,{type:"button",size:"sm",variant:"ghost",onClick:d,children:[r.jsx(un,{size:12})," ",_("project.mcps.add_arg")]})]})}function sL({pid:e,onClose:n,onCreated:s}){const o=st(),l=String(e)==="0",[c,d]=x.useState(""),[f,p]=x.useState(""),[m,g]=x.useState(!1),[b,v]=x.useState(l?"global":"project"),S=async()=>{if(!c.trim()){o.error(_("project.vars.name_required"));return}if(!f){o.error(_("project.vars.value_required"));return}g(!0);try{await vc.upsert(e,{name:c.trim(),value:f,scope:b}),o.success(_("project.vars.added")),s()}catch(C){o.error(C?.message||_("common.error_generic"))}finally{g(!1)}};return r.jsx(Mn,{open:!0,onClose:()=>m?null:n(),title:_("project.vars.new_title"),description:_("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:m,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:S,loading:m,children:_("project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:_("project.vars.scope_label"),children:r.jsx(wt,{value:b,onChange:C=>v(C),options:[...l?[]:[{value:"project",label:_("project.vars.scope_project"),description:_("project.vars.scope_project_desc")}],{value:"global",label:_("project.vars.scope_global"),description:_("project.vars.scope_global_desc")}]})}),r.jsx(de,{label:_("project.vars.name_label"),hint:_("project.vars.name_hint"),children:r.jsx(Ee,{value:c,onChange:C=>d(C.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),r.jsx(de,{label:_("project.vars.value_label"),hint:_("project.vars.value_hint"),children:r.jsx(Ee,{type:"password",value:f,onChange:C=>p(C.target.value),className:"font-mono text-xs"})})]})})}function rL({pid:e}){const n=st(),s=String(e)==="0",[o,l]=x.useState(s?"global":"all"),[c,d]=x.useState(!1),f=Qe(`/projects/${e}/vars?reveal=${c?1:0}`,()=>vc.list(e,{reveal:c})),[p,m]=x.useState(null),g=x.useMemo(()=>{if(!f.data)return[];const v=[],S=f.data.project||{},C=f.data.global||{};for(const[j,w]of Object.entries(S))v.push({name:j,scope:"project",masked:w});for(const[j,w]of Object.entries(C))S[j]===void 0&&v.push({name:j,scope:"global",masked:w});return v.filter(j=>o==="all"?!0:j.scope===o).sort((j,w)=>j.name.localeCompare(w.name))},[f.data,o]),b=async(v,S)=>{if(confirm(_("project.vars.delete_confirm",{name:v,scope:S})))try{await vc.remove(e,v,S),n.success(_("project.vars.removed")),f.mutate()}catch(C){n.error(C?.message||_("common.error_generic"))}};return r.jsxs($e,{title:_("project.vars.title"),description:_(s?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(en,{checked:c,onChange:d,label:_("project.vars.reveal_all")}),r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>m({}),children:[r.jsx(un,{size:14})," ",_("project.vars.new")]})]}),children:[!s&&r.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-muted-fg",children:_("project.vars.filter_label")}),r.jsx(Ag,{active:o==="all",onClick:()=>l("all"),children:_("project.vars.filter_all")}),r.jsx(Ag,{active:o==="project",onClick:()=>l("project"),children:_("project.vars.filter_project")}),r.jsx(Ag,{active:o==="global",onClick:()=>l("global"),children:_("project.vars.filter_global")})]}),f.isLoading&&r.jsx(nt,{}),!f.isLoading&&g.length===0&&r.jsx(it,{children:_("project.vars.empty")}),g.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:g.map(v=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-mono text-xs font-medium",children:v.name}),r.jsx(Ge,{tone:v.scope==="project"?"info":"muted",children:v.scope==="project"?_("project.vars.scope_project"):_("project.vars.scope_global")}),r.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:v.masked}),r.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>m({name:v.name,scope:v.scope}),"aria-label":_("project.vars.edit_btn"),children:r.jsx(Ml,{size:13})}),!(s&&v.scope==="project")&&r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>b(v.name,v.scope),"aria-label":_("project.vars.delete_btn"),children:r.jsx(la,{size:13})})]})]},`${v.scope}-${v.name}`))}),r.jsx(oL,{open:p!==null,initial:p||void 0,onClose:()=>m(null),pid:e,isBase:s,onSaved:()=>{m(null),f.mutate()}})]})}function Ag({active:e,onClick:n,children:s}){return r.jsx("button",{type:"button",onClick:n,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:s})}function oL({open:e,onClose:n,pid:s,isBase:o,initial:l,onSaved:c}){const d=st(),[f,p]=x.useState(!1),[m,g]=x.useState(!1),[b,v]=x.useState(l?.name||""),[S,C]=x.useState(l?.value||""),[j,w]=x.useState(l?.scope||(o?"global":"project")),k=!!l?.name;x.useEffect(()=>{e&&(v(l?.name||""),C(l?.value||""),w(l?.scope||(o?"global":"project")),g(!1))},[e,l?.name,l?.scope,l?.value,o]);const E=async()=>{if(!b.trim()){d.error(_("project.vars.name_required"));return}if(!S){d.error(_("project.vars.value_required"));return}p(!0);try{await vc.upsert(s,{name:b.trim(),value:S,scope:j}),d.success(_(k?"project.vars.updated":"project.vars.added")),c()}catch(R){d.error(R?.message||_("common.error_generic"))}finally{p(!1)}};return r.jsx(Mn,{open:e,onClose:()=>f?null:n(),title:_(k?"project.vars.edit_title":"project.vars.new_title"),description:_("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:f,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:E,loading:f,children:_(k?"project.vars.save_btn":"project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:_("project.vars.scope_label"),children:r.jsx(wt,{value:j,onChange:R=>w(R),options:[...o?[]:[{value:"project",label:_("project.vars.scope_project"),description:_("project.vars.scope_project_desc")}],{value:"global",label:_("project.vars.scope_global"),description:_("project.vars.scope_global_desc")}]})}),r.jsx(de,{label:_("project.vars.name_label"),hint:_("project.vars.name_hint"),children:r.jsx(Ee,{value:b,onChange:R=>v(R.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:k,autoFocus:!k})}),r.jsx(de,{label:_("project.vars.value_label"),hint:_("project.vars.value_hint"),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ee,{type:m?"text":"password",value:S,onChange:R=>C(R.target.value),placeholder:k?_("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:k}),r.jsx("button",{type:"button",onClick:()=>g(R=>!R),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":_(m?"project.vars.hide":"project.vars.reveal"),children:m?r.jsx(zT,{size:14}):r.jsx(sf,{size:14})})]})})]})})}function lL({pid:e}){const n=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),[s,o]=x.useState(null),[l,c]=x.useState(null);return r.jsxs($e,{title:_("project.threads.title"),description:_("project.threads.subtitle"),children:[n.isLoading&&r.jsx(nt,{}),!n.isLoading&&(n.data?.length??0)===0&&r.jsx(it,{children:_("project.threads.no_agents")}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[r.jsx("ul",{className:"space-y-1 md:col-span-1",children:(n.data||[]).map(d=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>o(d.slug),className:Me("flex w-full items-center justify-between rounded-md px-2.5 py-1.5 text-sm",s===d.slug?"bg-accent text-accent-fg":"text-foreground hover:bg-accent/60"),children:[r.jsx("span",{children:d.slug}),d.model&&r.jsx(Ge,{tone:"info",children:d.model})]})},d.slug))}),r.jsx("div",{className:"md:col-span-2",children:s?r.jsx(iL,{pid:e,slug:s,onOpen:c}):r.jsx(it,{children:_("project.threads.pick")})})]}),s&&l&&r.jsx(cL,{pid:e,slug:s,id:l,onClose:()=>c(null)})]})}function iL({pid:e,slug:n,onOpen:s}){const o=Qe(`/projects/${e}/agents/${n}/conversations`,()=>Qx.list(e,n));return o.isLoading?r.jsx(nt,{}):o.data?.length?r.jsx("ul",{className:"space-y-1 text-sm",children:o.data.map(l=>r.jsxs("li",{className:"cursor-pointer rounded-md border border-border bg-muted/30 px-3 py-2 hover:bg-accent/40",onClick:()=>s(l.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:l.title||l.filename}),r.jsx("span",{className:"text-xs text-muted-fg",children:new Date(l.started_at).toLocaleString()})]}),r.jsxs("div",{className:"mt-0.5 text-xs text-muted-fg",children:[l.channel&&r.jsxs(r.Fragment,{children:[_("project.threads.via")," ",l.channel," · "]}),l.messages??0," ",_("project.threads.messages")]})]},l.id))}):r.jsx(it,{children:_("project.threads.empty",{slug:n})})}function cL({pid:e,slug:n,id:s,onClose:o}){const l=Qe(`/projects/${e}/agents/${n}/conversations/${s}`,()=>Qx.get(e,n,s));return r.jsxs(Mn,{open:!0,onClose:o,title:_("project.threads.conversation_title",{id:s}),size:"lg",children:[l.isLoading&&r.jsx(nt,{}),l.data&&r.jsx("div",{className:"max-h-[60vh] space-y-3 overflow-y-auto pr-2",children:l.data.messages.map((c,d)=>r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm",children:[r.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-fg",children:[r.jsxs("span",{className:"uppercase tracking-wide",children:[c.role,c.name?` (${c.name})`:""]}),c.ts&&r.jsx("span",{children:new Date(c.ts).toLocaleString()})]}),r.jsx("div",{className:"whitespace-pre-wrap",children:c.content})]},d))})]})}function bb({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l=!1,disabled:c=!1,placeholder:d,autoFocus:f,minRows:p=2,maxRows:m=8,footer:g,className:b}){const v=x.useRef(null);x.useLayoutEffect(()=>{const C=v.current;if(!C)return;const j=()=>{C.style.height="auto",C.offsetHeight;const k=parseFloat(getComputedStyle(C).lineHeight)||20,E=k*p,R=k*m;C.style.height=`${Math.min(Math.max(C.scrollHeight,E),R)}px`,C.style.overflowY=C.scrollHeight>R?"auto":"hidden"};j();const w=requestAnimationFrame(j);return()=>cancelAnimationFrame(w)},[e,p,m]);const S=e.trim().length>0&&!c;return r.jsxs("div",{className:Ot("flex flex-col gap-1.5 rounded-2xl border border-border bg-muted/60 p-2 shadow-sm transition-colors","focus-within:border-foreground/25 focus-within:bg-muted",c&&"opacity-60",b),children:[r.jsx("textarea",{ref:v,rows:p,value:e,autoFocus:f,disabled:c,placeholder:d,onChange:C=>n(C.target.value),onKeyDown:C=>{if(C.key==="Enter"&&!C.shiftKey){if(C.preventDefault(),l||!S)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),r.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:g}),l&&o?r.jsx(fo,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":_("chat_ui.stop"),title:_("chat_ui.stop"),children:r.jsx(Kw,{className:"size-3.5",fill:"currentColor"})}):r.jsx(fo,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!S,"aria-label":_("chat_ui.send"),title:_("chat_ui.send"),children:r.jsx(wT,{className:"size-4"})})]})]})}function vb({value:e,onChange:n,disabled:s}){const[o,l]=x.useState(!1),[c,d]=x.useState(""),[f,p]=x.useState([]),[m,g]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const w=k=>{b.current&&!b.current.contains(k.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),x.useEffect(()=>{if(!o||m)return;let w=!1;return(async()=>{try{const{engines:k}=await Yd.list(),E=await Promise.all(k.map(R=>Yd.models({engine:R}).then(N=>(N.models||[]).map(T=>T.includes(":")?T:`${R}:${T}`)).catch(()=>[])));if(!w){const R=Array.from(new Set(E.flat())).sort();p(R),g(!0)}}catch{w||g(!0)}})(),()=>{w=!0}},[o,m]);const v=c.trim().toLowerCase(),S=v?f.filter(w=>w.toLowerCase().includes(v)):f,C=e||"Auto",j=w=>{n(w),l(!1),d("")};return r.jsxs("div",{ref:b,className:"relative",children:[r.jsxs("button",{type:"button",disabled:s,onClick:()=>l(w=>!w),"data-testid":"chat-model-picker",className:Me("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),title:_("chat_ui.pick_model"),"aria-label":_("chat_ui.pick_model"),children:[r.jsx(Xw,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:C}),r.jsx(xo,{className:"size-3 shrink-0 opacity-60"})]}),o&&r.jsxs("div",{className:"absolute bottom-full left-0 z-50 mb-1.5 w-64 rounded-lg border border-border bg-popover p-1.5 shadow-md ring-1 ring-foreground/10",children:[r.jsx("input",{autoFocus:!0,value:c,placeholder:"filtrar o escribir modelo…",onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&c.trim()&&j(c.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),r.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),j("")},className:Me("flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent hover:text-accent-fg",!e&&"bg-accent/50"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(bo,{className:"size-3"})," Auto (router decide)"]}),!e&&r.jsx(dc,{className:"size-3"})]})}),!m&&r.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:"cargando modelos…"}),m&&S.length===0&&c.trim()&&r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),j(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:["usar “",c.trim(),"”"]})}),S.map(w=>r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:k=>{k.preventDefault(),j(w)},className:Me("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",w===e&&"bg-accent/50"),children:[r.jsx("span",{className:"truncate",children:w}),w===e&&r.jsx(dc,{className:"size-3 shrink-0"})]})},w))]})]})]})}function uL({onSend:e,onStop:n,streaming:s,model:o,onModelChange:l}){const[c,d]=x.useState(""),f=()=>{const p=c.trim();p&&(d(""),e(p))};return r.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:r.jsx(bb,{value:c,onValueChange:d,onSubmit:f,onStop:n,busy:s,placeholder:_("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(vb,{value:o||"",onChange:l,disabled:s}):void 0})})}const dL={read_file:{icon:IT,label:"Leer archivo"},write_file:{icon:PT,label:"Escribir archivo"},edit_file:{icon:Ad,label:"Editar archivo"},list_files:{icon:$w,label:"Listar archivos"},search_files:{icon:vd,label:"Buscar en archivos"},search_messages:{icon:vd,label:"Buscar mensajes"},tail_messages:{icon:vd,label:"Últimos mensajes"},run_shell:{icon:Sr,label:"Ejecutar shell"},send_telegram:{icon:rs,label:"Enviar Telegram"},call_agent:{icon:yn,label:"Llamar agente"},call_mcp:{icon:rA,label:"Llamar MCP"},call_runtime:{icon:yn,label:"Llamar runtime"},create_task:{icon:ZT,label:"Crear tarea"}},VC=new Set(["write_file","edit_file"]);function fL(e){return dL[e]||{icon:zl,label:e}}function pL(e,n){if(!n)return"";const s=l=>typeof n[l]=="string"?n[l]:void 0,o=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return o?String(o):""}function oj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function mL({status:e}){return e==="running"?r.jsx(of,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?r.jsx(bo,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?r.jsx(MT,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(dc,{className:"size-3 shrink-0 text-emerald-400"})}function gL({part:e}){const[n,s]=x.useState(!1),{icon:o,label:l}=fL(e.tool),c=pL(e.tool,e.args),d=VC.has(e.tool),f=!!e.args||e.result!==void 0;return r.jsxs("div",{className:Me("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[r.jsxs("button",{type:"button",onClick:()=>f&&s(p=>!p),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[f?r.jsx(af,{className:Me("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:Me("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),r.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&r.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),r.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&r.jsx("span",{className:"text-[10px] text-amber-400",children:"dedup"}),r.jsx(mL,{status:e.status})]})]}),n&&f&&r.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.args&&Object.keys(e.args).length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"args"}),r.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:oj(e.args)})]}),e.result!==void 0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"result"}),r.jsx("pre",{className:Me("max-h-64 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed",e.status==="error"?"text-rose-300":"text-foreground"),children:oj(e.result)})]})]})]})}function hL(e){const n=e.args;return(n&&Array.isArray(n.questions)?n.questions:[]).map(o=>typeof o=="string"?o:o&&typeof o=="object"&&typeof o.question=="string"?o.question:null).filter(o=>!!o)}function xL({part:e,pending:n}){const s=hL(e),o=_(n?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:Me("rounded-2xl border px-3 py-2 text-sm shadow-sm",n?"rounded-bl-sm border-amber-500/30 bg-amber-500/5 text-foreground":"rounded-bl-sm border-emerald-500/30 bg-emerald-500/5 text-foreground"),"data-testid":"ask-questions-card","data-state":n?"pending":"answered",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[n?r.jsx(of,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(ox,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(Gw,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"text-[12px] font-medium",children:o}),s.length>1&&r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[s.length," preguntas"]})]}),s.length>0&&r.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:s.map((l,c)=>r.jsx("li",{className:"list-disc",children:l},c))})]})}function qC(e){const n=e.split(`
586
+ `),s=[];let o=null;for(const l of n)if(l.startsWith("- "))o&&s.push(o),o={question:l.slice(2),answer:"",skipped:!1};else if(l.startsWith(" → ")&&o){const c=l.slice(4);o.answer=c,o.skipped=c==="(omitido)"}else return null;return o&&s.push(o),s.length>0?s:null}function bL({text:e}){const n=qC(e);return n?r.jsx("div",{className:"flex w-full justify-center",children:r.jsxs("div",{className:"w-full max-w-[85%] rounded-2xl border border-border/70 bg-card/40 px-4 py-3 shadow-sm","data-testid":"ask-answers-card",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(Gw,{className:"size-3.5"}),r.jsx("span",{children:_("ask_panel.answers_header")})]}),r.jsx("ul",{className:"space-y-2.5",children:n.map((s,o)=>r.jsxs("li",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:s.question}),r.jsx("div",{className:Me("whitespace-pre-wrap text-[13px] leading-snug",s.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:s.answer})]},o))})]})}):null}function qh(e){return e.parts.filter(n=>n.kind==="text").map(n=>n.text).join(`
587
+
588
+ `).trim()}function vL(e){const n=e.args?.questions;if(!Array.isArray(n)||n.length===0)return null;const s=n.map(o=>{if(typeof o=="string")return`- ${o}`;if(!o||typeof o!="object")return null;const l=o;if(typeof l.question!="string")return null;const d=(Array.isArray(l.options)?l.options:[]).map(f=>typeof f=="string"?f:f&&typeof f=="object"&&typeof f.label=="string"?f.label:"").filter(f=>f).join(", ");return d?`- ${l.question} (opciones: ${d})`:`- ${l.question}`}).filter(o=>!!o);return s.length===0?null:`[ask_questions]
589
+ ${s.join(`
590
+ `)}`}function yL(e){const n=[];for(const s of e.parts)if(s.kind==="text"&&s.text)n.push(s.text);else if(s.kind==="tool"&&s.tool==="ask_questions"){const o=vL(s);o&&n.push(o)}return n.join(`
591
+
592
+ `).trim()}const _L=e=>[{kind:"text",text:e}];function jL(e){if(!e||typeof e!="object")return!1;const n=e;return"error"in n&&!!n.error}function yb(e,n){const s=o=>({...e,notes:[...e.notes||[],o]});switch(n.type){case"model_start":return n.model?{...e,model:n.model}:e;case"model_routed":{const o=n.model?{...e,model:n.model}:e;return n.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${n.model}`]}:o}case"engine_failed":return s(`engine ${n.model||"?"} failed → ${n.retry_with||"retry"}`);case"model_retry":return s(`retry (${n.reason||"?"})`);case"tools_suppressed":return s(`tools suppressed: ${(n.tools||[]).join(", ")}`);case"assistant_text":return n.text?{...e,parts:[...e.parts,{kind:"text",text:n.text}]}:e;case"tool_start":return n.trace?{...e,parts:[...e.parts,{kind:"tool",id:n.trace.id,tool:n.trace.tool,args:n.trace.args,status:"running"}]}:e;case"tool_deduped":return n.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===n.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!n.trace)return e;{const o=jL(n.trace.result);return{...e,parts:e.parts.map(l=>l.kind==="tool"&&l.id===n.trace.id?{...l,result:n.trace.result,status:o?"error":l.status==="deduped"?"deduped":"done"}:l)}}case"final":return{...e,pending:!1,usage:n.result?.usage??e.usage,model:e.model??n.result?.name,parts:n.result?.text&&!e.parts.some(o=>o.kind==="text")?[...e.parts,{kind:"text",text:n.result.text}]:e.parts};default:{const o=n.delta||n.content||"";if(!o)return e;const l=[...e.parts],c=l[l.length-1];return c&&c.kind==="text"?l[l.length-1]={...c,text:c.text+o}:l.push({kind:"text",text:o}),{...e,parts:l}}}}function wL(e,n){const[s,o]=x.useState([]),[l,c]=x.useState(!1),d=x.useRef(null),f=x.useRef(void 0),p=x.useCallback(S=>{o(C=>{const j=[...C],w=j[j.length-1];return w&&w.role==="assistant"&&(j[j.length-1]=S(w)),j})},[]),m=x.useCallback(S=>{if(S.type==="error"){n?.(S.error||"stream error");return}p(C=>yb(C,S))},[p,n]),g=x.useCallback(async(S,C={})=>{const j=S.trim();if(!j||l)return;const w=()=>new Date().toISOString(),k=s.map(R=>({role:R.role,content:yL(R)}));if(o(R=>[...R,{role:"user",parts:_L(j),ts:w()},{role:"assistant",parts:[],ts:w(),pending:!0}]),c(!0),C.agentSlug){try{const R=await Jt.chat(e,C.agentSlug,{prompt:j,conversation_id:f.current,model:C.model||void 0});f.current=R.conversation_id,p(N=>({...N,pending:!1,model:R.engine,parts:[{kind:"text",text:R.text}]}))}catch(R){n?.(R?.message||"fallo"),o(N=>N.filter((T,M)=>M!==N.length-1))}finally{c(!1)}return}const E=new AbortController;d.current=E;try{await P2.stream(e,{prompt:j,previousMessages:k,model:C.model||void 0,channel:"web"},m,E.signal),p(R=>({...R,pending:!1}))}catch(R){E.signal.aborted?p(N=>({...N,pending:!1,parts:[...N.parts,{kind:"text",text:"[detenido]"}]})):(n?.(R?.message||"stream falló"),o(N=>N.filter((T,M)=>M!==N.length-1)))}finally{c(!1),d.current=null}},[e,s,l,m,p,n]),b=x.useCallback(()=>d.current?.abort(),[]),v=x.useCallback(()=>{l||(f.current=void 0,o([]))},[l]);return{msgs:s,send:g,stop:b,clear:v,streaming:l}}function SL({msg:e,isLast:n,isAskAnswer:s,onCopy:o}){const l=e.role==="user",c=qh(e),d=e.parts.some(f=>f.kind==="tool");if(l&&s){const f=qh(e);if(qC(f))return r.jsx(bL,{text:f})}return r.jsxs("div",{className:Me("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(yn,{size:14})}),r.jsxs("div",{className:Me("flex min-w-0 flex-col gap-1.5",l?"items-end":"w-full max-w-[85%]"),children:[!l&&e.notes&&e.notes.length>0&&r.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((f,p)=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[r.jsx(XT,{size:10})," ",f]},p))}),e.parts.map((f,p)=>f.kind==="tool"?f.tool==="ask_questions"&&!l?r.jsx(xL,{part:f,pending:!!n},`${f.id}-${p}`):r.jsx(gL,{part:f},`${f.id}-${p}`):f.text?r.jsx("div",{className:Me("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",l?"rounded-br-sm border border-emerald-500/30 bg-emerald-500/10 text-foreground dark:bg-emerald-500/15":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:f.text},p):null),!l&&e.pending&&e.parts.length===0&&r.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsx("span",{children:CL(e.ts)}),!l&&e.model&&r.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&d&&r.jsxs("span",{children:["· ",e.parts.filter(f=>f.kind==="tool").length," tools"]}),o&&c&&r.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground",title:_("chat_ui.copy"),"aria-label":_("chat_ui.copy"),children:[r.jsx(Td,{size:10})," ",_("chat_ui.copy")]})]})]}),l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(Zw,{size:14})})]})}function CL(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function _b({msgs:e,onCopy:n}){const s=x.useRef(null);if(x.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(it,{children:_("project.chat.empty")})});const o=e.length-1;return r.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>r.jsx(SL,{msg:l,isLast:c===o,isAskAnswer:kL(e,c),onCopy:n},c)),r.jsx("div",{ref:s})]})}function kL(e,n){const s=e[n];if(!s||s.role!=="user")return!1;const o=e[n-1];if(!o||o.role!=="assistant")return!1;for(let l=o.parts.length-1;l>=0;l--){const c=o.parts[l];if(c.kind==="tool")return c.tool==="ask_questions"}return!1}function EL(e){if(!e)return;const n=e.path??e.file??e.filename;return typeof n=="string"?n:void 0}function $C({msgs:e}){const[n,s]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:d,model:f}=x.useMemo(()=>{let m=0,g=0,b=0,v;const S=new Set,C=[];for(const j of e)if(j.role==="assistant"){j.usage&&(m+=j.usage.input_tokens||0,g+=j.usage.output_tokens||0),j.model&&(v=j.model);for(const w of j.parts)if(w.kind==="tool"&&(b+=1,VC.has(w.tool)&&w.status!=="error")){const k=EL(w.args);k&&!S.has(k)&&(S.add(k),C.push({path:k,tool:w.tool}))}}return{inTok:m,outTok:g,toolCount:b,changed:C,model:v}},[e]),p=o+l;return p===0&&c===0?null:r.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[r.jsxs("button",{type:"button",onClick:()=>d.length>0&&s(m=>!m),className:Me("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",d.length>0&&"hover:text-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(rf,{size:12})," ",Mg(p)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",Mg(o),"↑ / ",Mg(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zl,{size:12})," ",c," tools"]}),d.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Ad,{size:12})," ",d.length," archivos"]}),f&&r.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:f}),d.length>0&&r.jsx(xo,{className:Me("size-3 shrink-0 transition-transform",n&&"rotate-180")})]}),n&&d.length>0&&r.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:d.map(m=>r.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[r.jsx(Ad,{size:11,className:"shrink-0 text-violet-400"}),r.jsx("span",{className:"truncate",children:m.path}),r.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:m.tool==="write_file"?"write":"edit"})]},m.path))})]})}function Mg(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ul(){return{picked:new Set,text:"",skipped:!1}}function lj(e,n){const s=[];return e.forEach((o,l)=>{const c=n[l]||ul();if(c.skipped){s.push(`- ${o.question}
593
+ → (omitido)`);return}const d=[];if(o.options&&o.options.length>0){const m=[...c.picked].sort((g,b)=>g-b).map(g=>o.options[g]?.label).filter(Boolean);m.length>0&&d.push(m.join(", "))}const f=c.text.trim();f&&d.push(o.options&&o.options.length>0?`(Otro: ${f})`:f);const p=d.length>0?d.join(" "):"(sin respuesta)";s.push(`- ${o.question}
594
+ → ${p}`)}),s.join(`
595
+ `)}function GC({turnKey:e,questions:n,onSubmit:s,onDismiss:o,disabled:l}){const c=n.length,[d,f]=x.useState(0),[p,m]=x.useState(()=>n.map(()=>ul()));x.useEffect(()=>{f(0),m(n.map(()=>ul()))},[e,n]);const g=n[d],b=p[d]||ul(),v=!!g?.options&&g.options.length>0,S=!!g?.multiSelect,C=g?.allowText!==!1,j=M=>{m(O=>{const P=[...O],B=P[d]||ul();return P[d]={...B,...M,skipped:!1},P})},w=M=>{m(O=>{const P=[...O],B=P[d]||ul(),L=new Set(B.picked);return S?L.has(M)?L.delete(M):L.add(M):(L.clear(),L.add(M)),P[d]={...B,picked:L,skipped:!1},P})},k=x.useMemo(()=>!0,[]),E=d===c-1,R=()=>f(M=>Math.max(0,M-1)),N=()=>{if(E){s(lj(n,p));return}f(M=>Math.min(c-1,M+1))},T=()=>{if(m(M=>{const O=[...M];return O[d]={picked:new Set,text:"",skipped:!0},O}),E){const M=p.map((O,P)=>P===d?{picked:new Set,text:"",skipped:!0}:O);s(lj(n,M))}else f(M=>Math.min(c-1,M+1))};return x.useEffect(()=>{const M=O=>{if(l)return;const P=O.target?.tagName?.toLowerCase(),B=P==="input"||P==="textarea";if(O.key==="Enter"&&(O.metaKey||O.ctrlKey)){O.preventDefault(),N();return}if(!B&&v&&/^[1-9]$/.test(O.key)){const L=parseInt(O.key,10)-1;L<(g?.options?.length||0)&&(O.preventDefault(),w(L))}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)}),!g||c===0?null:r.jsxs("div",{className:Me("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",l&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[r.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[d+1,"/",c]}),g.header&&r.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:g.header}),r.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:g.question}),o&&r.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":_("common.close"),children:r.jsx(bo,{className:"size-3.5"})})]}),r.jsxs("div",{className:"space-y-1 px-2 py-2",children:[v&&g.options.map((M,O)=>{const P=b.picked.has(O);return r.jsxs("button",{type:"button",onClick:()=>w(O),className:Me("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",P?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium",children:M.label}),M.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:M.description})]}),S?r.jsx("span",{className:Me("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",P?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:P&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:Me("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",P?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:O+1})]},`${O}:${M.label}`)}),(C||!v)&&r.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[v&&r.jsx("div",{className:"mb-1 text-xs font-medium",children:_("ask_panel.other")}),r.jsx("input",{type:"text",value:b.text,onChange:M=>j({text:M.target.value}),placeholder:_(v?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),r.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[r.jsx("button",{type:"button",onClick:R,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:_("ask_panel.back")}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:T,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:_("ask_panel.skip")}),r.jsxs("button",{type:"button",onClick:N,disabled:!k,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[_(E?"ask_panel.submit":"ask_panel.next"),r.jsx(AT,{className:"size-3 opacity-60"})]})]})]})]})}function NL(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const n=e,s=typeof n.question=="string"?n.question:"";if(!s)return null;const l=(Array.isArray(n.options)?n.options:[]).map(c=>{if(typeof c=="string")return{label:c};if(c&&typeof c=="object"&&typeof c.label=="string"){const d=c;return{label:d.label,description:typeof d.description=="string"?d.description:void 0}}return null}).filter(c=>c!==null);return{question:s,header:typeof n.header=="string"?n.header:void 0,options:l,multiSelect:n.multiSelect===!0,allowText:n.allowText!==!1}}function FC(e){if(!e.length)return null;const n=e[e.length-1];if(n.role!=="assistant")return null;let s=null,o=-1;for(let m=n.parts.length-1;m>=0;m--){const g=n.parts[m];if(g.kind==="tool"&&g.tool==="ask_questions"){s=g,o=m;break}}if(!s||o<0)return null;let l=null;if(typeof s.result=="string")try{l=JSON.parse(s.result)}catch{l=null}else s.result&&typeof s.result=="object"&&(l=s.result);const c=[];Array.isArray(s.args?.questions)&&c.push(s.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let d=[];for(const m of c)if(d=m.map(NL).filter(g=>!!g),d.length>0)break;return d.length?{turnKey:`${n.ts||""}#${o}`,questions:d}:null}const Vi="__super_agent__";function RL({pid:e}){const n=st(),[s]=Ow(),o=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),[l,c]=x.useState(s.get("agent")||""),[d,f]=x.useState(!1),[p,m]=x.useState(""),[g,b]=x.useState(null),{msgs:v,send:S,stop:C,clear:j,streaming:w}=wL(e,z=>n.error(z)),k=eb(),E=o.data||[],R=z=>z===Vi,N=x.useMemo(()=>[{value:Vi,label:`${k} (super-agent)`},...E.map(z=>({value:z.slug,label:z.slug}))],[E,k]),T=x.useMemo(()=>E.find(z=>z.slug===l)||E[0],[E,l]),M=R(l)?Vi:T?.slug||Vi,O=M===Vi;x.useEffect(()=>{!l&&T?.slug&&c(T.slug)},[T?.slug,l]);const P=()=>j(),B=async z=>{!O&&!T||await S(z,{model:p||void 0,agentSlug:O?void 0:T.slug})},L=async z=>{try{await navigator.clipboard.writeText(z),n.info(_("project.chat.copied"))}catch{}};if(o.isLoading)return r.jsx(nt,{});const D=O?_("project.chat.superagent_subtitle",{persona:k}):_("project.chat.subtitle");return r.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-sm font-semibold",children:O?_("project.chat.superagent_title",{persona:k}):_("project.chat.title")}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:D})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-52",children:r.jsx(wt,{value:M,onChange:z=>{c(z),P()},options:N})}),O?r.jsx(Ge,{tone:"success",children:"super-agent"}):T?.model&&r.jsx(Ge,{tone:"info",children:T.model}),!E.length&&!O&&r.jsxs(me,{variant:"primary",size:"sm",onClick:()=>f(!0),children:[r.jsx(un,{size:14})," ",_("project.chat.create_agent")]}),r.jsxs(me,{variant:"ghost",size:"sm",disabled:w||v.length===0,onClick:P,children:[r.jsx(la,{size:13})," ",_("project.chat.clear")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:v.length?r.jsx(_b,{msgs:v,onCopy:L}):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:_("project.chat.empty")})})}),r.jsx($C,{msgs:v}),(()=>{const z=w?null:FC(v);return!z||z.turnKey===g?null:r.jsx(GC,{turnKey:z.turnKey,questions:z.questions,onSubmit:H=>void B(H),onDismiss:()=>b(z.turnKey),disabled:w})})(),r.jsx(uL,{onSend:B,onStop:C,streaming:w,model:p,onModelChange:m}),r.jsx(TL,{open:d,pid:e,onClose:()=>f(!1),onCreated:()=>{f(!1),o.mutate()}})]})}function TL({open:e,onClose:n,onCreated:s,pid:o}){const l=st(),[c,d]=x.useState(""),[f,p]=x.useState("master"),[m,g]=x.useState(""),[b,v]=x.useState(!0),[S,C]=x.useState(!1),j=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(_("project.agents.slug_invalid"));return}C(!0);try{await Jt.create(o,{slug:c,role:f,model:m||void 0,is_master:b}),l.success(_("project.agents.created",{slug:c})),d(""),p("master"),g(""),v(!0),s()}catch(w){l.error(w.message)}finally{C(!1)}};return r.jsx(Mn,{open:e,onClose:n,title:_("project.chat.create_agent_title"),description:_("project.chat.create_agent_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:S,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:j,loading:S,children:_("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"slug",children:r.jsx(Ee,{autoFocus:!0,value:c,onChange:w=>d(w.target.value),placeholder:"master"})}),r.jsx(de,{label:_("project.chat.role_label"),children:r.jsx(Ee,{value:f,onChange:w=>p(w.target.value),placeholder:"master"})}),r.jsx(de,{label:_("project.chat.model_label"),hint:_("project.chat.model_hint"),children:r.jsx(Ee,{value:m,onChange:w=>g(w.target.value)})}),r.jsx(en,{checked:b,onChange:v,label:_("project.chat.master_label")})]})})}function AL({pid:e}){const n=st(),{project:s}=Zx(e),{channels:o,isLoading:l,mutate:c}=lb(),d=String(e),f=s?.name||s?.path?.split("/").pop()||d,p=`proj-${d}`,m=o.find(O=>O.project===d||O.project===f||O.name===p),[g,b]=x.useState(!!m),[v,S]=x.useState(""),[C,j]=x.useState(""),[w,k]=x.useState(""),[E,R]=x.useState(!0),[N,T]=x.useState(!1);if(x.useEffect(()=>{m?(b(!0),S(""),j(m.chat_id||""),k(m.route_to_agent||""),R(m.respond_with_engine??!0)):(b(!1),S(""),j(""),k(""),R(!0))},[m?.name,m?.chat_id,m?.route_to_agent]),l)return r.jsx(nt,{});const M=async()=>{T(!0);try{if(!g){m&&(await An.channels.remove(m.name),n.success(_("project.telegram.cleared"))),await c();return}const O={name:m?.name||p,project:d,chat_id:C,route_to_agent:w,respond_with_engine:E,...v?{bot_token:v}:{}};m?await An.channels.patch(m.name,O):await An.channels.upsert(O),n.success(_("project.telegram.saved")),await c(),S("")}catch(O){n.error(O.message)}finally{T(!1)}};return r.jsx($e,{title:_("project.telegram.title"),description:_("project.telegram.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(en,{checked:g,onChange:b,label:_(g?"project.telegram.override_active":"project.telegram.use_default")}),m&&r.jsx(Ge,{tone:"success",children:_("project.telegram.channel_badge",{name:m.name})})]}),g&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.telegram.bot_token"),hint:m?.bot_token?`${jr(m.bot_token)} — vacío = mantener`:_("project.telegram.bot_hint_none"),children:r.jsx(Ee,{type:"password",value:v,onChange:O=>S(O.target.value),placeholder:m?.bot_token?jr(m.bot_token):""})}),r.jsx(de,{label:_("project.telegram.chat_id"),children:r.jsx(Ee,{value:C,onChange:O=>j(O.target.value)})}),r.jsx(de,{label:_("project.telegram.route_agent"),hint:_("project.telegram.route_hint"),children:r.jsx(Ee,{value:w,onChange:O=>k(O.target.value)})})]}),r.jsx(en,{checked:E,onChange:R,label:_("project.telegram.respond_engine")})]}),r.jsx("div",{className:"pt-2",children:r.jsx(me,{variant:"primary",loading:N,onClick:M,children:_("common.save")})}),!g&&!m&&r.jsx(it,{children:_("project.telegram.no_override")})]})})}function YC({load:e,save:n,rows:s=10,placeholder:o}){const l=st(),[c,d]=x.useState(null),[f,p]=x.useState(""),[m,g]=x.useState(!1);if(x.useEffect(()=>{let S=!0;return e().then(C=>{S&&(d(C),p(C))}).catch(()=>{S&&(d(""),p(""))}),()=>{S=!1}},[e]),c===null)return r.jsx(nt,{});const b=f!==c,v=async()=>{g(!0);try{await n(f),d(f),l.success(_("project.memories.saved"))}catch(S){l.error(S.message)}finally{g(!1)}};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(ln,{rows:s,className:"font-mono text-xs",value:f,onChange:S=>p(S.target.value),placeholder:o}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[f.length," ",_("project.memories.chars")]}),r.jsxs(me,{size:"sm",variant:"primary",loading:m,disabled:!b,onClick:v,children:[r.jsx(lf,{size:12})," ",_("project.memories.save_btn")]})]})]})}function ML({pid:e,agent:n}){const[s,o]=x.useState(!1),l=n.is_master?Ps:yn;return r.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[r.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?r.jsx(xo,{size:14,className:"text-muted-fg"}):r.jsx(af,{size:14,className:"text-muted-fg"}),r.jsx(l,{size:14,className:n.is_master?"text-violet-400":"text-muted-fg"}),r.jsx("span",{className:"text-sm font-medium",children:n.slug}),n.role&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",n.role]})]}),s&&r.jsx("div",{className:"border-t border-border p-3",children:r.jsx(YC,{rows:8,load:()=>Jt.memory.get(e,n.slug).then(c=>c.body),save:c=>Jt.memory.put(e,n.slug,c).then(()=>{})})})]})}function OL({pid:e}){const n=Qe(`/projects/${e}/agents`,()=>Jt.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:_("project.memories.project_title"),description:_("project.memories.project_desc"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-indigo-600",children:r.jsx(Rd,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(YC,{rows:12,load:()=>na.memory.get(e).then(s=>s.body),save:s=>na.memory.put(e,s).then(()=>{}),placeholder:_("project.memories.project_ph")})})]})}),r.jsxs($e,{title:_("project.memories.agents_title"),description:_("project.memories.agents_desc"),children:[n.isLoading&&r.jsx(nt,{}),!n.isLoading&&(n.data?.length??0)===0&&r.jsx(it,{children:_("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(n.data||[]).map(s=>r.jsx(ML,{pid:e,agent:s},s.slug))})]})]})}function zL(e,n){var s,o=1;e==null&&(e=0),n==null&&(n=0);function l(){var c,d=s.length,f,p=0,m=0;for(c=0;c<d;++c)f=s[c],p+=f.x,m+=f.y;for(p=(p/d-e)*o,m=(m/d-n)*o,c=0;c<d;++c)f=s[c],f.x-=p,f.y-=m}return l.initialize=function(c){s=c},l.x=function(c){return arguments.length?(e=+c,l):e},l.y=function(c){return arguments.length?(n=+c,l):n},l.strength=function(c){return arguments.length?(o=+c,l):o},l}function DL(e){const n=+this._x.call(null,e),s=+this._y.call(null,e);return XC(this.cover(n,s),n,s,e)}function XC(e,n,s,o){if(isNaN(n)||isNaN(s))return e;var l,c=e._root,d={data:o},f=e._x0,p=e._y0,m=e._x1,g=e._y1,b,v,S,C,j,w,k,E;if(!c)return e._root=d,e;for(;c.length;)if((j=n>=(b=(f+m)/2))?f=b:m=b,(w=s>=(v=(p+g)/2))?p=v:g=v,l=c,!(c=c[k=w<<1|j]))return l[k]=d,e;if(S=+e._x.call(null,c.data),C=+e._y.call(null,c.data),n===S&&s===C)return d.next=c,l?l[k]=d:e._root=d,e;do l=l?l[k]=new Array(4):e._root=new Array(4),(j=n>=(b=(f+m)/2))?f=b:m=b,(w=s>=(v=(p+g)/2))?p=v:g=v;while((k=w<<1|j)===(E=(C>=v)<<1|S>=b));return l[E]=c,l[k]=d,e}function LL(e){var n,s,o=e.length,l,c,d=new Array(o),f=new Array(o),p=1/0,m=1/0,g=-1/0,b=-1/0;for(s=0;s<o;++s)isNaN(l=+this._x.call(null,n=e[s]))||isNaN(c=+this._y.call(null,n))||(d[s]=l,f[s]=c,l<p&&(p=l),l>g&&(g=l),c<m&&(m=c),c>b&&(b=c));if(p>g||m>b)return this;for(this.cover(p,m).cover(g,b),s=0;s<o;++s)XC(this,d[s],f[s],e[s]);return this}function PL(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var s=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(s))l=(s=Math.floor(e))+1,c=(o=Math.floor(n))+1;else{for(var d=l-s||1,f=this._root,p,m;s>e||e>=l||o>n||n>=c;)switch(m=(n<o)<<1|e<s,p=new Array(4),p[m]=f,f=p,d*=2,m){case 0:l=s+d,c=o+d;break;case 1:s=l-d,c=o+d;break;case 2:l=s+d,o=c-d;break;case 3:s=l-d,o=c-d;break}this._root&&this._root.length&&(this._root=f)}return this._x0=s,this._y0=o,this._x1=l,this._y1=c,this}function IL(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function BL(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Gn(e,n,s,o,l){this.node=e,this.x0=n,this.y0=s,this.x1=o,this.y1=l}function UL(e,n,s){var o,l=this._x0,c=this._y0,d,f,p,m,g=this._x1,b=this._y1,v=[],S=this._root,C,j;for(S&&v.push(new Gn(S,l,c,g,b)),s==null?s=1/0:(l=e-s,c=n-s,g=e+s,b=n+s,s*=s);C=v.pop();)if(!(!(S=C.node)||(d=C.x0)>g||(f=C.y0)>b||(p=C.x1)<l||(m=C.y1)<c))if(S.length){var w=(d+p)/2,k=(f+m)/2;v.push(new Gn(S[3],w,k,p,m),new Gn(S[2],d,k,w,m),new Gn(S[1],w,f,p,k),new Gn(S[0],d,f,w,k)),(j=(n>=k)<<1|e>=w)&&(C=v[v.length-1],v[v.length-1]=v[v.length-1-j],v[v.length-1-j]=C)}else{var E=e-+this._x.call(null,S.data),R=n-+this._y.call(null,S.data),N=E*E+R*R;if(N<s){var T=Math.sqrt(s=N);l=e-T,c=n-T,g=e+T,b=n+T,o=S.data}}return o}function HL(e){if(isNaN(g=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var n,s=this._root,o,l,c,d=this._x0,f=this._y0,p=this._x1,m=this._y1,g,b,v,S,C,j,w,k;if(!s)return this;if(s.length)for(;;){if((C=g>=(v=(d+p)/2))?d=v:p=v,(j=b>=(S=(f+m)/2))?f=S:m=S,n=s,!(s=s[w=j<<1|C]))return this;if(!s.length)break;(n[w+1&3]||n[w+2&3]||n[w+3&3])&&(o=n,k=w)}for(;s.data!==e;)if(l=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,l?(c?l.next=c:delete l.next,this):n?(c?n[w]=c:delete n[w],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(o?o[k]=s:this._root=s),this):(this._root=c,this)}function VL(e){for(var n=0,s=e.length;n<s;++n)this.remove(e[n]);return this}function qL(){return this._root}function $L(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function GL(e){var n=[],s,o=this._root,l,c,d,f,p;for(o&&n.push(new Gn(o,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!e(o=s.node,c=s.x0,d=s.y0,f=s.x1,p=s.y1)&&o.length){var m=(c+f)/2,g=(d+p)/2;(l=o[3])&&n.push(new Gn(l,m,g,f,p)),(l=o[2])&&n.push(new Gn(l,c,g,m,p)),(l=o[1])&&n.push(new Gn(l,m,d,f,g)),(l=o[0])&&n.push(new Gn(l,c,d,m,g))}return this}function FL(e){var n=[],s=[],o;for(this._root&&n.push(new Gn(this._root,this._x0,this._y0,this._x1,this._y1));o=n.pop();){var l=o.node;if(l.length){var c,d=o.x0,f=o.y0,p=o.x1,m=o.y1,g=(d+p)/2,b=(f+m)/2;(c=l[0])&&n.push(new Gn(c,d,f,g,b)),(c=l[1])&&n.push(new Gn(c,g,f,p,b)),(c=l[2])&&n.push(new Gn(c,d,b,g,m)),(c=l[3])&&n.push(new Gn(c,g,b,p,m))}s.push(o)}for(;o=s.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function YL(e){return e[0]}function XL(e){return arguments.length?(this._x=e,this):this._x}function KL(e){return e[1]}function QL(e){return arguments.length?(this._y=e,this):this._y}function jb(e,n,s){var o=new wb(n??YL,s??KL,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function wb(e,n,s,o,l,c){this._x=e,this._y=n,this._x0=s,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function ij(e){for(var n={data:e.data},s=n;e=e.next;)s=s.next={data:e.data};return n}var Yn=jb.prototype=wb.prototype;Yn.copy=function(){var e=new wb(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,o;if(!n)return e;if(!n.length)return e._root=ij(n),e;for(s=[{source:n,target:e._root=new Array(4)}];n=s.pop();)for(var l=0;l<4;++l)(o=n.source[l])&&(o.length?s.push({source:o,target:n.target[l]=new Array(4)}):n.target[l]=ij(o));return e};Yn.add=DL;Yn.addAll=LL;Yn.cover=PL;Yn.data=IL;Yn.extent=BL;Yn.find=UL;Yn.remove=HL;Yn.removeAll=VL;Yn.root=qL;Yn.size=$L;Yn.visit=GL;Yn.visitAfter=FL;Yn.x=XL;Yn.y=QL;function lo(e){return function(){return e}}function vr(e){return(e()-.5)*1e-6}function ZL(e){return e.x+e.vx}function WL(e){return e.y+e.vy}function JL(e){var n,s,o,l=1,c=1;typeof e!="function"&&(e=lo(e==null?1:+e));function d(){for(var m,g=n.length,b,v,S,C,j,w,k=0;k<c;++k)for(b=jb(n,ZL,WL).visitAfter(f),m=0;m<g;++m)v=n[m],j=s[v.index],w=j*j,S=v.x+v.vx,C=v.y+v.vy,b.visit(E);function E(R,N,T,M,O){var P=R.data,B=R.r,L=j+B;if(P){if(P.index>v.index){var D=S-P.x-P.vx,z=C-P.y-P.vy,H=D*D+z*z;H<L*L&&(D===0&&(D=vr(o),H+=D*D),z===0&&(z=vr(o),H+=z*z),H=(L-(H=Math.sqrt(H)))/H*l,v.vx+=(D*=H)*(L=(B*=B)/(w+B)),v.vy+=(z*=H)*L,P.vx-=D*(L=1-L),P.vy-=z*L)}return}return N>S+L||M<S-L||T>C+L||O<C-L}}function f(m){if(m.data)return m.r=s[m.data.index];for(var g=m.r=0;g<4;++g)m[g]&&m[g].r>m.r&&(m.r=m[g].r)}function p(){if(n){var m,g=n.length,b;for(s=new Array(g),m=0;m<g;++m)b=n[m],s[b.index]=+e(b,m,n)}}return d.initialize=function(m,g){n=m,o=g,p()},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(l=+m,d):l},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:lo(+m),p(),d):e},d}function eP(e){return e.index}function cj(e,n){var s=e.get(n);if(!s)throw new Error("node not found: "+n);return s}function tP(e){var n=eP,s=b,o,l=lo(30),c,d,f,p,m,g=1;e==null&&(e=[]);function b(w){return 1/Math.min(f[w.source.index],f[w.target.index])}function v(w){for(var k=0,E=e.length;k<g;++k)for(var R=0,N,T,M,O,P,B,L;R<E;++R)N=e[R],T=N.source,M=N.target,O=M.x+M.vx-T.x-T.vx||vr(m),P=M.y+M.vy-T.y-T.vy||vr(m),B=Math.sqrt(O*O+P*P),B=(B-c[R])/B*w*o[R],O*=B,P*=B,M.vx-=O*(L=p[R]),M.vy-=P*L,T.vx+=O*(L=1-L),T.vy+=P*L}function S(){if(d){var w,k=d.length,E=e.length,R=new Map(d.map((T,M)=>[n(T,M,d),T])),N;for(w=0,f=new Array(k);w<E;++w)N=e[w],N.index=w,typeof N.source!="object"&&(N.source=cj(R,N.source)),typeof N.target!="object"&&(N.target=cj(R,N.target)),f[N.source.index]=(f[N.source.index]||0)+1,f[N.target.index]=(f[N.target.index]||0)+1;for(w=0,p=new Array(E);w<E;++w)N=e[w],p[w]=f[N.source.index]/(f[N.source.index]+f[N.target.index]);o=new Array(E),C(),c=new Array(E),j()}}function C(){if(d)for(var w=0,k=e.length;w<k;++w)o[w]=+s(e[w],w,e)}function j(){if(d)for(var w=0,k=e.length;w<k;++w)c[w]=+l(e[w],w,e)}return v.initialize=function(w,k){d=w,m=k,S()},v.links=function(w){return arguments.length?(e=w,S(),v):e},v.id=function(w){return arguments.length?(n=w,v):n},v.iterations=function(w){return arguments.length?(g=+w,v):g},v.strength=function(w){return arguments.length?(s=typeof w=="function"?w:lo(+w),C(),v):s},v.distance=function(w){return arguments.length?(l=typeof w=="function"?w:lo(+w),j(),v):l},v}var nP={value:()=>{}};function KC(){for(var e=0,n=arguments.length,s={},o;e<n;++e){if(!(o=arguments[e]+"")||o in s||/[\s.]/.test(o))throw new Error("illegal type: "+o);s[o]=[]}return new Cd(s)}function Cd(e){this._=e}function aP(e,n){return e.trim().split(/^|\s+/).map(function(s){var o="",l=s.indexOf(".");if(l>=0&&(o=s.slice(l+1),s=s.slice(0,l)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:o}})}Cd.prototype=KC.prototype={constructor:Cd,on:function(e,n){var s=this._,o=aP(e+"",s),l,c=-1,d=o.length;if(arguments.length<2){for(;++c<d;)if((l=(e=o[c]).type)&&(l=sP(s[l],e.name)))return l;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++c<d;)if(l=(e=o[c]).type)s[l]=uj(s[l],e.name,n);else if(n==null)for(l in s)s[l]=uj(s[l],e.name,null);return this},copy:function(){var e={},n=this._;for(var s in n)e[s]=n[s].slice();return new Cd(e)},call:function(e,n){if((l=arguments.length-2)>0)for(var s=new Array(l),o=0,l,c;o<l;++o)s[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],o=0,l=c.length;o<l;++o)c[o].value.apply(n,s)},apply:function(e,n,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],l=0,c=o.length;l<c;++l)o[l].value.apply(n,s)}};function sP(e,n){for(var s=0,o=e.length,l;s<o;++s)if((l=e[s]).name===n)return l.value}function uj(e,n,s){for(var o=0,l=e.length;o<l;++o)if(e[o].name===n){e[o]=nP,e=e.slice(0,o).concat(e.slice(o+1));break}return s!=null&&e.push({name:n,value:s}),e}var Nl=0,Ji=0,qi=0,QC=1e3,Jd,ec,ef=0,po=0,zf=0,_c=typeof performance=="object"&&performance.now?performance:Date,ZC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function WC(){return po||(ZC(rP),po=_c.now()+zf)}function rP(){po=0}function $h(){this._call=this._time=this._next=null}$h.prototype=JC.prototype={constructor:$h,restart:function(e,n,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?WC():+s)+(n==null?0:+n),!this._next&&ec!==this&&(ec?ec._next=this:Jd=this,ec=this),this._call=e,this._time=s,Gh()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gh())}};function JC(e,n,s){var o=new $h;return o.restart(e,n,s),o}function oP(){WC(),++Nl;for(var e=Jd,n;e;)(n=po-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Nl}function dj(){po=(ef=_c.now())+zf,Nl=Ji=0;try{oP()}finally{Nl=0,iP(),po=0}}function lP(){var e=_c.now(),n=e-ef;n>QC&&(zf-=n,ef=e)}function iP(){for(var e,n=Jd,s,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(s=n._next,n._next=null,n=e?e._next=s:Jd=s);ec=e,Gh(o)}function Gh(e){if(!Nl){Ji&&(Ji=clearTimeout(Ji));var n=e-po;n>24?(e<1/0&&(Ji=setTimeout(dj,e-_c.now()-zf)),qi&&(qi=clearInterval(qi))):(qi||(ef=_c.now(),qi=setInterval(lP,QC)),Nl=1,ZC(dj))}}const cP=1664525,uP=1013904223,fj=4294967296;function dP(){let e=1;return()=>(e=(cP*e+uP)%fj)/fj}function fP(e){return e.x}function pP(e){return e.y}var mP=10,gP=Math.PI*(3-Math.sqrt(5));function hP(e){var n,s=1,o=.001,l=1-Math.pow(o,1/300),c=0,d=.6,f=new Map,p=JC(b),m=KC("tick","end"),g=dP();e==null&&(e=[]);function b(){v(),m.call("tick",n),s<o&&(p.stop(),m.call("end",n))}function v(j){var w,k=e.length,E;j===void 0&&(j=1);for(var R=0;R<j;++R)for(s+=(c-s)*l,f.forEach(function(N){N(s)}),w=0;w<k;++w)E=e[w],E.fx==null?E.x+=E.vx*=d:(E.x=E.fx,E.vx=0),E.fy==null?E.y+=E.vy*=d:(E.y=E.fy,E.vy=0);return n}function S(){for(var j=0,w=e.length,k;j<w;++j){if(k=e[j],k.index=j,k.fx!=null&&(k.x=k.fx),k.fy!=null&&(k.y=k.fy),isNaN(k.x)||isNaN(k.y)){var E=mP*Math.sqrt(.5+j),R=j*gP;k.x=E*Math.cos(R),k.y=E*Math.sin(R)}(isNaN(k.vx)||isNaN(k.vy))&&(k.vx=k.vy=0)}}function C(j){return j.initialize&&j.initialize(e,g),j}return S(),n={tick:v,restart:function(){return p.restart(b),n},stop:function(){return p.stop(),n},nodes:function(j){return arguments.length?(e=j,S(),f.forEach(C),n):e},alpha:function(j){return arguments.length?(s=+j,n):s},alphaMin:function(j){return arguments.length?(o=+j,n):o},alphaDecay:function(j){return arguments.length?(l=+j,n):+l},alphaTarget:function(j){return arguments.length?(c=+j,n):c},velocityDecay:function(j){return arguments.length?(d=1-j,n):1-d},randomSource:function(j){return arguments.length?(g=j,f.forEach(C),n):g},force:function(j,w){return arguments.length>1?(w==null?f.delete(j):f.set(j,C(w)),n):f.get(j)},find:function(j,w,k){var E=0,R=e.length,N,T,M,O,P;for(k==null?k=1/0:k*=k,E=0;E<R;++E)O=e[E],N=j-O.x,T=w-O.y,M=N*N+T*T,M<k&&(P=O,k=M);return P},on:function(j,w){return arguments.length>1?(m.on(j,w),n):m.on(j)}}}function xP(){var e,n,s,o,l=lo(-30),c,d=1,f=1/0,p=.81;function m(S){var C,j=e.length,w=jb(e,fP,pP).visitAfter(b);for(o=S,C=0;C<j;++C)n=e[C],w.visit(v)}function g(){if(e){var S,C=e.length,j;for(c=new Array(C),S=0;S<C;++S)j=e[S],c[j.index]=+l(j,S,e)}}function b(S){var C=0,j,w,k=0,E,R,N;if(S.length){for(E=R=N=0;N<4;++N)(j=S[N])&&(w=Math.abs(j.value))&&(C+=j.value,k+=w,E+=w*j.x,R+=w*j.y);S.x=E/k,S.y=R/k}else{j=S,j.x=j.data.x,j.y=j.data.y;do C+=c[j.data.index];while(j=j.next)}S.value=C}function v(S,C,j,w){if(!S.value)return!0;var k=S.x-n.x,E=S.y-n.y,R=w-C,N=k*k+E*E;if(R*R/p<N)return N<f&&(k===0&&(k=vr(s),N+=k*k),E===0&&(E=vr(s),N+=E*E),N<d&&(N=Math.sqrt(d*N)),n.vx+=k*S.value*o/N,n.vy+=E*S.value*o/N),!0;if(S.length||N>=f)return;(S.data!==n||S.next)&&(k===0&&(k=vr(s),N+=k*k),E===0&&(E=vr(s),N+=E*E),N<d&&(N=Math.sqrt(d*N)));do S.data!==n&&(R=c[S.data.index]*o/N,n.vx+=k*R,n.vy+=E*R);while(S=S.next)}return m.initialize=function(S,C){e=S,s=C,g()},m.strength=function(S){return arguments.length?(l=typeof S=="function"?S:lo(+S),g(),m):l},m.distanceMin=function(S){return arguments.length?(d=S*S,m):Math.sqrt(d)},m.distanceMax=function(S){return arguments.length?(f=S*S,m):Math.sqrt(f)},m.theta=function(S){return arguments.length?(p=S*S,m):Math.sqrt(p)},m}const $i={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"},pj={agent:"agente",memory:"memoria",thread:"thread",task:"task",routine:"rutina",agentlink:"jerarquía"},Gi=760,Fi=460;function bP({center:e,nodes:n}){const s=x.useRef(null),o=x.useRef(null),l=x.useRef([]),c=x.useRef([]),d=x.useRef(null),[,f]=x.useState(0),[p,m]=x.useState(null);x.useEffect(()=>{const w={id:"__center",label:e,kind:"agent",relation:"self",x:Gi/2,y:Fi/2,fx:Gi/2,fy:Fi/2},k=[w,...n.map(N=>({...N}))],E=k.slice(1).map(N=>({source:w,target:N}));l.current=k,c.current=E;const R=hP(k).force("link",tP(E).distance(120).strength(.5)).force("charge",xP().strength(-220)).force("center",zL(Gi/2,Fi/2).strength(.05)).force("collide",JL(26)).on("tick",()=>f(N=>N+1));return o.current=R,()=>{R.stop()}},[e,n]);const g=w=>{const k=s.current.getBoundingClientRect();return{x:(w.clientX-k.left)/k.width*Gi,y:(w.clientY-k.top)/k.height*Fi}},b=w=>k=>{w.id!=="__center"&&(d.current=w,k.target.setPointerCapture?.(k.pointerId),o.current?.alphaTarget(.3).restart())},v=w=>{const k=d.current;if(!k)return;const{x:E,y:R}=g(w);k.fx=E,k.fy=R},S=()=>{const w=d.current;w&&(w.fx=null,w.fy=null),d.current=null,o.current?.alphaTarget(0)},C=l.current,j=c.current;return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:r.jsxs("svg",{ref:s,viewBox:`0 0 ${Gi} ${Fi}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:v,onPointerUp:S,onPointerLeave:S,children:[j.map((w,k)=>r.jsx("line",{x1:w.source.x,y1:w.source.y,x2:w.target.x,y2:w.target.y,stroke:$i[w.target.kind],strokeOpacity:.22,strokeWidth:1.5},k)),C.map(w=>{if(w.id==="__center")return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,children:[r.jsx("circle",{r:22,fill:$i.agent}),r.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},w.id);const k=p?.id===w.id;return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(w),onClick:()=>m(w),children:[r.jsx("circle",{r:k?9:6,fill:$i[w.kind],fillOpacity:k?1:.9,stroke:k?"#fff":"none",strokeWidth:k?2:0}),r.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:w.label.length>22?`${w.label.slice(0,22)}…`:w.label})]},w.id)})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[Object.keys(pj).filter(w=>w!=="agent").map(w=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:$i[w]}})," ",pj[w]]},w)),r.jsxs("span",{className:"ml-auto",children:[n.length," nodos · arrastrá para reacomodar"]})]}),p&&r.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:$i[p.kind]}}),r.jsx("span",{className:"font-medium",children:p.label}),r.jsxs("span",{className:"text-muted-fg",children:["· ",p.relation]})]}),p.detail&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:p.detail})]})]})}function vP(){return[{key:"overview",label:"Explorer",icon:rf},{key:"memories",label:_("project.nav.memories"),icon:Rd},{key:"records",label:_("project.agent_detail.records_title"),icon:Dw},{key:"sleep",label:_("project.agent_detail.sleep_title"),icon:vl},{key:"brain",label:_("project.agent_detail.brain_title"),icon:Ol},{key:"config",label:_("settings.tabs.advanced"),icon:Od}]}const yP=[{value:"",label:"— sin tipo —"},{value:"orchestrator",label:"Orchestrator",description:"Coordina al equipo y delega."},{value:"specialist",label:"Specialist",description:"Experto en un dominio; ejecuta tareas."},{value:"assistant",label:"Assistant",description:"Ayudante conversacional."},{value:"worker",label:"Worker",description:"Corre tareas autónomas."},{value:"monitor",label:"Monitor",description:"Observa estado y reporta."}],Fh=e=>e.split(",").map(n=>n.trim()).filter(Boolean),_P=(e,n)=>e.filter(s=>s.spec?.agent===n||n==="super-agent"&&s.kind==="super_agent");function jP(e){return e.split(`
596
+ `).map(n=>n.replace(/^[-*#>\s]+/,"").trim()).filter(n=>n.length>2&&!n.startsWith("```")).slice(0,12)}function wP({pid:e}){const{slug:n=""}=Sw(),s=La(),[o,l]=x.useState("overview"),c=vP(),d=Qe(`/projects/${e}/agents/${n}`,()=>Jt.get(e,n)),f=Qe(`/projects/${e}/agents`,()=>Jt.list(e)),p=Qe(`/projects/${e}/routines`,()=>gr.list(e)),m=Qe(`/projects/${e}/messages?agent=${n}`,()=>zh.project(e,{agent:n,limit:200})),g=Qe(`/projects/${e}/agents/${n}/conversations`,()=>Qx.list(e,n)),b=Qe(`/projects/${e}/tasks?all`,()=>hr.list(e,"all")),v=d.data,S=_P(p.data||[],n),C=(b.data||[]).filter(k=>k.agent===n),j=(f.data||[]).filter(k=>k.parent===n);if(d.isLoading)return r.jsx(nt,{});if(!v)return r.jsx("div",{className:"text-sm text-muted-fg",children:_("project.agent_detail.not_found")});const w=v.is_master?Ps:yn;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:r.jsx(jT,{size:16})}),r.jsx("div",{className:Me("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",v.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:r.jsx(w,{className:"size-5 text-white"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-lg font-semibold",children:v.slug}),v.is_master&&r.jsxs(Ge,{tone:"success",children:[r.jsx(Ps,{size:10})," ",_("project.agents.orchestrator")]}),v.role&&r.jsx(Ge,{children:v.role}),v.model&&r.jsx(Ge,{tone:"info",children:v.model}),v.parent&&r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${v.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[_("project.agent_detail.reports_to")," ",v.parent]})]}),v.description&&r.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:v.description})]})]}),r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${n}`),children:[r.jsx(rs,{size:13})," ",_("project.agent_detail.chat_btn",{slug:v.slug})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:k,label:E,icon:R})=>r.jsxs("button",{onClick:()=>l(k),className:Me("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===k?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[r.jsx(R,{size:14})," ",E]},k))}),o==="overview"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(fd,{label:"Threads",value:g.data?.length??0,icon:nc}),r.jsx(fd,{label:"Records",value:m.data?.length??0,icon:Dw}),r.jsx(fd,{label:"Tasks",value:C.length,icon:rf}),r.jsx(fd,{label:"Heartbeats",value:S.length,icon:vl})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx($e,{title:_("agent_detail_extra.skills_title"),description:"",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.skills?.map(k=>r.jsxs(Ge,{tone:"info",children:[r.jsx(Ol,{size:10})," ",k]},k)),v.tools?.map(k=>r.jsxs(Ge,{children:[r.jsx(zl,{size:10})," ",k]},k)),!v.skills?.length&&!v.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx($e,{title:_("project.agent_detail.threads_recent"),description:"",children:r.jsxs("ul",{className:"space-y-1 text-xs",children:[(g.data||[]).slice(0,6).map(k=>r.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[r.jsx("span",{className:"truncate",children:k.title||k.filename}),r.jsxs("span",{className:"shrink-0 text-muted-fg",children:[k.messages??0," ",_("project.agent_detail.msgs_count")]})]},k.id)),!g.data?.length&&r.jsx("li",{className:"text-muted-fg",children:_("project.agent_detail.no_threads")})]})})]}),j.length>0&&r.jsx($e,{title:_("project.agent_detail.subagents"),description:_("project.agent_detail.subagents_desc"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:j.map(k=>r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${k.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[r.jsx(yn,{size:14,className:"text-muted-fg"})," ",k.slug]},k.slug))})})]}),o==="memories"&&r.jsx(CP,{pid:e,slug:n,initial:v.memory||"",onSaved:()=>d.mutate()}),o==="records"&&r.jsx(kP,{records:m.data||[],loading:m.isLoading}),o==="sleep"&&r.jsx(EP,{routines:S}),o==="brain"&&r.jsx(RP,{slug:n,memory:v.memory||"",threads:(g.data||[]).map(k=>({id:k.id,label:k.title||k.filename})),tasks:C.map(k=>({id:k.id,label:k.title,detail:k.body||void 0})),routines:S,parent:v.parent||null,children:j.map(k=>k.slug)}),o==="config"&&r.jsx(SP,{pid:e,agent:v,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),s(`/p/${e}/agents`)}})]})}function SP({pid:e,agent:n,agents:s,onSaved:o,onDeleted:l}){const c=st(),[d,f]=x.useState(n.type||""),[p,m]=x.useState(n.area||""),[g,b]=x.useState(n.role||""),[v,S]=x.useState(n.model||""),[C,j]=x.useState(n.parent||""),[w,k]=x.useState(!!n.is_master),[E,R]=x.useState((n.skills||[]).join(", ")),[N,T]=x.useState((n.tools||[]).join(", ")),[M,O]=x.useState(n.description||""),[P,B]=x.useState(n.system||""),[L,D]=x.useState(!1),z=async()=>{D(!0);try{await Jt.update(e,n.slug,{type:d||null,area:p||null,role:g||null,model:v||null,parent:C||null,is_master:w||d==="orchestrator",skills:Fh(E),tools:Fh(N),description:M||null,system:P}),c.success(_("project.agent_detail.update_success")),o()}catch(q){c.error(q.message)}finally{D(!1)}},H=async()=>{if(confirm(_("project.agent_detail.delete_confirm",{slug:n.slug})))try{await Jt.remove(e,n.slug),c.success(_("project.agent_detail.delete_success")),l()}catch(q){c.error(q.message)}};return r.jsx($e,{title:_("project.agent_detail.config_title"),description:`.apc/agents/${n.slug}.md — definición (frontmatter + system prompt).`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.agent_detail.type_label"),children:r.jsx(wt,{value:d,onChange:f,options:yP})}),r.jsx(de,{label:_("project.agent_detail.area_label"),hint:_("project.agent_detail.area_hint"),children:r.jsx(Ee,{value:p,onChange:q=>m(q.target.value),placeholder:_("project.agent_detail.area_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("project.agent_detail.role_label"),children:r.jsx(Ee,{value:g,onChange:q=>b(q.target.value),placeholder:"Operations Lead"})}),r.jsx(de,{label:_("project.agent_detail.parent_label"),children:r.jsx(wt,{value:C,onChange:j,placeholder:_("project.agent_detail.none_parent"),options:[{value:"",label:_("project.agent_detail.none_parent")},...s.filter(q=>q.slug!==n.slug).map(q=>({value:q.slug,label:q.slug}))]})})]}),r.jsx(de,{label:_("project.agent_detail.model_label"),hint:_("project.agent_detail.model_hint"),children:r.jsx(Ee,{value:v,onChange:q=>S(q.target.value),placeholder:_("project.agent_detail.model_ph")})}),r.jsx(de,{label:_("project.agent_detail.skills_label"),children:r.jsx(Ee,{value:E,onChange:q=>R(q.target.value),placeholder:"skill-a, skill-b"})}),r.jsx(NP,{value:N,onChange:T}),r.jsx(de,{label:_("project.agent_detail.bio_label"),children:r.jsx(ln,{rows:2,value:M,onChange:q=>O(q.target.value)})}),r.jsx(de,{label:_("project.agent_detail.system_label"),hint:_("project.agent_detail.system_hint"),children:r.jsx(ln,{rows:10,className:"font-mono text-xs",value:P,onChange:q=>B(q.target.value),placeholder:"You are…"})}),r.jsx(en,{checked:w,onChange:k,label:_("project.agent_detail.master_label")}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[r.jsxs(me,{variant:"destructive",onClick:H,children:[r.jsx(la,{size:13})," ",_("project.agent_detail.delete_btn")]}),r.jsxs(me,{variant:"primary",loading:L,onClick:z,children:[r.jsx(lf,{size:13})," ",_("project.agent_detail.save_btn")]})]})]})})}function fd({label:e,value:n,icon:s}){return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(s,{size:13})," ",e]}),r.jsx("div",{className:"mt-1 text-2xl font-semibold",children:n})]})}function CP({pid:e,slug:n,initial:s,onSaved:o}){const l=st(),[c,d]=x.useState(s),[f,p]=x.useState(!1);x.useEffect(()=>{d(s)},[s]);const m=c!==s,g=async()=>{p(!0);try{await Jt.memory.put(e,n,c),l.success(_("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{p(!1)}};return r.jsxs($e,{title:_("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${n}/memory.md — hechos durables que el agente recuerda.`,children:[r.jsx(ln,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>d(b.target.value),placeholder:_("project.agent_detail.memory_empty")}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",_("project.memories.chars")]}),r.jsxs(me,{size:"sm",variant:"primary",loading:f,disabled:!m,onClick:g,children:[r.jsx(lf,{size:12})," ",_("project.memories.save_btn")]})]})]})}function kP({records:e,loading:n}){const s=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs($e,{title:_("project.agent_detail.records_title"),description:_("project.agent_detail.records_desc"),children:[n&&r.jsx(nt,{}),!n&&s.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:_("project.agent_detail.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:s.map((o,l)=>r.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?r.jsx(Lw,{size:13,className:"text-blue-400"}):r.jsx(Iw,{size:13,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),r.jsx(Ge,{tone:"info",children:o.channel}),o.type&&r.jsx(Ge,{children:o.type})]}),o.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:o.body.length>400?`${o.body.slice(0,400)}…`:o.body})]})]},`${o.ts}-${l}`))})]})}function EP({routines:e}){return e.length===0?r.jsx($e,{title:_("project.agent_detail.sleep_title"),description:_("project.agent_detail.sleep_desc"),children:r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[r.jsx("div",{className:"font-medium text-amber-400",children:_("project.agent_detail.sleep_deep")}),r.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:_("project.agent_detail.sleep_deep_desc")})]})}):r.jsx($e,{title:_("project.agent_detail.sleep_title"),description:_("project.agent_detail.sleep_desc"),children:r.jsx("div",{className:"space-y-3",children:e.map(n=>{const s=n.enabled,o=n.last_status==="error";return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Me("size-2 rounded-full",o?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),r.jsx("span",{className:"text-sm font-medium",children:n.name}),r.jsx(Ge,{tone:s?"success":"muted",children:s?"running":"paused"}),o&&r.jsx(Ge,{tone:"danger",children:"last: error"})]}),r.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[r.jsx(pd,{label:"Tick",value:n.schedule}),r.jsx(pd,{label:"Next tick",value:n.next_run_at?new Date(n.next_run_at).toLocaleString():"—"}),r.jsx(pd,{label:"Last tick",value:n.last_run_at?new Date(n.last_run_at).toLocaleString():"—"}),r.jsx(pd,{label:"Last run",value:n.last_status||"—"})]}),n.last_error&&r.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:n.last_error})]},n.name)})})})}function pd({label:e,value:n}){return r.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:n})]})}function NP({value:e,onChange:n}){const s=Qe("/tools",()=>rO.list()),o=Fh(e),l=s.data||[],c=f=>{const p=new Set(o);p.has(f)?p.delete(f):p.add(f),n([...p].join(", "))},d=o.filter(f=>!l.some(p=>p.name===f));return r.jsxs(de,{label:"Tools",hint:_("project.agent_detail.tools_hint"),children:[r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(f=>{const p=o.includes(f.name);return r.jsx("button",{type:"button",title:f.description||f.name,onClick:()=>c(f.name),className:Me("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",p?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f.name},f.name)}),d.map(f=>r.jsxs("button",{type:"button",onClick:()=>c(f),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[f," ✕"]},f))]}),r.jsx(Ee,{className:"mt-2",value:e,onChange:f=>n(f.target.value),placeholder:_("project.agent_detail.tools_custom_ph")})]})}function RP({slug:e,memory:n,threads:s,tasks:o,routines:l,parent:c,children:d}){const f=x.useMemo(()=>{const p=[];return jP(n).forEach((m,g)=>p.push({id:`m${g}`,label:m,kind:"memory",relation:"knows",detail:m})),s.slice(0,8).forEach(m=>p.push({id:`th-${m.id}`,label:m.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(m=>p.push({id:`ts-${m.id}`,label:m.label,kind:"task",relation:"handles_task",detail:m.detail})),l.forEach(m=>p.push({id:`rt-${m.name}`,label:m.name,kind:"routine",relation:"ticks",detail:`schedule: ${m.schedule}`})),c&&p.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),d.forEach(m=>p.push({id:`c-${m}`,label:m,kind:"agentlink",relation:"orchestrates"})),p},[n,s,o,l,c,d]);return r.jsx($e,{title:_("project.agent_detail.brain_title"),description:_("project.agent_detail.brain_desc"),children:f.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:_("project.agent_detail.brain_empty")}):r.jsx(bP,{center:e,nodes:f})})}function TP(){const e=La(),n=oa(),{pid:s=""}=Sw(),{project:o}=Zx(s),{collapsed:l,toggle:c}=uC(Rn.sidebarCollapsed+".project"),d=String(s)==="0",f=x.useMemo(()=>d?[{title:_("base.nav_general"),items:[{key:"",label:"Dashboard",icon:KT},{key:"workspaces",label:_("base.workspaces_title"),icon:ST},{key:"models",label:_("settings.tabs.engines"),icon:lx},{key:"agent-defaults",label:_("base.defaults_title"),icon:yn}]},{title:_("base.nav_activity"),items:[{key:"chat",label:_("project.nav.chat"),icon:nc},{key:"sessions",label:_("base.sessions_title"),icon:FT},{key:"tasks",label:_("project.nav.tasks"),icon:fc},{key:"logs",label:_("project.nav.logs"),icon:Md}]},{title:_("base.nav_system"),items:[{key:"agents",label:_("project.nav.agents"),icon:yn},{key:"memories",label:_("project.nav.memories"),icon:Rd},{key:"routines",label:_("project.nav.routines"),icon:vl},{key:"mcps",label:_("project.nav.mcps"),icon:fh},{key:"vars",label:_("project.nav.vars"),icon:dh},{key:"config",label:_("project.nav.config"),icon:Od}]}]:[{title:_("project.sections.workspace"),items:[{key:"",label:_("project.nav.overview"),icon:Vw},{key:"telegram",label:_("project.nav.telegram"),icon:rs},{key:"chat",label:_("project.nav.chat"),icon:nc},{key:"threads",label:_("project.nav.threads"),icon:nc},{key:"agents",label:_("project.nav.agents"),icon:yn},{key:"memories",label:_("project.nav.memories"),icon:Rd}]},{title:_("project.sections.automation"),items:[{key:"routines",label:_("project.nav.routines"),icon:vl},{key:"tasks",label:_("project.nav.tasks"),icon:fc},{key:"mcps",label:_("project.nav.mcps"),icon:fh},{key:"vars",label:_("project.nav.vars"),icon:dh},{key:"logs",label:_("project.nav.logs"),icon:Md}]},{title:_("project.sections.config"),items:[{key:"config",label:_("project.nav.config"),icon:Od}]}],[d]),p=n.pathname.replace(`/p/${s}`,"").replace(/^\//,"").split("/")[0];if(!o)return r.jsx("div",{className:"p-8 text-muted-fg",children:_("project.not_found",{pid:s})});const m=g=>{const b=g?`/p/${s}/${g}`:`/p/${s}`;e(b)};return r.jsx(xC,{sections:f,active:p,onChange:m,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${p||"overview"}`,children:r.jsxs(Nw,{children:[r.jsx($t,{index:!0,element:r.jsx(F_,{pid:s})}),r.jsx($t,{path:"workspaces",element:r.jsx(Gz,{})}),r.jsx($t,{path:"models",element:r.jsx(OC,{})}),r.jsx($t,{path:"agent-defaults",element:r.jsx(e6,{})}),r.jsx($t,{path:"sessions",element:r.jsx(s6,{})}),r.jsx($t,{path:"logs",element:r.jsx(qD,{pid:s})}),r.jsx($t,{path:"config",element:r.jsx(C6,{pid:s})}),r.jsx($t,{path:"telegram",element:r.jsx(AL,{pid:s})}),r.jsx($t,{path:"agents",element:r.jsx(T6,{pid:s})}),r.jsx($t,{path:"agents/:slug",element:r.jsx(wP,{pid:s})}),r.jsx($t,{path:"memories",element:r.jsx(OL,{pid:s})}),r.jsx($t,{path:"routines",element:r.jsx(B6,{pid:s})}),r.jsx($t,{path:"tasks",element:d?r.jsx(r6,{}):r.jsx(H6,{pid:s})}),r.jsx($t,{path:"mcps",element:r.jsx(J6,{pid:s})}),r.jsx($t,{path:"vars",element:r.jsx(rL,{pid:s})}),r.jsx($t,{path:"threads",element:r.jsx(lL,{pid:s})}),r.jsx($t,{path:"chat",element:r.jsx(RL,{pid:s})}),r.jsx($t,{path:"*",element:r.jsx(F_,{pid:s})})]})})}const AP=["es","en","pt","fr","it","de"];function MP(){const e=st(),{identity:n,isLoading:s,save:o}=Jx(),[l,c]=x.useState({}),[d,f]=x.useState(!1);if(x.useEffect(()=>{c(n)},[n]),s)return r.jsx(nt,{});const p=async()=>{f(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(_("settings.identity.saved"))}catch(m){e.error(m.message)}finally{f(!1)}};return r.jsxs($e,{title:_("settings.identity.title"),description:_("settings.identity.subtitle"),children:[n?null:r.jsx(it,{children:_("common.none_yet")}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("settings.identity.owner_name"),children:r.jsx(Ee,{value:l.owner_name||"",onChange:m=>c({...l,owner_name:m.target.value})})}),r.jsx(de,{label:_("settings.identity.language"),children:r.jsx(wt,{value:l.language||"es",onChange:m=>c({...l,language:m}),options:AP.map(m=>({value:m,label:m}))})}),r.jsx(de,{label:_("settings.identity.timezone"),hint:"ej. America/Argentina/Buenos_Aires",children:r.jsx(Ee,{value:l.timezone||"",onChange:m=>c({...l,timezone:m.target.value})})})]}),r.jsx("div",{className:"mt-3",children:r.jsx(de,{label:_("settings.identity.owner_context"),hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",children:r.jsx(ln,{rows:3,value:l.owner_context||"",onChange:m=>c({...l,owner_context:m.target.value})})})}),r.jsx("div",{className:"mt-4",children:r.jsx(me,{variant:"primary",loading:d,onClick:p,children:_("common.save")})})]})}function OP(){const e=st(),n=La(),{superAgent:s,isLoading:o,mutate:l}=AC(),{patch:c}=Or(),{identity:d,save:f}=Jx(),[p,m]=x.useState(!0),[g,b]=x.useState(""),[v,S]=x.useState(""),[C,j]=x.useState("permiso"),[w,k]=x.useState(!1);if(x.useEffect(()=>{s&&(m(!!s.enabled),b(s.system||""),j(s.permission_mode||"permiso"))},[s]),x.useEffect(()=>{S(d.personality||"")},[d.personality]),o||!s)return r.jsx(nt,{});const E=async()=>{k(!0);try{await c({"super_agent.enabled":p,"super_agent.system":g,"super_agent.permission_mode":C},["super_agent.name"]),await f({personality:v}),e.success(_("settings.super_agent.saved")),l()}catch(R){e.error(R.message)}finally{k(!1)}};return r.jsx($e,{title:_("settings.super_agent.title"),description:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos.",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(en,{checked:p,onChange:m,label:"Super-agente habilitado"})}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:"Modelo activo (router)"}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:()=>n("/p/0/models"),children:[r.jsx(lx,{size:13})," Configurar en Modelos"]})]}),r.jsx(de,{label:_("settings.super_agent.permission_mode"),children:r.jsx(wt,{value:C,onChange:j,options:dx.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:_("settings.super_agent.personality"),children:r.jsx(ln,{rows:2,value:v,onChange:R=>S(R.target.value)})}),r.jsx(de,{label:_("settings.super_agent.system"),hint:_("settings.super_agent.system_hint"),children:r.jsx(ln,{rows:6,className:"font-mono text-xs",value:g,onChange:R=>b(R.target.value),placeholder:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)"})}),r.jsx(me,{variant:"primary",loading:w,onClick:E,children:_("common.save")})]})})}const Og={providers:()=>ge.get("/embeddings/providers"),test:(e={})=>ge.post("/embeddings/test",e),reindex:()=>ge.post("/embeddings/reindex",{})},zP=[{value:"auto",label:"Automático (cadena: Ollama → Gemini → OpenAI → offline)"},{value:"ollama",label:"Ollama — local, sin API key (nomic-embed-text)"},{value:"gemini",label:"Gemini — free tier con key (text-embedding-004)"},{value:"openai",label:"OpenAI — text-embedding-3-small (cloud)"},{value:"tf",label:"Offline (term-frequency, sin modelo — degradado)"}],DP=[{value:"chain",label:"Cadena (fallback automático)"},{value:"single",label:"Único (usa solo el elegido)"}],mj=e=>e.startsWith("***");function LP(){const e=st(),{config:n,isLoading:s,patch:o}=Or(),{data:l,mutate:c}=Qe("/embeddings/providers",()=>Og.providers()),[d,f]=x.useState(!1),[p,m]=x.useState(null);if(s)return r.jsx(nt,{});const b=(n.memory||{}).embeddings||{},v=l?.configured_provider||b.provider||"auto",S=l?.mode||b.mode||"chain",C=l?.engines||[],j=async E=>{f(!0);try{await o(E),await c()}catch(R){e.error(`No se pudo guardar: ${R.message}`)}finally{f(!1)}},w=async()=>{f(!0),m(null);try{const E=await Og.test({});m(`${E.embedder} · dim ${E.dim} · ${E.ms}ms`),e.success(`Embedding OK con ${E.embedder}`)}catch(E){e.error(`Falló el test: ${E.message}`)}finally{f(!1)}},k=async()=>{f(!0);try{const E=await Og.reindex();e.success(`Reindexado: ${E.indexed} chunks (limpiados ${E.cleared}).`)}catch(E){e.error(`Falló el reindex: ${E.message}`)}finally{f(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:_("memory_panel.embeddings_title"),description:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí proveedor y modelo. 'Automático' prueba local primero y cae al offline si no hay nada.",children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"Proveedor",hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de acá abajo).",children:r.jsx(wt,{value:v,onChange:E=>j({"memory.embeddings.provider":E}),options:zP,disabled:d,className:"max-w-xl"})}),r.jsx(de,{label:"Modo de selección",hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",children:r.jsx(wt,{value:S,onChange:E=>j({"memory.embeddings.mode":E}),options:DP,disabled:d,className:"max-w-md"})}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:C.map(E=>r.jsxs(Ge,{tone:E.available?"success":"muted",children:[E.id,": ",E.available?"disponible":"no disp."]},E.id))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(me,{variant:"secondary",onClick:w,loading:d,children:[r.jsx(Ol,{size:14})," Probar embedding"]}),r.jsxs(me,{variant:"secondary",onClick:k,loading:d,children:[r.jsx(Uw,{size:14})," Reindexar memoria"]}),p&&r.jsx("span",{className:"text-sm text-muted-foreground",children:p})]})]})}),r.jsxs($e,{title:_("memory_panel.ollama_title"),description:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",children:[r.jsx(de,{label:"Modelo",children:r.jsx(Ee,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:E=>{const R=E.target.value.trim();R&&R!==b.ollama?.model&&j({"memory.embeddings.ollama.model":R})},className:"max-w-md"})}),r.jsx(de,{label:"Base URL",hint:"Vacío usa engines.ollama.base_url (por defecto http://localhost:11434).",children:r.jsx(Ee,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:E=>j({"memory.embeddings.ollama.base_url":E.target.value.trim()}),className:"max-w-md"})})]}),r.jsxs($e,{title:_("memory_panel.openai_title"),description:"text-embedding-3-small (1536 dims) u otro modelo compatible.",children:[r.jsx(de,{label:"Modelo",children:r.jsx(Ee,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:E=>{const R=E.target.value.trim();R&&R!==b.openai?.model&&j({"memory.embeddings.openai.model":R})},className:"max-w-md"})}),r.jsx(de,{label:"API key",hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para no tocar la guardada.",children:r.jsx(Ee,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:E=>{const R=E.target.value;R&&!mj(R)&&j({"memory.embeddings.openai.api_key":R})},className:"max-w-md"})})]}),r.jsxs($e,{title:_("memory_panel.gemini_title"),description:"text-embedding-004 (768 dims). Free tier con API key de Google.",children:[r.jsx(de,{label:"Modelo",children:r.jsx(Ee,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:E=>{const R=E.target.value.trim();R&&R!==b.gemini?.model&&j({"memory.embeddings.gemini.model":R})},className:"max-w-md"})}),r.jsx(de,{label:"API key",hint:"Vacío reusa engines.gemini.api_key.",children:r.jsx(Ee,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:E=>{const R=E.target.value;R&&!mj(R)&&j({"memory.embeddings.gemini.api_key":R})},className:"max-w-md"})})]})]})}function PP(){const e=st(),{config:n,isLoading:s,patch:o,mutate:l}=Or(),c=n.telegram?.channels||[],d=Math.max(0,c.findIndex(T=>T.name==="default")),f=c[d],[p,m]=x.useState(!0),[g,b]=x.useState(1500),[v,S]=x.useState(!0),[C,j]=x.useState(""),[w,k]=x.useState(""),[E,R]=x.useState(!1);if(x.useEffect(()=>{m(!!n.telegram?.enabled),b(Number(n.telegram?.poll_interval_ms||1500)),S(!!n.telegram?.respond_with_engine),j(""),k(f?.chat_id||"")},[n,f?.chat_id]),s)return r.jsx(nt,{});const N=async()=>{R(!0);try{const T=c.slice(),M={name:"default",chat_id:w,respond_with_engine:v,...C?{bot_token:C}:{}};c.length===0?T.push(M):T[d]={...f,...M},await o({"telegram.enabled":p,"telegram.poll_interval_ms":g,"telegram.respond_with_engine":v,"telegram.channels":T}),e.success(_("settings.telegram_global.saved")),l(),j("")}catch(T){e.error(T.message)}finally{R(!1)}};return r.jsx($e,{title:_("settings.telegram_global.title"),description:_("settings.telegram_global.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(en,{checked:p,onChange:m,label:_("settings.telegram_global.enabled")}),r.jsx(en,{checked:v,onChange:S,label:_("settings.telegram_global.respond_with_engine")})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("settings.telegram_global.bot_token"),hint:f?.bot_token?`…${kl(f.bot_token)??""} (seteado — escribí para reemplazar)`:"Token del BotFather.",children:r.jsx(Ee,{type:"password",value:C,onChange:T=>j(T.target.value),placeholder:f?.bot_token?`…${kl(f.bot_token)??""} (ya seteado)`:""})}),r.jsx(de,{label:_("settings.telegram_global.chat_id"),children:r.jsx(Ee,{value:w,onChange:T=>k(T.target.value),placeholder:"889721252"})}),r.jsx(de,{label:_("settings.telegram_global.poll_interval"),children:r.jsx(Ee,{type:"number",value:String(g),onChange:T=>b(Number(T.target.value)||1500)})})]}),r.jsx(me,{variant:"primary",loading:E,onClick:N,children:_("common.save")})]})})}function IP(){const e=st(),{channels:n,isLoading:s,mutate:o}=lb(),{contacts:l}=ib(),[c,d]=x.useState(null),[f,p]=x.useState(null),m=new Map;for(const b of l)m.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const g=async b=>{if(confirm(_("telegram_channels.delete_confirm",{name:b})))try{await An.channels.remove(b),e.success(_("telegram_channels.removed")),o()}catch(v){e.error(v.message)}};return r.jsxs($e,{title:_("telegram_channels.title"),description:_("telegram_channels.desc"),action:r.jsxs(me,{size:"sm",onClick:()=>d({name:""}),children:[r.jsx(un,{size:14})," ",_("telegram_channels.new_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(it,{children:_("telegram_channels.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:n.map(b=>{const v=b.owner_user_id!=null?m.get(String(b.owner_user_id))||`user_id ${b.owner_user_id}`:_("telegram_channels.no_owner");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:b.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&r.jsxs(Ge,{tone:"success",children:["project = ",b.project]}),r.jsxs(me,{size:"sm",variant:"ghost",onClick:()=>p(b),children:[r.jsx(rs,{size:13})," ",_("admin.telegram_send_test")]}),r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>d(b),children:_("common.edit")}),r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>g(b.name),children:_("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),r.jsxs("span",{children:["bot_token: ",b.bot_token?`…${kl(b.bot_token)??""}`:"—"]}),r.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",b.respond_with_engine?"sí":"no"]}),r.jsxs("span",{className:"col-span-2",children:[_("telegram_channels.owner_label")," ",v]})]})]},b.name)})}),r.jsx(lC,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),o()}}),r.jsx(iC,{channel:f,onClose:()=>p(null)})]})}const gj=new Set(["owner","guest"]);function BP(){const e=st(),{roles:n,mutate:s,isLoading:o}=ib(),[l,c]=x.useState(""),[d,f]=x.useState(""),[p,m]=x.useState(!1),[g,b]=x.useState(!1),v=async()=>{const j=l.trim();if(!j){e.error(_("telegram_roles.name_required"));return}if(gj.has(j)){e.error(_("telegram_roles.builtin_error",{name:j}));return}b(!0);try{const w=p?"*":d.split(",").map(k=>k.trim()).filter(Boolean);await An.roles.set(j,w),e.success(_("telegram_roles.saved",{name:j})),c(""),f(""),m(!1),s()}catch(w){e.error(w.message)}finally{b(!1)}},S=async j=>{if(confirm(_("telegram_roles.delete_confirm",{name:j})))try{await An.roles.remove(j),e.success(_("telegram_roles.removed")),s()}catch(w){e.error(w.message)}},C=Object.entries(n);return r.jsxs($e,{title:_("telegram_roles.title"),description:_("telegram_roles.desc"),children:[o&&r.jsx(nt,{}),C.length===0&&!o&&r.jsx(it,{children:_("telegram_roles.empty")}),C.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:C.map(([j,w])=>{const k=gj.has(j),E=w?.tools==="*"?_("telegram_roles.tools_all"):Array.isArray(w?.tools)&&w.tools.length>0?w.tools.join(", "):_("telegram_roles.tools_none");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:j}),k&&r.jsx(Ge,{tone:"info",children:_("telegram_roles.builtin")})]}),!k&&r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>S(j),children:_("telegram_roles.delete_btn")})]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:["tools: ",E]})]},j)})}),r.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(un,{size:14})," ",_("telegram_roles.new_title")]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:_("telegram_roles.name_label"),children:r.jsx(Ee,{value:l,onChange:j=>c(j.target.value),placeholder:_("telegram_roles.name_ph")})}),r.jsx(de,{label:_("telegram_roles.tools_label"),hint:_("telegram_roles.tools_hint"),children:r.jsx(Ee,{value:d,onChange:j=>f(j.target.value),disabled:p,placeholder:_("telegram_roles.tools_ph")})})]}),r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(en,{checked:p,onChange:m,label:_("telegram_roles.full_access")}),r.jsx(me,{variant:"primary",loading:g,onClick:v,children:_("telegram_roles.save_btn")})]})]})]})}const ek="apx.settings.telegramTab";function UP(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(ek);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function HP(){const[e,n]=x.useState("default");x.useEffect(()=>{n(UP())},[]);const s=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";n(l);try{window.localStorage.setItem(ek,l)}catch{}};return r.jsxs(Mf,{value:e,onValueChange:s,className:"w-full",children:[r.jsxs(Of,{children:[r.jsx(es,{value:"default",children:_("settings.telegram_global.title")}),r.jsx(es,{value:"channels",children:_("telegram_channels.title")}),r.jsx(es,{value:"contacts",children:_("telegram_contacts.title")}),r.jsx(es,{value:"roles",children:_("telegram_roles.title")})]}),r.jsx(Ma,{value:"default",className:"mt-4",children:r.jsx(PP,{})}),r.jsx(Ma,{value:"channels",className:"mt-4",children:r.jsx(IP,{})}),r.jsx(Ma,{value:"contacts",className:"mt-4",children:r.jsx(cC,{})}),r.jsx(Ma,{value:"roles",className:"mt-4",children:r.jsx(BP,{})})]})}function VP(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/pair/list",()=>Cl.list(),{refreshInterval:cf.pairList});return{clients:e?.clients||[],error:n,isLoading:s,mutate:o}}var ll={},zg,hj;function qP(){return hj||(hj=1,zg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),zg}var Dg={},mr={},xj;function yo(){if(xj)return mr;xj=1;let e;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return mr.getSymbolSize=function(o){if(!o)throw new Error('"version" cannot be null or undefined');if(o<1||o>40)throw new Error('"version" should be in range from 1 to 40');return o*4+17},mr.getSymbolTotalCodewords=function(o){return n[o]},mr.getBCHDigit=function(s){let o=0;for(;s!==0;)o++,s>>>=1;return o},mr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},mr.isKanjiModeEnabled=function(){return typeof e<"u"},mr.toSJIS=function(o){return e(o)},mr}var Lg={},bj;function Sb(){return bj||(bj=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function n(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,l){if(e.isValid(o))return o;try{return n(o)}catch{return l}}})(Lg)),Lg}var Pg,vj;function $P(){if(vj)return Pg;vj=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(n){const s=Math.floor(n/8);return(this.buffer[s]>>>7-n%8&1)===1},put:function(n,s){for(let o=0;o<s;o++)this.putBit((n>>>s-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),n&&(this.buffer[s]|=128>>>this.length%8),this.length++}},Pg=e,Pg}var Ig,yj;function GP(){if(yj)return Ig;yj=1;function e(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return e.prototype.set=function(n,s,o,l){const c=n*this.size+s;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(n,s){return this.data[n*this.size+s]},e.prototype.xor=function(n,s,o){this.data[n*this.size+s]^=o},e.prototype.isReserved=function(n,s){return this.reservedBit[n*this.size+s]},Ig=e,Ig}var Bg={},_j;function FP(){return _j||(_j=1,(function(e){const n=yo().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=n(o),d=c===145?26:Math.ceil((c-13)/(2*l-2))*2,f=[c-7];for(let p=1;p<l-1;p++)f[p]=f[p-1]-d;return f.push(6),f.reverse()},e.getPositions=function(o){const l=[],c=e.getRowColCoords(o),d=c.length;for(let f=0;f<d;f++)for(let p=0;p<d;p++)f===0&&p===0||f===0&&p===d-1||f===d-1&&p===0||l.push([c[f],c[p]]);return l}})(Bg)),Bg}var Ug={},jj;function YP(){if(jj)return Ug;jj=1;const e=yo().getSymbolSize,n=7;return Ug.getPositions=function(o){const l=e(o);return[[0,0],[l-n,0],[0,l-n]]},Ug}var Hg={},wj;function XP(){return wj||(wj=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const c=l.size;let d=0,f=0,p=0,m=null,g=null;for(let b=0;b<c;b++){f=p=0,m=g=null;for(let v=0;v<c;v++){let S=l.get(b,v);S===m?f++:(f>=5&&(d+=n.N1+(f-5)),m=S,f=1),S=l.get(v,b),S===g?p++:(p>=5&&(d+=n.N1+(p-5)),g=S,p=1)}f>=5&&(d+=n.N1+(f-5)),p>=5&&(d+=n.N1+(p-5))}return d},e.getPenaltyN2=function(l){const c=l.size;let d=0;for(let f=0;f<c-1;f++)for(let p=0;p<c-1;p++){const m=l.get(f,p)+l.get(f,p+1)+l.get(f+1,p)+l.get(f+1,p+1);(m===4||m===0)&&d++}return d*n.N2},e.getPenaltyN3=function(l){const c=l.size;let d=0,f=0,p=0;for(let m=0;m<c;m++){f=p=0;for(let g=0;g<c;g++)f=f<<1&2047|l.get(m,g),g>=10&&(f===1488||f===93)&&d++,p=p<<1&2047|l.get(g,m),g>=10&&(p===1488||p===93)&&d++}return d*n.N3},e.getPenaltyN4=function(l){let c=0;const d=l.data.length;for(let p=0;p<d;p++)c+=l.data[p];return Math.abs(Math.ceil(c*100/d/5)-10)*n.N4};function s(o,l,c){switch(o){case e.Patterns.PATTERN000:return(l+c)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(l+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return l*c%2+l*c%3===0;case e.Patterns.PATTERN110:return(l*c%2+l*c%3)%2===0;case e.Patterns.PATTERN111:return(l*c%3+(l+c)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(l,c){const d=c.size;for(let f=0;f<d;f++)for(let p=0;p<d;p++)c.isReserved(p,f)||c.xor(p,f,s(l,p,f))},e.getBestMask=function(l,c){const d=Object.keys(e.Patterns).length;let f=0,p=1/0;for(let m=0;m<d;m++){c(m),e.applyMask(m,l);const g=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(m,l),g<p&&(p=g,f=m)}return f}})(Hg)),Hg}var md={},Sj;function tk(){if(Sj)return md;Sj=1;const e=Sb(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return md.getBlocksCount=function(l,c){switch(c){case e.L:return n[(l-1)*4+0];case e.M:return n[(l-1)*4+1];case e.Q:return n[(l-1)*4+2];case e.H:return n[(l-1)*4+3];default:return}},md.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return s[(l-1)*4+0];case e.M:return s[(l-1)*4+1];case e.Q:return s[(l-1)*4+2];case e.H:return s[(l-1)*4+3];default:return}},md}var Vg={},Yi={},Cj;function KP(){if(Cj)return Yi;Cj=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let o=1;for(let l=0;l<255;l++)e[l]=o,n[o]=l,o<<=1,o&256&&(o^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),Yi.log=function(o){if(o<1)throw new Error("log("+o+")");return n[o]},Yi.exp=function(o){return e[o]},Yi.mul=function(o,l){return o===0||l===0?0:e[n[o]+n[l]]},Yi}var kj;function QP(){return kj||(kj=1,(function(e){const n=KP();e.mul=function(o,l){const c=new Uint8Array(o.length+l.length-1);for(let d=0;d<o.length;d++)for(let f=0;f<l.length;f++)c[d+f]^=n.mul(o[d],l[f]);return c},e.mod=function(o,l){let c=new Uint8Array(o);for(;c.length-l.length>=0;){const d=c[0];for(let p=0;p<l.length;p++)c[p]^=n.mul(l[p],d);let f=0;for(;f<c.length&&c[f]===0;)f++;c=c.slice(f)}return c},e.generateECPolynomial=function(o){let l=new Uint8Array([1]);for(let c=0;c<o;c++)l=e.mul(l,new Uint8Array([1,n.exp(c)]));return l}})(Vg)),Vg}var qg,Ej;function ZP(){if(Ej)return qg;Ej=1;const e=QP();function n(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},n.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(o.length+this.degree);l.set(o);const c=e.mod(l,this.genPoly),d=this.degree-c.length;if(d>0){const f=new Uint8Array(this.degree);return f.set(c,d),f}return c},qg=n,qg}var $g={},Gg={},Fg={},Nj;function nk(){return Nj||(Nj=1,Fg.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),Fg}var Qa={},Rj;function ak(){if(Rj)return Qa;Rj=1;const e="[0-9]+",n="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
597
+ ]))+`;Qa.KANJI=new RegExp(s,"g"),Qa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Qa.BYTE=new RegExp(o,"g"),Qa.NUMERIC=new RegExp(e,"g"),Qa.ALPHANUMERIC=new RegExp(n,"g");const l=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Qa.testKanji=function(p){return l.test(p)},Qa.testNumeric=function(p){return c.test(p)},Qa.testAlphanumeric=function(p){return d.test(p)},Qa}var Tj;function _o(){return Tj||(Tj=1,(function(e){const n=nk(),s=ak();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(c,d){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!n.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?c.ccBits[0]:d<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return s.testNumeric(c)?e.NUMERIC:s.testAlphanumeric(c)?e.ALPHANUMERIC:s.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.ccBits};function o(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(c,d){if(e.isValid(c))return c;try{return o(c)}catch{return d}}})(Gg)),Gg}var Aj;function WP(){return Aj||(Aj=1,(function(e){const n=yo(),s=tk(),o=Sb(),l=_o(),c=nk(),d=7973,f=n.getBCHDigit(d);function p(v,S,C){for(let j=1;j<=40;j++)if(S<=e.getCapacity(j,C,v))return j}function m(v,S){return l.getCharCountIndicator(v,S)+4}function g(v,S){let C=0;return v.forEach(function(j){const w=m(j.mode,S);C+=w+j.getBitsLength()}),C}function b(v,S){for(let C=1;C<=40;C++)if(g(v,C)<=e.getCapacity(C,S,l.MIXED))return C}e.from=function(S,C){return c.isValid(S)?parseInt(S,10):C},e.getCapacity=function(S,C,j){if(!c.isValid(S))throw new Error("Invalid QR Code version");typeof j>"u"&&(j=l.BYTE);const w=n.getSymbolTotalCodewords(S),k=s.getTotalCodewordsCount(S,C),E=(w-k)*8;if(j===l.MIXED)return E;const R=E-m(j,S);switch(j){case l.NUMERIC:return Math.floor(R/10*3);case l.ALPHANUMERIC:return Math.floor(R/11*2);case l.KANJI:return Math.floor(R/13);case l.BYTE:default:return Math.floor(R/8)}},e.getBestVersionForData=function(S,C){let j;const w=o.from(C,o.M);if(Array.isArray(S)){if(S.length>1)return b(S,w);if(S.length===0)return 1;j=S[0]}else j=S;return p(j.mode,j.getLength(),w)},e.getEncodedBits=function(S){if(!c.isValid(S)||S<7)throw new Error("Invalid QR Code version");let C=S<<12;for(;n.getBCHDigit(C)-f>=0;)C^=d<<n.getBCHDigit(C)-f;return S<<12|C}})($g)),$g}var Yg={},Mj;function JP(){if(Mj)return Yg;Mj=1;const e=yo(),n=1335,s=21522,o=e.getBCHDigit(n);return Yg.getEncodedBits=function(c,d){const f=c.bit<<3|d;let p=f<<10;for(;e.getBCHDigit(p)-o>=0;)p^=n<<e.getBCHDigit(p)-o;return(f<<10|p)^s},Yg}var Xg={},Kg,Oj;function e8(){if(Oj)return Kg;Oj=1;const e=_o();function n(s){this.mode=e.NUMERIC,this.data=s.toString()}return n.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(o){let l,c,d;for(l=0;l+3<=this.data.length;l+=3)c=this.data.substr(l,3),d=parseInt(c,10),o.put(d,10);const f=this.data.length-l;f>0&&(c=this.data.substr(l),d=parseInt(c,10),o.put(d,f*3+1))},Kg=n,Kg}var Qg,zj;function t8(){if(zj)return Qg;zj=1;const e=_o(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(o){this.mode=e.ALPHANUMERIC,this.data=o}return s.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let d=n.indexOf(this.data[c])*45;d+=n.indexOf(this.data[c+1]),l.put(d,11)}this.data.length%2&&l.put(n.indexOf(this.data[c]),6)},Qg=s,Qg}var Zg,Dj;function n8(){if(Dj)return Zg;Dj=1;const e=_o();function n(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return n.getBitsLength=function(o){return o*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){for(let o=0,l=this.data.length;o<l;o++)s.put(this.data[o],8)},Zg=n,Zg}var Wg,Lj;function a8(){if(Lj)return Wg;Lj=1;const e=_o(),n=yo();function s(o){this.mode=e.KANJI,this.data=o}return s.getBitsLength=function(l){return l*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(o){let l;for(l=0;l<this.data.length;l++){let c=n.toSJIS(this.data[l]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
598
+ Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},Wg=s,Wg}var Jg={exports:{}},Pj;function s8(){return Pj||(Pj=1,(function(e){var n={single_source_shortest_paths:function(s,o,l){var c={},d={};d[o]=0;var f=n.PriorityQueue.make();f.push(o,0);for(var p,m,g,b,v,S,C,j,w;!f.empty();){p=f.pop(),m=p.value,b=p.cost,v=s[m]||{};for(g in v)v.hasOwnProperty(g)&&(S=v[g],C=b+S,j=d[g],w=typeof d[g]>"u",(w||j>C)&&(d[g]=C,f.push(g,C),c[g]=m))}if(typeof l<"u"&&typeof d[l]>"u"){var k=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(k)}return c},extract_shortest_path_from_predecessor_list:function(s,o){for(var l=[],c=o;c;)l.push(c),s[c],c=s[c];return l.reverse(),l},find_path:function(s,o,l){var c=n.single_source_shortest_paths(s,o,l);return n.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(s){var o=n.PriorityQueue,l={},c;s=s||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=s.sorter||o.default_sorter,l},default_sorter:function(s,o){return s.cost-o.cost},push:function(s,o){var l={value:s,cost:o};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=n})(Jg)),Jg.exports}var Ij;function r8(){return Ij||(Ij=1,(function(e){const n=_o(),s=e8(),o=t8(),l=n8(),c=a8(),d=ak(),f=yo(),p=s8();function m(k){return unescape(encodeURIComponent(k)).length}function g(k,E,R){const N=[];let T;for(;(T=k.exec(R))!==null;)N.push({data:T[0],index:T.index,mode:E,length:T[0].length});return N}function b(k){const E=g(d.NUMERIC,n.NUMERIC,k),R=g(d.ALPHANUMERIC,n.ALPHANUMERIC,k);let N,T;return f.isKanjiModeEnabled()?(N=g(d.BYTE,n.BYTE,k),T=g(d.KANJI,n.KANJI,k)):(N=g(d.BYTE_KANJI,n.BYTE,k),T=[]),E.concat(R,N,T).sort(function(O,P){return O.index-P.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function v(k,E){switch(E){case n.NUMERIC:return s.getBitsLength(k);case n.ALPHANUMERIC:return o.getBitsLength(k);case n.KANJI:return c.getBitsLength(k);case n.BYTE:return l.getBitsLength(k)}}function S(k){return k.reduce(function(E,R){const N=E.length-1>=0?E[E.length-1]:null;return N&&N.mode===R.mode?(E[E.length-1].data+=R.data,E):(E.push(R),E)},[])}function C(k){const E=[];for(let R=0;R<k.length;R++){const N=k[R];switch(N.mode){case n.NUMERIC:E.push([N,{data:N.data,mode:n.ALPHANUMERIC,length:N.length},{data:N.data,mode:n.BYTE,length:N.length}]);break;case n.ALPHANUMERIC:E.push([N,{data:N.data,mode:n.BYTE,length:N.length}]);break;case n.KANJI:E.push([N,{data:N.data,mode:n.BYTE,length:m(N.data)}]);break;case n.BYTE:E.push([{data:N.data,mode:n.BYTE,length:m(N.data)}])}}return E}function j(k,E){const R={},N={start:{}};let T=["start"];for(let M=0;M<k.length;M++){const O=k[M],P=[];for(let B=0;B<O.length;B++){const L=O[B],D=""+M+B;P.push(D),R[D]={node:L,lastCount:0},N[D]={};for(let z=0;z<T.length;z++){const H=T[z];R[H]&&R[H].node.mode===L.mode?(N[H][D]=v(R[H].lastCount+L.length,L.mode)-v(R[H].lastCount,L.mode),R[H].lastCount+=L.length):(R[H]&&(R[H].lastCount=L.length),N[H][D]=v(L.length,L.mode)+4+n.getCharCountIndicator(L.mode,E))}}T=P}for(let M=0;M<T.length;M++)N[T[M]].end=0;return{map:N,table:R}}function w(k,E){let R;const N=n.getBestModeForData(k);if(R=n.from(E,N),R!==n.BYTE&&R.bit<N.bit)throw new Error('"'+k+'" cannot be encoded with mode '+n.toString(R)+`.
599
+ Suggested mode is: `+n.toString(N));switch(R===n.KANJI&&!f.isKanjiModeEnabled()&&(R=n.BYTE),R){case n.NUMERIC:return new s(k);case n.ALPHANUMERIC:return new o(k);case n.KANJI:return new c(k);case n.BYTE:return new l(k)}}e.fromArray=function(E){return E.reduce(function(R,N){return typeof N=="string"?R.push(w(N,null)):N.data&&R.push(w(N.data,N.mode)),R},[])},e.fromString=function(E,R){const N=b(E,f.isKanjiModeEnabled()),T=C(N),M=j(T,R),O=p.find_path(M.map,"start","end"),P=[];for(let B=1;B<O.length-1;B++)P.push(M.table[O[B]].node);return e.fromArray(S(P))},e.rawSplit=function(E){return e.fromArray(b(E,f.isKanjiModeEnabled()))}})(Xg)),Xg}var Bj;function o8(){if(Bj)return Dg;Bj=1;const e=yo(),n=Sb(),s=$P(),o=GP(),l=FP(),c=YP(),d=XP(),f=tk(),p=ZP(),m=WP(),g=JP(),b=_o(),v=r8();function S(M,O){const P=M.size,B=c.getPositions(O);for(let L=0;L<B.length;L++){const D=B[L][0],z=B[L][1];for(let H=-1;H<=7;H++)if(!(D+H<=-1||P<=D+H))for(let q=-1;q<=7;q++)z+q<=-1||P<=z+q||(H>=0&&H<=6&&(q===0||q===6)||q>=0&&q<=6&&(H===0||H===6)||H>=2&&H<=4&&q>=2&&q<=4?M.set(D+H,z+q,!0,!0):M.set(D+H,z+q,!1,!0))}}function C(M){const O=M.size;for(let P=8;P<O-8;P++){const B=P%2===0;M.set(P,6,B,!0),M.set(6,P,B,!0)}}function j(M,O){const P=l.getPositions(O);for(let B=0;B<P.length;B++){const L=P[B][0],D=P[B][1];for(let z=-2;z<=2;z++)for(let H=-2;H<=2;H++)z===-2||z===2||H===-2||H===2||z===0&&H===0?M.set(L+z,D+H,!0,!0):M.set(L+z,D+H,!1,!0)}}function w(M,O){const P=M.size,B=m.getEncodedBits(O);let L,D,z;for(let H=0;H<18;H++)L=Math.floor(H/3),D=H%3+P-8-3,z=(B>>H&1)===1,M.set(L,D,z,!0),M.set(D,L,z,!0)}function k(M,O,P){const B=M.size,L=g.getEncodedBits(O,P);let D,z;for(D=0;D<15;D++)z=(L>>D&1)===1,D<6?M.set(D,8,z,!0):D<8?M.set(D+1,8,z,!0):M.set(B-15+D,8,z,!0),D<8?M.set(8,B-D-1,z,!0):D<9?M.set(8,15-D-1+1,z,!0):M.set(8,15-D-1,z,!0);M.set(B-8,8,1,!0)}function E(M,O){const P=M.size;let B=-1,L=P-1,D=7,z=0;for(let H=P-1;H>0;H-=2)for(H===6&&H--;;){for(let q=0;q<2;q++)if(!M.isReserved(L,H-q)){let Y=!1;z<O.length&&(Y=(O[z]>>>D&1)===1),M.set(L,H-q,Y),D--,D===-1&&(z++,D=7)}if(L+=B,L<0||P<=L){L-=B,B=-B;break}}}function R(M,O,P){const B=new s;P.forEach(function(q){B.put(q.mode.bit,4),B.put(q.getLength(),b.getCharCountIndicator(q.mode,M)),q.write(B)});const L=e.getSymbolTotalCodewords(M),D=f.getTotalCodewordsCount(M,O),z=(L-D)*8;for(B.getLengthInBits()+4<=z&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const H=(z-B.getLengthInBits())/8;for(let q=0;q<H;q++)B.put(q%2?17:236,8);return N(B,M,O)}function N(M,O,P){const B=e.getSymbolTotalCodewords(O),L=f.getTotalCodewordsCount(O,P),D=B-L,z=f.getBlocksCount(O,P),H=B%z,q=z-H,Y=Math.floor(B/z),V=Math.floor(D/z),$=V+1,Z=Y-V,G=new p(Z);let X=0;const U=new Array(z),K=new Array(z);let F=0;const J=new Uint8Array(M.buffer);for(let ee=0;ee<z;ee++){const Te=ee<q?V:$;U[ee]=J.slice(X,X+Te),K[ee]=G.encode(U[ee]),X+=Te,F=Math.max(F,Te)}const ie=new Uint8Array(B);let re=0,oe,ce;for(oe=0;oe<F;oe++)for(ce=0;ce<z;ce++)oe<U[ce].length&&(ie[re++]=U[ce][oe]);for(oe=0;oe<Z;oe++)for(ce=0;ce<z;ce++)ie[re++]=K[ce][oe];return ie}function T(M,O,P,B){let L;if(Array.isArray(M))L=v.fromArray(M);else if(typeof M=="string"){let Y=O;if(!Y){const V=v.rawSplit(M);Y=m.getBestVersionForData(V,P)}L=v.fromString(M,Y||40)}else throw new Error("Invalid data");const D=m.getBestVersionForData(L,P);if(!D)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=D;else if(O<D)throw new Error(`
600
+ The chosen QR Code version cannot contain this amount of data.
601
+ Minimum version required to store current data is: `+D+`.
602
+ `);const z=R(O,P,L),H=e.getSymbolSize(O),q=new o(H);return S(q,O),C(q),j(q,O),k(q,P,0),O>=7&&w(q,O),E(q,z),isNaN(B)&&(B=d.getBestMask(q,k.bind(null,q,P))),d.applyMask(B,q),k(q,P,B),{modules:q,version:O,errorCorrectionLevel:P,maskPattern:B,segments:L}}return Dg.create=function(O,P){if(typeof O>"u"||O==="")throw new Error("No input text");let B=n.M,L,D;return typeof P<"u"&&(B=n.from(P.errorCorrectionLevel,n.M),L=m.from(P.version),D=d.from(P.maskPattern),P.toSJISFunc&&e.setToSJISFunction(P.toSJISFunc)),T(O,L,B,D)},Dg}var eh={},th={},Uj;function sk(){return Uj||(Uj=1,(function(e){function n(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let o=s.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+s);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(c){return[c,c]}))),o.length===6&&o.push("F","F");const l=parseInt(o.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const l=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,c=o.width&&o.width>=21?o.width:void 0,d=o.scale||4;return{width:c,scale:c?4:d,margin:l,color:{dark:n(o.color.dark||"#000000ff"),light:n(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,l){return l.width&&l.width>=o+l.margin*2?l.width/(o+l.margin*2):l.scale},e.getImageWidth=function(o,l){const c=e.getScale(o,l);return Math.floor((o+l.margin*2)*c)},e.qrToImageData=function(o,l,c){const d=l.modules.size,f=l.modules.data,p=e.getScale(d,c),m=Math.floor((d+c.margin*2)*p),g=c.margin*p,b=[c.color.light,c.color.dark];for(let v=0;v<m;v++)for(let S=0;S<m;S++){let C=(v*m+S)*4,j=c.color.light;if(v>=g&&S>=g&&v<m-g&&S<m-g){const w=Math.floor((v-g)/p),k=Math.floor((S-g)/p);j=b[f[w*d+k]?1:0]}o[C++]=j.r,o[C++]=j.g,o[C++]=j.b,o[C]=j.a}}})(th)),th}var Hj;function l8(){return Hj||(Hj=1,(function(e){const n=sk();function s(l,c,d){l.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=d,c.width=d,c.style.height=d+"px",c.style.width=d+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,d,f){let p=f,m=d;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),d||(m=o()),p=n.getOptions(p);const g=n.getImageWidth(c.modules.size,p),b=m.getContext("2d"),v=b.createImageData(g,g);return n.qrToImageData(v.data,c,p),s(b,m,g),b.putImageData(v,0,0),m},e.renderToDataURL=function(c,d,f){let p=f;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),p||(p={});const m=e.render(c,d,p),g=p.type||"image/png",b=p.rendererOpts||{};return m.toDataURL(g,b.quality)}})(eh)),eh}var nh={},Vj;function i8(){if(Vj)return nh;Vj=1;const e=sk();function n(l,c){const d=l.a/255,f=c+'="'+l.hex+'"';return d<1?f+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':f}function s(l,c,d){let f=l+c;return typeof d<"u"&&(f+=" "+d),f}function o(l,c,d){let f="",p=0,m=!1,g=0;for(let b=0;b<l.length;b++){const v=Math.floor(b%c),S=Math.floor(b/c);!v&&!m&&(m=!0),l[b]?(g++,b>0&&v>0&&l[b-1]||(f+=m?s("M",v+d,.5+S+d):s("m",p,0),p=0,m=!1),v+1<c&&l[b+1]||(f+=s("h",g),g=0)):p++}return f}return nh.render=function(c,d,f){const p=e.getOptions(d),m=c.modules.size,g=c.modules.data,b=m+p.margin*2,v=p.color.light.a?"<path "+n(p.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",S="<path "+n(p.color.dark,"stroke")+' d="'+o(g,m,p.margin)+'"/>',C='viewBox="0 0 '+b+" "+b+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(p.width?'width="'+p.width+'" height="'+p.width+'" ':"")+C+' shape-rendering="crispEdges">'+v+S+`</svg>
603
+ `;return typeof f=="function"&&f(null,w),w},nh}var qj;function c8(){if(qj)return ll;qj=1;const e=qP(),n=o8(),s=l8(),o=i8();function l(c,d,f,p,m){const g=[].slice.call(arguments,1),b=g.length,v=typeof g[b-1]=="function";if(!v&&!e())throw new Error("Callback required as last argument");if(v){if(b<2)throw new Error("Too few arguments provided");b===2?(m=f,f=d,d=p=void 0):b===3&&(d.getContext&&typeof m>"u"?(m=p,p=void 0):(m=p,p=f,f=d,d=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(f=d,d=p=void 0):b===2&&!d.getContext&&(p=f,f=d,d=void 0),new Promise(function(S,C){try{const j=n.create(f,p);S(c(j,d,p))}catch(j){C(j)}})}try{const S=n.create(f,p);m(null,c(S,d,p))}catch(S){m(S)}}return ll.create=n.create,ll.toCanvas=l.bind(null,s.render),ll.toDataURL=l.bind(null,s.renderToDataURL),ll.toString=l.bind(null,function(c,d,f){return o.render(c,f)}),ll}var u8=c8();const d8=Qh(u8);function f8({value:e,size:n=200}){const[s,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return d8.toDataURL(e,{margin:2,width:n*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,n]),r.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:n+24,height:n+24},children:s?r.jsx("img",{src:s,width:n,height:n,alt:"QR"}):r.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function p8(e){return e.find(n=>!n.includes("127.0.0.1")&&!n.includes("localhost"))||e[0]||window.location.origin}function m8({open:e,onClose:n,onPaired:s}){const o=st(),[l,c]=x.useState(null),[d,f]=x.useState(null),[p,m]=x.useState(0),[g,b]=x.useState(!1),v=x.useRef(null),S=x.useCallback(async()=>{c(null),f(null),b(!1);try{const E=await Cl.init();c(E),m(Math.round((E.ttl_ms||9e4)/1e3))}catch(E){E instanceof Mc&&E.status===403?f(_("settings.devices_pair_localhost_only")):f(E.message)}},[]);x.useEffect(()=>{e?S():(c(null),f(null),b(!1))},[e,S]),x.useEffect(()=>{if(!l||g||p<=0)return;const E=window.setTimeout(()=>m(R=>R-1),1e3);return()=>window.clearTimeout(E)},[l,p,g]),x.useEffect(()=>{if(!e||!l||g)return;let E=!0;const R=async()=>{try{const N=await Cl.status(l.pairing_id);if(!E)return;if(N.status==="confirmed"){b(!0),o.success(_("settings.devices_pair_done")),s(),window.setTimeout(()=>{E&&n()},900);return}if(N.status==="expired"||N.status==="unknown"){m(0);return}}catch{}v.current=window.setTimeout(R,1500)};return v.current=window.setTimeout(R,1500),()=>{E=!1,v.current&&window.clearTimeout(v.current)}},[e,l,g,n,s,o]);const C=!!l&&!g&&p<=0,j=l?p8(l.lan_urls):"",w=l?`${j}/#pair=${l.pairing_id}`:"",k=async(E,R)=>{try{await navigator.clipboard.writeText(E),o.success(R)}catch{o.error(E)}};return r.jsxs(Mn,{open:e,onClose:n,title:_("settings.devices_pair_title"),description:_("settings.devices_pair_desc"),footer:r.jsx(me,{variant:"secondary",onClick:n,children:_("common.close")}),children:[d&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!l&&r.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[r.jsx(za,{})," ",_("common.loading")]}),!d&&l&&r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx("div",{className:C?"opacity-40":"",children:r.jsx(f8,{value:w,size:196})}),g?r.jsx("p",{className:"text-sm font-medium text-emerald-500",children:_("settings.devices_pair_done")}):C?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-fg",children:_("settings.devices_pair_expired")}),r.jsx(me,{variant:"primary",onClick:()=>void S(),children:_("settings.devices_pair_regen")})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-xs text-muted-fg",children:_("settings.devices_pair_scan")}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(za,{size:12}),r.jsx("span",{children:_("settings.devices_pair_waiting")}),r.jsxs("span",{className:"tabular-nums",children:["· ",_("settings.devices_pair_expires",{s:p})]})]}),r.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:_("settings.devices_pair_link")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:w}),r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>k(w,_("settings.devices_pair_copied")),title:_("settings.devices_pair_copy"),children:r.jsx(Td,{size:14})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:_("settings.devices_pair_code")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:l.pairing_id}),r.jsx(me,{size:"sm",variant:"secondary",onClick:()=>k(l.pairing_id,_("settings.devices_pair_copied_code")),title:_("settings.devices_pair_copy"),children:r.jsx(Td,{size:14})})]})]})]})]})]})]})}function g8(){const e=st(),{clients:n,isLoading:s,mutate:o}=VP(),[l,c]=x.useState(!1),d=async f=>{if(confirm(_("settings.devices_revoke_confirm",{id:f})))try{await Cl.revoke(f),e.success("Cliente revocado."),o()}catch(p){e.error(p.message)}};return r.jsxs($e,{title:_("settings.devices"),description:_("settings.devices_sub"),action:r.jsxs(me,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(oA,{size:14})," ",_("settings.devices_pair_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(it,{children:_("settings.devices_empty")}),n.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:n.map(f=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-medium",children:f.label||f.id}),r.jsx(Ge,{tone:f.kind==="web"?"info":f.kind==="deck"?"success":"muted",children:f.kind}),r.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",f.token_suffix]}),r.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:["visto: ",f.last_seen?new Date(f.last_seen).toLocaleString():"nunca"]}),r.jsx(me,{size:"sm",variant:"destructive",onClick:()=>d(f.id),children:"Revocar"})]},f.id))}),r.jsx(m8,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]})}const h8=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. Config general APX.",fields:[{path:"port",label:"Port",kind:"number",placeholder:"7430"},{path:"host",label:"Host",placeholder:"127.0.0.1"},{path:"log_level",label:"Log level",placeholder:"info"},{path:"user.language",label:"Idioma",placeholder:"es"},{path:"user.locale",label:"Locale",placeholder:"es-AR"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agente",fields:[{path:"super_agent.enabled",label:"Super-agente habilitado",kind:"boolean"},{path:"super_agent.model",label:"Modelo",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:dx.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling habilitado",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Responder con engine",kind:"boolean"},{path:"telegram.route_to_agent",label:"Route to agent",placeholder:"master"},{path:"telegram.channels.0.chat_id",label:"Default chat ID"},{path:"telegram.channels.0.bot_token",label:"Default bot token",kind:"password"}]},{key:"engines",label:"Engines",fields:[{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.openai.base_url",label:"OpenAI base URL",placeholder:"https://api.openai.com/v1"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.groq.base_url",label:"Groq base URL",placeholder:"https://api.groq.com/openai/v1"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.openrouter.base_url",label:"OpenRouter base URL",placeholder:"https://openrouter.ai/api/v1"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"},{path:"engines.ollama.base_url",label:"Ollama URL",placeholder:"http://localhost:11434"}]}];function x8(){const{config:e,isLoading:n,patch:s,mutate:o}=Or();if(n)return r.jsx(nt,{});const l=async c=>{const d={};for(const[f,p]of Object.entries(hb(c)))Va(p)||(d[f]=p);await s(d),o()};return r.jsx($e,{title:_("global_config.title"),description:"Config general en ~/.apx/config.json. Editable por tabs; JSON queda separado.",children:r.jsx(Hh,{sections:h8,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:"Secretos redacted no se sobrescriben.",onSaveFields:async(c,d)=>{await s(c,d),o()},onSaveJson:l})})}function b8(){const e=st(),{health:n,isUp:s}=oC(),o=async()=>{try{await Sl.reload(),e.success("Config recargada.")}catch(l){e.error(l.message)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:_("daemon.version"),action:r.jsx(me,{size:"sm",onClick:o,children:_("common.reload")}),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(ah,{label:_("daemon.version"),value:n?.version||"—"}),r.jsx(ah,{label:_("daemon.uptime"),value:n?`${n.uptime_s}s`:"—"}),r.jsx(ah,{label:_("daemon.status"),value:_(s?"daemon.running":"daemon.down"),ok:s})]})}),r.jsx(x8,{})]})}function ah({label:e,value:n,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(kf,{ok:s}),r.jsx("span",{children:n})]})]})}function v8(){const e=st(),{theme:n,set:s}=fx(),[o,l]=x.useState(""),[c,d]=x.useState(vO()),f=()=>{const m=o.trim();if(m){no(m);try{localStorage.setItem(Rn.token,m)}catch{}l(""),e.success(_("settings.token_saved"))}},p=m=>{xO(m),d(m),window.location.reload()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:_("settings.appearance"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(me,{variant:n==="light"?"primary":"secondary",onClick:()=>s("light"),children:_("settings.light_mode")}),r.jsx(me,{variant:n==="dark"?"primary":"secondary",onClick:()=>s("dark"),children:_("settings.dark_mode")})]})}),r.jsx($e,{title:_("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:bO.map(m=>r.jsx(me,{variant:c===m.value?"primary":"secondary",onClick:()=>p(m.value),children:m.label},m.value))})}),r.jsxs($e,{title:_("settings.token"),description:_("settings.token_sub"),children:[r.jsx(de,{label:"Bearer",children:r.jsx(Ee,{type:"password",placeholder:Kx()?_("settings.token_active"):_("settings.token_paste"),value:o,onChange:m=>l(m.target.value),className:"font-mono",onKeyDown:m=>{m.key==="Enter"&&f()}})}),r.jsx("div",{className:"mt-2",children:r.jsx(me,{variant:"primary",onClick:f,children:_("common.save")})})]})]})}const y8=[{title:_("settings.account_section"),items:[{key:"identity",label:_("settings.tabs.identity"),icon:Zw},{key:"appearance",label:_("settings.appearance"),icon:aA}]},{title:_("settings.agents_section"),items:[{key:"super_agent",label:_("settings.tabs.super_agent"),icon:yn},{key:"engines",label:_("settings.tabs.engines"),icon:lx},{key:"memory",label:"Memoria (RAG)",icon:Uw}]},{title:_("settings.channels_section"),items:[{key:"telegram",label:_("settings.tabs.telegram"),icon:rs},{key:"devices",label:_("settings.tabs.devices"),icon:iA}]},{title:_("settings.advanced_section"),items:[{key:"advanced",label:_("settings.tabs.advanced"),icon:Md}]}],_8=new Set(["engines","telegram"]),j8={identity:()=>r.jsx(MP,{}),super_agent:()=>r.jsx(OP,{}),engines:()=>r.jsx(OC,{}),memory:()=>r.jsx(LP,{}),telegram:()=>r.jsx(HP,{}),devices:()=>r.jsx(g8,{}),appearance:()=>r.jsx(v8,{}),advanced:()=>r.jsx(b8,{})};function w8(){const e=La(),n=oa(),s=S8(n.pathname),o=j8[s],{collapsed:l,toggle:c}=uC(Rn.sidebarCollapsed+".settings");return r.jsx(xC,{sections:y8,active:s,onChange:d=>e(d==="identity"?"/settings":`/settings/${C8(d)}`),collapsed:l,onToggleCollapse:c,contentClassName:`mx-auto w-full ${_8.has(s)?"max-w-6xl":"max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:r.jsx(o,{})})}function S8(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"telegram":return"telegram";case"devices":return"devices";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function C8(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function k8({engines:e,order:n,mode:s,configuredProvider:o,onSetMode:l,onSetDefault:c,onToggleEnabled:d,onReorder:f,onConfigure:p,busy:m}){const g=new Map(e.map(C=>[C.id,C])),b=[...n.filter(C=>g.has(C)),...e.map(C=>C.id).filter(C=>!n.includes(C))],v=s==="chain",S=(C,j)=>{const w=b.indexOf(C),k=w+j;if(w<0||k<0||k>=b.length)return;const E=[...b];[E[w],E[k]]=[E[k],E[w]],f(E)};return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg border border-border p-3",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:"Modo de selección"}),r.jsx("div",{className:"text-xs text-muted-fg",children:v?"Cadena con fallback: usa el primer motor disponible según el orden de abajo.":"Solo el motor por defecto: usa siempre el elegido; los demás quedan configurados para otras cosas."})]}),r.jsxs("div",{className:"flex shrink-0 overflow-hidden rounded-md border border-border",role:"group",children:[r.jsx("button",{type:"button",onClick:()=>l("chain"),disabled:m,"data-testid":"voice-mode-chain",className:Me("px-3 py-1.5 text-xs font-medium transition-colors",v?"bg-emerald-500/15 text-emerald-300":"text-muted-fg hover:text-fg"),children:"Cadena (router)"}),r.jsx("button",{type:"button",onClick:()=>l("single"),disabled:m,"data-testid":"voice-mode-single",className:Me("border-l border-border px-3 py-1.5 text-xs font-medium transition-colors",v?"text-muted-fg hover:text-fg":"bg-emerald-500/15 text-emerald-300"),children:"Solo el motor por defecto"})]})]})}),r.jsx("div",{className:"space-y-2",children:b.map((C,j)=>{const w=g.get(C),k=Xd[C]||{name:C,note:""},E=!v&&o===C,R=C==="mock";return r.jsxs("div",{"data-testid":`voice-provider-${C}`,className:Me("flex items-center gap-3 rounded-lg border px-3 py-2.5",E?"border-emerald-500/50 bg-emerald-500/10":"border-border",v&&!R&&!w.enabled&&"opacity-60"),children:[v&&r.jsxs("div",{className:"flex flex-col",children:[r.jsx("button",{type:"button",onClick:()=>S(C,-1),disabled:m||j===0,"aria-label":"Subir","data-testid":`voice-provider-${C}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Bw,{className:"size-3.5"})}),r.jsx("button",{type:"button",onClick:()=>S(C,1),disabled:m||j===b.length-1,"aria-label":"Bajar","data-testid":`voice-provider-${C}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(xo,{className:"size-3.5"})})]}),r.jsx(kf,{ok:w.available?!0:w.configured?!1:null}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:k.name}),k.local&&r.jsx(Ge,{tone:"info",children:"local"}),w.available?r.jsx(Ge,{tone:"success",children:"disponible"}):w.configured?r.jsx(Ge,{tone:"warning",children:"configurado, no disponible"}):r.jsx(Ge,{tone:"muted",children:"sin configurar"}),E&&r.jsx(Ge,{tone:"success",children:"por defecto"})]}),r.jsx("div",{className:"truncate text-xs text-muted-fg",children:k.note})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[v?r.jsx(en,{checked:R?!0:w.enabled,onChange:N=>d(C,N),disabled:m||R}):!E&&r.jsxs(me,{size:"sm",variant:"ghost",onClick:()=>c(C),disabled:m,"data-testid":`voice-provider-${C}-default`,children:[r.jsx(NT,{className:"size-3.5"})," Usar por defecto"]}),E&&r.jsx(ox,{className:"size-4 text-emerald-400"}),r.jsxs(me,{size:"sm",variant:"secondary",onClick:()=>p(C),"data-testid":`voice-provider-${C}-config`,children:[r.jsx(lA,{className:"size-3.5"})," Configurar"]})]})]},C)})})]})}function Ta(e){return typeof e=="string"?e:e==null?"":String(e)}function E8({open:e,providerId:n,config:s,onClose:o,onSave:l}){const[c,d]=x.useState(!1),[f,p]=x.useState(null),[m,g]=x.useState(""),[b,v]=x.useState({});if(x.useEffect(()=>{if(!e||!n)return;p(null),g("");const N=s||{};if(n==="piper"){const T=N;v({bin:Ta(T.bin),model:Ta(T.model),speaker:Ta(T.speaker)})}else if(n==="elevenlabs"){const T=N;v({model:Ta(T.model),voice_id:Ta(T.voice_id),output_format:Ta(T.output_format)})}else if(n==="openai"){const T=N;v({model:Ta(T.model)||"tts-1",voice:Ta(T.voice)||"alloy",format:Ta(T.format)||"mp3"})}else if(n==="gemini"){const T=N;v({model:Ta(T.model),voice:Ta(T.voice)||"Kore",style:Ta(T.style)})}else v({})},[e,n,s]),!n)return null;const S=Xd[n],C=`voice.tts.${n}`,j=N=>v(T=>({...T,...N})),w=n!=="piper"&&n!=="mock",k=w&&Va(s?.api_key),E=k?`…${kl(s?.api_key)??""} (ya seteada)`:"API key",R=async()=>{d(!0),p(null);try{const N={},T=[],M=(O,P)=>{P.trim()?N[`${C}.${O}`]=P.trim():T.push(`${C}.${O}`)};n==="piper"?(M("bin",b.bin),M("model",b.model),b.speaker.trim()?N[`${C}.speaker`]=b.speaker.trim():T.push(`${C}.speaker`)):n==="elevenlabs"?(M("model",b.model),M("voice_id",b.voice_id),M("output_format",b.output_format)):n==="openai"?(M("model",b.model),M("voice",b.voice),M("format",b.format)):n==="gemini"&&(M("model",b.model),M("voice",b.voice),M("style",b.style)),w&&m.trim()&&(N[`${C}.api_key`]=m.trim()),await l({set:N,unset:T}),o()}catch(N){p(N.message||"Error al guardar.")}finally{d(!1)}};return r.jsx(Mn,{open:e,onClose:o,title:_("voice_screen.configure_provider",{name:S?.name||n||""}),description:S?.note,size:"md",footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:o,disabled:c,children:"Cancelar"}),r.jsx(me,{variant:"primary",onClick:R,loading:c,"data-testid":"voice-provider-save",children:"Guardar"})]}),children:r.jsxs("div",{className:"space-y-3",children:[n==="piper"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"Binario (bin)",hint:"Ruta o nombre del CLI piper (PATH).",children:r.jsx(Ee,{value:b.bin,onChange:N=>j({bin:N.target.value}),placeholder:"piper"})}),r.jsx(de,{label:"Modelo (.onnx)",hint:"Ruta absoluta al modelo de voz piper.",children:r.jsx(Ee,{value:b.model,onChange:N=>j({model:N.target.value}),placeholder:"/abs/path/voz.onnx"})}),r.jsx(de,{label:"Speaker (opcional)",hint:"Id de hablante para modelos multi-voz.",children:r.jsx(Ee,{value:b.speaker,onChange:N=>j({speaker:N.target.value}),placeholder:"0"})})]}),n==="elevenlabs"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se guarda como secreto. Env: ELEVENLABS_API_KEY",children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:m,onChange:N=>g(N.target.value),placeholder:E})}),r.jsx(de,{label:"Modelo",children:r.jsx(wt,{value:b.model||"",onChange:N=>j({model:N}),options:cO.map(N=>({value:N,label:N})),placeholder:"eleven_multilingual_v2"})}),r.jsx(de,{label:"Voice ID",hint:"Id de la voz de ElevenLabs (vacío = default).",children:r.jsx(Ee,{value:b.voice_id,onChange:N=>j({voice_id:N.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),r.jsx(de,{label:"Formato de salida",children:r.jsx(Ee,{value:b.output_format,onChange:N=>j({output_format:N.target.value}),placeholder:"mp3_44100_128"})})]}),n==="openai"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se reusa engines.openai.api_key si la dejás en blanco. Env: OPENAI_API_KEY",children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:m,onChange:N=>g(N.target.value),placeholder:E})}),r.jsx(de,{label:"Modelo",children:r.jsx(wt,{value:b.model||"tts-1",onChange:N=>j({model:N}),options:uO.map(N=>({value:N,label:N}))})}),r.jsx(de,{label:"Voz",children:r.jsx(wt,{value:b.voice||"alloy",onChange:N=>j({voice:N}),options:lO.map(N=>({value:N,label:N}))})}),r.jsx(de,{label:"Formato",children:r.jsx(wt,{value:b.format||"mp3",onChange:N=>j({format:N}),options:["mp3","opus","aac","flac","wav"].map(N=>({value:N,label:N}))})})]}),n==="gemini"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se reusa engines.gemini.api_key si la dejás en blanco. Env: GEMINI_API_KEY",children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:m,onChange:N=>g(N.target.value),placeholder:E})}),r.jsx(de,{label:"Modelo",hint:"TTS de Gemini sigue en preview.",children:r.jsx(Ee,{value:b.model,onChange:N=>j({model:N.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),r.jsx(de,{label:"Voz",children:r.jsx(wt,{value:b.voice||"Kore",onChange:N=>j({voice:N}),options:iO.map(N=>({value:N,label:N}))})}),r.jsx(de,{label:"Estilo (cómo querés que hable)",hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej: 'hablá en tono alegre y pausado'.",children:r.jsx(ln,{rows:2,value:b.style||"",onChange:N=>j({style:N.target.value}),placeholder:"hablá en tono alegre y enérgico"})})]}),n==="mock"&&r.jsxs("p",{className:"text-sm text-muted-fg",children:["El motor ",r.jsx("strong",{children:"mock"})," genera un WAV silencioso de prueba. No tiene parámetros: sirve como fallback garantizado cuando no hay otro motor configurado."]}),f&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f})]})})}function N8(){const e=x.useRef(null),n=x.useRef(null),[s,o]=x.useState(!1),[l,c]=x.useState(!1),d=x.useCallback(()=>{n.current&&(URL.revokeObjectURL(n.current),n.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=x.useCallback(async m=>{c(!0);try{d();const g=await fO(m);n.current=g,e.current||(e.current=new Audio);const b=e.current;b.src=g,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[d]),p=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:f,stop:p,playing:s,loading:l}}function R8({engines:e,defaultProvider:n,mode:s}){const o=st(),{play:l,stop:c,playing:d,loading:f}=N8(),[p,m]=x.useState("Hola, soy APX. Esto es una prueba de voz."),[g,b]=x.useState(""),[v,S]=x.useState(""),[C,j]=x.useState(!1),[w,k]=x.useState(null),R=[{value:"",label:s==="single"&&n&&n!=="auto"?`Por defecto (${Xd[n]?.name||n})`:"Por defecto (cadena)"},...e.map(T=>({value:T.id,label:`${Xd[T.id]?.name||T.id}${T.available?"":" · no disponible"}`}))],N=async()=>{const T=p.trim();if(!T){o.error("Escribí algo para decir.");return}j(!0);try{const M=await I2.say({text:T,provider:g||void 0,style:v.trim()||void 0});k(M),await l(M.audio_path)}catch(M){o.error(M.message||"No se pudo sintetizar.")}finally{j(!1)}};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Motor",hint:"Override del por defecto para probar.",children:r.jsx(wt,{value:g,onChange:b,options:R})}),r.jsx(de,{label:"Estilo (solo Gemini)",hint:"Cómo querés que hable. Vacío = sin estilo.",children:r.jsx(Ee,{value:v,onChange:T=>S(T.target.value),placeholder:"hablá en tono alegre y enérgico","data-testid":"voice-test-style"})})]}),r.jsx(de,{label:"Texto a decir",children:r.jsx(ln,{rows:2,value:p,onChange:T=>m(T.target.value),placeholder:"Escribí lo que querés que diga…","data-testid":"voice-test-input"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(me,{variant:"primary",onClick:N,loading:C,disabled:f,"data-testid":"voice-test-say",children:[r.jsx(fA,{className:"size-4"})," Decir esto"]}),d?r.jsxs(me,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(Kw,{className:"size-4"})," Parar"]}):w?r.jsxs(me,{variant:"secondary",onClick:()=>l(w.audio_path),loading:f,"data-testid":"voice-test-replay",children:[r.jsx(cx,{className:"size-4"})," Repetir"]}):null,w&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["Motor: ",r.jsx("strong",{children:w.provider}),w.duration_s?` · ${w.duration_s.toFixed(1)}s`:""]})]})]})}const T8=[{value:"auto",label:"Automático (local, luego OpenAI)"},{value:"local",label:"Local — faster-whisper (offline)"},{value:"openai",label:"OpenAI — Whisper-1 (cloud)"}],A8=[{value:"auto",label:"Auto-detectar"},{value:"es",label:"Español"},{value:"en",label:"Inglés"},{value:"pt",label:"Portugués"},{value:"fr",label:"Francés"},{value:"it",label:"Italiano"},{value:"de",label:"Alemán"}];function M8({config:e,onPatch:n,busy:s}){const o=e.provider||"auto",l=e.local||{},c=l.model||"small",d=l.language||"auto",f=o!=="openai";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"Motor de transcripción",hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",children:r.jsx(wt,{value:o,onChange:p=>n({"transcription.provider":p}),options:T8,disabled:s,className:"max-w-md"})}),f&&r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Modelo local (whisper)",hint:"Más grande = más preciso y más lento.",children:r.jsx(wt,{value:c,onChange:p=>n({"transcription.local.model":p}),options:dO.map(p=>({value:p,label:p})),disabled:s})}),r.jsx(de,{label:"Idioma",hint:'Para español, fijá "Español" mejora la precisión.',children:r.jsx(wt,{value:d,onChange:p=>n({"transcription.local.language":p}),options:A8,disabled:s})})]})]})}function O8(){const e=st(),{config:n,isLoading:s,patch:o,mutate:l}=Or(),{data:c,isLoading:d,error:f,mutate:p}=Qe("/tts/providers",()=>I2.providers()),[m,g]=x.useState(null),[b,v]=x.useState(!1),S=n,C=S.voice?.tts||{},j=S.transcription||{},w=c?.configured_provider||C.provider||"auto",k=c?.mode||C.mode||"chain",E=c?.engines||[],R=c?.order||[],N=x.useMemo(()=>m?C[m]||{}:{},[m,C]),T=async D=>{v(!0);try{await o({"voice.tts.provider":D,"voice.tts.mode":"single"}),await p(),e.success(`Motor por defecto: ${D}.`)}catch(z){e.error(z.message)}finally{v(!1)}},M=async D=>{v(!0);try{const z={"voice.tts.mode":D};if(D==="single"&&(w==="auto"||!w)){const H=E.find(q=>q.available)?.id||R[0]||"mock";z["voice.tts.provider"]=H}await o(z),await p(),e.success(D==="chain"?"Modo: cadena con fallback.":"Modo: solo el motor por defecto.")}catch(z){e.error(z.message)}finally{v(!1)}},O=async(D,z)=>{v(!0);try{await o({[`voice.tts.${D}.enabled`]:z}),await p()}catch(H){e.error(H.message)}finally{v(!1)}},P=async D=>{v(!0);try{await o({"voice.tts.order":D}),await p()}catch(z){e.error(z.message)}finally{v(!1)}},B=async({set:D,unset:z})=>{await o(D,z.length?z:void 0),await p(),await l(),e.success("Configuración de voz guardada.")},L=async(D,z)=>{try{await o(D,z),e.success("Transcripción actualizada.")}catch(H){e.error(H.message)}};return r.jsxs("div",{className:"mx-auto max-w-6xl p-6","data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx($e,{title:_("voice_screen.providers_title"),description:"Motores de síntesis. El estado lo reporta el daemon en vivo. Elegí cuál usar por defecto.",children:d||s?r.jsx(nt,{}):f?r.jsxs(it,{children:["No se pudieron cargar los proveedores: ",f.message]}):r.jsx(k8,{engines:E,order:R,mode:k,configuredProvider:w,onSetMode:M,onSetDefault:T,onToggleEnabled:O,onReorder:P,onConfigure:D=>g(D),busy:b})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx($e,{title:_("voice_screen.test_title"),description:"Elegí con qué motor sintetizar y, si aplica, cómo querés que hable.",children:r.jsx(R8,{engines:E,defaultProvider:w,mode:k})}),r.jsx($e,{title:_("voice_screen.stt_title"),description:"Motor de voz a texto que usan el deck, Telegram y la CLI al escuchar.",children:s?r.jsx(nt,{}):r.jsx(M8,{config:j,onPatch:L})})]})]}),r.jsx(E8,{open:!!m,providerId:m,config:N,onClose:()=>g(null),onSave:B})]})}const sh={status:()=>ge.get("/desktop/status"),autostartGet:()=>ge.get("/desktop/autostart"),autostartSet:e=>ge.post("/desktop/autostart",{enable:e})};function z8(e=30){return ge.get(`/messages/global?channel=desktop&limit=${e}`)}const $j="CommandOrControl+G",D8=[{value:"left",label:"Izquierda"},{value:"center",label:"Centro"},{value:"right",label:"Derecha"}],L8=[{value:"light",label:"Claro"},{value:"dark",label:"Oscuro"}];function P8(){const e=st(),{config:n,isLoading:s,patch:o}=Or(),l=n,c=l.desktop?.shortcut||l.overlay?.shortcut||$j,d=l.desktop?.enabled!==!1,f=l.desktop?.theme||"light",p=l.desktop?.position||"right",{data:m,isLoading:g,mutate:b}=Qe("/desktop/status",()=>sh.status(),{refreshInterval:5e3}),v=!!m?.running,{data:S,mutate:C}=Qe("/desktop/autostart",()=>sh.autostartGet()),{data:j,isLoading:w,mutate:k}=Qe("/messages/global?channel=desktop",()=>z8(40),{refreshInterval:8e3}),[E,R]=x.useState(c),[N,T]=x.useState(!1),[M,O]=x.useState(!1);x.useEffect(()=>R(c),[c]);const P=async()=>{const D=E.trim();if(!(!D||D===c)){T(!0);try{await o({"desktop.shortcut":D}),e.success("Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.")}catch(z){e.error(z.message)}finally{T(!1)}}},B=async(D,z,H)=>{T(!0);try{await o({[D]:z}),e.success(H)}catch(q){e.error(q.message)}finally{T(!1)}},L=async D=>{O(!0);try{await sh.autostartSet(D),await C(),e.success(D?"Autostart activado para el próximo login.":"Autostart desactivado.")}catch(z){e.error(z.message)}finally{O(!1)}};return r.jsx("div",{className:"mx-auto max-w-6xl space-y-6 p-6","data-testid":"screen-desktop",children:r.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_1fr]",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs($e,{title:_("desktop_screen.status_title"),description:"La ventana se lanza desde la terminal o por autostart.",children:[g?r.jsx(nt,{}):r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(kf,{ok:v}),r.jsx("span",{className:"font-medium",children:v?"En ejecución":"Detenida"}),r.jsx("button",{type:"button",onClick:()=>b(),className:"ml-2 text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"})]}),r.jsxs("p",{className:"mt-3 text-xs text-muted-fg",children:["Desde terminal: ",r.jsx(z_,{children:"apx desktop start"})," · ",r.jsx(z_,{children:"apx desktop --debug"})]})]}),r.jsx($e,{title:_("desktop_screen.autostart_title"),description:"Lanza la ventana al iniciar sesión del usuario. Equivalente a `apx desktop install` (no requiere sudo).",children:S?r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(en,{checked:S.enabled,onChange:L,disabled:M,label:S.enabled?"Activado":"Desactivado"}),r.jsxs("span",{className:"text-xs text-muted-fg",children:["platform: ",S.platform]})]}):r.jsx(nt,{})}),r.jsx($e,{title:_("desktop_screen.shortcut_title"),description:"Botón de acceso rápido global que muestra/oculta la ventana y arranca a escuchar.",children:s?r.jsx(nt,{}):r.jsxs("div",{className:"flex items-end gap-3",children:[r.jsx("div",{className:"flex-1",children:r.jsx(de,{label:"Acelerador",hint:'Formato Electron, p. ej. "CommandOrControl+G" o "CommandOrControl+Shift+Space". Reiniciá la ventana para aplicar.',children:r.jsx(Ee,{value:E,onChange:D=>R(D.target.value),onKeyDown:D=>{D.key==="Enter"&&P()},placeholder:$j,className:"max-w-md font-mono",disabled:N})})}),r.jsx(me,{variant:"primary",onClick:P,loading:N,disabled:!E.trim()||E.trim()===c,children:"Guardar"})]})}),r.jsx($e,{title:_("desktop_screen.appearance_title"),description:"Tema y posición de la ventana en la pantalla.",children:s?r.jsx(nt,{}):r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:"Tema",hint:"Reiniciá la ventana para aplicar.",children:r.jsx(wt,{value:f,onChange:D=>B("desktop.theme",D,`Tema: ${D}.`),options:L8,disabled:N})}),r.jsx(de,{label:"Posición",hint:'"izquierda" / "centro" / "derecha" del borde superior.',children:r.jsx(wt,{value:p,onChange:D=>B("desktop.position",D,`Posición: ${D}.`),options:D8,disabled:N})})]})}),r.jsx($e,{title:_("desktop_screen.activation_title"),description:"El plugin del daemon procesa los mensajes. STT se configura en Voces.",children:s?r.jsx(nt,{}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(en,{checked:d,onChange:D=>B("desktop.enabled",D,D?"Desktop activado.":"Desktop desactivado."),disabled:N,label:d?"Plugin activado (responde mensajes)":"Plugin desactivado"}),r.jsxs("p",{className:"text-xs text-muted-fg",children:["Motor de voz a texto: ",r.jsx(rx,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:"Voces"})," ","(whisper local, idioma, modelo)."]})]})})]}),r.jsx("div",{children:r.jsx($e,{title:_("desktop_screen.last_conv_title"),description:"Lo último charlado con el agente desde la ventana flotante.",action:r.jsx("button",{type:"button",onClick:()=>k(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"}),children:r.jsx(I8,{messages:j||[],loading:w})})})]})})}function I8({messages:e,loading:n}){const s=x.useMemo(()=>U8(e),[e]);return n?r.jsx(nt,{}):e.length?r.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((o,l)=>r.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,d)=>r.jsx(B8,{m:c},d))},l))}):r.jsx(it,{children:"Sin mensajes todavía. Mandale algo a la ventana de escritorio para que aparezca aquí."})}function B8({m:e}){const n=e.direction==="in",s=H8(e.ts);return r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-semibold",children:n?"Vos":"Roby"}),r.jsx("span",{children:s})]}),r.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(n?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||r.jsx("span",{className:"italic opacity-50",children:"(vacío)"})})]})}function U8(e){const n=[];for(const s of e)s.direction==="in"||!n.length?n.push([s]):n[n.length-1].push(s);return n}function H8(e){try{const n=new Date(e);return n.toDateString()===new Date().toDateString()?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):n.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function V8(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function q8({manifest:e}){const n=e.daemon,s=e.safety;return r.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"font-semibold text-foreground",children:[n.name," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["v",n.version]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),r.jsxs("span",{className:"text-muted-fg",children:["activo · ",V8(n.uptime_s)]})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[n.host,":",n.port]}),r.jsx("span",{className:"text-muted-fg",children:"·"}),r.jsxs("span",{className:"text-muted-fg",children:["iniciado"," ",new Date(n.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),r.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&r.jsx(Ge,{tone:"success",children:"sin shell directo"}),s.arbitrary_commands===!1&&r.jsx(Ge,{tone:"success",children:"comandos arbitrarios bloqueados"}),s.dangerous_actions_require_confirmation&&r.jsx(Ge,{tone:"info",children:"acciones peligrosas requieren confirmación"})]})]})}function $8(e){return e==="available"?"success":e==="configured"?"info":"muted"}function G8(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function F8(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function Y8({widget:e,onToggle:n}){const s=e.source==="external",[o,l]=x.useState(!1),c=e.user_enabled===!0,d=async f=>{if(!(!n||o)){l(!0);try{await n(f)}finally{l(!1)}}};return r.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Me("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",s?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[r.jsx("span",{title:e.source==="apx"?_("deck_screen.widget_native"):_("deck_screen.widget_external"),className:Me("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium",children:e.title}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),r.jsx(Ge,{tone:F8(e.kind),children:e.kind}),r.jsx(Ge,{tone:$8(e.status),children:G8(e.status)}),s?r.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:r.jsx(en,{checked:c,onChange:d,disabled:o||!n})}):r.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function X8({desktop:e,widgets:n,onToggle:s}){return n.length===0?null:r.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),r.jsx("ul",{className:"space-y-1.5",children:n.map(o=>r.jsx(Y8,{widget:o,onToggle:o.source==="external"?l=>s(o.id,l):void 0},o.id))})]})}function K8(){const e=st(),{data:n,error:s,isLoading:o,mutate:l}=Qe("/deck/manifest",()=>O_.manifest(),{refreshInterval:3e4}),c=async(b,v)=>{try{await O_.setWidget(b,{enabled:v}),await l(S=>S&&{...S,deck:{...S.deck,widgets:S.deck.widgets.map(C=>C.id===b?{...C,user_enabled:v,status:v?C.daemon_status?"available":"configured":"disabled"}:C)}},{revalidate:!1}),e.success(v?`Widget ${b} habilitado.`:`Widget ${b} deshabilitado.`),setTimeout(()=>l(),800)}catch(S){const C=S instanceof Error?S.message:"Error al guardar";e.error(C)}},d=n?.deck.desktops??[],f=n?.deck.widgets??[],p=d.map(b=>({desktop:b,widgets:f.filter(v=>v.desktop===b.id)})),g=f.filter(b=>b.source==="external").filter(b=>b.user_enabled===!0).length;return r.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-deck",children:[n&&r.jsx(q8,{manifest:n}),r.jsxs($e,{title:_("deck_screen.widgets_title"),description:o?"Cargando manifest…":s?"Error al cargar el manifest.":`${f.length} widgets · ${g} externos habilitados`,action:r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>l(),disabled:o,title:_("deck_screen.reload_manifest"),"aria-label":_("deck_screen.reload_manifest"),children:r.jsx(Nr,{size:14,className:o?"animate-spin":""})}),children:[o&&r.jsx(nt,{label:"Cargando manifest del Deck…"}),!o&&s&&r.jsxs(it,{children:["No se pudo cargar el manifest del Deck."," ",r.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>l(),children:"Reintentar"})]}),!o&&!s&&f.length===0&&r.jsx(it,{children:"No hay widgets en el manifest."}),!o&&!s&&f.length>0&&r.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(b=>b.widgets.length>0).map(b=>r.jsx(X8,{desktop:b.desktop,widgets:b.widgets,onToggle:c},b.desktop.id))})]}),n?.apx&&r.jsx($e,{title:_("deck_screen.context_title"),description:"Información que el Deck ve del daemon.",children:r.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:"Proyecto activo:"}),r.jsx("span",{className:"font-medium",children:n.apx.active_project?n.apx.active_project.name:"ninguno"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:"Proyectos registrados:"}),r.jsx("span",{className:"font-medium",children:n.apx.projects.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:"Plugins activos:"}),r.jsx("span",{className:"font-medium",children:Object.keys(n.apx.plugins).join(", ")||"—"})]})]})})]})}function Q8(e,n){const s=getComputedStyle(e),o=parseFloat(s.fontSize);return n*o}function Z8(e,n){const s=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(s.fontSize);return n*o}function W8(e){return e/100*window.innerHeight}function J8(e){return e/100*window.innerWidth}function e7(e){switch(typeof e){case"number":return[e,"px"];case"string":{const n=parseFloat(e);return e.endsWith("%")?[n,"%"]:e.endsWith("px")?[n,"px"]:e.endsWith("rem")?[n,"rem"]:e.endsWith("em")?[n,"em"]:e.endsWith("vh")?[n,"vh"]:e.endsWith("vw")?[n,"vw"]:[n,"%"]}}}function tc({groupSize:e,panelElement:n,styleProp:s}){let o;const[l,c]=e7(s);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=Z8(n,l);break}case"em":{o=Q8(n,l);break}case"vh":{o=W8(l);break}case"vw":{o=J8(l);break}}return o}function Fn(e){return parseFloat(e.toFixed(3))}function Rl({group:e}){const{orientation:n,panels:s}=e;return s.reduce((o,l)=>(o+=n==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function Yh(e){const{panels:n}=e,s=Rl({group:e});return s===0?n.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):n.map(o=>{const{element:l,panelConstraints:c}=o;let d=0;if(c.collapsedSize!==void 0){const g=tc({groupSize:s,panelElement:l,styleProp:c.collapsedSize});d=Fn(g/s*100)}let f;if(c.defaultSize!==void 0){const g=tc({groupSize:s,panelElement:l,styleProp:c.defaultSize});f=Fn(g/s*100)}let p=0;if(c.minSize!==void 0){const g=tc({groupSize:s,panelElement:l,styleProp:c.minSize});p=Fn(g/s*100)}let m=100;if(c.maxSize!==void 0){const g=tc({groupSize:s,panelElement:l,styleProp:c.maxSize});m=Fn(g/s*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:d,collapsible:c.collapsible===!0,defaultSize:f,disabled:c.disabled,minSize:p,maxSize:m,panelId:o.id}})}function Ut(e,n="Assertion error"){if(!e)throw Error(n)}function Xh(e,n){return Array.from(n).sort(e==="horizontal"?t7:n7)}function t7(e,n){const s=e.element.offsetLeft-n.element.offsetLeft;return s!==0?s:e.element.offsetWidth-n.element.offsetWidth}function n7(e,n){const s=e.element.offsetTop-n.element.offsetTop;return s!==0?s:e.element.offsetHeight-n.element.offsetHeight}function rk(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function ok(e,n){return{x:e.x>=n.left&&e.x<=n.right?0:Math.min(Math.abs(e.x-n.left),Math.abs(e.x-n.right)),y:e.y>=n.top&&e.y<=n.bottom?0:Math.min(Math.abs(e.y-n.top),Math.abs(e.y-n.bottom))}}function a7({orientation:e,rects:n,targetRect:s}){const o={x:s.x+s.width/2,y:s.y+s.height/2};let l,c=Number.MAX_VALUE;for(const d of n){const{x:f,y:p}=ok(o,d),m=e==="horizontal"?f:p;m<c&&(c=m,l=d)}return Ut(l,"No rect found"),l}let gd;function s7(){return gd===void 0&&(typeof matchMedia=="function"?gd=!!matchMedia("(pointer:coarse)").matches:gd=!1),gd}function lk(e){const{element:n,orientation:s,panels:o,separators:l}=e,c=Xh(s,Array.from(n.children).filter(rk).map(C=>({element:C}))).map(({element:C})=>C),d=[];let f=!1,p=!1,m=-1,g=-1,b=0,v,S=[];{let C=-1;for(const j of c)j.hasAttribute("data-panel")&&(C++,j.hasAttribute("data-disabled")||(b++,m===-1&&(m=C),g=C))}if(b>1){let C=-1;for(const j of c)if(j.hasAttribute("data-panel")){C++;const w=o.find(k=>k.element===j);if(w){if(v){const k=v.element.getBoundingClientRect(),E=j.getBoundingClientRect();let R;if(p){const N=s==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),T=s==="horizontal"?new DOMRect(E.left,E.top,0,E.height):new DOMRect(E.left,E.top,E.width,0);switch(S.length){case 0:{R=[N,T];break}case 1:{const M=S[0],O=a7({orientation:s,rects:[k,E],targetRect:M.element.getBoundingClientRect()});R=[M,O===k?T:N];break}default:{R=S;break}}}else S.length?R=S:R=[s==="horizontal"?new DOMRect(k.right,E.top,E.left-k.right,E.height):new DOMRect(E.left,k.bottom,E.width,E.top-k.bottom)];for(const N of R){let T="width"in N?N:N.element.getBoundingClientRect();const M=s7()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(T.width<M){const P=M-T.width;T=new DOMRect(T.x-P/2,T.y,T.width+P,T.height)}if(T.height<M){const P=M-T.height;T=new DOMRect(T.x,T.y-P/2,T.width,T.height+P)}const O=C<=m||C>g;!f&&!O&&d.push({group:e,groupSize:Rl({group:e}),panels:[v,w],separator:"width"in N?void 0:N,rect:T}),f=!1}}p=!1,v=w,S=[]}}else if(j.hasAttribute("data-separator")){j.ariaDisabled!==null&&(f=!0);const w=l.find(k=>k.element===j);w?S.push(w):(v=void 0,S=[])}else p=!0}return d}class ik{#e={};addListener(n,s){const o=this.#e[n];return o===void 0?this.#e[n]=[s]:o.includes(s)||o.push(s),()=>{this.removeListener(n,s)}}emit(n,s){const o=this.#e[n];if(o!==void 0)if(o.length===1)o[0].call(null,s);else{let l=!1,c=null;const d=Array.from(o);for(let f=0;f<d.length;f++){const p=d[f];try{p.call(null,s)}catch(m){c===null&&(l=!0,c=m)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(n,s){const o=this.#e[n];if(o!==void 0){const l=o.indexOf(s);l>=0&&o.splice(l,1)}}}let ts=new Map;const ck=new ik;function r7(e){ts=new Map(ts),ts.delete(e)}function Gj(e,n){for(const[s]of ts)if(s.id===e)return s}function wr(e,n){for(const[s,o]of ts)if(s.id===e)return o;if(n)throw Error(`Could not find data for Group with id ${e}`)}function jo(){return ts}function Cb(e,n){return ck.addListener("groupChange",s=>{s.group.id===e&&n(s)})}function Vs(e,n){const s=ts.get(e);ts=new Map(ts),ts.set(e,n),ck.emit("groupChange",{group:e,prev:s,next:n})}function o7(e,n,s){let o,l={x:1/0,y:1/0};for(const c of n){const d=ok(s,c.rect);switch(e){case"horizontal":{d.x<=l.x&&(o=c,l=d);break}case"vertical":{d.y<=l.y&&(o=c,l=d);break}}}return o?{distance:l,hitRegion:o}:void 0}function l7(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function i7(e,n){if(e===n)throw new Error("Cannot compare node with itself");const s={a:Xj(e),b:Xj(n)};let o;for(;s.a.at(-1)===s.b.at(-1);)o=s.a.pop(),s.b.pop();Ut(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:Yj(Fj(s.a)),b:Yj(Fj(s.b))};if(l.a===l.b){const c=o.childNodes,d={a:s.a.at(-1),b:s.b.at(-1)};let f=c.length;for(;f--;){const p=c[f];if(p===d.a)return 1;if(p===d.b)return-1}}return Math.sign(l.a-l.b)}const c7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function u7(e){const n=getComputedStyle(uk(e)??e).display;return n==="flex"||n==="inline-flex"}function d7(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||u7(e))||+n.opacity<1||"transform"in n&&n.transform!=="none"||"webkitTransform"in n&&n.webkitTransform!=="none"||"mixBlendMode"in n&&n.mixBlendMode!=="normal"||"filter"in n&&n.filter!=="none"||"webkitFilter"in n&&n.webkitFilter!=="none"||"isolation"in n&&n.isolation==="isolate"||c7.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function Fj(e){let n=e.length;for(;n--;){const s=e[n];if(Ut(s,"Missing node"),d7(s))return s}return null}function Yj(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Xj(e){const n=[];for(;e;)n.push(e),e=uk(e);return n}function uk(e){const{parentNode:n}=e;return l7(n)?n.host:n}function f7(e,n){return e.x<n.x+n.width&&e.x+e.width>n.x&&e.y<n.y+n.height&&e.y+e.height>n.y}function p7({groupElement:e,hitRegion:n,pointerEventTarget:s}){if(!rk(s)||s.contains(e)||e.contains(s))return!0;if(i7(s,e)>0){let o=s;for(;o;){if(o.contains(e))return!0;if(f7(o.getBoundingClientRect(),n))return!1;o=o.parentElement}}return!0}function kb(e,n){const s=[];return n.forEach((o,l)=>{if(l.disabled)return;const c=lk(l),d=o7(l.orientation,c,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&p7({groupElement:l.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&s.push(d.hitRegion)}),s}function m7(e,n){if(e.length!==n.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=n[s])return!1;return!0}function Bn(e,n,s=0){return Math.abs(Fn(e)-Fn(n))<=s}function Za(e,n){return Bn(e,n)?0:e>n?1:-1}function fl({overrideDisabledPanels:e,panelConstraints:n,prevSize:s,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:d,maxSize:f=100,minSize:p=0}=n;if(d&&!e)return s;if(Za(o,p)<0)if(c){const m=(l+p)/2;Za(o,m)<0?o=l:o=p}else o=p;return o=Math.min(f,o),o=Fn(o),o}function jc({delta:e,initialLayout:n,panelConstraints:s,pivotIndices:o,prevLayout:l,trigger:c}){if(Bn(e,0))return n;const d=c==="imperative-api",f=Object.values(n),p=Object.values(l),m=[...f],[g,b]=o;Ut(g!=null,"Invalid first pivot index"),Ut(b!=null,"Invalid second pivot index");let v=0;switch(c){case"keyboard":{{const j=e<0?b:g,w=s[j];Ut(w,`Panel constraints not found for index ${j}`);const{collapsedSize:k=0,collapsible:E,minSize:R=0}=w;if(E){const N=f[j];if(Ut(N!=null,`Previous layout not found for panel index ${j}`),Bn(N,k)){const T=R-N;Za(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const j=e<0?g:b,w=s[j];Ut(w,`No panel constraints found for index ${j}`);const{collapsedSize:k=0,collapsible:E,minSize:R=0}=w;if(E){const N=f[j];if(Ut(N!=null,`Previous layout not found for panel index ${j}`),Bn(N,R)){const T=N-k;Za(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}break}default:{const j=e<0?b:g,w=s[j];Ut(w,`Panel constraints not found for index ${j}`);const k=f[j],{collapsible:E,collapsedSize:R,minSize:N}=w;if(E&&Za(k,N)<0)if(e>0){const T=N-R,M=T/2,O=k+e;Za(O,N)<0&&(e=Za(e,M)<=0?0:T)}else{const T=N-R,M=100-T/2,O=k-e;Za(O,N)<0&&(e=Za(100+e,M)>0?0:-T)}break}}{const j=e<0?1:-1;let w=e<0?b:g,k=0;for(;;){const R=f[w];Ut(R!=null,`Previous layout not found for panel index ${w}`);const N=fl({overrideDisabledPanels:d,panelConstraints:s[w],prevSize:R,size:100})-R;if(k+=N,w+=j,w<0||w>=s.length)break}const E=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-E:E}{let j=e<0?g:b;for(;j>=0&&j<s.length;){const w=Math.abs(e)-Math.abs(v),k=f[j];Ut(k!=null,`Previous layout not found for panel index ${j}`);const E=k-w,R=fl({overrideDisabledPanels:d,panelConstraints:s[j],prevSize:k,size:E});if(!Bn(k,R)&&(v+=k-R,m[j]=R,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?j--:j++}}if(m7(p,m))return l;{const j=e<0?b:g,w=f[j];Ut(w!=null,`Previous layout not found for panel index ${j}`);const k=w+v,E=fl({overrideDisabledPanels:d,panelConstraints:s[j],prevSize:w,size:k});if(m[j]=E,!Bn(E,k)){let R=k-E,N=e<0?b:g;for(;N>=0&&N<s.length;){const T=m[N];Ut(T!=null,`Previous layout not found for panel index ${N}`);const M=T+R,O=fl({overrideDisabledPanels:d,panelConstraints:s[N],prevSize:T,size:M});if(Bn(T,O)||(R-=O-T,m[N]=O),Bn(R,0))break;e>0?N--:N++}}}const S=Object.values(m).reduce((j,w)=>w+j,0);if(!Bn(S,100,.1))return l;const C=Object.keys(l);return m.reduce((j,w,k)=>(j[C[k]]=w,j),{})}function mo(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(n[s]===void 0||Za(e[s],n[s])!==0)return!1;return!0}function go({layout:e,panelConstraints:n}){const s=Object.values(e),o=[...s],l=o.reduce((f,p)=>f+p,0);if(o.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${o.map(f=>`${f}%`).join(", ")}`);if(!Bn(l,100)&&o.length>0)for(let f=0;f<n.length;f++){const p=o[f];Ut(p!=null,`No layout data found for index ${f}`);const m=100/l*p;o[f]=m}let c=0;for(let f=0;f<n.length;f++){const p=s[f];Ut(p!=null,`No layout data found for index ${f}`);const m=o[f];Ut(m!=null,`No layout data found for index ${f}`);const g=fl({overrideDisabledPanels:!0,panelConstraints:n[f],prevSize:p,size:m});m!=g&&(c+=m-g,o[f]=g)}if(!Bn(c,0))for(let f=0;f<n.length;f++){const p=o[f];Ut(p!=null,`No layout data found for index ${f}`);const m=p+c,g=fl({overrideDisabledPanels:!0,panelConstraints:n[f],prevSize:p,size:m});if(p!==g&&(c-=g-p,o[f]=g,Bn(c,0)))break}const d=Object.keys(e);return o.reduce((f,p,m)=>(f[d[m]]=p,f),{})}function dk({groupId:e,panelId:n}){const s=()=>{const p=jo();for(const[m,{defaultLayoutDeferred:g,derivedPanelConstraints:b,layout:v,groupSize:S,separatorToPanels:C}]of p)if(m.id===e)return{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:m,groupSize:S,layout:v,separatorToPanels:C};throw Error(`Group ${e} not found`)},o=()=>{const p=s().derivedPanelConstraints.find(m=>m.panelId===n);if(p!==void 0)return p;throw Error(`Panel constraints not found for Panel ${n}`)},l=()=>{const p=s().group.panels.find(m=>m.id===n);if(p!==void 0)return p;throw Error(`Layout not found for Panel ${n}`)},c=()=>{const p=s().layout[n];if(p!==void 0)return p;throw Error(`Layout not found for Panel ${n}`)},d=({nextSize:p,panels:m,prevLayout:g,derivedPanelConstraints:b})=>{const v=c(),S=m.findIndex(w=>w.id===n),C=S===0,j=S===m.length-1;if(j&&p<v&&(C||m.slice(0,S).every((w,k)=>{const E=b[k];return E?.collapsible&&Bn(E.collapsedSize,g[E.panelId])}))){const w=m.slice(0,S).reduce((k,E)=>k+g[E.id],0);return{...g,[n]:Fn(100-w)}}return jc({delta:j?v-p:p-v,initialLayout:g,panelConstraints:b,pivotIndices:j?[S-1,S]:[S,S+1],prevLayout:g,trigger:"imperative-api"})},f=p=>{const m=c();if(p===m)return;const{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:v,groupSize:S,layout:C,separatorToPanels:j}=s(),w=d({nextSize:p,panels:v.panels,prevLayout:C,derivedPanelConstraints:b}),k=go({layout:w,panelConstraints:b});mo(C,k)||Vs(v,{defaultLayoutDeferred:g,derivedPanelConstraints:b,groupSize:S,layout:k,separatorToPanels:j})};return{collapse:()=>{const{collapsible:p,collapsedSize:m}=o(),{mutableValues:g}=l(),b=c();p&&b!==m&&(g.expandToSize=b,f(m))},expand:()=>{const{collapsible:p,collapsedSize:m,minSize:g}=o(),{mutableValues:b}=l(),v=c();if(p&&v===m){let S=b.expandToSize??g;S===0&&(S=1),f(S)}},getSize:()=>{const{group:p}=s(),m=c(),{element:g}=l(),b=p.orientation==="horizontal"?g.offsetWidth:g.offsetHeight;return{asPercentage:m,inPixels:b}},isCollapsed:()=>{const{collapsible:p,collapsedSize:m}=o(),g=c();return p&&Bn(m,g)},resize:p=>{const{group:m}=s(),{element:g}=l(),b=Rl({group:m}),v=tc({groupSize:b,panelElement:g,styleProp:p}),S=Fn(v/b*100);f(S)}}}function Kj(e){if(e.defaultPrevented)return;const n=jo();kb(e,n).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const o=s.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=dk({groupId:s.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function kd(e){const n=jo();for(const[s]of n)if(s.separators.some(o=>o.element===e))return s;throw Error("Could not find parent Group for separator element")}function fk({groupId:e}){const n=()=>{const s=jo();for(const[o,l]of s)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:o}=n();return s?{}:o},setLayout(s){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:d,layout:f,separatorToPanels:p}=n(),m=go({layout:s,panelConstraints:l});return o?f:(mo(f,m)||Vs(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:d,layout:m,separatorToPanels:p}),m)}}}function eo(e,n){const s=kd(e),o=wr(s.id,!0),l=s.separators.find(g=>g.element===e);Ut(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Ut(c,"Matching panels not found");const d=c.map(g=>s.panels.indexOf(g)),f=fk({groupId:s.id}).getLayout(),p=jc({delta:n,initialLayout:f,panelConstraints:o.derivedPanelConstraints,pivotIndices:d,prevLayout:f,trigger:"keyboard"}),m=go({layout:p,panelConstraints:o.derivedPanelConstraints});mo(f,m)||Vs(s,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:m,separatorToPanels:o.separatorToPanels})}function Qj(e){if(e.defaultPrevented)return;const n=e.currentTarget,s=kd(n);if(!s.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),s.orientation==="vertical"&&eo(n,5);break}case"ArrowLeft":{e.preventDefault(),s.orientation==="horizontal"&&eo(n,-5);break}case"ArrowRight":{e.preventDefault(),s.orientation==="horizontal"&&eo(n,5);break}case"ArrowUp":{e.preventDefault(),s.orientation==="vertical"&&eo(n,-5);break}case"End":{e.preventDefault(),eo(n,100);break}case"Enter":{e.preventDefault();const o=kd(n),l=wr(o.id,!0),{derivedPanelConstraints:c,layout:d,separatorToPanels:f}=l,p=o.separators.find(v=>v.element===n);Ut(p,"Matching separator not found");const m=f.get(p);Ut(m,"Matching panels not found");const g=m[0],b=c.find(v=>v.panelId===g.id);if(Ut(b,"Panel metadata not found"),b.collapsible){const v=d[g.id],S=b.collapsedSize===v?o.mutableState.expandedPanelSizes[g.id]??b.minSize:b.collapsedSize;eo(n,S-v)}break}case"F6":{e.preventDefault();const o=kd(n).separators.map(d=>d.element),l=Array.from(o).findIndex(d=>d===e.currentTarget);Ut(l!==null,"Index not found");const c=e.shiftKey?l>0?l-1:o.length-1:l+1<o.length?l+1:0;o[c].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),eo(n,-100);break}}}let xl={cursorFlags:0,state:"inactive"};const Eb=new ik;function ho(){return xl}function g7(e){return Eb.addListener("change",e)}function h7(e){const n=xl,s={...xl};s.cursorFlags=e,xl=s,Eb.emit("change",{prev:n,next:s})}function bl(e){const n=xl;xl=e,Eb.emit("change",{prev:n,next:e})}function Zj(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=jo(),s=kb(e,n),o=new Map;let l=!1;s.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const d=n.get(c.group);d&&o.set(c.group,d.layout)}),bl({cursorFlags:0,hitRegions:s,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),s.length&&e.preventDefault()}const x7=e=>e,rh=()=>{},pk=1,mk=2,gk=4,hk=8,Wj=3,Jj=12;let hd;function ew(){return hd===void 0&&(hd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(hd=!0)),hd}function b7({cursorFlags:e,groups:n,state:s}){let o=0,l=0;switch(s){case"active":case"hover":n.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{l++;break}}})}if(!(o===0&&l===0)){switch(s){case"active":{if(e&&ew()){const c=(e&pk)!==0,d=(e&mk)!==0,f=(e&gk)!==0,p=(e&hk)!==0;if(c)return f?"se-resize":p?"ne-resize":"e-resize";if(d)return f?"sw-resize":p?"nw-resize":"w-resize";if(f)return"s-resize";if(p)return"n-resize"}break}}return ew()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const tw=new WeakMap;function Nb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:n,styleSheet:s}=tw.get(e)??{};s===void 0&&(s=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(s):e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]));const o=ho();switch(o.state){case"active":case"hover":{const l=b7({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(d=>d.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(n===c)return;n=c,l?s.cssRules.length===0?s.insertRule(c):s.replaceSync(c):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{n=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}tw.set(e,{prevStyle:n,styleSheet:s})}function xk({document:e,event:n,hitRegions:s,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:d}){let f=0;s.forEach(m=>{const{group:g,groupSize:b}=m,{orientation:v,panels:S}=g,{disableCursor:C}=g.mutableState;let j=0;c?v==="horizontal"?j=(n.clientX-c.x)/b*100:j=(n.clientY-c.y)/b*100:v==="horizontal"?j=n.clientX<0?-100:100:j=n.clientY<0?-100:100;const w=o.get(g),k=l.get(g);if(!w||!k)return;const{defaultLayoutDeferred:E,derivedPanelConstraints:R,groupSize:N,layout:T,separatorToPanels:M}=k;if(R&&T&&M){const O=jc({delta:j,initialLayout:w,panelConstraints:R,pivotIndices:m.panels.map(P=>S.indexOf(P)),prevLayout:T,trigger:"mouse-or-touch"});if(mo(O,T)){if(j!==0&&!C)switch(v){case"horizontal":{f|=j<0?pk:mk;break}case"vertical":{f|=j<0?gk:hk;break}}}else Vs(m.group,{defaultLayoutDeferred:E,derivedPanelConstraints:R,groupSize:N,layout:O,separatorToPanels:M})}});let p=0;n.movementX===0?p|=d&Wj:p|=f&Wj,n.movementY===0?p|=d&Jj:p|=f&Jj,h7(p),Nb(e)}function nw(e){const n=jo(),s=ho();switch(s.state){case"active":xk({document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:n,prevCursorFlags:s.cursorFlags})}}function aw(e){if(e.defaultPrevented)return;const n=ho(),s=jo();switch(n.state){case"active":{if(e.buttons===0){bl({cursorFlags:0,state:"inactive"}),n.hitRegions.forEach(o=>{const l=wr(o.group.id,!0);Vs(o.group,l)});return}for(const o of n.hitRegions)if(o.separator){const{element:l}=o.separator;l.hasPointerCapture?.(e.pointerId)||l.setPointerCapture?.(e.pointerId)}xk({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const o=kb(e,s);o.length===0?n.state!=="inactive"&&bl({cursorFlags:0,state:"inactive"}):bl({cursorFlags:0,hitRegions:o,state:"hover"}),Nb(e.currentTarget);break}}}function sw(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ho().state){case"hover":bl({cursorFlags:0,state:"inactive"})}}function rw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=ho();switch(n.state){case"active":bl({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(Nb(e.currentTarget),n.hitRegions.forEach(s=>{const o=wr(s.group.id,!0);Vs(s.group,o)}),e.preventDefault())}}function ow(e){let n=0,s=0;const o={};for(const c of e)if(c.defaultSize!==void 0){n++;const d=Fn(c.defaultSize);s+=d,o[c.panelId]=d}else o[c.panelId]=void 0;const l=e.length-n;if(l!==0){const c=Fn((100-s)/l);for(const d of e)d.defaultSize===void 0&&(o[d.panelId]=c)}return o}function v7(e,n,s){if(!s[0])return;const o=e.panels.find(p=>p.element===n);if(!o||!o.onResize)return;const l=Rl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,d=o.mutableValues.prevSize,f={asPercentage:Fn(c/l*100),inPixels:c};o.mutableValues.prevSize=f,o.onResize(f,o.id,d)}function y7(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}function _7({group:e,nextGroupSize:n,prevGroupSize:s,prevLayout:o}){if(s<=0||n<=0||s===n)return o;let l=0,c=0,d=!1;const f=new Map,p=[];for(const b of e.panels){const v=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const S=v/100*s,C=Fn(S/n*100);f.set(b.id,C),l+=C;break}case"preserve-relative-size":default:{p.push(b.id),c+=v;break}}}if(!d||p.length===0)return o;const m=100-l,g={...o};if(f.forEach((b,v)=>{g[v]=b}),c>0)for(const b of p){const v=o[b]??0;g[b]=Fn(v/c*m)}else{const b=Fn(m/p.length);for(const v of p)g[v]=b}return g}function j7(e,n){const s=e.map(l=>l.id),o=Object.keys(n);if(s.length!==o.length)return!1;for(const l of s)if(!o.includes(l))return!1;return!0}const il=new Map;function w7(e){let n=!0;Ut(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new s(C=>{for(const j of C){const{borderBoxSize:w,target:k}=j;if(k===e.element){if(n){const E=Rl({group:e});if(E===0)return;const R=wr(e.id);if(!R)return;const N=Yh(e),T=R.defaultLayoutDeferred?ow(N):R.layout,M=_7({group:e,nextGroupSize:E,prevGroupSize:R.groupSize,prevLayout:T}),O=go({layout:M,panelConstraints:N});if(!R.defaultLayoutDeferred&&mo(R.layout,O)&&y7(R.derivedPanelConstraints,N)&&R.groupSize===E)return;Vs(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:N,groupSize:E,layout:O,separatorToPanels:R.separatorToPanels})}}else v7(e,k,w)}});c.observe(e.element),e.panels.forEach(C=>{Ut(!o.has(C.id),`Panel ids must be unique; id "${C.id}" was used more than once`),o.add(C.id),C.onResize&&c.observe(C.element)});const d=Rl({group:e}),f=Yh(e),p=e.panels.map(({id:C})=>C).join(",");let m=e.mutableState.defaultLayout;m&&(j7(e.panels,m)||(m=void 0));const g=e.mutableState.layouts[p]??m??ow(f),b=go({layout:g,panelConstraints:f}),v=e.element.ownerDocument;il.set(v,(il.get(v)??0)+1);const S=new Map;return lk(e).forEach(C=>{C.separator&&S.set(C.separator,C.panels)}),Vs(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:f,groupSize:d,layout:b,separatorToPanels:S}),e.separators.forEach(C=>{Ut(!l.has(C.id),`Separator ids must be unique; id "${C.id}" was used more than once`),l.add(C.id),C.element.addEventListener("keydown",Qj)}),il.get(v)===1&&(v.addEventListener("dblclick",Kj,!0),v.addEventListener("pointerdown",Zj,!0),v.addEventListener("pointerleave",nw),v.addEventListener("pointermove",aw),v.addEventListener("pointerout",sw),v.addEventListener("pointerup",rw,!0)),function(){n=!1,il.set(v,Math.max(0,(il.get(v)??0)-1)),r7(e),e.separators.forEach(C=>{C.element.removeEventListener("keydown",Qj)}),il.get(v)||(v.removeEventListener("dblclick",Kj,!0),v.removeEventListener("pointerdown",Zj,!0),v.removeEventListener("pointerleave",nw),v.removeEventListener("pointermove",aw),v.removeEventListener("pointerout",sw),v.removeEventListener("pointerup",rw,!0)),c.disconnect()}}function S7(){const[e,n]=x.useState({}),s=x.useCallback(()=>n({}),[]);return[e,s]}function Rb(e){const n=x.useId();return`${e??n}`}const wo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function cc(e){const n=x.useRef(e);return wo(()=>{n.current=e},[e]),x.useCallback((...s)=>n.current?.(...s),[n])}function Tb(...e){return cc(n=>{e.forEach(s=>{if(s)switch(typeof s){case"function":{s(n);break}case"object":{s.current=n;break}}})})}function Ab(e){const n=x.useRef({...e});return wo(()=>{for(const s in e)n.current[s]=e[s]},[e]),n.current}const bk=x.createContext(null);function C7(e,n){const s=x.useRef({getLayout:()=>({}),setLayout:x7});x.useImperativeHandle(n,()=>s.current,[]),wo(()=>{Object.assign(s.current,fk({groupId:e}))})}function Kh({children:e,className:n,defaultLayout:s,disableCursor:o,disabled:l,elementRef:c,groupRef:d,id:f,onLayoutChange:p,onLayoutChanged:m,orientation:g="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:v,...S}){const C=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),j=cc(D=>{mo(C.current.onLayoutChange,D)||(C.current.onLayoutChange=D,p?.(D))}),w=cc(D=>{mo(C.current.onLayoutChanged,D)||(C.current.onLayoutChanged=D,m?.(D))}),k=Rb(f),E=x.useRef(null),[R,N]=S7(),T=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),M=Tb(E,c);C7(k,d);const O=cc((D,z)=>{const H=ho(),q=Gj(D),Y=wr(D);if(Y){let V=!1;switch(H.state){case"active":{V=H.hitRegions.some($=>$.group===q);break}}return{flexGrow:Y.layout[z]??1,pointerEvents:V?"none":void 0}}if(s?.[z])return{flexGrow:s?.[z]}}),P=Ab({defaultLayout:s,disableCursor:o}),B=x.useMemo(()=>({get disableCursor(){return!!P.disableCursor},getPanelStyles:O,id:k,orientation:g,registerPanel:D=>{const z=T.current;return z.panels=Xh(g,[...z.panels,D]),N(),()=>{z.panels=z.panels.filter(H=>H!==D),N()}},registerSeparator:D=>{const z=T.current;return z.separators=Xh(g,[...z.separators,D]),N(),()=>{z.separators=z.separators.filter(H=>H!==D),N()}},updatePanelProps:(D,{disabled:z})=>{const H=T.current.panels.find(V=>V.id===D);H&&(H.panelConstraints.disabled=z);const q=Gj(k),Y=wr(k);q&&Y&&Vs(q,{...Y,derivedPanelConstraints:Yh(q)})},updateSeparatorProps:(D,{disabled:z,disableDoubleClick:H})=>{const q=T.current.separators.find(Y=>Y.id===D);q&&(q.disabled=z,q.disableDoubleClick=H)}}),[O,k,N,g,P]),L=x.useRef(null);return wo(()=>{const D=E.current;if(D===null)return;const z=T.current;let H;if(P.defaultLayout!==void 0&&Object.keys(P.defaultLayout).length===z.panels.length){H={};for(const X of z.panels){const U=P.defaultLayout[X.id];U!==void 0&&(H[X.id]=U)}}const q={disabled:!!l,element:D,id:k,mutableState:{defaultLayout:H,disableCursor:!!P.disableCursor,expandedPanelSizes:T.current.lastExpandedPanelSizes,layouts:T.current.layouts},orientation:g,panels:z.panels,resizeTargetMinimumSize:z.resizeTargetMinimumSize,separators:z.separators};L.current=q;const Y=w7(q),{defaultLayoutDeferred:V,derivedPanelConstraints:$,layout:Z}=wr(q.id,!0);!V&&$.length>0&&(j(Z),w(Z));const G=Cb(k,X=>{const{defaultLayoutDeferred:U,derivedPanelConstraints:K,layout:F}=X.next;if(U||K.length===0)return;const J=q.panels.map(({id:re})=>re).join(",");q.mutableState.layouts[J]=F,K.forEach(re=>{if(re.collapsible){const{layout:oe}=X.prev??{};if(oe){const ce=Bn(re.collapsedSize,F[re.panelId]),ee=Bn(re.collapsedSize,oe[re.panelId]);ce&&!ee&&(q.mutableState.expandedPanelSizes[re.panelId]=oe[re.panelId])}}});const ie=ho().state!=="active";j(F),ie&&w(F)});return()=>{L.current=null,Y(),G()}},[l,k,w,j,g,R,P]),x.useEffect(()=>{const D=L.current;D&&(D.mutableState.defaultLayout=s,D.mutableState.disableCursor=!!o)}),r.jsx(bk.Provider,{value:B,children:r.jsx("div",{...S,className:n,"data-group":!0,"data-testid":k,id:k,ref:M,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}Kh.displayName="Group";function Mb(){const e=x.useContext(bk);return Ut(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function k7(e,n){const{id:s}=Mb(),o=x.useRef({collapse:rh,expand:rh,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:rh});x.useImperativeHandle(n,()=>o.current,[]),wo(()=>{Object.assign(o.current,dk({groupId:s,panelId:e}))})}function to({children:e,className:n,collapsedSize:s="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:d,groupResizeBehavior:f="preserve-relative-size",id:p,maxSize:m="100%",minSize:g="0%",onResize:b,panelRef:v,style:S,...C}){const j=!!p,w=Rb(p),k=Ab({disabled:c}),E=x.useRef(null),R=Tb(E,d),{getPanelStyles:N,id:T,orientation:M,registerPanel:O,updatePanelProps:P}=Mb(),B=b!==null,L=cc((q,Y,V)=>{b?.(q,p,V)});wo(()=>{const q=E.current;if(q!==null){const Y={element:q,id:w,idIsStable:j,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?L:void 0,panelConstraints:{groupResizeBehavior:f,collapsedSize:s,collapsible:o,defaultSize:l,disabled:k.disabled,maxSize:m,minSize:g}};return O(Y)}},[f,s,o,l,B,w,j,m,g,L,O,k]),x.useEffect(()=>{P(w,{disabled:c})},[c,w,P]),k7(w,v);const D=()=>{const q=N(T,w);if(q)return JSON.stringify(q)},z=x.useSyncExternalStore(q=>Cb(T,q),D,D);let H;return z?H=JSON.parse(z):l!==void 0?H={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:H={flexGrow:1},r.jsx("div",{...C,"data-disabled":c||void 0,"data-panel":!0,"data-testid":w,id:w,ref:R,style:{...E7,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...H},children:r.jsx("div",{className:n,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:M==="horizontal"?"pan-y":"pan-x"},children:e})})}to.displayName="Panel";const E7={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function N7({layout:e,panelConstraints:n,panelId:s,panelIndex:o}){let l,c;const d=e[s],f=n.find(p=>p.panelId===s);if(f){const p=f.maxSize,m=f.collapsible?f.collapsedSize:f.minSize,g=[o,o+1];c=go({layout:jc({delta:m-d,initialLayout:e,panelConstraints:n,pivotIndices:g,prevLayout:e}),panelConstraints:n})[s],l=go({layout:jc({delta:p-d,initialLayout:e,panelConstraints:n,pivotIndices:g,prevLayout:e}),panelConstraints:n})[s]}return{valueControls:s,valueMax:l,valueMin:c,valueNow:d}}function Ob({children:e,className:n,disabled:s,disableDoubleClick:o,elementRef:l,id:c,style:d,...f}){const p=Rb(c),m=Ab({disabled:s,disableDoubleClick:o}),[g,b]=x.useState({}),[v,S]=x.useState("inactive"),[C,j]=x.useState(!1),w=x.useRef(null),k=Tb(w,l),{disableCursor:E,id:R,orientation:N,registerSeparator:T,updateSeparatorProps:M}=Mb(),O=N==="horizontal"?"vertical":"horizontal";wo(()=>{const L=w.current;if(L!==null){const D={disabled:m.disabled,disableDoubleClick:m.disableDoubleClick,element:L,id:p},z=T(D),H=g7(Y=>{S(Y.next.state!=="inactive"&&Y.next.hitRegions.some(V=>V.separator===D)?Y.next.state:"inactive")}),q=Cb(R,Y=>{const{derivedPanelConstraints:V,layout:$,separatorToPanels:Z}=Y.next,G=Z.get(D);if(G){const X=G[0],U=G.indexOf(X);b(N7({layout:$,panelConstraints:V,panelId:X.id,panelIndex:U}))}});return()=>{H(),q(),z()}}},[R,p,T,m]),x.useEffect(()=>{M(p,{disabled:s,disableDoubleClick:o})},[s,o,p,M]);let P;s&&!E&&(P="not-allowed");let B;if(s)B="disabled";else switch(v){case"active":{B="active";break}default:C?B="focus":B=v}return r.jsx("div",{...f,"aria-controls":g.valueControls,"aria-disabled":s||void 0,"aria-orientation":O,"aria-valuemax":g.valueMax,"aria-valuemin":g.valueMin,"aria-valuenow":g.valueNow,children:e,className:n,"data-separator":B,"data-testid":p,id:p,onBlur:()=>j(!1),onFocus:()=>j(!0),ref:k,role:"separator",style:{flexBasis:"auto",cursor:P,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}Ob.displayName="Separator";function R7({projects:e,value:n,onChange:s,disabled:o}){const l=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||`proyecto ${c.id}`;return{value:String(c.id),label:c.name||d,icon:HT,description:c.path}});return r.jsx("div",{className:"w-full","data-testid":"code-project-select",children:r.jsx(wt,{value:n,onChange:s,options:l,placeholder:"Elegí un proyecto…",disabled:o})})}function T7({sessions:e,activeId:n,busy:s,onSelect:o,onCreate:l,onRename:c,onDelete:d}){return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:_("code_module.sessions")}),r.jsx(Mt,{content:_("code_module.new_session"),children:r.jsxs("button",{type:"button",onClick:l,disabled:s,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[r.jsx(un,{className:"size-3"})," ",_("code_module.new_session")]})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?r.jsx("div",{className:"p-2",children:r.jsx(it,{children:_("code_module.no_sessions")})}):r.jsx("ul",{className:"space-y-0.5",children:e.map(f=>r.jsxs("li",{className:"group/item relative",children:[r.jsxs("button",{type:"button",onClick:()=>o(f.id),className:Me("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",f.id===n?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[r.jsx(Fw,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate font-medium",children:f.title}),r.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[f.mode," · ",f.messageCount," msg",f.model?` · ${f.model}`:""]})]})]}),r.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[r.jsx(Mt,{content:_("code_module.rename"),children:r.jsx("button",{type:"button",onClick:()=>c(f.id,f.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:r.jsx(Ml,{className:"size-3"})})}),r.jsx(Mt,{content:_("code_module.delete"),children:r.jsx("button",{type:"button",onClick:()=>d(f.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:r.jsx(la,{className:"size-3"})})})]})]},f.id))})})]})}function A7({mode:e,onChange:n,disabled:s}){const o=(l,c,d,f)=>r.jsx(Mt,{content:d,children:r.jsxs("button",{type:"button",disabled:s,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>n(l),className:Me("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===l?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(f,{className:"size-3.5"})," ",c]})});return r.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",_("code_module.mode_build"),_("code_module.mode_build_hint"),GT),o("plan",_("code_module.mode_plan"),_("code_module.mode_plan_hint"),RT)]})}function M7({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,mode:d,onModeChange:f,model:p,onModelChange:m}){return r.jsx(bb,{value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,placeholder:_("code_module.placeholder"),minRows:1,maxRows:6,footer:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A7,{mode:d,onChange:f,disabled:l}),r.jsx(vb,{value:p,onChange:m,disabled:l})]})})}function oh(e,n){let s=0;for(const o of e.parts||[])o.kind==="text"&&n.text&&(s+=o.text.length),o.kind==="tool"&&n.tool&&(o.args&&(s+=JSON.stringify(o.args).length),o.result!==void 0&&(s+=JSON.stringify(o.result).length));return Math.ceil(s/4)}function O7(e){let n=null,s=0,o=0;for(const d of e)d.role==="user"?s++:o++,d.role==="assistant"&&d.usage&&(n={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const l=n?.input??0,c=n?.output??0;return{model:n?.model??null,input:l,output:c,total:l+c,hasUsage:!!n,messages:e.length,userMsgs:s,assistantMsgs:o}}function z7(e){let n=0,s=0,o=0;for(const d of e)d.role==="user"?n+=oh(d,{text:!0}):s+=oh(d,{text:!0}),o+=oh(d,{tool:!0});const l=n+s+o||1,c=(d,f)=>({key:d,tokens:f,percent:Math.round(f/l*100)});return[c("user",n),c("assistant",s),c("tool",o)].filter(d=>d.tokens>0)}const lw={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ts({label:e,value:n}){return r.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[r.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:n})]})}function iw(e){if(!e)return"";const n=new Date(e),s=o=>String(o).padStart(2,"0");return`${s(n.getDate())} ${n.toLocaleString("es",{month:"short"})} ${n.getFullYear()}, ${s(n.getHours())}:${s(n.getMinutes())}`}function D7({turns:e,session:n}){const s=x.useMemo(()=>O7(e),[e]),o=x.useMemo(()=>z7(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(it,{children:_("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(Ts,{label:_("code_module.ctx_model"),value:s.model||"auto"}),n?.mode&&r.jsx(Ts,{label:"Modo",value:n.mode}),n?.agentSlug&&r.jsx(Ts,{label:"Agente",value:n.agentSlug}),r.jsx(Ts,{label:_("code_module.ctx_messages"),value:`${s.userMsgs} usuario · ${s.assistantMsgs} asistente`}),r.jsx(Ts,{label:_("code_module.ctx_input"),value:s.input.toLocaleString()}),r.jsx(Ts,{label:_("code_module.ctx_output"),value:s.output.toLocaleString()}),r.jsx(Ts,{label:"Tokens Total",value:(s.input+s.output).toLocaleString()}),n?.createdAt&&r.jsx(Ts,{label:"Creado",value:iw(n.createdAt)}),n?.updatedAt&&r.jsx(Ts,{label:"Actividad",value:iw(n.updatedAt)}),r.jsx("hr",{className:"border-border my-2"}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:_("code_module.ctx_breakdown")}),o.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>r.jsx(Mt,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:r.jsx("div",{className:lw[l.key],style:{width:`${l.percent}%`}})},l.key))}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>r.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{className:`size-2 rounded-full ${lw[l.key]}`}),r.jsx("span",{className:"flex-1 text-foreground/80",children:_(`code_module.seg_${l.key}`)}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):r.jsx("p",{className:"text-[11px] text-muted-foreground",children:_("code_module.ctx_none")})]})]})}function L7(e){const n=[];for(const s of(e||"").split(`
604
+ `))s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("new file")||s.startsWith("deleted file")||s.startsWith("similarity index")||s.startsWith("rename ")||(s.startsWith("@@")?n.push({kind:"hunk",text:s}):s.startsWith("+")?n.push({kind:"add",text:s.slice(1)}):s.startsWith("-")?n.push({kind:"del",text:s.slice(1)}):n.push({kind:"ctx",text:s.replace(/^ /,"")}));for(;n.length&&n[n.length-1].kind==="ctx"&&n[n.length-1].text==="";)n.pop();return n}function P7({patch:e}){const n=x.useMemo(()=>L7(e),[e]);return n.length?r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:r.jsx("code",{className:"block",children:n.map((s,o)=>r.jsxs("div",{className:Me("px-2 whitespace-pre",s.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",s.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",s.kind==="hunk"&&"bg-muted/60 text-muted-foreground",s.kind==="ctx"&&"text-foreground/70"),children:[r.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},o))})}):null}const I7={added:LT,modified:Ad,deleted:BT},B7={added:"text-emerald-600 dark:text-emerald-400",modified:"text-amber-600 dark:text-amber-400",deleted:"text-rose-600 dark:text-rose-400"};function U7({file:e}){const[n,s]=x.useState(!1),o=I7[e.status];return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[r.jsx(af,{className:Me("size-3 shrink-0 transition-transform",n&&"rotate-90")}),r.jsx(o,{className:Me("size-3.5 shrink-0",B7[e.status])}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&r.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&r.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),n&&r.jsx("div",{className:"border-t border-border p-1.5",children:r.jsx(P7,{patch:e.patch})})]})}function H7({changes:e,loading:n,onRefresh:s}){const o=e?.files||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?_("code_module.changes_files",{n:o.length}):""}),r.jsx(Mt,{content:_("code_module.reload"),children:r.jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:n?r.jsx(za,{size:12}):r.jsx(Nr,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?r.jsx(it,{children:_("code_module.changes_no_git")}):o.length===0?r.jsx(it,{children:_("code_module.changes_none")}):r.jsx("ul",{className:"space-y-1.5",children:o.map(l=>r.jsx(U7,{file:l},l.path))})})]})}function V7({pid:e,entry:n,onDeleted:s,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[d,f]=x.useState(!1),[p,m]=x.useState(null),g=st(),[b,v]=x.useState(!1),[S,C]=x.useState(n.name),j=x.useRef(null),[w,k]=x.useState(!1),[E,R]=x.useState(!1),[N,T]=x.useState(!1),M=w?["artifact",e,n.name]:null,O=Qe(M,()=>hl.read(e,n.name),{revalidateOnFocus:!1}),P=!O.data?.content||O.data.content.startsWith("#!"),B=async H=>{try{await navigator.clipboard.writeText(H),g.info("Copiado.")}catch{}},L=async()=>{T(!0);try{await hl.remove(e,n.name),R(!1),s()}catch(H){g.error(H.message)}finally{T(!1)}},D=()=>{C(n.name),v(!0),requestAnimationFrame(()=>j.current?.select())},z=async()=>{const H=S.trim();if(v(!1),!(!H||H===n.name))try{await hl.rename(e,n.name,H),o()}catch(q){g.error(q.message)}};return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[r.jsx(DT,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),b?r.jsx("input",{ref:j,value:S,onChange:H=>C(H.target.value),onBlur:()=>void z(),onKeyDown:H=>{H.key==="Enter"&&z(),H.key==="Escape"&&v(!1)},autoFocus:!0,className:"min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 font-mono text-xs outline-none focus:ring-1 focus:ring-ring"}):r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:n.name}),r.jsx(Mt,{content:_("code_module.artifacts_rename"),children:r.jsx("button",{type:"button",onClick:D,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Ml,{className:"size-3"})})}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[n.size,"b"]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:n.path}),r.jsx(Mt,{content:_("code_module.artifacts_copy_path"),children:r.jsx("button",{type:"button",onClick:()=>void B(n.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Td,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(Dh,{open:w,onOpenChange:k,children:[r.jsx(Mt,{content:_("code_module.artifacts_view"),children:r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-blue-500/15 text-blue-700 hover:bg-blue-500/25 dark:text-blue-300",children:[r.jsx(sf,{className:"size-3"}),"Ver"]})}),r.jsxs(Lh,{className:"sm:max-w-lg",children:[r.jsx(Ph,{children:r.jsx(Ih,{className:"font-mono text-sm",children:n.name})}),O.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(za,{size:16})}):r.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:O.data?.content??""}),r.jsx(G_,{showCloseButton:!0})]})]}),r.jsx(Mt,{content:_("code_module.artifacts_edit"),children:r.jsxs("button",{type:"button",onClick:()=>c?.(n.name),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-violet-500/15 text-violet-700 hover:bg-violet-500/25 dark:text-violet-300",children:[r.jsx(cA,{className:"size-3"}),"Editar"]})}),P&&r.jsx(Mt,{content:_("code_module.artifacts_run"),children:r.jsxs("button",{type:"button",onClick:()=>l?.(`apx artifact run ${n.name}`),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[r.jsx(cx,{className:"size-3"}),_("code_module.artifacts_run")]})}),r.jsxs(Dh,{open:E,onOpenChange:R,children:[r.jsx(Mt,{content:_("code_module.artifacts_delete"),children:r.jsx("button",{type:"button",onClick:()=>R(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:r.jsx(la,{className:"size-3"})})}),r.jsxs(Lh,{className:"sm:max-w-sm",children:[r.jsx(Ph,{children:r.jsxs(Ih,{className:"font-mono text-sm",children:[_("code_module.artifacts_delete")," — ",n.name]})}),r.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:_("code_module.artifacts_delete_confirm")}),r.jsxs(G_,{children:[r.jsx(Sz,{render:r.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:"Cancelar"}),r.jsxs("button",{type:"button",onClick:()=>void L(),disabled:N,className:Me("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",N?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[N&&r.jsx(za,{size:10}),"Eliminar"]})]})]})]})]}),r.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[_("code_module.artifacts_run_hint")," ",r.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",n.name]})]}),p&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[r.jsxs("span",{className:Me("rounded px-1.5 py-0.5 font-mono",p.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:["exit ",p.exitCode??p.signal??"?"]}),p.timedOut&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:"timeout"}),p.truncated&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:"truncated"}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[p.durationMs,"ms"]})]}),p.stdout&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:p.stdout}),p.stderr&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-rose-500/5 p-2 text-[10px] leading-tight text-rose-700 dark:text-rose-300",children:p.stderr})]})]})]})}function q7({pid:e,onRunInTerminal:n,onEditArtifact:s}){const o=Qe(e?["artifacts",e]:null,()=>hl.list(e)),l=o.data||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?_("code_module.artifacts_count",{n:l.length}):""}),r.jsx(Mt,{content:_("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?r.jsx(za,{size:12}):r.jsx(Nr,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?r.jsx(it,{children:_("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(V7,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:n,onEditArtifact:s},c.name))})})]})}const $7=[{value:"context",icon:rf,label:"tab_context"},{value:"changes",icon:$T,label:"tab_changes"},{value:"artifacts",icon:nA,label:"tab_artifacts"}];function G7({pid:e,turns:n,changes:s,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:d,onEditArtifact:f}){const[p,m]=x.useState("context"),g=s?.files.length||0;return r.jsxs(Mf,{value:p,onValueChange:m,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[r.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:r.jsx(Of,{variant:"line",className:"w-full",children:$7.map(({value:b,icon:v,label:S})=>{const C=p===b,j=_(`code_module.${S}`);return r.jsx(Mt,{content:j,children:r.jsxs(es,{value:b,className:C?"flex-1 min-w-0":"w-8 shrink-0",children:[r.jsx(v,{className:"size-3.5 shrink-0"}),C&&r.jsx("span",{className:"truncate text-xs",children:j}),b==="changes"&&g>0&&r.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:g})]})},b)})})}),r.jsx(Ma,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(D7,{turns:n,session:c})}),r.jsx(Ma,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(H7,{changes:s,loading:o,onRefresh:l})}),r.jsx(Ma,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(q7,{pid:e,onRunInTerminal:d,onEditArtifact:f})})]})}function F7(e){const n=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=n,d="";for(let f=0;f<l.length;f++){d=d?`${d}/${l[f]}`:l[f];const p=f===l.length-1;let m=c.find(g=>g.name===l[f]);m||(m={name:l[f],path:d,type:p?"file":"dir",children:p?void 0:[]},c.push(m)),p||(c=m.children)}}const s=o=>(o.forEach(l=>{l.children&&(l.children=s(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return s(n)}function vk({node:e,depth:n,onOpenFile:s,openDirs:o,toggleDir:l}){const c=e.type==="dir",d=c&&o.has(e.path);return r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>c?l(e.path):s(e.path),style:{paddingLeft:`${n*12+6}px`},className:Me("flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[11px] rounded transition-colors","hover:bg-accent/40",c?"text-foreground/80":"text-foreground/70"),children:[c?r.jsxs(r.Fragment,{children:[r.jsx(af,{className:Me("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?r.jsx(qw,{className:"size-3.5 shrink-0 text-amber-400"}):r.jsx(VT,{className:"size-3.5 shrink-0 text-amber-400"})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(UT,{className:"size-3.5 shrink-0 text-sky-400"})]}),r.jsx("span",{className:"truncate",children:e.name})]}),c&&d&&e.children&&e.children.length>0&&r.jsx("ul",{children:e.children.map(f=>r.jsx(vk,{node:f,depth:n+1,onOpenFile:s,openDirs:o,toggleDir:l},f.path))})]})}function Y7({pid:e,projectPath:n,className:s,onOpenFile:o}){const[l,c]=x.useState([]),[d,f]=x.useState(!1),[p,m]=x.useState(!1),[g,b]=x.useState(()=>new Set),v=x.useCallback(async()=>{f(!0);try{const E=(await ge.post("/run",{cmd:"find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.claude/*' | sed 's|^\\./||' | sort | head -500",project:e})).stdout.split(`
605
+ `).map(R=>R.trim()).filter(Boolean);c(E),m(!0)}catch{m(!0)}finally{f(!1)}},[e]);x.useEffect(()=>{b(new Set),v()},[v]);const S=x.useCallback(k=>{b(E=>{const R=new Set(E);return R.has(k)?R.delete(k):R.add(k),R})},[]),C=x.useCallback(()=>{b(new Set)},[]),j=F7(l),w=g.size>0;return r.jsxs("div",{className:Me("flex h-full flex-col",s),"data-testid":"code-file-tree",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Mt,{content:_("code_module.tree_collapse_all"),children:r.jsx("button",{type:"button",onClick:C,disabled:!w,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(kT,{className:"size-3"})})}),r.jsx(Mt,{content:_("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void v(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:d?r.jsx(za,{size:12}):r.jsx(Nr,{className:"size-3"})})})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:p?j.length===0?r.jsx("div",{className:"p-3",children:r.jsx(it,{children:"Sin archivos"})}):r.jsx("ul",{children:j.map(k=>r.jsx(vk,{node:k,depth:0,onOpenFile:o??(()=>{}),openDirs:g,toggleDir:S},k.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(za,{size:14})})})]})}function X7({path:e,content:n,loading:s,onSave:o}){const l=typeof o=="function",[c,d]=x.useState(n),[f,p]=x.useState(!1);x.useEffect(()=>{d(n)},[n]);const m=l&&c!==n,g=async()=>{if(!(!o||!m)){p(!0);try{await o(c)}finally{p(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,m&&r.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&r.jsxs(r.Fragment,{children:[r.jsx(Mt,{content:_("code_module.discard_changes"),children:r.jsxs("button",{type:"button",onClick:()=>d(n),disabled:!m||f,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[r.jsx(ux,{className:"size-3"}),"Descartar"]})}),r.jsx(Mt,{content:_("code_module.save_shortcut_hint"),children:r.jsxs("button",{type:"button",onClick:()=>void g(),disabled:!m||f,className:Me("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",m&&!f?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[f?r.jsx(za,{size:10}):r.jsx(lf,{className:"size-3"}),"Guardar"]})})]})]}),s?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(za,{size:16})}):l?r.jsx("textarea",{value:c,onChange:b=>d(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),g())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:r.jsx("tbody",{children:n.split(`
606
+ `).map((b,v)=>r.jsxs("tr",{className:"hover:bg-accent/20",children:[r.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:v+1}),r.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},v))})})})]})}function K7({pid:e,className:n,initCmd:s,onClose:o}){const[l,c]=x.useState([]),[d,f]=x.useState(""),[p,m]=x.useState(!1),[g,b]=x.useState([]),[v,S]=x.useState(-1),C=x.useRef(null),j=x.useRef(null);x.useEffect(()=>{C.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{s&&(f(s),setTimeout(()=>j.current?.focus(),50))},[s]);const w=async E=>{const R=E.trim();if(R){b(N=>[R,...N.slice(0,49)]),S(-1),c(N=>[...N,{type:"cmd",text:`$ ${R}`}]),m(!0);try{const N=await ge.post("/run",{cmd:R,project:e});N.stdout&&c(T=>[...T,{type:"out",text:N.stdout}]),N.stderr&&c(T=>[...T,{type:"err",text:N.stderr}])}catch(N){c(T=>[...T,{type:"err",text:String(N.message)}])}finally{m(!1)}}},k=E=>{if(E.key==="Enter")w(d),f("");else if(E.key==="ArrowUp"){E.preventDefault();const R=Math.min(v+1,g.length-1);S(R),f(g[R]??"")}else if(E.key==="ArrowDown"){E.preventDefault();const R=Math.max(v-1,-1);S(R),f(R===-1?"":g[R]??"")}};return r.jsxs("div",{className:Me("flex h-full min-h-0 flex-col bg-card/60",n),"data-testid":"code-terminal",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[r.jsx(Sr,{className:"size-3 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),r.jsx(Mt,{content:_("code_module.terminal_clear"),children:r.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(OT,{className:"size-3"})})}),r.jsx(Mt,{content:_("code_module.terminal_close"),children:r.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(bo,{className:"size-3"})})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>j.current?.focus(),children:[l.map((E,R)=>r.jsx("div",{className:Me("whitespace-pre-wrap break-all",E.type==="cmd"&&"text-emerald-400",E.type==="err"&&"text-rose-400",E.type==="out"&&"text-foreground/90"),children:E.text},R)),r.jsx("div",{ref:C})]}),r.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[r.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),r.jsx("input",{ref:j,value:d,onChange:E=>f(E.target.value),onKeyDown:k,disabled:p,placeholder:p?"ejecutando…":"comando…",className:"flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted-foreground/50 disabled:opacity-50",spellCheck:!1,autoComplete:"off"})]})]})}const Xi="super-agent";function lh(){return r.jsx(Ob,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function Q7(){return r.jsx(Ob,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function Z7(){const e=st(),n=Qe("/projects",()=>na.list()),s=x.useMemo(()=>n.data||[],[n.data]),[o,l]=x.useState(""),[c,d]=x.useState(null),[f,p]=x.useState(Xi),[m,g]=x.useState([]),[b,v]=x.useState(""),[S,C]=x.useState(!1),[j,w]=x.useState(!0),[k,E]=x.useState(!0),[R,N]=x.useState(!1),[T,M]=x.useState(""),[O,P]=x.useState(!1),B=x.useRef(null),[L,D]=x.useState([]),[z,H]=x.useState("chat"),q=x.useCallback(pe=>{N(!0),M(pe)},[]);x.useEffect(()=>{!o&&s.length&&l(String(s[0].id))},[o,s]);const Y=Qe(o?["code-sessions",o]:null,()=>Rs.sessions.list(o)),V=Qe(o?["agents",o]:null,()=>Jt.list(o)),$=Qe(o&&c?["code-session",o,c]:null,()=>Rs.sessions.get(o,c)),Z=Qe(o&&c?["code-changes",o,c]:null,()=>Rs.changes(o,c));x.useEffect(()=>{const pe=Y.data||[];!c&&pe.length&&d(pe[0].id),c&&pe.length&&!pe.some(ke=>ke.id===c)&&d(pe[0]?.id??null)},[Y.data,c]),x.useEffect(()=>{$.data&&p($.data.agentSlug||Xi)},[$.data]),x.useEffect(()=>{S||($.data?g($.data.messages||[]):c||g([]))},[$.data,c,S]),x.useEffect(()=>()=>B.current?.abort(),[]);const G=$.data,X=G?.mode==="plan"?"plan":"build",U=G?.model||"",K=pe=>{pe===o||S||(l(pe),d(null),g([]))},F=pe=>{S||pe===c||(d(pe),g([]))},J=async()=>{if(!(!o||S))try{const pe=await Rs.sessions.create(o,{title:_("code_module.untitled"),agentSlug:f!==Xi?f:null});await Y.mutate(),d(pe.id),g([])}catch(pe){e.error(pe.message)}},ie=async(pe,ke)=>{const Re=window.prompt(_("code_module.rename"),ke);if(!(!Re||Re===ke))try{await Rs.sessions.update(o,pe,{title:Re}),await Y.mutate(),pe===c&&await $.mutate()}catch(Ve){e.error(Ve.message)}},re=async pe=>{if(!S&&window.confirm(_("code_module.delete_confirm")))try{await Rs.sessions.remove(o,pe),pe===c&&(d(null),g([])),await Y.mutate()}catch(ke){e.error(ke.message)}},oe=async pe=>{if(p(pe),!!c)try{await Rs.sessions.update(o,c,{agentSlug:pe!==Xi?pe:null}),await Promise.all([$.mutate(),Y.mutate()])}catch(ke){e.error(ke.message)}},ce=x.useCallback(async pe=>{if(c)try{await Rs.sessions.update(o,c,pe),await Promise.all([$.mutate(),Y.mutate()])}catch(ke){e.error(ke.message)}},[o,c,$,Y,e]),ee=()=>{B.current?.abort(),C(!1)},Te=pe=>g(ke=>{const Re=[...ke],Ve=Re[Re.length-1];return Ve&&Ve.role==="assistant"&&(Re[Re.length-1]=pe(Ve)),Re}),Fe=async pe=>{const ke=(pe??b).trim();if(!ke||S||!o||!c)return;const Re=new Date().toISOString();g(nn=>[...nn,{role:"user",parts:[{kind:"text",text:ke}],ts:Re},{role:"assistant",parts:[],ts:Re,pending:!0}]),v(""),C(!0);const Ve=new AbortController;B.current=Ve;const at=nn=>{if(nn.type==="error"){e.error(nn.error||"error");return}Te(Vt=>yb(Vt,nn))};try{await Rs.stream(o,c,{prompt:ke},at,Ve.signal),Te(nn=>({...nn,pending:!1}))}catch(nn){Ve.signal.aborted?Te(Vt=>({...Vt,pending:!1,parts:[...Vt.parts,{kind:"text",text:_("code_module.stopped")}]})):(e.error(nn.message),g(Vt=>Vt.filter((mt,Nt)=>Nt!==Vt.length-1)))}finally{B.current===Ve&&(B.current=null),C(!1),$.mutate(),Y.mutate(),Z.mutate()}},ve=async pe=>{try{await navigator.clipboard.writeText(pe),e.info("Copiado.")}catch{}},Ce=x.useCallback(pe=>{H(pe),D(ke=>ke.some(Re=>Re.path===pe)?ke:[...ke,{path:pe,content:"",loading:!0}]),ge.post("/run",{cmd:`cat "${pe}"`,project:o}).then(ke=>{const Re=ke.stdout||ke.stderr||"(vacío)";D(Ve=>Ve.map(at=>at.path===pe?{...at,content:Re,loading:!1}:at))}).catch(ke=>{D(Re=>Re.map(Ve=>Ve.path===pe?{...Ve,content:`Error: ${ke.message}`,loading:!1}:Ve))})},[o]),Ne=x.useCallback(pe=>{D(ke=>ke.filter(Re=>Re.path!==pe)),H(ke=>ke===pe?"chat":ke)},[]),Pe=x.useCallback(pe=>{const ke=`artifacts/${pe}`;H(ke),D(Re=>Re.some(Ve=>Ve.path===ke)?Re:[...Re,{path:ke,content:"",loading:!0,artifactName:pe}]),hl.read(o,pe).then(Re=>{D(Ve=>Ve.map(at=>at.path===ke?{...at,content:Re.content,loading:!1}:at))}).catch(Re=>{D(Ve=>Ve.map(at=>at.path===ke?{...at,content:`Error: ${Re.message}`,loading:!1}:at))})},[o]),Ie=x.useCallback(async(pe,ke)=>{const Re=L.find(Ve=>Ve.path===pe);if(Re?.artifactName)try{await hl.write(o,Re.artifactName,ke),D(Ve=>Ve.map(at=>at.path===pe?{...at,content:ke}:at)),e.info("Guardado.")}catch(Ve){e.error(Ve.message)}},[L,o,e]),be=!n.isLoading&&s.length>0,Ae=x.useMemo(()=>{const pe=[{value:Xi,label:"super-agent",icon:yn,description:"Agente principal con todas las herramientas"}],ke=(V.data||[]).map(Re=>({value:Re.slug,label:Re.slug,icon:yn,description:Re.description||Re.role||void 0}));return[...pe,...ke]},[V.data]),we=x.useMemo(()=>m,[m]),Be=x.useMemo(()=>Y.data?.find(pe=>pe.id===c)?.title||"",[Y.data,c]),Xe=x.useMemo(()=>s.find(pe=>String(pe.id)===o),[s,o]);Vz(Be);const[Ye,De]=x.useState(null),ye=S?null:FC(m),le=ye&&ye.turnKey!==Ye,_e=pe=>{Fe(pe)},Se=x.useCallback(()=>w(pe=>!pe),[]),Ue=x.useCallback(()=>P(pe=>!pe),[]),Je=x.useCallback(()=>N(pe=>!pe),[]),_t=x.useCallback(()=>E(pe=>!pe),[]),zt=x.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:Yw,open:j,toggle:Se,title:"Lista de sesiones"},{Icon:$w,open:O,toggle:Ue,title:"Árbol de archivos"},{Icon:Sr,open:R,toggle:Je,title:"Terminal"},{Icon:sA,open:k,toggle:_t,title:"Panel de contexto"}].map(({Icon:pe,open:ke,toggle:Re,title:Ve})=>r.jsx(Mt,{content:Ve,children:r.jsx("button",{type:"button",onClick:Re,"data-active":ke,className:"rounded p-1 text-muted-fg transition-colors hover:bg-accent hover:text-accent-fg data-[active=true]:bg-accent data-[active=true]:text-accent-fg",children:r.jsx(pe,{className:"size-3.5"})})},Ve))}):null,[c,j,O,R,k,Se,Ue,Je,_t]);return $z(zt),r.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:n.isLoading?r.jsx(nt,{}):be?r.jsxs(Kh,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(to,{id:"top",defaultSize:R?"55%":"100%",minSize:"20%",children:r.jsxs(Kh,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[j&&r.jsxs(r.Fragment,{children:[r.jsx(to,{id:"left",defaultSize:"14%",minSize:"8%",children:r.jsxs("aside",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"shrink-0 border-b border-border p-2",children:r.jsx(R7,{projects:s,value:o,onChange:K,disabled:S})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(T7,{sessions:Y.data||[],activeId:c,busy:S,onSelect:F,onCreate:J,onRename:ie,onDelete:re})}),r.jsx("div",{className:"shrink-0 border-t border-border p-2",children:r.jsx(wt,{value:f,onChange:oe,options:Ae,disabled:S,showIcon:!0})})]})}),r.jsx(lh,{})]}),O&&r.jsxs(r.Fragment,{children:[r.jsx(to,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(Y7,{pid:o,projectPath:Xe?.path,onOpenFile:Ce})})}),r.jsx(lh,{})]}),r.jsx(to,{id:"main",defaultSize:"50%",minSize:"20%",children:r.jsxs("div",{className:"flex h-full flex-col",children:[L.length>0&&r.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[r.jsxs("button",{type:"button",onClick:()=>H("chat"),"data-active":z==="chat",className:"flex shrink-0 items-center gap-1.5 border-r border-border px-3 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Fw,{className:"size-3 shrink-0"}),"Chat"]}),L.map(pe=>{const ke=pe.path.split("/").pop()??pe.path,Re=z===pe.path;return r.jsxs("div",{"data-active":Re,className:"group flex shrink-0 items-center gap-1 border-r border-border px-2 py-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Mt,{content:pe.path,children:r.jsx("button",{type:"button",onClick:()=>H(pe.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:ke})}),r.jsx(Mt,{content:_("code_module.close"),children:r.jsx("button",{type:"button",onClick:()=>Ne(pe.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:r.jsx(bo,{className:"size-2.5"})})})]},pe.path)})]}),z==="chat"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?m.length?r.jsx(_b,{msgs:m,onCopy:ve}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(it,{children:_("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(it,{children:_("code_module.pick_project")})})}),le&&ye&&r.jsx(GC,{turnKey:ye.turnKey,questions:ye.questions,onSubmit:_e,onDismiss:()=>De(ye.turnKey),disabled:S})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const pe=L.find(ke=>ke.path===z);return pe?r.jsx(X7,{path:pe.path,content:pe.content,loading:pe.loading,onSave:pe.artifactName?ke=>Ie(pe.path,ke):void 0}):null})()}),r.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:r.jsx(M7,{value:b,onValueChange:v,onSubmit:()=>void Fe(),onStop:ee,busy:S,disabled:!c,mode:X,onModeChange:pe=>void ce({mode:pe}),model:U,onModelChange:pe=>void ce({model:pe||null})})})]})}),k&&r.jsxs(r.Fragment,{children:[r.jsx(lh,{}),r.jsx(to,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(G7,{pid:o,turns:we,changes:Z.data,changesLoading:Z.isLoading,onRefreshChanges:()=>void Z.mutate(),session:$.data?{title:$.data.title,mode:$.data.mode,createdAt:$.data.createdAt,updatedAt:$.data.updatedAt,agentSlug:$.data.agentSlug??null}:null,onRunInTerminal:q,onEditArtifact:Pe})})})]})]})}),R&&o&&r.jsxs(r.Fragment,{children:[r.jsx(Q7,{}),r.jsx(to,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(K7,{pid:o,initCmd:T,onClose:Je,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(it,{children:_("code_module.no_projects")})})})}function W7({open:e,onClose:n}){const{mutate:s}=D2(),o=st(),[l,c]=x.useState(""),[d,f]=x.useState(""),[p,m]=x.useState([]),[g,b]=x.useState(null),[v,S]=x.useState(""),[C,j]=x.useState(!1),[w,k]=x.useState(!1),E=async(N,T=!1)=>{j(!0),S("");try{const M=await oO.dirs(N||"~");f(M.path),c(M.path),b(M.parent),m(M.entries)}catch(M){const O=M.message;S(O),T||o.error(O)}finally{j(!1)}};x.useEffect(()=>{e&&!d&&E(l||"~",!0)},[e]);const R=async()=>{const N=l.trim();if(!N){o.error(_("add_project.path_required"));return}k(!0);try{const T=await na.register(N);o.success(_("add_project.registered",{id:T.id})),await s("/projects"),c(""),n()}catch(T){o.error(T.message)}finally{k(!1)}};return r.jsx(Mn,{open:e,onClose:n,title:_("add_project.title"),description:_("add_project.subtitle"),footer:r.jsxs(r.Fragment,{children:[r.jsx(me,{variant:"ghost",onClick:n,disabled:w,children:_("common.cancel")}),r.jsx(me,{variant:"primary",onClick:R,loading:w,children:_("add_project.register")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:_("add_project.path_label"),hint:_("add_project.path_hint"),children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ee,{autoFocus:!0,placeholder:_("add_project.path_placeholder"),value:l,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&R()}}),r.jsxs(me,{onClick:()=>E(l||"~"),disabled:C,children:[r.jsx(vd,{size:14})," ",_("add_project.search_btn")]})]})}),r.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:d||l||"~"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>E("~"),disabled:C,children:r.jsx(YT,{size:13})}),r.jsx(me,{size:"sm",variant:"ghost",onClick:()=>g&&E(g),disabled:!g||C,children:".."})]})]}),r.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[C&&r.jsx(nt,{}),!C&&v&&r.jsx(it,{children:_("add_project.browser_unavailable")}),!C&&!v&&p.length===0&&r.jsx(it,{children:_("add_project.no_folders")}),!C&&!v&&p.map(N=>r.jsxs("button",{type:"button",onClick:()=>E(N),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[r.jsx(qw,{size:14,className:"text-muted-fg"}),r.jsx("span",{className:"truncate",children:N.split("/").pop()}),r.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:N})]},N))]})]})]})})}function J7({onPaired:e}){const[n,s]=x.useState(""),[o,l]=x.useState(eI()),[c,d]=x.useState(!1),[f,p]=x.useState(null);async function m(){const g=n.trim();if(!g){p(_("pairing.err_required"));return}d(!0),p(null);try{const b=await Cl.confirm({pairing_id:g,label:o.trim()||void 0});no(b.token);try{localStorage.setItem(Rn.token,b.token)}catch{}e()}catch(b){p(tI(b)),d(!1)}}return r.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:r.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[r.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:r.jsx(dh,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-semibold",children:_("pairing.title")}),r.jsx("p",{className:"text-xs text-muted-fg",children:_("pairing.subtitle")})]})]}),r.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[r.jsx("li",{className:"font-medium text-foreground",children:_("pairing.steps_title")}),r.jsxs("li",{children:["1. ",_("pairing.step_1")]}),r.jsxs("li",{children:["2. ",_("pairing.step_2")]}),r.jsxs("li",{children:["3. ",_("pairing.step_3")]})]}),r.jsxs("form",{className:"space-y-3",onSubmit:g=>{g.preventDefault(),m()},children:[r.jsx(de,{label:_("pairing.code_label"),children:r.jsx(Ee,{value:n,onChange:g=>s(g.target.value),placeholder:_("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),r.jsx(de,{label:_("pairing.label_label"),hint:_("pairing.revoke_hint"),children:r.jsx(Ee,{value:o,onChange:g=>l(g.target.value),placeholder:_("pairing.label_ph")})}),f&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f}),r.jsx(me,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:_(c?"pairing.linking":"pairing.submit")})]})]})})}function eI(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function tI(e){if(e instanceof Mc){if(e.status===410)return _("pairing.err_expired");if(e.status===404||e.status===409)return _("pairing.err_unknown")}return _("pairing.err_generic")}function nI({...e}){return r.jsx(aC,{"data-slot":"sheet",...e})}function aI({...e}){return r.jsx(tC,{"data-slot":"sheet-portal",...e})}function sI({className:e,...n}){return r.jsx(Y2,{"data-slot":"sheet-overlay",className:Ot("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...n})}function rI({className:e,children:n,side:s="right",showCloseButton:o=!0,...l}){return r.jsxs(aI,{children:[r.jsx(sI,{}),r.jsxs(J2,{"data-slot":"sheet-content","data-side":s,className:Ot("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...l,children:[n,o&&r.jsxs(Rf,{"data-slot":"sheet-close",render:r.jsx(fo,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(bo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function oI({className:e,...n}){return r.jsx("div",{"data-slot":"sheet-header",className:Ot("flex flex-col gap-0.5 p-4",e),...n})}function lI({className:e,...n}){return r.jsx(sC,{"data-slot":"sheet-title",className:Ot("font-heading text-base font-medium text-foreground",e),...n})}function iI({className:e,...n}){return r.jsx(X2,{"data-slot":"sheet-description",className:Ot("text-sm text-muted-foreground",e),...n})}function cI({value:e,projectPath:n,onPick:s}){const o=uI(e),l=o?dI(e):"",{data:c}=Qe(o?["/skills",n||""]:null,()=>pO.list(n)),d=c?.skills||[],f=x.useMemo(()=>{const p=l.toLowerCase();return p?d.filter(m=>m.slug.toLowerCase().includes(p)).slice(0,8):d.slice(0,8)},[d,l]);return!o||f.length===0?null:r.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[r.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:f.map(p=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(p.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[r.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",p.slug]}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:p.description})]})},p.slug))}),r.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[10px] text-muted-foreground",children:"Type a name to filter · click to insert · the skill body will be loaded for this turn."})]})}function uI(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function dI(e){const n=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return n?n[1]:""}function fI(){try{const e=localStorage.getItem(Rn.robyChat);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(s=>s&&Array.isArray(s.parts)&&!s.pending):[]}catch{return[]}}function pI({open:e,onOpenChange:n}){const s=eb(),o=st(),[l,c]=x.useState(fI),[d,f]=x.useState(""),[p,m]=x.useState(!1),[g,b]=x.useState(""),v=x.useRef(null);x.useEffect(()=>{const E=l.filter(R=>!R.pending);try{E.length?localStorage.setItem(Rn.robyChat,JSON.stringify(E)):localStorage.removeItem(Rn.robyChat)}catch{}},[l]);const S=()=>{if(!p){c([]),f("");try{localStorage.removeItem(Rn.robyChat)}catch{}}};x.useEffect(()=>()=>v.current?.abort(),[]);const C=()=>{v.current?.abort(),m(!1)},j=E=>c(R=>{const N=[...R],T=N[N.length-1];return T?.role==="assistant"&&(N[N.length-1]=E(T)),N}),w=async()=>{const E=d.trim();if(!E||p)return;const R=new Date().toISOString(),N=l.filter(P=>!P.pending).map(P=>({role:P.role,content:qh(P)}));c(P=>[...P,{role:"user",parts:[{kind:"text",text:E}],ts:R},{role:"assistant",parts:[],ts:R,pending:!0}]),f(""),m(!0);const T=new AbortController;v.current=T;let M=!1;const O=P=>{if(P?.type==="error"){M=!0,o.error(P.error||"error"),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L});return}j(B=>yb(B,P))};try{await P2.stream(0,{prompt:E,previousMessages:N,model:g||void 0,channel:"web_sidebar"},O,T.signal),j(P=>({...P,pending:!1}))}catch(P){T.signal.aborted?j(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:_("project.chat.stopped_marker")}]})):M||(o.error(P.message),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L}))}finally{v.current===T&&(v.current=null),m(!1)}},k=async E=>{try{await navigator.clipboard.writeText(E),o.info(_("project.chat.copied"))}catch{}};return r.jsx(nI,{open:e,onOpenChange:n,children:r.jsxs(rI,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[r.jsxs(oI,{className:"pr-12",children:[r.jsxs(lI,{className:"flex items-center gap-2",children:[r.jsx(yn,{size:18})," ",_("superagent.title",{persona:s}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:_("superagent.badge")})]}),r.jsx(iI,{children:_("superagent.desc")})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?r.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:_("superagent.empty",{persona:s})}):r.jsx(_b,{msgs:l,onCopy:k})}),r.jsx($C,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(cI,{value:d,onPick:E=>f(`/${E} `)})}),r.jsx(bb,{value:d,onValueChange:f,onSubmit:()=>void w(),onStop:C,busy:p,placeholder:_("superagent.placeholder"),footer:r.jsx(vb,{value:g,onChange:b,disabled:p})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs(fo,{size:"xs",variant:"ghost",onClick:S,disabled:p||l.length===0,children:[r.jsx(un,{className:"size-3"})," ",_("superagent.new_chat")]})})]})]})})}function mI(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function gI(){const[e,n]=x.useState({status:"loading"}),[s,o]=x.useState(0),l=x.useCallback(()=>{n({status:"loading"}),o(c=>c+1)},[]);return x.useEffect(()=>{let c=!1;return(async()=>{try{const g=await fetch("/health");if(!g.ok)throw new Error(`HTTP ${g.status}`)}catch(g){c||n({status:"error",reason:String(g)});return}const d=window.location.hash.replace(/^#/,""),f=new URLSearchParams(d),p=f.get("pair");if(p){history.replaceState(null,"",window.location.pathname+window.location.search);try{const g=await Cl.confirm({pairing_id:p,label:mI(),kind:"web"});no(g.token);try{localStorage.setItem(Rn.token,g.token)}catch{}c||n({status:"ok"});return}catch{}}const m=f.get("token");if(m){no(m);try{localStorage.setItem(Rn.token,m)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const g=localStorage.getItem(Rn.token);g&&no(g)}catch{}try{const g=await fetch("/admin/web-token");if(g.ok){const b=await g.json();if(b?.token){no(b.token);try{localStorage.setItem(Rn.token,b.token)}catch{}}}}catch{}if(!Kx()){c||n({status:"unpaired"});return}try{await ge.get("/projects"),c||n({status:"ok"})}catch(g){if(g instanceof Mc&&(g.status===401||g.status===403)){no(null);try{localStorage.removeItem(Rn.token)}catch{}c||n({status:"unpaired"})}else c||n({status:"error",reason:String(g)})}})(),()=>{c=!0}},[s]),{...e,reload:l}}function hI(){const e=gI();return e.status==="loading"?r.jsx(cw,{text:_("daemon.connecting")}):e.status==="error"?r.jsx(cw,{text:_("daemon.unreachable"),sub:`${_("daemon.unreachable_hint")}
607
+
608
+ ${e.reason}`}):e.status==="unpaired"?r.jsx(J7,{onPaired:e.reload}):r.jsx(Az,{children:r.jsx(y4,{delay:300,children:r.jsx(xI,{})})})}function xI(){const e=La(),n=oa(),[s,o]=Ow(),{theme:l,toggle:c}=fx(),d=s.get("action")==="add-project",[f,p]=x.useState(!1),m=()=>{const g=new URLSearchParams(s);g.delete("action"),o(g,{replace:!0})};return r.jsx(Iz,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(SO,{onSelect:g=>e(g),onOpenRoby:()=>p(!0)}),r.jsxs("main",{className:"m-2 ml-0 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[r.jsx(bI,{onToggleTheme:c,isDark:l==="dark",pathname:n.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(Nw,{children:[r.jsx($t,{path:"/",element:r.jsx(Dz,{})}),r.jsx($t,{path:"/settings/*",element:r.jsx(w8,{})}),r.jsx($t,{path:"/m/voice/*",element:r.jsx(O8,{})}),r.jsx($t,{path:"/m/desktop/*",element:r.jsx(P8,{})}),r.jsx($t,{path:"/m/deck/*",element:r.jsx(K8,{})}),r.jsx($t,{path:"/m/code/*",element:r.jsx(Z7,{})}),r.jsx($t,{path:"/p/:pid/*",element:r.jsx(TP,{})}),r.jsx($t,{path:"*",element:r.jsx(jI,{})})]})})]}),r.jsx(W7,{open:d,onClose:m}),r.jsx(pI,{open:f,onOpenChange:p})]})})}function bI({onToggleTheme:e,isDark:n,pathname:s}){const{projects:o}=Oc(),l=Hz(),c=s.split("/").filter(Boolean),d=c[0]==="p"?o.find(C=>String(C.id)===c[1]):void 0,f=c[0]==="settings"?yI(c[1]):c[0]==="p"?_I(c[2]):"",p=c[0]==="p"&&c[1]==="0",m=d?.name||d?.path?.split("/").pop()||_("nav.project"),g=s==="/"?_("topbar.breadcrumb_root"):c[0]==="settings"?[_("topbar.breadcrumb_root"),_("nav.settings"),f].filter(Boolean).join(" › "):c[0]==="m"?[_("topbar.breadcrumb_root"),vI(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?p?[_("topbar.breadcrumb_root"),_("topbar.breadcrumb_base"),f].filter(Boolean).join(" › "):[_("topbar.breadcrumb_root"),_("topbar.breadcrumb_projects"),m,f].filter(Boolean).join(" › "):_("topbar.breadcrumb_root"),b=s==="/"?"":c[0]==="settings"?_("settings.subtitle"):c[0]==="p"?p?_("base.subtitle"):d?`${B2(d.kind)} · ${d.path}`:"":"",v=Bz(),S=qz();return r.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[v&&r.jsx(Lz,{collapsed:v.collapsed,onToggle:v.toggle}),r.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[g,b&&r.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),S,r.jsx("button",{type:"button",onClick:e,title:_(n?"topbar.light":"topbar.dark"),className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:n?r.jsx(uA,{size:14}):r.jsx(tA,{size:14})})]})}function vI(e){switch(e){case"voice":return _("nav.modules.voice");case"desktop":return _("nav.modules.desktop");case"deck":return _("nav.modules.deck");case"code":return _("nav.modules.code");default:return e||""}}function yI(e){switch(e){case"super-agent":return _("settings.tabs.super_agent");case"engines":return _("settings.tabs.engines");case"telegram":return _("settings.tabs.telegram");case"devices":return _("settings.tabs.devices");case"appearance":return _("settings.appearance");case"config":case"advanced":return _("settings.tabs.advanced");case"identity":default:return e||""}}function _I(e){switch(e){case"chat":return _("project.nav.chat");case"threads":return _("project.nav.threads");case"telegram":return _("project.nav.telegram");case"agents":return _("project.nav.agents");case"routines":return _("project.nav.routines");case"tasks":return _("project.nav.tasks");case"mcps":return _("project.nav.mcps");case"config":return _("project.nav.config");case"workspaces":return _("base.workspaces_title");case"models":return _("settings.tabs.engines");case"agent-defaults":return _("base.defaults_title");case"sessions":return _("base.sessions_title");case"logs":return _("project.nav.logs");case"memories":return _("project.nav.memories");default:return""}}function cw({text:e,sub:n}){return r.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-mono text-xs text-muted-fg whitespace-pre leading-none mb-4",children:` ▄███████▄
609
+ █ ██ ██ █
610
+ █ ◔ ◔ █
611
+ █ ╰~╯ █
612
+ ▀███████▀`}),r.jsx("div",{className:"text-foreground",children:e}),n&&r.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:n})]})})}function jI(){return r.jsxs("div",{className:"p-8",children:[r.jsx("h1",{className:"text-2xl",children:_("not_found.title")}),r.jsx("p",{className:"text-muted-fg",children:_("not_found.message")})]})}VN.createRoot(document.getElementById("root")).render(r.jsx(Sc.StrictMode,{children:r.jsx(uT,{children:r.jsx(gA,{children:r.jsx(hI,{})})})}));
613
+ //# sourceMappingURL=index-M4FspaCH.js.map