@hellcoder/companion 0.96.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 (242) hide show
  1. package/bin/cli.ts +168 -0
  2. package/bin/ctl.ts +528 -0
  3. package/bin/generate-token.ts +28 -0
  4. package/dist/apple-touch-icon.png +0 -0
  5. package/dist/assets/AgentsPage-DCFhrJ28.js +13 -0
  6. package/dist/assets/CronManager-EGwLJONv.js +1 -0
  7. package/dist/assets/IntegrationsPage-CTMRnbQS.js +1 -0
  8. package/dist/assets/LinearOAuthSettingsPage-CgQFMIgr.js +1 -0
  9. package/dist/assets/LinearSettingsPage-C9nok1qi.js +1 -0
  10. package/dist/assets/Playground-BV3k0RbV.js +109 -0
  11. package/dist/assets/PromptsPage-CFojqNKP.js +4 -0
  12. package/dist/assets/RunsPage-DUJ1QUSa.js +1 -0
  13. package/dist/assets/SandboxManager-CrVQ-VU_.js +8 -0
  14. package/dist/assets/SettingsPage-D1fPCL19.js +1 -0
  15. package/dist/assets/TailscalePage-D06cyvyC.js +1 -0
  16. package/dist/assets/index-BhUa1e6X.css +1 -0
  17. package/dist/assets/index-DkqeP-R9.js +134 -0
  18. package/dist/assets/sw-register-BibwRdvC.js +1 -0
  19. package/dist/assets/workbox-window.prod.es5-BIl4cyR9.js +2 -0
  20. package/dist/favicon.svg +8 -0
  21. package/dist/fonts/MesloLGSNerdFontMono-Bold.woff2 +0 -0
  22. package/dist/fonts/MesloLGSNerdFontMono-Regular.woff2 +0 -0
  23. package/dist/icon-192.png +0 -0
  24. package/dist/icon-512.png +0 -0
  25. package/dist/index.html +20 -0
  26. package/dist/logo-codex.svg +14 -0
  27. package/dist/logo-docker.svg +4 -0
  28. package/dist/logo.svg +14 -0
  29. package/dist/manifest.json +24 -0
  30. package/dist/sw.js +2 -0
  31. package/package.json +104 -0
  32. package/server/agent-cron-migrator.test.ts +610 -0
  33. package/server/agent-cron-migrator.ts +85 -0
  34. package/server/agent-executor.test.ts +1108 -0
  35. package/server/agent-executor.ts +346 -0
  36. package/server/agent-store.test.ts +588 -0
  37. package/server/agent-store.ts +185 -0
  38. package/server/agent-types.ts +138 -0
  39. package/server/ai-validation-settings.test.ts +128 -0
  40. package/server/ai-validation-settings.ts +35 -0
  41. package/server/ai-validator.test.ts +387 -0
  42. package/server/ai-validator.ts +271 -0
  43. package/server/auth-manager.test.ts +83 -0
  44. package/server/auth-manager.ts +150 -0
  45. package/server/auto-namer.test.ts +252 -0
  46. package/server/auto-namer.ts +78 -0
  47. package/server/backend-adapter.test.ts +38 -0
  48. package/server/backend-adapter.ts +54 -0
  49. package/server/cache-headers.test.ts +98 -0
  50. package/server/cache-headers.ts +61 -0
  51. package/server/claude-adapter.test.ts +1363 -0
  52. package/server/claude-adapter.ts +889 -0
  53. package/server/claude-container-auth.test.ts +44 -0
  54. package/server/claude-container-auth.ts +30 -0
  55. package/server/claude-protocol-contract.test.ts +71 -0
  56. package/server/claude-protocol-drift.test.ts +78 -0
  57. package/server/claude-session-discovery.test.ts +132 -0
  58. package/server/claude-session-discovery.ts +157 -0
  59. package/server/claude-session-history.test.ts +158 -0
  60. package/server/claude-session-history.ts +410 -0
  61. package/server/cli-launcher.test.ts +1343 -0
  62. package/server/cli-launcher.ts +1298 -0
  63. package/server/cli.test.ts +16 -0
  64. package/server/codex-adapter.test.ts +5545 -0
  65. package/server/codex-adapter.ts +3062 -0
  66. package/server/codex-container-auth.test.ts +50 -0
  67. package/server/codex-container-auth.ts +24 -0
  68. package/server/codex-home.test.ts +61 -0
  69. package/server/codex-home.ts +26 -0
  70. package/server/codex-protocol-contract.test.ts +96 -0
  71. package/server/codex-protocol-drift.test.ts +123 -0
  72. package/server/codex-ws-proxy.cjs +226 -0
  73. package/server/commands-discovery.test.ts +179 -0
  74. package/server/commands-discovery.ts +81 -0
  75. package/server/constants.ts +7 -0
  76. package/server/container-manager.test.ts +1211 -0
  77. package/server/container-manager.ts +1053 -0
  78. package/server/cron-scheduler.test.ts +957 -0
  79. package/server/cron-scheduler.ts +243 -0
  80. package/server/cron-store.test.ts +422 -0
  81. package/server/cron-store.ts +148 -0
  82. package/server/cron-types.ts +63 -0
  83. package/server/env-manager.test.ts +268 -0
  84. package/server/env-manager.ts +161 -0
  85. package/server/event-bus-types.ts +64 -0
  86. package/server/event-bus.test.ts +244 -0
  87. package/server/event-bus.ts +124 -0
  88. package/server/execution-store.test.ts +307 -0
  89. package/server/execution-store.ts +170 -0
  90. package/server/fs-utils.ts +15 -0
  91. package/server/git-utils.test.ts +938 -0
  92. package/server/git-utils.ts +421 -0
  93. package/server/github-pr.test.ts +498 -0
  94. package/server/github-pr.ts +379 -0
  95. package/server/image-pull-manager.test.ts +303 -0
  96. package/server/image-pull-manager.ts +279 -0
  97. package/server/index.ts +396 -0
  98. package/server/linear-agent-bridge.test.ts +1157 -0
  99. package/server/linear-agent-bridge.ts +629 -0
  100. package/server/linear-agent.test.ts +473 -0
  101. package/server/linear-agent.ts +479 -0
  102. package/server/linear-cache.test.ts +136 -0
  103. package/server/linear-cache.ts +113 -0
  104. package/server/linear-connections.test.ts +350 -0
  105. package/server/linear-connections.ts +231 -0
  106. package/server/linear-credential-migration.test.ts +337 -0
  107. package/server/linear-credential-migration.ts +63 -0
  108. package/server/linear-oauth-connections-migration.test.ts +268 -0
  109. package/server/linear-oauth-connections.test.ts +365 -0
  110. package/server/linear-oauth-connections.ts +294 -0
  111. package/server/linear-project-manager.test.ts +162 -0
  112. package/server/linear-project-manager.ts +111 -0
  113. package/server/linear-prompt-builder.test.ts +74 -0
  114. package/server/linear-prompt-builder.ts +61 -0
  115. package/server/linear-staging.test.ts +276 -0
  116. package/server/linear-staging.ts +142 -0
  117. package/server/logger.test.ts +393 -0
  118. package/server/logger.ts +259 -0
  119. package/server/metrics-collector.test.ts +413 -0
  120. package/server/metrics-collector.ts +350 -0
  121. package/server/metrics-types.ts +108 -0
  122. package/server/middleware/managed-auth.test.ts +264 -0
  123. package/server/middleware/managed-auth.ts +195 -0
  124. package/server/novnc-proxy.test.ts +333 -0
  125. package/server/novnc-proxy.ts +99 -0
  126. package/server/path-resolver.test.ts +552 -0
  127. package/server/path-resolver.ts +186 -0
  128. package/server/paths.test.ts +31 -0
  129. package/server/paths.ts +11 -0
  130. package/server/pr-poller.test.ts +191 -0
  131. package/server/pr-poller.ts +162 -0
  132. package/server/prompt-manager.test.ts +211 -0
  133. package/server/prompt-manager.ts +211 -0
  134. package/server/protocol/claude-upstream/README.md +19 -0
  135. package/server/protocol/claude-upstream/sdk.d.ts.txt +1943 -0
  136. package/server/protocol/codex-upstream/ClientNotification.ts.txt +5 -0
  137. package/server/protocol/codex-upstream/ClientRequest.ts.txt +60 -0
  138. package/server/protocol/codex-upstream/README.md +18 -0
  139. package/server/protocol/codex-upstream/ServerNotification.ts.txt +41 -0
  140. package/server/protocol/codex-upstream/ServerRequest.ts.txt +16 -0
  141. package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +6 -0
  142. package/server/protocol/codex-upstream/v2/DynamicToolCallResponse.ts.txt +6 -0
  143. package/server/protocol-monitor.ts +50 -0
  144. package/server/recorder.test.ts +454 -0
  145. package/server/recorder.ts +374 -0
  146. package/server/recording-hub/compat-validator.test.ts +150 -0
  147. package/server/recording-hub/compat-validator.ts +284 -0
  148. package/server/recording-hub/diagnostics.test.ts +140 -0
  149. package/server/recording-hub/diagnostics.ts +299 -0
  150. package/server/recording-hub/hub-config.test.ts +44 -0
  151. package/server/recording-hub/hub-config.ts +19 -0
  152. package/server/recording-hub/hub-routes.test.ts +417 -0
  153. package/server/recording-hub/hub-routes.ts +236 -0
  154. package/server/recording-hub/hub-store.test.ts +262 -0
  155. package/server/recording-hub/hub-store.ts +265 -0
  156. package/server/recording-hub/replay-adapter.test.ts +294 -0
  157. package/server/recording-hub/replay-adapter.ts +207 -0
  158. package/server/relay-client.test.ts +337 -0
  159. package/server/relay-client.ts +320 -0
  160. package/server/replay.test.ts +200 -0
  161. package/server/replay.ts +78 -0
  162. package/server/routes/agent-routes.test.ts +1400 -0
  163. package/server/routes/agent-routes.ts +409 -0
  164. package/server/routes/cron-routes.test.ts +881 -0
  165. package/server/routes/cron-routes.ts +103 -0
  166. package/server/routes/env-routes.test.ts +383 -0
  167. package/server/routes/env-routes.ts +95 -0
  168. package/server/routes/fs-routes.test.ts +1198 -0
  169. package/server/routes/fs-routes.ts +605 -0
  170. package/server/routes/git-routes.test.ts +813 -0
  171. package/server/routes/git-routes.ts +97 -0
  172. package/server/routes/linear-agent-routes.test.ts +721 -0
  173. package/server/routes/linear-agent-routes.ts +304 -0
  174. package/server/routes/linear-connection-routes.test.ts +927 -0
  175. package/server/routes/linear-connection-routes.ts +244 -0
  176. package/server/routes/linear-oauth-connection-routes.test.ts +406 -0
  177. package/server/routes/linear-oauth-connection-routes.ts +129 -0
  178. package/server/routes/linear-routes.test.ts +1510 -0
  179. package/server/routes/linear-routes.ts +953 -0
  180. package/server/routes/metrics-routes.test.ts +103 -0
  181. package/server/routes/metrics-routes.ts +13 -0
  182. package/server/routes/prompt-routes.ts +67 -0
  183. package/server/routes/sandbox-routes.test.ts +513 -0
  184. package/server/routes/sandbox-routes.ts +127 -0
  185. package/server/routes/settings-routes.ts +270 -0
  186. package/server/routes/skills-routes.test.ts +690 -0
  187. package/server/routes/skills-routes.ts +100 -0
  188. package/server/routes/system-routes.test.ts +637 -0
  189. package/server/routes/system-routes.ts +228 -0
  190. package/server/routes/tailscale-routes.test.ts +176 -0
  191. package/server/routes/tailscale-routes.ts +22 -0
  192. package/server/routes.test.ts +4655 -0
  193. package/server/routes.ts +1277 -0
  194. package/server/sandbox-manager.test.ts +378 -0
  195. package/server/sandbox-manager.ts +168 -0
  196. package/server/service.test.ts +1419 -0
  197. package/server/service.ts +718 -0
  198. package/server/session-creation-service.test.ts +661 -0
  199. package/server/session-creation-service.ts +473 -0
  200. package/server/session-git-info.ts +104 -0
  201. package/server/session-linear-issues.test.ts +118 -0
  202. package/server/session-linear-issues.ts +88 -0
  203. package/server/session-names.test.ts +94 -0
  204. package/server/session-names.ts +67 -0
  205. package/server/session-orchestrator.test.ts +1784 -0
  206. package/server/session-orchestrator.ts +973 -0
  207. package/server/session-state-machine.test.ts +606 -0
  208. package/server/session-state-machine.ts +207 -0
  209. package/server/session-store.test.ts +290 -0
  210. package/server/session-store.ts +146 -0
  211. package/server/session-types.ts +509 -0
  212. package/server/settings-manager.test.ts +275 -0
  213. package/server/settings-manager.ts +173 -0
  214. package/server/tailscale-manager.test.ts +553 -0
  215. package/server/tailscale-manager.ts +451 -0
  216. package/server/terminal-manager.ts +240 -0
  217. package/server/update-checker.test.ts +306 -0
  218. package/server/update-checker.ts +197 -0
  219. package/server/usage-limits.test.ts +536 -0
  220. package/server/usage-limits.ts +225 -0
  221. package/server/worktree-tracker.test.ts +243 -0
  222. package/server/worktree-tracker.ts +84 -0
  223. package/server/ws-auth.test.ts +59 -0
  224. package/server/ws-auth.ts +41 -0
  225. package/server/ws-bridge-browser-ingest.test.ts +272 -0
  226. package/server/ws-bridge-browser-ingest.ts +72 -0
  227. package/server/ws-bridge-browser.ts +112 -0
  228. package/server/ws-bridge-cli-ingest.test.ts +302 -0
  229. package/server/ws-bridge-cli-ingest.ts +81 -0
  230. package/server/ws-bridge-codex.test.ts +1837 -0
  231. package/server/ws-bridge-codex.ts +266 -0
  232. package/server/ws-bridge-controls.test.ts +124 -0
  233. package/server/ws-bridge-controls.ts +20 -0
  234. package/server/ws-bridge-persist.test.ts +296 -0
  235. package/server/ws-bridge-persist.ts +66 -0
  236. package/server/ws-bridge-publish.test.ts +234 -0
  237. package/server/ws-bridge-publish.ts +79 -0
  238. package/server/ws-bridge-replay.test.ts +44 -0
  239. package/server/ws-bridge-replay.ts +61 -0
  240. package/server/ws-bridge-types.ts +106 -0
  241. package/server/ws-bridge.test.ts +4777 -0
  242. package/server/ws-bridge.ts +1279 -0
@@ -0,0 +1,134 @@
1
+ var Kj=Object.defineProperty;var Zj=(e,t,n)=>t in e?Kj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jv=(e,t,n)=>Zj(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(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 i(l){if(l.ep)return;l.ep=!0;const c=n(l);fetch(l.href,c)}})();const Jj="modulepreload",ek=function(e){return"/"+e},e1={},Xn=function(t,n,i){let l=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=u(n.map(p=>{if(p=ek(p),p in e1)return;e1[p]=!0;const g=p.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":Jj,g||(y.as="script"),y.crossOrigin="",y.href=p,h&&y.setAttribute("nonce",h),document.head.appendChild(y),g)return new Promise((b,_)=>{y.addEventListener("load",b),y.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return l.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})};function Om(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zh={exports:{}},ao={};/**
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 t1;function tk(){if(t1)return ao;t1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+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:i,key:u,ref:l!==void 0?l:null,props:c}}return ao.Fragment=t,ao.jsx=n,ao.jsxs=n,ao}var n1;function nk(){return n1||(n1=1,zh.exports=tk()),zh.exports}var a=nk(),Oh={exports:{}},Ve={};/**
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 r1;function rk(){if(r1)return Ve;r1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,E={};function S(P,Q,A){this.props=P,this.context=Q,this.refs=E,this.updater=A||_}S.prototype.isReactComponent={},S.prototype.setState=function(P,Q){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,Q,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function M(){}M.prototype=S.prototype;function C(P,Q,A){this.props=P,this.context=Q,this.refs=E,this.updater=A||_}var $=C.prototype=new M;$.constructor=C,k($,S.prototype),$.isPureReactComponent=!0;var L=Array.isArray;function T(){}var H={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function G(P,Q,A){var pe=A.ref;return{$$typeof:e,type:P,key:Q,ref:pe!==void 0?pe:null,props:A}}function O(P,Q){return G(P.type,Q,P.props)}function I(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function R(P){var Q={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(A){return Q[A]})}var oe=/\/+/g;function J(P,Q){return typeof P=="object"&&P!==null&&P.key!=null?R(""+P.key):Q.toString(36)}function X(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(T,T):(P.status="pending",P.then(function(Q){P.status==="pending"&&(P.status="fulfilled",P.value=Q)},function(Q){P.status==="pending"&&(P.status="rejected",P.reason=Q)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function B(P,Q,A,pe,_e){var ke=typeof P;(ke==="undefined"||ke==="boolean")&&(P=null);var ze=!1;if(P===null)ze=!0;else switch(ke){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(P.$$typeof){case e:case t:ze=!0;break;case g:return ze=P._init,B(ze(P._payload),Q,A,pe,_e)}}if(ze)return _e=_e(P),ze=pe===""?"."+J(P,0):pe,L(_e)?(A="",ze!=null&&(A=ze.replace(oe,"$&/")+"/"),B(_e,Q,A,"",function(Fe){return Fe})):_e!=null&&(I(_e)&&(_e=O(_e,A+(_e.key==null||P&&P.key===_e.key?"":(""+_e.key).replace(oe,"$&/")+"/")+ze)),Q.push(_e)),1;ze=0;var ce=pe===""?".":pe+":";if(L(P))for(var je=0;je<P.length;je++)pe=P[je],ke=ce+J(pe,je),ze+=B(pe,Q,A,ke,_e);else if(je=b(P),typeof je=="function")for(P=je.call(P),je=0;!(pe=P.next()).done;)pe=pe.value,ke=ce+J(pe,je++),ze+=B(pe,Q,A,ke,_e);else if(ke==="object"){if(typeof P.then=="function")return B(X(P),Q,A,pe,_e);throw Q=String(P),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ze}function U(P,Q,A){if(P==null)return P;var pe=[],_e=0;return B(P,pe,"","",function(ke){return Q.call(A,ke,_e++)}),pe}function Z(P){if(P._status===-1){var Q=P._result;Q=Q(),Q.then(function(A){(P._status===0||P._status===-1)&&(P._status=1,P._result=A)},function(A){(P._status===0||P._status===-1)&&(P._status=2,P._result=A)}),P._status===-1&&(P._status=0,P._result=Q)}if(P._status===1)return P._result.default;throw P._result}var me=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},D={map:U,forEach:function(P,Q,A){U(P,function(){Q.apply(this,arguments)},A)},count:function(P){var Q=0;return U(P,function(){Q++}),Q},toArray:function(P){return U(P,function(Q){return Q})||[]},only:function(P){if(!I(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Ve.Activity=v,Ve.Children=D,Ve.Component=S,Ve.Fragment=n,Ve.Profiler=l,Ve.PureComponent=C,Ve.StrictMode=i,Ve.Suspense=h,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(P){return H.H.useMemoCache(P)}},Ve.cache=function(P){return function(){return P.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(P,Q,A){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var pe=k({},P.props),_e=P.key;if(Q!=null)for(ke in Q.key!==void 0&&(_e=""+Q.key),Q)!z.call(Q,ke)||ke==="key"||ke==="__self"||ke==="__source"||ke==="ref"&&Q.ref===void 0||(pe[ke]=Q[ke]);var ke=arguments.length-2;if(ke===1)pe.children=A;else if(1<ke){for(var ze=Array(ke),ce=0;ce<ke;ce++)ze[ce]=arguments[ce+2];pe.children=ze}return G(P.type,_e,pe)},Ve.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},Ve.createElement=function(P,Q,A){var pe,_e={},ke=null;if(Q!=null)for(pe in Q.key!==void 0&&(ke=""+Q.key),Q)z.call(Q,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(_e[pe]=Q[pe]);var ze=arguments.length-2;if(ze===1)_e.children=A;else if(1<ze){for(var ce=Array(ze),je=0;je<ze;je++)ce[je]=arguments[je+2];_e.children=ce}if(P&&P.defaultProps)for(pe in ze=P.defaultProps,ze)_e[pe]===void 0&&(_e[pe]=ze[pe]);return G(P,ke,_e)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(P){return{$$typeof:f,render:P}},Ve.isValidElement=I,Ve.lazy=function(P){return{$$typeof:g,_payload:{_status:-1,_result:P},_init:Z}},Ve.memo=function(P,Q){return{$$typeof:p,type:P,compare:Q===void 0?null:Q}},Ve.startTransition=function(P){var Q=H.T,A={};H.T=A;try{var pe=P(),_e=H.S;_e!==null&&_e(A,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(T,me)}catch(ke){me(ke)}finally{Q!==null&&A.types!==null&&(Q.types=A.types),H.T=Q}},Ve.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},Ve.use=function(P){return H.H.use(P)},Ve.useActionState=function(P,Q,A){return H.H.useActionState(P,Q,A)},Ve.useCallback=function(P,Q){return H.H.useCallback(P,Q)},Ve.useContext=function(P){return H.H.useContext(P)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(P,Q){return H.H.useDeferredValue(P,Q)},Ve.useEffect=function(P,Q){return H.H.useEffect(P,Q)},Ve.useEffectEvent=function(P){return H.H.useEffectEvent(P)},Ve.useId=function(){return H.H.useId()},Ve.useImperativeHandle=function(P,Q,A){return H.H.useImperativeHandle(P,Q,A)},Ve.useInsertionEffect=function(P,Q){return H.H.useInsertionEffect(P,Q)},Ve.useLayoutEffect=function(P,Q){return H.H.useLayoutEffect(P,Q)},Ve.useMemo=function(P,Q){return H.H.useMemo(P,Q)},Ve.useOptimistic=function(P,Q){return H.H.useOptimistic(P,Q)},Ve.useReducer=function(P,Q,A){return H.H.useReducer(P,Q,A)},Ve.useRef=function(P){return H.H.useRef(P)},Ve.useState=function(P){return H.H.useState(P)},Ve.useSyncExternalStore=function(P,Q,A){return H.H.useSyncExternalStore(P,Q,A)},Ve.useTransition=function(){return H.H.useTransition()},Ve.version="19.2.5",Ve}var i1;function Bm(){return i1||(i1=1,Oh.exports=rk()),Oh.exports}var j=Bm();const ku=Om(j);var Bh={exports:{}},lo={},Uh={exports:{}},Ph={};/**
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 s1;function ik(){return s1||(s1=1,(function(e){function t(B,U){var Z=B.length;B.push(U);e:for(;0<Z;){var me=Z-1>>>1,D=B[me];if(0<l(D,U))B[me]=U,B[Z]=D,Z=me;else break e}}function n(B){return B.length===0?null:B[0]}function i(B){if(B.length===0)return null;var U=B[0],Z=B.pop();if(Z!==U){B[0]=Z;e:for(var me=0,D=B.length,P=D>>>1;me<P;){var Q=2*(me+1)-1,A=B[Q],pe=Q+1,_e=B[pe];if(0>l(A,Z))pe<D&&0>l(_e,A)?(B[me]=_e,B[pe]=Z,me=pe):(B[me]=A,B[Q]=Z,me=Q);else if(pe<D&&0>l(_e,Z))B[me]=_e,B[pe]=Z,me=pe;else break e}}return U}function l(B,U){var Z=B.sortIndex-U.sortIndex;return Z!==0?Z:B.id-U.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 u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],g=1,v=null,y=3,b=!1,_=!1,k=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function $(B){for(var U=n(p);U!==null;){if(U.callback===null)i(p);else if(U.startTime<=B)i(p),U.sortIndex=U.expirationTime,t(h,U);else break;U=n(p)}}function L(B){if(k=!1,$(B),!_)if(n(h)!==null)_=!0,T||(T=!0,R());else{var U=n(p);U!==null&&X(L,U.startTime-B)}}var T=!1,H=-1,z=5,G=-1;function O(){return E?!0:!(e.unstable_now()-G<z)}function I(){if(E=!1,T){var B=e.unstable_now();G=B;var U=!0;try{e:{_=!1,k&&(k=!1,M(H),H=-1),b=!0;var Z=y;try{t:{for($(B),v=n(h);v!==null&&!(v.expirationTime>B&&O());){var me=v.callback;if(typeof me=="function"){v.callback=null,y=v.priorityLevel;var D=me(v.expirationTime<=B);if(B=e.unstable_now(),typeof D=="function"){v.callback=D,$(B),U=!0;break t}v===n(h)&&i(h),$(B)}else i(h);v=n(h)}if(v!==null)U=!0;else{var P=n(p);P!==null&&X(L,P.startTime-B),U=!1}}break e}finally{v=null,y=Z,b=!1}U=void 0}}finally{U?R():T=!1}}}var R;if(typeof C=="function")R=function(){C(I)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,J=oe.port2;oe.port1.onmessage=I,R=function(){J.postMessage(null)}}else R=function(){S(I,0)};function X(B,U){H=S(function(){B(e.unstable_now())},U)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(B){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var Z=y;y=U;try{return B()}finally{y=Z}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(B,U){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=y;y=B;try{return U()}finally{y=Z}},e.unstable_scheduleCallback=function(B,U,Z){var me=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?me+Z:me):Z=me,B){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=Z+D,B={id:g++,callback:U,priorityLevel:B,startTime:Z,expirationTime:D,sortIndex:-1},Z>me?(B.sortIndex=Z,t(p,B),n(h)===null&&B===n(p)&&(k?(M(H),H=-1):k=!0,X(L,Z-me))):(B.sortIndex=D,t(h,B),_||b||(_=!0,T||(T=!0,R()))),B},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(B){var U=y;return function(){var Z=y;y=U;try{return B.apply(this,arguments)}finally{y=Z}}}})(Ph)),Ph}var a1;function sk(){return a1||(a1=1,Uh.exports=ik()),Uh.exports}var $h={exports:{}},wn={};/**
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 l1;function ak(){if(l1)return wn;l1=1;var e=Bm();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(h,p,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:h,containerInfo:p,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return wn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,wn.createPortal=function(h,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(h,p,null,g)},wn.flushSync=function(h){var p=u.T,g=i.p;try{if(u.T=null,i.p=2,h)return h()}finally{u.T=p,i.p=g,i.d.f()}},wn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(h,p))},wn.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},wn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var g=p.as,v=f(g,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,b=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?i.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:b}):g==="script"&&i.d.X(h,{crossOrigin:v,integrity:y,fetchPriority:b,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},wn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=f(p.as,p.crossOrigin);i.d.M(h,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(h)},wn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,v=f(g,p.crossOrigin);i.d.L(h,g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},wn.preloadModule=function(h,p){if(typeof h=="string")if(p){var g=f(p.as,p.crossOrigin);i.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(h)},wn.requestFormReset=function(h){i.d.r(h)},wn.unstable_batchedUpdates=function(h,p){return h(p)},wn.useFormState=function(h,p,g){return u.H.useFormState(h,p,g)},wn.useFormStatus=function(){return u.H.useHostTransitionStatus()},wn.version="19.2.5",wn}var o1;function Jy(){if(o1)return $h.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(t){console.error(t)}}return e(),$h.exports=ak(),$h.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 c1;function lk(){if(c1)return lo;c1=1;var e=sk(),t=Bm(),n=Jy();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(c(r)!==r)throw Error(i(188))}function p(r){var s=r.alternate;if(!s){if(s=c(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,d=s;;){var m=o.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===o)return h(m),r;if(x===d)return h(m),s;x=x.sibling}throw Error(i(188))}if(o.return!==d.return)o=m,d=x;else{for(var w=!1,N=m.child;N;){if(N===o){w=!0,o=m,d=x;break}if(N===d){w=!0,d=m,o=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===o){w=!0,o=x,d=m;break}if(N===d){w=!0,d=x,o=m;break}N=N.sibling}if(!w)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function g(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=g(r),s!==null)return s;r=r.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),C=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function R(r){return r===null||typeof r!="object"?null:(r=I&&r[I]||r["@@iterator"],typeof r=="function"?r:null)}var oe=Symbol.for("react.client.reference");function J(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===oe?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case T:return"SuspenseList";case G:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case C:return r.displayName||"Context";case M:return(r._context.displayName||"Context")+".Consumer";case $:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case H:return s=r.displayName||null,s!==null?s:J(r.type)||"Memo";case z:s=r._payload,r=r._init;try{return J(r(s))}catch{}}return null}var X=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},me=[],D=-1;function P(r){return{current:r}}function Q(r){0>D||(r.current=me[D],me[D]=null,D--)}function A(r,s){D++,me[D]=r.current,r.current=s}var pe=P(null),_e=P(null),ke=P(null),ze=P(null);function ce(r,s){switch(A(ke,s),A(_e,r),A(pe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?wv(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=wv(s),r=jv(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Q(pe),A(pe,r)}function je(){Q(pe),Q(_e),Q(ke)}function Fe(r){r.memoizedState!==null&&A(ze,r);var s=pe.current,o=jv(s,r.type);s!==o&&(A(_e,r),A(pe,o))}function At(r){_e.current===r&&(Q(pe),Q(_e)),ze.current===r&&(Q(ze),no._currentValue=Z)}var Ke,pt;function vt(r){if(Ke===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Ke=s&&s[1]||"",pt=-1<o.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Ke+r+pt}var qe=!1;function bt(r,s){if(!r||qe)return"";qe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ie){var ne=ie}Reflect.construct(r,[],de)}else{try{de.call()}catch(ie){ne=ie}r.call(de.prototype)}}else{try{throw Error()}catch(ie){ne=ie}(de=r())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ie){if(ie&&ne&&typeof ie.stack=="string")return[ie.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=d.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var F=w.split(`
44
+ `),te=N.split(`
45
+ `);for(m=d=0;d<F.length&&!F[d].includes("DetermineComponentFrameRoot");)d++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(d===F.length||m===te.length)for(d=F.length-1,m=te.length-1;1<=d&&0<=m&&F[d]!==te[m];)m--;for(;1<=d&&0<=m;d--,m--)if(F[d]!==te[m]){if(d!==1||m!==1)do if(d--,m--,0>m||F[d]!==te[m]){var le=`
46
+ `+F[d].replace(" at new "," at ");return r.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",r.displayName)),le}while(1<=d&&0<=m);break}}}finally{qe=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?vt(o):""}function pn(r,s){switch(r.tag){case 26:case 27:case 5:return vt(r.type);case 16:return vt("Lazy");case 13:return r.child!==s&&s!==null?vt("Suspense Fallback"):vt("Suspense");case 19:return vt("SuspenseList");case 0:case 15:return bt(r.type,!1);case 11:return bt(r.type.render,!1);case 1:return bt(r.type,!0);case 31:return vt("Activity");default:return""}}function dn(r){try{var s="",o=null;do s+=pn(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
47
+ Error generating stack: `+d.message+`
48
+ `+d.stack}}var se=Object.prototype.hasOwnProperty,Ce=e.unstable_scheduleCallback,fe=e.unstable_cancelCallback,Se=e.unstable_shouldYield,Ze=e.unstable_requestPaint,Be=e.unstable_now,mn=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,De=e.unstable_NormalPriority,Ge=e.unstable_LowPriority,Qe=e.unstable_IdlePriority,ln=e.log,Nn=e.unstable_setDisableYieldValue,jt=null,kt=null;function $t(r){if(typeof ln=="function"&&Nn(r),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(jt,r)}catch{}}var K=Math.clz32?Math.clz32:He,he=Math.log,ge=Math.LN2;function He(r){return r>>>=0,r===0?32:31-(he(r)/ge|0)|0}var mt=256,Vt=262144,Wn=4194304;function St(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Qt(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=d&134217727;return N!==0?(d=N&~x,d!==0?m=St(d):(w&=N,w!==0?m=St(w):o||(o=N&~r,o!==0&&(m=St(o))))):(N=d&~x,N!==0?m=St(N):w!==0?m=St(w):o||(o=d&~r,o!==0&&(m=St(o)))),m===0?0:s!==0&&s!==m&&(s&x)===0&&(x=m&-m,o=s&-s,x>=o||x===32&&(o&4194048)!==0)?s:m}function Hr(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Li(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 oc(){var r=Wn;return Wn<<=1,(Wn&62914560)===0&&(Wn=4194304),r}function cl(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function kr(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ws(r,s,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var N=r.entanglements,F=r.expirationTimes,te=r.hiddenUpdates;for(o=w&~o;0<o;){var le=31-K(o),de=1<<le;N[le]=0,F[le]=-1;var ne=te[le];if(ne!==null)for(te[le]=null,le=0;le<ne.length;le++){var ie=ne[le];ie!==null&&(ie.lane&=-536870913)}o&=~de}d!==0&&gs(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~s))}function gs(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-K(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function xs(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-K(o),m=1<<d;m&s|r[d]&s&&(r[d]|=s),o&=~m}}function ul(r,s){var o=s&-s;return o=(o&42)!==0?1:Sr(o),(o&(r.suspendedLanes|s))!==0?0:o}function Sr(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function dl(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Qs(){var r=U.p;return r!==0?r:(r=window.event,r===void 0?32:Gv(r.type))}function vs(r,s){var o=U.p;try{return U.p=r,s()}finally{U.p=o}}var Kt=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Kt,fn="__reactProps$"+Kt,Ir="__reactContainer$"+Kt,Ks="__reactEvents$"+Kt,Ft="__reactListeners$"+Kt,Ld="__reactHandles$"+Kt,fl="__reactResources$"+Kt,bs="__reactMarker$"+Kt;function hl(r){delete r[Gt],delete r[fn],delete r[Ks],delete r[Ft],delete r[Ld]}function Di(r){var s=r[Gt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Ir]||o[Gt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=Av(r);r!==null;){if(o=r[Gt])return o;r=Av(r)}return s}r=o,o=r.parentNode}return null}function qr(r){if(r=r[Gt]||r[Ir]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function zi(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function zn(r){var s=r[fl];return s||(s=r[fl]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ht(r){r[bs]=!0}var Qn=new Set,Nr={};function Cr(r,s){Oi(r,s),Oi(r+"Capture",s)}function Oi(r,s){for(Nr[r]=s,r=0;r<s.length;r++)Qn.add(s[r])}var cc=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]*$"),uc={},Zs={};function Dd(r){return se.call(Zs,r)?!0:se.call(uc,r)?!1:cc.test(r)?Zs[r]=!0:(uc[r]=!0,!1)}function Js(r,s,o){if(Dd(s))if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+o)}}function ea(r,s,o){if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+o)}}function Er(r,s,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(s,o,""+d)}}function Cn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pl(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function zd(r,s,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function ml(r){if(!r._valueTracker){var s=pl(r)?"checked":"value";r._valueTracker=zd(r,s,""+r[s])}}function gl(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=pl(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function ii(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var dc=/[\n"\\]/g;function On(r){return r.replace(dc,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function xl(r,s,o,d,m,x,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Cn(s)):r.value!==""+Cn(s)&&(r.value=""+Cn(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?vl(r,w,Cn(s)):o!=null?vl(r,w,Cn(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+Cn(N):r.removeAttribute("name")}function fc(r,s,o,d,m,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),s!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||s!=null)){ml(r);return}o=o!=null?""+Cn(o):"",s=s!=null?""+Cn(s):o,N||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=N?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),ml(r)}function vl(r,s,o){s==="number"&&ii(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Bi(r,s,o,d){if(r=r.options,s){s={};for(var m=0;m<o.length;m++)s["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=s.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Cn(o),s=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function hc(r,s,o){if(s!=null&&(s=""+Cn(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+Cn(o):""}function bl(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(X(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=Cn(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),ml(r)}function si(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var pc=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 yl(r,s,o){var d=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,o):typeof o!="number"||o===0||pc.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function V(r,s,o){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in s)d=s[m],s.hasOwnProperty(m)&&o[m]!==d&&yl(r,m,d)}else for(var x in s)s.hasOwnProperty(x)&&yl(r,x,s[x])}function xe(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rt=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"]]),ct=/^[\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 Nt(r){return ct.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function $e(){}var Bn=null;function Vr(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Tr=null,Ar=null;function En(r){var s=qr(r);if(s&&(r=s.stateNode)){var o=r[fn]||null;e:switch(r=s.stateNode,s.type){case"input":if(xl(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+On(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var m=d[fn]||null;if(!m)throw Error(i(90));xl(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<o.length;s++)d=o[s],d.form===r.form&&gl(d)}break e;case"textarea":hc(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Bi(r,!!o.multiple,s,!1)}}}var ta=!1;function mc(r,s,o){if(ta)return r(s,o);ta=!0;try{var d=r(s);return d}finally{if(ta=!1,(Tr!==null||Ar!==null)&&(nu(),Tr&&(s=Tr,r=Ar,Ar=Tr=null,En(s),r)))for(s=0;s<r.length;s++)En(r[s])}}function ys(r,s){var o=r.stateNode;if(o===null)return null;var d=o[fn]||null;if(d===null)return null;o=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var Mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),na=!1;if(Mr)try{var or={};Object.defineProperty(or,"passive",{get:function(){na=!0}}),window.addEventListener("test",or,or),window.removeEventListener("test",or,or)}catch{na=!1}var Rr=null,ai=null,gc=null;function jg(){if(gc)return gc;var r,s=ai,o=s.length,d,m="value"in Rr?Rr.value:Rr.textContent,x=m.length;for(r=0;r<o&&s[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&s[o-d]===m[x-d];d++);return gc=m.slice(r,1<d?1-d:void 0)}function xc(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function vc(){return!0}function kg(){return!1}function Un(r){function s(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in r)r.hasOwnProperty(N)&&(o=r[N],this[N]=o?o(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?vc:kg,this.isPropagationStopped=kg,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=vc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=vc)},persist:function(){},isPersistent:vc}),s}var _s={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bc=Un(_s),_l=v({},_s,{view:0,detail:0}),Ww=Un(_l),Od,Bd,wl,yc=v({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pd,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==wl&&(wl&&r.type==="mousemove"?(Od=r.screenX-wl.screenX,Bd=r.screenY-wl.screenY):Bd=Od=0,wl=r),Od)},movementY:function(r){return"movementY"in r?r.movementY:Bd}}),Sg=Un(yc),Qw=v({},yc,{dataTransfer:0}),Kw=Un(Qw),Zw=v({},_l,{relatedTarget:0}),Ud=Un(Zw),Jw=v({},_s,{animationName:0,elapsedTime:0,pseudoElement:0}),e2=Un(Jw),t2=v({},_s,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),n2=Un(t2),r2=v({},_s,{data:0}),Ng=Un(r2),i2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s2={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"},a2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function l2(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=a2[r])?!!s[r]:!1}function Pd(){return l2}var o2=v({},_l,{key:function(r){if(r.key){var s=i2[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=xc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?s2[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pd,charCode:function(r){return r.type==="keypress"?xc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?xc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),c2=Un(o2),u2=v({},yc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cg=Un(u2),d2=v({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pd}),f2=Un(d2),h2=v({},_s,{propertyName:0,elapsedTime:0,pseudoElement:0}),p2=Un(h2),m2=v({},yc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),g2=Un(m2),x2=v({},_s,{newState:0,oldState:0}),v2=Un(x2),b2=[9,13,27,32],$d=Mr&&"CompositionEvent"in window,jl=null;Mr&&"documentMode"in document&&(jl=document.documentMode);var y2=Mr&&"TextEvent"in window&&!jl,Eg=Mr&&(!$d||jl&&8<jl&&11>=jl),Tg=" ",Ag=!1;function Mg(r,s){switch(r){case"keyup":return b2.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rg(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ra=!1;function _2(r,s){switch(r){case"compositionend":return Rg(s);case"keypress":return s.which!==32?null:(Ag=!0,Tg);case"textInput":return r=s.data,r===Tg&&Ag?null:r;default:return null}}function w2(r,s){if(ra)return r==="compositionend"||!$d&&Mg(r,s)?(r=jg(),gc=ai=Rr=null,ra=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Eg&&s.locale!=="ko"?null:s.data;default:return null}}var j2={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 Lg(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!j2[r.type]:s==="textarea"}function Dg(r,s,o,d){Tr?Ar?Ar.push(d):Ar=[d]:Tr=d,s=cu(s,"onChange"),0<s.length&&(o=new bc("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var kl=null,Sl=null;function k2(r){gv(r,0)}function _c(r){var s=zi(r);if(gl(s))return r}function zg(r,s){if(r==="change")return s}var Og=!1;if(Mr){var Fd;if(Mr){var Hd="oninput"in document;if(!Hd){var Bg=document.createElement("div");Bg.setAttribute("oninput","return;"),Hd=typeof Bg.oninput=="function"}Fd=Hd}else Fd=!1;Og=Fd&&(!document.documentMode||9<document.documentMode)}function Ug(){kl&&(kl.detachEvent("onpropertychange",Pg),Sl=kl=null)}function Pg(r){if(r.propertyName==="value"&&_c(Sl)){var s=[];Dg(s,Sl,r,Vr(r)),mc(k2,s)}}function S2(r,s,o){r==="focusin"?(Ug(),kl=s,Sl=o,kl.attachEvent("onpropertychange",Pg)):r==="focusout"&&Ug()}function N2(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return _c(Sl)}function C2(r,s){if(r==="click")return _c(s)}function E2(r,s){if(r==="input"||r==="change")return _c(s)}function T2(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var Kn=typeof Object.is=="function"?Object.is:T2;function Nl(r,s){if(Kn(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),d=Object.keys(s);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!se.call(s,m)||!Kn(r[m],s[m]))return!1}return!0}function $g(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Fg(r,s){var o=$g(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=s&&d>=s)return{node:o,offset:s-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=$g(o)}}function Hg(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Hg(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Ig(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=ii(r.document);s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=ii(r.document)}return s}function Id(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var A2=Mr&&"documentMode"in document&&11>=document.documentMode,ia=null,qd=null,Cl=null,Vd=!1;function qg(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Vd||ia==null||ia!==ii(d)||(d=ia,"selectionStart"in d&&Id(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Cl&&Nl(Cl,d)||(Cl=d,d=cu(qd,"onSelect"),0<d.length&&(s=new bc("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=ia)))}function ws(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var sa={animationend:ws("Animation","AnimationEnd"),animationiteration:ws("Animation","AnimationIteration"),animationstart:ws("Animation","AnimationStart"),transitionrun:ws("Transition","TransitionRun"),transitionstart:ws("Transition","TransitionStart"),transitioncancel:ws("Transition","TransitionCancel"),transitionend:ws("Transition","TransitionEnd")},Gd={},Vg={};Mr&&(Vg=document.createElement("div").style,"AnimationEvent"in window||(delete sa.animationend.animation,delete sa.animationiteration.animation,delete sa.animationstart.animation),"TransitionEvent"in window||delete sa.transitionend.transition);function js(r){if(Gd[r])return Gd[r];if(!sa[r])return r;var s=sa[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Vg)return Gd[r]=s[o];return r}var Gg=js("animationend"),Xg=js("animationiteration"),Yg=js("animationstart"),M2=js("transitionrun"),R2=js("transitionstart"),L2=js("transitioncancel"),Wg=js("transitionend"),Qg=new Map,Xd="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(" ");Xd.push("scrollEnd");function Lr(r,s){Qg.set(r,s),Cr(s,[r])}var wc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},cr=[],aa=0,Yd=0;function jc(){for(var r=aa,s=Yd=aa=0;s<r;){var o=cr[s];cr[s++]=null;var d=cr[s];cr[s++]=null;var m=cr[s];cr[s++]=null;var x=cr[s];if(cr[s++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Kg(o,m,x)}}function kc(r,s,o,d){cr[aa++]=r,cr[aa++]=s,cr[aa++]=o,cr[aa++]=d,Yd|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Wd(r,s,o,d){return kc(r,s,o,d),Sc(r)}function ks(r,s){return kc(r,null,null,s),Sc(r)}function Kg(r,s,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&s!==null&&(m=31-K(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=o|536870912),x):null}function Sc(r){if(50<Wl)throw Wl=0,sh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var la={};function D2(r,s,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(r,s,o,d){return new D2(r,s,o,d)}function Qd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function li(r,s){var o=r.alternate;return o===null?(o=Zn(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Zg(r,s){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Nc(r,s,o,d,m,x){var w=0;if(d=r,typeof r=="function")Qd(r)&&(w=1);else if(typeof r=="string")w=Pj(r,o,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case G:return r=Zn(31,o,s,m),r.elementType=G,r.lanes=x,r;case k:return Ss(o.children,m,x,s);case E:w=8,m|=24;break;case S:return r=Zn(12,o,s,m|2),r.elementType=S,r.lanes=x,r;case L:return r=Zn(13,o,s,m),r.elementType=L,r.lanes=x,r;case T:return r=Zn(19,o,s,m),r.elementType=T,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case M:w=9;break e;case $:w=11;break e;case H:w=14;break e;case z:w=16,d=null;break e}w=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=Zn(w,o,s,m),s.elementType=r,s.type=d,s.lanes=x,s}function Ss(r,s,o,d){return r=Zn(7,r,d,s),r.lanes=o,r}function Kd(r,s,o){return r=Zn(6,r,null,s),r.lanes=o,r}function Jg(r){var s=Zn(18,null,null,0);return s.stateNode=r,s}function Zd(r,s,o){return s=Zn(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var ex=new WeakMap;function ur(r,s){if(typeof r=="object"&&r!==null){var o=ex.get(r);return o!==void 0?o:(s={value:r,source:s,stack:dn(s)},ex.set(r,s),s)}return{value:r,source:s,stack:dn(s)}}var oa=[],ca=0,Cc=null,El=0,dr=[],fr=0,Ui=null,Gr=1,Xr="";function oi(r,s){oa[ca++]=El,oa[ca++]=Cc,Cc=r,El=s}function tx(r,s,o){dr[fr++]=Gr,dr[fr++]=Xr,dr[fr++]=Ui,Ui=r;var d=Gr;r=Xr;var m=32-K(d)-1;d&=~(1<<m),o+=1;var x=32-K(s)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Gr=1<<32-K(s)+m|o<<m|d,Xr=x+r}else Gr=1<<x|o<<m|d,Xr=r}function Jd(r){r.return!==null&&(oi(r,1),tx(r,1,0))}function ef(r){for(;r===Cc;)Cc=oa[--ca],oa[ca]=null,El=oa[--ca],oa[ca]=null;for(;r===Ui;)Ui=dr[--fr],dr[fr]=null,Xr=dr[--fr],dr[fr]=null,Gr=dr[--fr],dr[fr]=null}function nx(r,s){dr[fr++]=Gr,dr[fr++]=Xr,dr[fr++]=Ui,Gr=s.id,Xr=s.overflow,Ui=r}var gn=null,Rt=null,lt=!1,Pi=null,hr=!1,tf=Error(i(519));function $i(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tl(ur(s,r)),tf}function rx(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[Gt]=r,s[fn]=d,o){case"dialog":et("cancel",s),et("close",s);break;case"iframe":case"object":case"embed":et("load",s);break;case"video":case"audio":for(o=0;o<Kl.length;o++)et(Kl[o],s);break;case"source":et("error",s);break;case"img":case"image":case"link":et("error",s),et("load",s);break;case"details":et("toggle",s);break;case"input":et("invalid",s),fc(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":et("invalid",s);break;case"textarea":et("invalid",s),bl(s,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||d.suppressHydrationWarning===!0||yv(s.textContent,o)?(d.popover!=null&&(et("beforetoggle",s),et("toggle",s)),d.onScroll!=null&&et("scroll",s),d.onScrollEnd!=null&&et("scrollend",s),d.onClick!=null&&(s.onclick=$e),s=!0):s=!1,s||$i(r,!0)}function ix(r){for(gn=r.return;gn;)switch(gn.tag){case 5:case 31:case 13:hr=!1;return;case 27:case 3:hr=!0;return;default:gn=gn.return}}function ua(r){if(r!==gn)return!1;if(!lt)return ix(r),lt=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||yh(r.type,r.memoizedProps)),o=!o),o&&Rt&&$i(r),ix(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Rt=Tv(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Rt=Tv(r)}else s===27?(s=Rt,es(r.type)?(r=Sh,Sh=null,Rt=r):Rt=s):Rt=gn?mr(r.stateNode.nextSibling):null;return!0}function Ns(){Rt=gn=null,lt=!1}function nf(){var r=Pi;return r!==null&&(Hn===null?Hn=r:Hn.push.apply(Hn,r),Pi=null),r}function Tl(r){Pi===null?Pi=[r]:Pi.push(r)}var rf=P(null),Cs=null,ci=null;function Fi(r,s,o){A(rf,s._currentValue),s._currentValue=o}function ui(r){r._currentValue=rf.current,Q(rf)}function sf(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function af(r,s,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=m;for(var F=0;F<s.length;F++)if(N.context===s[F]){x.lanes|=o,N=x.alternate,N!==null&&(N.lanes|=o),sf(x.return,o,r),d||(w=null);break e}x=N.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),sf(w,o,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function da(r,s,o,d){r=null;for(var m=s,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=m.type;Kn(m.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}else if(m===ze.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(no):r=[no])}m=m.return}r!==null&&af(s,r,o,d),s.flags|=262144}function Ec(r){for(r=r.firstContext;r!==null;){if(!Kn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Es(r){Cs=r,ci=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function xn(r){return sx(Cs,r)}function Tc(r,s){return Cs===null&&Es(r),sx(r,s)}function sx(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},ci===null){if(r===null)throw Error(i(308));ci=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else ci=ci.next=s;return o}var z2=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(o){return o()})}},O2=e.unstable_scheduleCallback,B2=e.unstable_NormalPriority,Zt={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lf(){return{controller:new z2,data:new Map,refCount:0}}function Al(r){r.refCount--,r.refCount===0&&O2(B2,function(){r.controller.abort()})}var Ml=null,of=0,fa=0,ha=null;function U2(r,s){if(Ml===null){var o=Ml=[];of=0,fa=dh(),ha={status:"pending",value:void 0,then:function(d){o.push(d)}}}return of++,s.then(ax,ax),s}function ax(){if(--of===0&&Ml!==null){ha!==null&&(ha.status="fulfilled");var r=Ml;Ml=null,fa=0,ha=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function P2(r,s){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<o.length;m++)(0,o[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var lx=B.S;B.S=function(r,s){q0=Be(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&U2(r,s),lx!==null&&lx(r,s)};var Ts=P(null);function cf(){var r=Ts.current;return r!==null?r:Ct.pooledCache}function Ac(r,s){s===null?A(Ts,Ts.current):A(Ts,s.pool)}function ox(){var r=cf();return r===null?null:{parent:Zt._currentValue,pool:r}}var pa=Error(i(460)),uf=Error(i(474)),Mc=Error(i(542)),Rc={then:function(){}};function cx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function ux(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then($e,$e),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,fx(r),r;default:if(typeof s.status=="string")s.then($e,$e);else{if(r=Ct,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var m=s;m.status="fulfilled",m.value=d}},function(d){if(s.status==="pending"){var m=s;m.status="rejected",m.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,fx(r),r}throw Ms=s,pa}}function As(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ms=o,pa):o}}var Ms=null;function dx(){if(Ms===null)throw Error(i(459));var r=Ms;return Ms=null,r}function fx(r){if(r===pa||r===Mc)throw Error(i(483))}var ma=null,Rl=0;function Lc(r){var s=Rl;return Rl+=1,ma===null&&(ma=[]),ux(ma,r,s)}function Ll(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function Dc(r,s){throw s.$$typeof===y?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function hx(r){function s(W,q){if(r){var ee=W.deletions;ee===null?(W.deletions=[q],W.flags|=16):ee.push(q)}}function o(W,q){if(!r)return null;for(;q!==null;)s(W,q),q=q.sibling;return null}function d(W){for(var q=new Map;W!==null;)W.key!==null?q.set(W.key,W):q.set(W.index,W),W=W.sibling;return q}function m(W,q){return W=li(W,q),W.index=0,W.sibling=null,W}function x(W,q,ee){return W.index=ee,r?(ee=W.alternate,ee!==null?(ee=ee.index,ee<q?(W.flags|=67108866,q):ee):(W.flags|=67108866,q)):(W.flags|=1048576,q)}function w(W){return r&&W.alternate===null&&(W.flags|=67108866),W}function N(W,q,ee,ue){return q===null||q.tag!==6?(q=Kd(ee,W.mode,ue),q.return=W,q):(q=m(q,ee),q.return=W,q)}function F(W,q,ee,ue){var Oe=ee.type;return Oe===k?le(W,q,ee.props.children,ue,ee.key):q!==null&&(q.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===z&&As(Oe)===q.type)?(q=m(q,ee.props),Ll(q,ee),q.return=W,q):(q=Nc(ee.type,ee.key,ee.props,null,W.mode,ue),Ll(q,ee),q.return=W,q)}function te(W,q,ee,ue){return q===null||q.tag!==4||q.stateNode.containerInfo!==ee.containerInfo||q.stateNode.implementation!==ee.implementation?(q=Zd(ee,W.mode,ue),q.return=W,q):(q=m(q,ee.children||[]),q.return=W,q)}function le(W,q,ee,ue,Oe){return q===null||q.tag!==7?(q=Ss(ee,W.mode,ue,Oe),q.return=W,q):(q=m(q,ee),q.return=W,q)}function de(W,q,ee){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Kd(""+q,W.mode,ee),q.return=W,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case b:return ee=Nc(q.type,q.key,q.props,null,W.mode,ee),Ll(ee,q),ee.return=W,ee;case _:return q=Zd(q,W.mode,ee),q.return=W,q;case z:return q=As(q),de(W,q,ee)}if(X(q)||R(q))return q=Ss(q,W.mode,ee,null),q.return=W,q;if(typeof q.then=="function")return de(W,Lc(q),ee);if(q.$$typeof===C)return de(W,Tc(W,q),ee);Dc(W,q)}return null}function ne(W,q,ee,ue){var Oe=q!==null?q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Oe!==null?null:N(W,q,""+ee,ue);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return ee.key===Oe?F(W,q,ee,ue):null;case _:return ee.key===Oe?te(W,q,ee,ue):null;case z:return ee=As(ee),ne(W,q,ee,ue)}if(X(ee)||R(ee))return Oe!==null?null:le(W,q,ee,ue,null);if(typeof ee.then=="function")return ne(W,q,Lc(ee),ue);if(ee.$$typeof===C)return ne(W,q,Tc(W,ee),ue);Dc(W,ee)}return null}function ie(W,q,ee,ue,Oe){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return W=W.get(ee)||null,N(q,W,""+ue,Oe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:return W=W.get(ue.key===null?ee:ue.key)||null,F(q,W,ue,Oe);case _:return W=W.get(ue.key===null?ee:ue.key)||null,te(q,W,ue,Oe);case z:return ue=As(ue),ie(W,q,ee,ue,Oe)}if(X(ue)||R(ue))return W=W.get(ee)||null,le(q,W,ue,Oe,null);if(typeof ue.then=="function")return ie(W,q,ee,Lc(ue),Oe);if(ue.$$typeof===C)return ie(W,q,ee,Tc(q,ue),Oe);Dc(q,ue)}return null}function Ae(W,q,ee,ue){for(var Oe=null,dt=null,Me=q,Ye=q=0,st=null;Me!==null&&Ye<ee.length;Ye++){Me.index>Ye?(st=Me,Me=null):st=Me.sibling;var ft=ne(W,Me,ee[Ye],ue);if(ft===null){Me===null&&(Me=st);break}r&&Me&&ft.alternate===null&&s(W,Me),q=x(ft,q,Ye),dt===null?Oe=ft:dt.sibling=ft,dt=ft,Me=st}if(Ye===ee.length)return o(W,Me),lt&&oi(W,Ye),Oe;if(Me===null){for(;Ye<ee.length;Ye++)Me=de(W,ee[Ye],ue),Me!==null&&(q=x(Me,q,Ye),dt===null?Oe=Me:dt.sibling=Me,dt=Me);return lt&&oi(W,Ye),Oe}for(Me=d(Me);Ye<ee.length;Ye++)st=ie(Me,W,Ye,ee[Ye],ue),st!==null&&(r&&st.alternate!==null&&Me.delete(st.key===null?Ye:st.key),q=x(st,q,Ye),dt===null?Oe=st:dt.sibling=st,dt=st);return r&&Me.forEach(function(ss){return s(W,ss)}),lt&&oi(W,Ye),Oe}function Pe(W,q,ee,ue){if(ee==null)throw Error(i(151));for(var Oe=null,dt=null,Me=q,Ye=q=0,st=null,ft=ee.next();Me!==null&&!ft.done;Ye++,ft=ee.next()){Me.index>Ye?(st=Me,Me=null):st=Me.sibling;var ss=ne(W,Me,ft.value,ue);if(ss===null){Me===null&&(Me=st);break}r&&Me&&ss.alternate===null&&s(W,Me),q=x(ss,q,Ye),dt===null?Oe=ss:dt.sibling=ss,dt=ss,Me=st}if(ft.done)return o(W,Me),lt&&oi(W,Ye),Oe;if(Me===null){for(;!ft.done;Ye++,ft=ee.next())ft=de(W,ft.value,ue),ft!==null&&(q=x(ft,q,Ye),dt===null?Oe=ft:dt.sibling=ft,dt=ft);return lt&&oi(W,Ye),Oe}for(Me=d(Me);!ft.done;Ye++,ft=ee.next())ft=ie(Me,W,Ye,ft.value,ue),ft!==null&&(r&&ft.alternate!==null&&Me.delete(ft.key===null?Ye:ft.key),q=x(ft,q,Ye),dt===null?Oe=ft:dt.sibling=ft,dt=ft);return r&&Me.forEach(function(Qj){return s(W,Qj)}),lt&&oi(W,Ye),Oe}function wt(W,q,ee,ue){if(typeof ee=="object"&&ee!==null&&ee.type===k&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:e:{for(var Oe=ee.key;q!==null;){if(q.key===Oe){if(Oe=ee.type,Oe===k){if(q.tag===7){o(W,q.sibling),ue=m(q,ee.props.children),ue.return=W,W=ue;break e}}else if(q.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===z&&As(Oe)===q.type){o(W,q.sibling),ue=m(q,ee.props),Ll(ue,ee),ue.return=W,W=ue;break e}o(W,q);break}else s(W,q);q=q.sibling}ee.type===k?(ue=Ss(ee.props.children,W.mode,ue,ee.key),ue.return=W,W=ue):(ue=Nc(ee.type,ee.key,ee.props,null,W.mode,ue),Ll(ue,ee),ue.return=W,W=ue)}return w(W);case _:e:{for(Oe=ee.key;q!==null;){if(q.key===Oe)if(q.tag===4&&q.stateNode.containerInfo===ee.containerInfo&&q.stateNode.implementation===ee.implementation){o(W,q.sibling),ue=m(q,ee.children||[]),ue.return=W,W=ue;break e}else{o(W,q);break}else s(W,q);q=q.sibling}ue=Zd(ee,W.mode,ue),ue.return=W,W=ue}return w(W);case z:return ee=As(ee),wt(W,q,ee,ue)}if(X(ee))return Ae(W,q,ee,ue);if(R(ee)){if(Oe=R(ee),typeof Oe!="function")throw Error(i(150));return ee=Oe.call(ee),Pe(W,q,ee,ue)}if(typeof ee.then=="function")return wt(W,q,Lc(ee),ue);if(ee.$$typeof===C)return wt(W,q,Tc(W,ee),ue);Dc(W,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,q!==null&&q.tag===6?(o(W,q.sibling),ue=m(q,ee),ue.return=W,W=ue):(o(W,q),ue=Kd(ee,W.mode,ue),ue.return=W,W=ue),w(W)):o(W,q)}return function(W,q,ee,ue){try{Rl=0;var Oe=wt(W,q,ee,ue);return ma=null,Oe}catch(Me){if(Me===pa||Me===Mc)throw Me;var dt=Zn(29,Me,null,W.mode);return dt.lanes=ue,dt.return=W,dt}finally{}}}var Rs=hx(!0),px=hx(!1),Hi=!1;function df(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ff(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Ii(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function qi(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ht&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=Sc(r),Kg(r,null,o),s}return kc(r,d,s,o),Sc(r)}function Dl(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,xs(r,o)}}function hf(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=s:x=x.next=s}else m=x=s;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var pf=!1;function zl(){if(pf){var r=ha;if(r!==null)throw r}}function Ol(r,s,o,d){pf=!1;var m=r.updateQueue;Hi=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var F=N,te=F.next;F.next=null,w===null?x=te:w.next=te,w=F;var le=r.alternate;le!==null&&(le=le.updateQueue,N=le.lastBaseUpdate,N!==w&&(N===null?le.firstBaseUpdate=te:N.next=te,le.lastBaseUpdate=F))}if(x!==null){var de=m.baseState;w=0,le=te=F=null,N=x;do{var ne=N.lane&-536870913,ie=ne!==N.lane;if(ie?(it&ne)===ne:(d&ne)===ne){ne!==0&&ne===fa&&(pf=!0),le!==null&&(le=le.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ae=r,Pe=N;ne=s;var wt=o;switch(Pe.tag){case 1:if(Ae=Pe.payload,typeof Ae=="function"){de=Ae.call(wt,de,ne);break e}de=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Pe.payload,ne=typeof Ae=="function"?Ae.call(wt,de,ne):Ae,ne==null)break e;de=v({},de,ne);break e;case 2:Hi=!0}}ne=N.callback,ne!==null&&(r.flags|=64,ie&&(r.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:N.tag,payload:N.payload,callback:N.callback,next:null},le===null?(te=le=ie,F=de):le=le.next=ie,w|=ne;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;ie=N,N=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);le===null&&(F=de),m.baseState=F,m.firstBaseUpdate=te,m.lastBaseUpdate=le,x===null&&(m.shared.lanes=0),Wi|=w,r.lanes=w,r.memoizedState=de}}function mx(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function gx(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)mx(o[r],s)}var ga=P(null),zc=P(0);function xx(r,s){r=bi,A(zc,r),A(ga,s),bi=r|s.baseLanes}function mf(){A(zc,bi),A(ga,ga.current)}function gf(){bi=zc.current,Q(ga),Q(zc)}var Jn=P(null),pr=null;function Vi(r){var s=r.alternate;A(Xt,Xt.current&1),A(Jn,r),pr===null&&(s===null||ga.current!==null||s.memoizedState!==null)&&(pr=r)}function xf(r){A(Xt,Xt.current),A(Jn,r),pr===null&&(pr=r)}function vx(r){r.tag===22?(A(Xt,Xt.current),A(Jn,r),pr===null&&(pr=r)):Gi()}function Gi(){A(Xt,Xt.current),A(Jn,Jn.current)}function er(r){Q(Jn),pr===r&&(pr=null),Q(Xt)}var Xt=P(0);function Oc(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||jh(o)||kh(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var di=0,Xe=null,yt=null,Jt=null,Bc=!1,xa=!1,Ls=!1,Uc=0,Bl=0,va=null,$2=0;function It(){throw Error(i(321))}function vf(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!Kn(r[o],s[o]))return!1;return!0}function bf(r,s,o,d,m,x){return di=x,Xe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=r===null||r.memoizedState===null?t0:Df,Ls=!1,x=o(d,m),Ls=!1,xa&&(x=yx(s,o,d,m)),bx(r),x}function bx(r){B.H=$l;var s=yt!==null&&yt.next!==null;if(di=0,Jt=yt=Xe=null,Bc=!1,Bl=0,va=null,s)throw Error(i(300));r===null||en||(r=r.dependencies,r!==null&&Ec(r)&&(en=!0))}function yx(r,s,o,d){Xe=r;var m=0;do{if(xa&&(va=null),Bl=0,xa=!1,25<=m)throw Error(i(301));if(m+=1,Jt=yt=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}B.H=n0,x=s(o,d)}while(xa);return x}function F2(){var r=B.H,s=r.useState()[0];return s=typeof s.then=="function"?Ul(s):s,r=r.useState()[0],(yt!==null?yt.memoizedState:null)!==r&&(Xe.flags|=1024),s}function yf(){var r=Uc!==0;return Uc=0,r}function _f(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function wf(r){if(Bc){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Bc=!1}di=0,Jt=yt=Xe=null,xa=!1,Bl=Uc=0,va=null}function Tn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Xe.memoizedState=Jt=r:Jt=Jt.next=r,Jt}function Yt(){if(yt===null){var r=Xe.alternate;r=r!==null?r.memoizedState:null}else r=yt.next;var s=Jt===null?Xe.memoizedState:Jt.next;if(s!==null)Jt=s,yt=r;else{if(r===null)throw Xe.alternate===null?Error(i(467)):Error(i(310));yt=r,r={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Jt===null?Xe.memoizedState=Jt=r:Jt=Jt.next=r}return Jt}function Pc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ul(r){var s=Bl;return Bl+=1,va===null&&(va=[]),r=ux(va,r,s),s=Xe,(Jt===null?s.memoizedState:Jt.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?t0:Df),r}function $c(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Ul(r);if(r.$$typeof===C)return xn(r)}throw Error(i(438,String(r)))}function jf(r){var s=null,o=Xe.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=Xe.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(m){return m.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=Pc(),Xe.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(r),d=0;d<r;d++)o[d]=O;return s.index++,o}function fi(r,s){return typeof s=="function"?s(r):s}function Fc(r){var s=Yt();return kf(s,yt,r)}function kf(r,s,o){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}s.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{s=m.next;var N=w=null,F=null,te=s,le=!1;do{var de=te.lane&-536870913;if(de!==te.lane?(it&de)===de:(di&de)===de){var ne=te.revertLane;if(ne===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),de===fa&&(le=!0);else if((di&ne)===ne){te=te.next,ne===fa&&(le=!0);continue}else de={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},F===null?(N=F=de,w=x):F=F.next=de,Xe.lanes|=ne,Wi|=ne;de=te.action,Ls&&o(x,de),x=te.hasEagerState?te.eagerState:o(x,de)}else ne={lane:de,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},F===null?(N=F=ne,w=x):F=F.next=ne,Xe.lanes|=de,Wi|=de;te=te.next}while(te!==null&&te!==s);if(F===null?w=x:F.next=N,!Kn(x,r.memoizedState)&&(en=!0,le&&(o=ha,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=F,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Sf(r){var s=Yt(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=s.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);Kn(x,s.memoizedState)||(en=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),o.lastRenderedState=x}return[x,d]}function _x(r,s,o){var d=Xe,m=Yt(),x=lt;if(x){if(o===void 0)throw Error(i(407));o=o()}else o=s();var w=!Kn((yt||m).memoizedState,o);if(w&&(m.memoizedState=o,en=!0),m=m.queue,Ef(kx.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||Jt!==null&&Jt.memoizedState.tag&1){if(d.flags|=2048,ba(9,{destroy:void 0},jx.bind(null,d,m,o,s),null),Ct===null)throw Error(i(349));x||(di&127)!==0||wx(d,s,o)}return o}function wx(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=Xe.updateQueue,s===null?(s=Pc(),Xe.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function jx(r,s,o,d){s.value=o,s.getSnapshot=d,Sx(s)&&Nx(r)}function kx(r,s,o){return o(function(){Sx(s)&&Nx(r)})}function Sx(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!Kn(r,o)}catch{return!0}}function Nx(r){var s=ks(r,2);s!==null&&In(s,r,2)}function Nf(r){var s=Tn();if(typeof r=="function"){var o=r;if(r=o(),Ls){$t(!0);try{o()}finally{$t(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fi,lastRenderedState:r},s}function Cx(r,s,o,d){return r.baseState=o,kf(r,yt,typeof d=="function"?d:fi)}function H2(r,s,o,d,m){if(qc(r))throw Error(i(485));if(r=s.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};B.T!==null?o(!0):x.isTransition=!1,d(x),o=s.pending,o===null?(x.next=s.pending=x,Ex(s,x)):(x.next=o.next,s.pending=o.next=x)}}function Ex(r,s){var o=s.action,d=s.payload,m=r.state;if(s.isTransition){var x=B.T,w={};B.T=w;try{var N=o(m,d),F=B.S;F!==null&&F(w,N),Tx(r,s,N)}catch(te){Cf(r,s,te)}finally{x!==null&&w.types!==null&&(x.types=w.types),B.T=x}}else try{x=o(m,d),Tx(r,s,x)}catch(te){Cf(r,s,te)}}function Tx(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){Ax(r,s,d)},function(d){return Cf(r,s,d)}):Ax(r,s,o)}function Ax(r,s,o){s.status="fulfilled",s.value=o,Mx(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,Ex(r,o)))}function Cf(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,Mx(s),s=s.next;while(s!==d)}r.action=null}function Mx(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function Rx(r,s){return s}function Lx(r,s){if(lt){var o=Ct.formState;if(o!==null){e:{var d=Xe;if(lt){if(Rt){t:{for(var m=Rt,x=hr;m.nodeType!==8;){if(!x){m=null;break t}if(m=mr(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Rt=mr(m.nextSibling),d=m.data==="F!";break e}}$i(d)}d=!1}d&&(s=o[0])}}return o=Tn(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rx,lastRenderedState:s},o.queue=d,o=Zx.bind(null,Xe,d),d.dispatch=o,d=Nf(!1),x=Lf.bind(null,Xe,!1,d.queue),d=Tn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,o=H2.bind(null,Xe,m,x,o),m.dispatch=o,d.memoizedState=r,[s,o,!1]}function Dx(r){var s=Yt();return zx(s,yt,r)}function zx(r,s,o){if(s=kf(r,s,Rx)[0],r=Fc(fi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=Ul(s)}catch(w){throw w===pa?Mc:w}else d=s;s=Yt();var m=s.queue,x=m.dispatch;return o!==s.memoizedState&&(Xe.flags|=2048,ba(9,{destroy:void 0},I2.bind(null,m,o),null)),[d,x,r]}function I2(r,s){r.action=s}function Ox(r){var s=Yt(),o=yt;if(o!==null)return zx(s,o,r);Yt(),s=s.memoizedState,o=Yt();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function ba(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=Xe.updateQueue,s===null&&(s=Pc(),Xe.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,s.lastEffect=r),r}function Bx(){return Yt().memoizedState}function Hc(r,s,o,d){var m=Tn();Xe.flags|=r,m.memoizedState=ba(1|s,{destroy:void 0},o,d===void 0?null:d)}function Ic(r,s,o,d){var m=Yt();d=d===void 0?null:d;var x=m.memoizedState.inst;yt!==null&&d!==null&&vf(d,yt.memoizedState.deps)?m.memoizedState=ba(s,x,o,d):(Xe.flags|=r,m.memoizedState=ba(1|s,x,o,d))}function Ux(r,s){Hc(8390656,8,r,s)}function Ef(r,s){Ic(2048,8,r,s)}function q2(r){Xe.flags|=4;var s=Xe.updateQueue;if(s===null)s=Pc(),Xe.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function Px(r){var s=Yt().memoizedState;return q2({ref:s,nextImpl:r}),function(){if((ht&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function $x(r,s){return Ic(4,2,r,s)}function Fx(r,s){return Ic(4,4,r,s)}function Hx(r,s){if(typeof s=="function"){r=r();var o=s(r);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Ix(r,s,o){o=o!=null?o.concat([r]):null,Ic(4,4,Hx.bind(null,s,r),o)}function Tf(){}function qx(r,s){var o=Yt();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&vf(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function Vx(r,s){var o=Yt();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&vf(s,d[1]))return d[0];if(d=r(),Ls){$t(!0);try{r()}finally{$t(!1)}}return o.memoizedState=[d,s],d}function Af(r,s,o){return o===void 0||(di&1073741824)!==0&&(it&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=G0(),Xe.lanes|=r,Wi|=r,o)}function Gx(r,s,o,d){return Kn(o,s)?o:ga.current!==null?(r=Af(r,o,d),Kn(r,s)||(en=!0),r):(di&42)===0||(di&1073741824)!==0&&(it&261930)===0?(en=!0,r.memoizedState=o):(r=G0(),Xe.lanes|=r,Wi|=r,s)}function Xx(r,s,o,d,m){var x=U.p;U.p=x!==0&&8>x?x:8;var w=B.T,N={};B.T=N,Lf(r,!1,s,o);try{var F=m(),te=B.S;if(te!==null&&te(N,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var le=P2(F,d);Pl(r,s,le,rr(r))}else Pl(r,s,d,rr(r))}catch(de){Pl(r,s,{then:function(){},status:"rejected",reason:de},rr())}finally{U.p=x,w!==null&&N.types!==null&&(w.types=N.types),B.T=w}}function V2(){}function Mf(r,s,o,d){if(r.tag!==5)throw Error(i(476));var m=Yx(r).queue;Xx(r,m,s,Z,o===null?V2:function(){return Wx(r),o(d)})}function Yx(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fi,lastRenderedState:Z},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fi,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function Wx(r){var s=Yx(r);s.next===null&&(s=r.alternate.memoizedState),Pl(r,s.next.queue,{},rr())}function Rf(){return xn(no)}function Qx(){return Yt().memoizedState}function Kx(){return Yt().memoizedState}function G2(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=rr();r=Ii(o);var d=qi(s,r,o);d!==null&&(In(d,s,o),Dl(d,s,o)),s={cache:lf()},r.payload=s;return}s=s.return}}function X2(r,s,o){var d=rr();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},qc(r)?Jx(s,o):(o=Wd(r,s,o,d),o!==null&&(In(o,r,d),e0(o,s,d)))}function Zx(r,s,o){var d=rr();Pl(r,s,o,d)}function Pl(r,s,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(qc(r))Jx(s,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var w=s.lastRenderedState,N=x(w,o);if(m.hasEagerState=!0,m.eagerState=N,Kn(N,w))return kc(r,s,m,0),Ct===null&&jc(),!1}catch{}finally{}if(o=Wd(r,s,m,d),o!==null)return In(o,r,d),e0(o,s,d),!0}return!1}function Lf(r,s,o,d){if(d={lane:2,revertLane:dh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},qc(r)){if(s)throw Error(i(479))}else s=Wd(r,o,d,2),s!==null&&In(s,r,2)}function qc(r){var s=r.alternate;return r===Xe||s!==null&&s===Xe}function Jx(r,s){xa=Bc=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function e0(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,xs(r,o)}}var $l={readContext:xn,use:$c,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};$l.useEffectEvent=It;var t0={readContext:xn,use:$c,useCallback:function(r,s){return Tn().memoizedState=[r,s===void 0?null:s],r},useContext:xn,useEffect:Ux,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,Hc(4194308,4,Hx.bind(null,s,r),o)},useLayoutEffect:function(r,s){return Hc(4194308,4,r,s)},useInsertionEffect:function(r,s){Hc(4,2,r,s)},useMemo:function(r,s){var o=Tn();s=s===void 0?null:s;var d=r();if(Ls){$t(!0);try{r()}finally{$t(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Tn();if(o!==void 0){var m=o(s);if(Ls){$t(!0);try{o(s)}finally{$t(!1)}}}else m=s;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=X2.bind(null,Xe,r),[d.memoizedState,r]},useRef:function(r){var s=Tn();return r={current:r},s.memoizedState=r},useState:function(r){r=Nf(r);var s=r.queue,o=Zx.bind(null,Xe,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:Tf,useDeferredValue:function(r,s){var o=Tn();return Af(o,r,s)},useTransition:function(){var r=Nf(!1);return r=Xx.bind(null,Xe,r.queue,!0,!1),Tn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=Xe,m=Tn();if(lt){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),Ct===null)throw Error(i(349));(it&127)!==0||wx(d,s,o)}m.memoizedState=o;var x={value:o,getSnapshot:s};return m.queue=x,Ux(kx.bind(null,d,x,r),[r]),d.flags|=2048,ba(9,{destroy:void 0},jx.bind(null,d,x,o,s),null),o},useId:function(){var r=Tn(),s=Ct.identifierPrefix;if(lt){var o=Xr,d=Gr;o=(d&~(1<<32-K(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=Uc++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=$2++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:Rf,useFormState:Lx,useActionState:Lx,useOptimistic:function(r){var s=Tn();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=Lf.bind(null,Xe,!0,o),o.dispatch=s,[r,s]},useMemoCache:jf,useCacheRefresh:function(){return Tn().memoizedState=G2.bind(null,Xe)},useEffectEvent:function(r){var s=Tn(),o={impl:r};return s.memoizedState=o,function(){if((ht&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},Df={readContext:xn,use:$c,useCallback:qx,useContext:xn,useEffect:Ef,useImperativeHandle:Ix,useInsertionEffect:$x,useLayoutEffect:Fx,useMemo:Vx,useReducer:Fc,useRef:Bx,useState:function(){return Fc(fi)},useDebugValue:Tf,useDeferredValue:function(r,s){var o=Yt();return Gx(o,yt.memoizedState,r,s)},useTransition:function(){var r=Fc(fi)[0],s=Yt().memoizedState;return[typeof r=="boolean"?r:Ul(r),s]},useSyncExternalStore:_x,useId:Qx,useHostTransitionStatus:Rf,useFormState:Dx,useActionState:Dx,useOptimistic:function(r,s){var o=Yt();return Cx(o,yt,r,s)},useMemoCache:jf,useCacheRefresh:Kx};Df.useEffectEvent=Px;var n0={readContext:xn,use:$c,useCallback:qx,useContext:xn,useEffect:Ef,useImperativeHandle:Ix,useInsertionEffect:$x,useLayoutEffect:Fx,useMemo:Vx,useReducer:Sf,useRef:Bx,useState:function(){return Sf(fi)},useDebugValue:Tf,useDeferredValue:function(r,s){var o=Yt();return yt===null?Af(o,r,s):Gx(o,yt.memoizedState,r,s)},useTransition:function(){var r=Sf(fi)[0],s=Yt().memoizedState;return[typeof r=="boolean"?r:Ul(r),s]},useSyncExternalStore:_x,useId:Qx,useHostTransitionStatus:Rf,useFormState:Ox,useActionState:Ox,useOptimistic:function(r,s){var o=Yt();return yt!==null?Cx(o,yt,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:jf,useCacheRefresh:Kx};n0.useEffectEvent=Px;function zf(r,s,o,d){s=r.memoizedState,o=o(d,s),o=o==null?s:v({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var Of={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=rr(),m=Ii(d);m.payload=s,o!=null&&(m.callback=o),s=qi(r,m,d),s!==null&&(In(s,r,d),Dl(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=rr(),m=Ii(d);m.tag=1,m.payload=s,o!=null&&(m.callback=o),s=qi(r,m,d),s!==null&&(In(s,r,d),Dl(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=rr(),d=Ii(o);d.tag=2,s!=null&&(d.callback=s),s=qi(r,d,o),s!==null&&(In(s,r,o),Dl(s,r,o))}};function r0(r,s,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):s.prototype&&s.prototype.isPureReactComponent?!Nl(o,d)||!Nl(m,x):!0}function i0(r,s,o,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,d),s.state!==r&&Of.enqueueReplaceState(s,s.state,null)}function Ds(r,s){var o=s;if("ref"in s){o={};for(var d in s)d!=="ref"&&(o[d]=s[d])}if(r=r.defaultProps){o===s&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function s0(r){wc(r)}function a0(r){console.error(r)}function l0(r){wc(r)}function Vc(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function o0(r,s,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Bf(r,s,o){return o=Ii(o),o.tag=3,o.payload={element:null},o.callback=function(){Vc(r,s)},o}function c0(r){return r=Ii(r),r.tag=3,r}function u0(r,s,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){o0(s,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){o0(s,o,d),typeof m!="function"&&(Qi===null?Qi=new Set([this]):Qi.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function Y2(r,s,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&da(s,o,m,!0),o=Jn.current,o!==null){switch(o.tag){case 31:case 13:return pr===null?ru():o.alternate===null&&qt===0&&(qt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===Rc?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),oh(r,d,m)),!1;case 22:return o.flags|=65536,d===Rc?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([d]):o.add(d)),oh(r,d,m)),!1}throw Error(i(435,o.tag))}return oh(r,d,m),ru(),!1}if(lt)return s=Jn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==tf&&(r=Error(i(422),{cause:d}),Tl(ur(r,o)))):(d!==tf&&(s=Error(i(423),{cause:d}),Tl(ur(s,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=ur(d,o),m=Bf(r.stateNode,d,m),hf(r,m),qt!==4&&(qt=2)),!1;var x=Error(i(520),{cause:d});if(x=ur(x,o),Yl===null?Yl=[x]:Yl.push(x),qt!==4&&(qt=2),s===null)return!0;d=ur(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=Bf(o.stateNode,d,r),hf(o,r),!1;case 1:if(s=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Qi===null||!Qi.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=c0(m),u0(m,r,o,d),hf(o,m),!1}o=o.return}while(o!==null);return!1}var Uf=Error(i(461)),en=!1;function vn(r,s,o,d){s.child=r===null?px(s,null,o,d):Rs(s,r.child,o,d)}function d0(r,s,o,d,m){o=o.render;var x=s.ref;if("ref"in d){var w={};for(var N in d)N!=="ref"&&(w[N]=d[N])}else w=d;return Es(s),d=bf(r,s,o,w,x,m),N=yf(),r!==null&&!en?(_f(r,s,m),hi(r,s,m)):(lt&&N&&Jd(s),s.flags|=1,vn(r,s,d,m),s.child)}function f0(r,s,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!Qd(x)&&x.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=x,h0(r,s,x,d,m)):(r=Nc(o.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(x=r.child,!Gf(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Nl,o(w,d)&&r.ref===s.ref)return hi(r,s,m)}return s.flags|=1,r=li(x,d),r.ref=s.ref,r.return=s,s.child=r}function h0(r,s,o,d,m){if(r!==null){var x=r.memoizedProps;if(Nl(x,d)&&r.ref===s.ref)if(en=!1,s.pendingProps=d=x,Gf(r,m))(r.flags&131072)!==0&&(en=!0);else return s.lanes=r.lanes,hi(r,s,m)}return Pf(r,s,o,d,m)}function p0(r,s,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,s.child=null;return m0(r,s,x,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Ac(s,x!==null?x.cachePool:null),x!==null?xx(s,x):mf(),vx(s);else return d=s.lanes=536870912,m0(r,s,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(Ac(s,x.cachePool),xx(s,x),Gi(),s.memoizedState=null):(r!==null&&Ac(s,null),mf(),Gi());return vn(r,s,m,o),s.child}function Fl(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function m0(r,s,o,d,m){var x=cf();return x=x===null?null:{parent:Zt._currentValue,pool:x},s.memoizedState={baseLanes:o,cachePool:x},r!==null&&Ac(s,null),mf(),vx(s),r!==null&&da(r,s,d,!0),s.childLanes=m,null}function Gc(r,s){return s=Yc({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function g0(r,s,o){return Rs(s,r.child,null,o),r=Gc(s,s.pendingProps),r.flags|=2,er(s),s.memoizedState=null,r}function W2(r,s,o){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(lt){if(d.mode==="hidden")return r=Gc(s,d),s.lanes=536870912,Fl(null,r);if(xf(s),(r=Rt)?(r=Ev(r,hr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Ui!==null?{id:Gr,overflow:Xr}:null,retryLane:536870912,hydrationErrors:null},o=Jg(r),o.return=s,s.child=o,gn=s,Rt=null)):r=null,r===null)throw $i(s);return s.lanes=536870912,null}return Gc(s,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(xf(s),m)if(s.flags&256)s.flags&=-257,s=g0(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(en||da(r,s,o,!1),m=(o&r.childLanes)!==0,en||m){if(d=Ct,d!==null&&(w=ul(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,ks(r,w),In(d,r,w),Uf;ru(),s=g0(r,s,o)}else r=x.treeContext,Rt=mr(w.nextSibling),gn=s,lt=!0,Pi=null,hr=!1,r!==null&&nx(s,r),s=Gc(s,d),s.flags|=4096;return s}return r=li(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function Xc(r,s){var o=s.ref;if(o===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(r===null||r.ref!==o)&&(s.flags|=4194816)}}function Pf(r,s,o,d,m){return Es(s),o=bf(r,s,o,d,void 0,m),d=yf(),r!==null&&!en?(_f(r,s,m),hi(r,s,m)):(lt&&d&&Jd(s),s.flags|=1,vn(r,s,o,m),s.child)}function x0(r,s,o,d,m,x){return Es(s),s.updateQueue=null,o=yx(s,d,o,m),bx(r),d=yf(),r!==null&&!en?(_f(r,s,x),hi(r,s,x)):(lt&&d&&Jd(s),s.flags|=1,vn(r,s,o,x),s.child)}function v0(r,s,o,d,m){if(Es(s),s.stateNode===null){var x=la,w=o.contextType;typeof w=="object"&&w!==null&&(x=xn(w)),x=new o(d,x),s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Of,s.stateNode=x,x._reactInternals=s,x=s.stateNode,x.props=d,x.state=s.memoizedState,x.refs={},df(s),w=o.contextType,x.context=typeof w=="object"&&w!==null?xn(w):la,x.state=s.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(zf(s,o,w,d),x.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Of.enqueueReplaceState(x,x.state,null),Ol(s,d,x,m),zl(),x.state=s.memoizedState),typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){x=s.stateNode;var N=s.memoizedProps,F=Ds(o,N);x.props=F;var te=x.context,le=o.contextType;w=la,typeof le=="object"&&le!==null&&(w=xn(le));var de=o.getDerivedStateFromProps;le=typeof de=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=s.pendingProps!==N,le||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||te!==w)&&i0(s,x,d,w),Hi=!1;var ne=s.memoizedState;x.state=ne,Ol(s,d,x,m),zl(),te=s.memoizedState,N||ne!==te||Hi?(typeof de=="function"&&(zf(s,o,de,d),te=s.memoizedState),(F=Hi||r0(s,o,F,d,ne,te,w))?(le||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=te),x.props=d,x.state=te,x.context=w,d=F):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{x=s.stateNode,ff(r,s),w=s.memoizedProps,le=Ds(o,w),x.props=le,de=s.pendingProps,ne=x.context,te=o.contextType,F=la,typeof te=="object"&&te!==null&&(F=xn(te)),N=o.getDerivedStateFromProps,(te=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==de||ne!==F)&&i0(s,x,d,F),Hi=!1,ne=s.memoizedState,x.state=ne,Ol(s,d,x,m),zl();var ie=s.memoizedState;w!==de||ne!==ie||Hi||r!==null&&r.dependencies!==null&&Ec(r.dependencies)?(typeof N=="function"&&(zf(s,o,N,d),ie=s.memoizedState),(le=Hi||r0(s,o,le,d,ne,ie,F)||r!==null&&r.dependencies!==null&&Ec(r.dependencies))?(te||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,ie,F),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,ie,F)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=ie),x.props=d,x.state=ie,x.context=F,d=le):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=1024),d=!1)}return x=d,Xc(r,s),d=(s.flags&128)!==0,x||d?(x=s.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),s.flags|=1,r!==null&&d?(s.child=Rs(s,r.child,null,m),s.child=Rs(s,null,o,m)):vn(r,s,o,m),s.memoizedState=x.state,r=s.child):r=hi(r,s,m),r}function b0(r,s,o,d){return Ns(),s.flags|=256,vn(r,s,o,d),s.child}var $f={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ff(r){return{baseLanes:r,cachePool:ox()}}function Hf(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=nr),r}function y0(r,s,o){var d=s.pendingProps,m=!1,x=(s.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(Xt.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(lt){if(m?Vi(s):Gi(),(r=Rt)?(r=Ev(r,hr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Ui!==null?{id:Gr,overflow:Xr}:null,retryLane:536870912,hydrationErrors:null},o=Jg(r),o.return=s,s.child=o,gn=s,Rt=null)):r=null,r===null)throw $i(s);return kh(r)?s.lanes=32:s.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(Gi(),m=s.mode,N=Yc({mode:"hidden",children:N},m),d=Ss(d,m,o,null),N.return=s,d.return=s,N.sibling=d,s.child=N,d=s.child,d.memoizedState=Ff(o),d.childLanes=Hf(r,w,o),s.memoizedState=$f,Fl(null,d)):(Vi(s),If(s,N))}var F=r.memoizedState;if(F!==null&&(N=F.dehydrated,N!==null)){if(x)s.flags&256?(Vi(s),s.flags&=-257,s=qf(r,s,o)):s.memoizedState!==null?(Gi(),s.child=r.child,s.flags|=128,s=null):(Gi(),N=d.fallback,m=s.mode,d=Yc({mode:"visible",children:d.children},m),N=Ss(N,m,o,null),N.flags|=2,d.return=s,N.return=s,d.sibling=N,s.child=d,Rs(s,r.child,null,o),d=s.child,d.memoizedState=Ff(o),d.childLanes=Hf(r,w,o),s.memoizedState=$f,s=Fl(null,d));else if(Vi(s),kh(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var te=w.dgst;w=te,d=Error(i(419)),d.stack="",d.digest=w,Tl({value:d,source:null,stack:null}),s=qf(r,s,o)}else if(en||da(r,s,o,!1),w=(o&r.childLanes)!==0,en||w){if(w=Ct,w!==null&&(d=ul(w,o),d!==0&&d!==F.retryLane))throw F.retryLane=d,ks(r,d),In(w,r,d),Uf;jh(N)||ru(),s=qf(r,s,o)}else jh(N)?(s.flags|=192,s.child=r.child,s=null):(r=F.treeContext,Rt=mr(N.nextSibling),gn=s,lt=!0,Pi=null,hr=!1,r!==null&&nx(s,r),s=If(s,d.children),s.flags|=4096);return s}return m?(Gi(),N=d.fallback,m=s.mode,F=r.child,te=F.sibling,d=li(F,{mode:"hidden",children:d.children}),d.subtreeFlags=F.subtreeFlags&65011712,te!==null?N=li(te,N):(N=Ss(N,m,o,null),N.flags|=2),N.return=s,d.return=s,d.sibling=N,s.child=d,Fl(null,d),d=s.child,N=r.child.memoizedState,N===null?N=Ff(o):(m=N.cachePool,m!==null?(F=Zt._currentValue,m=m.parent!==F?{parent:F,pool:F}:m):m=ox(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=Hf(r,w,o),s.memoizedState=$f,Fl(r.child,d)):(Vi(s),o=r.child,r=o.sibling,o=li(o,{mode:"visible",children:d.children}),o.return=s,o.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=o,s.memoizedState=null,o)}function If(r,s){return s=Yc({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function Yc(r,s){return r=Zn(22,r,null,s),r.lanes=0,r}function qf(r,s,o){return Rs(s,r.child,null,o),r=If(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function _0(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),sf(r.return,s,o)}function Vf(r,s,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function w0(r,s,o){var d=s.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=Xt.current,N=(w&2)!==0;if(N?(w=w&1|2,s.flags|=128):w&=1,A(Xt,w),vn(r,s,d,o),d=lt?El:0,!N&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&_0(r,o,s);else if(r.tag===19)_0(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=s.child,m=null;o!==null;)r=o.alternate,r!==null&&Oc(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=s.child,s.child=null):(m=o.sibling,o.sibling=null),Vf(s,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&Oc(r)===null){s.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}Vf(s,!0,o,null,x,d);break;case"together":Vf(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function hi(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),Wi|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(da(r,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=li(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=li(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function Gf(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Ec(r)))}function Q2(r,s,o){switch(s.tag){case 3:ce(s,s.stateNode.containerInfo),Fi(s,Zt,r.memoizedState.cache),Ns();break;case 27:case 5:Fe(s);break;case 4:ce(s,s.stateNode.containerInfo);break;case 10:Fi(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,xf(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(Vi(s),s.flags|=128,null):(o&s.child.childLanes)!==0?y0(r,s,o):(Vi(s),r=hi(r,s,o),r!==null?r.sibling:null);Vi(s);break;case 19:var m=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(da(r,s,o,!1),d=(o&s.childLanes)!==0),m){if(d)return w0(r,s,o);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),A(Xt,Xt.current),d)break;return null;case 22:return s.lanes=0,p0(r,s,o,s.pendingProps);case 24:Fi(s,Zt,r.memoizedState.cache)}return hi(r,s,o)}function j0(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)en=!0;else{if(!Gf(r,o)&&(s.flags&128)===0)return en=!1,Q2(r,s,o);en=(r.flags&131072)!==0}else en=!1,lt&&(s.flags&1048576)!==0&&tx(s,El,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=As(s.elementType),s.type=r,typeof r=="function")Qd(r)?(d=Ds(r,d),s.tag=1,s=v0(null,s,r,d,o)):(s.tag=0,s=Pf(null,s,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===$){s.tag=11,s=d0(null,s,r,d,o);break e}else if(m===H){s.tag=14,s=f0(null,s,r,d,o);break e}}throw s=J(r)||r,Error(i(306,s,""))}}return s;case 0:return Pf(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,m=Ds(d,s.pendingProps),v0(r,s,d,m,o);case 3:e:{if(ce(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var x=s.memoizedState;m=x.element,ff(r,s),Ol(s,d,null,o);var w=s.memoizedState;if(d=w.cache,Fi(s,Zt,d),d!==x.cache&&af(s,[Zt],o,!0),zl(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){s=b0(r,s,d,o);break e}else if(d!==m){m=ur(Error(i(424)),s),Tl(m),s=b0(r,s,d,o);break e}else{switch(r=s.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Rt=mr(r.firstChild),gn=s,lt=!0,Pi=null,hr=!0,o=px(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Ns(),d===m){s=hi(r,s,o);break e}vn(r,s,d,o)}s=s.child}return s;case 26:return Xc(r,s),r===null?(o=Dv(s.type,null,s.pendingProps,null))?s.memoizedState=o:lt||(o=s.type,r=s.pendingProps,d=uu(ke.current).createElement(o),d[Gt]=s,d[fn]=r,bn(d,o,r),Ht(d),s.stateNode=d):s.memoizedState=Dv(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return Fe(s),r===null&&lt&&(d=s.stateNode=Mv(s.type,s.pendingProps,ke.current),gn=s,hr=!0,m=Rt,es(s.type)?(Sh=m,Rt=mr(d.firstChild)):Rt=m),vn(r,s,s.pendingProps.children,o),Xc(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&lt&&((m=d=Rt)&&(d=Nj(d,s.type,s.pendingProps,hr),d!==null?(s.stateNode=d,gn=s,Rt=mr(d.firstChild),hr=!1,m=!0):m=!1),m||$i(s)),Fe(s),m=s.type,x=s.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,yh(m,x)?d=null:w!==null&&yh(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=bf(r,s,F2,null,null,o),no._currentValue=m),Xc(r,s),vn(r,s,d,o),s.child;case 6:return r===null&&lt&&((r=o=Rt)&&(o=Cj(o,s.pendingProps,hr),o!==null?(s.stateNode=o,gn=s,Rt=null,r=!0):r=!1),r||$i(s)),null;case 13:return y0(r,s,o);case 4:return ce(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Rs(s,null,d,o):vn(r,s,d,o),s.child;case 11:return d0(r,s,s.type,s.pendingProps,o);case 7:return vn(r,s,s.pendingProps,o),s.child;case 8:return vn(r,s,s.pendingProps.children,o),s.child;case 12:return vn(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,Fi(s,s.type,d.value),vn(r,s,d.children,o),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Es(s),m=xn(m),d=d(m),s.flags|=1,vn(r,s,d,o),s.child;case 14:return f0(r,s,s.type,s.pendingProps,o);case 15:return h0(r,s,s.type,s.pendingProps,o);case 19:return w0(r,s,o);case 31:return W2(r,s,o);case 22:return p0(r,s,o,s.pendingProps);case 24:return Es(s),d=xn(Zt),r===null?(m=cf(),m===null&&(m=Ct,x=lf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),s.memoizedState={parent:d,cache:m},df(s),Fi(s,Zt,m)):((r.lanes&o)!==0&&(ff(r,s),Ol(s,null,null,o),zl()),m=r.memoizedState,x=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),Fi(s,Zt,d)):(d=x.cache,Fi(s,Zt,d),d!==m.cache&&af(s,[Zt],o,!0))),vn(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function pi(r){r.flags|=4}function Xf(r,s,o,d,m){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(Q0())r.flags|=8192;else throw Ms=Rc,uf}else r.flags&=-16777217}function k0(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!Pv(s))if(Q0())r.flags|=8192;else throw Ms=Rc,uf}function Wc(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?oc():536870912,r.lanes|=s,ja|=s)}function Hl(r,s){if(!lt)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Lt(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(s)for(var m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,s}function K2(r,s,o){var d=s.pendingProps;switch(ef(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(s),null;case 1:return Lt(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),ui(Zt),je(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(ua(s)?pi(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,nf())),Lt(s),null;case 26:var m=s.type,x=s.memoizedState;return r===null?(pi(s),x!==null?(Lt(s),k0(s,x)):(Lt(s),Xf(s,m,null,d,o))):x?x!==r.memoizedState?(pi(s),Lt(s),k0(s,x)):(Lt(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&pi(s),Lt(s),Xf(s,m,r,d,o)),null;case 27:if(At(s),o=ke.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&pi(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Lt(s),null}r=pe.current,ua(s)?rx(s):(r=Mv(m,d,o),s.stateNode=r,pi(s))}return Lt(s),null;case 5:if(At(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&pi(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Lt(s),null}if(x=pe.current,ua(s))rx(s);else{var w=uu(ke.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Gt]=s,x[fn]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=x;e:switch(bn(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&pi(s)}}return Lt(s),Xf(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&pi(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=ke.current,ua(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,m=gn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Gt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||yv(r.nodeValue,o)),r||$i(s,!0)}else r=uu(r).createTextNode(d),r[Gt]=s,s.stateNode=r}return Lt(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=ua(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Gt]=s}else Ns(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Lt(s),r=!1}else o=nf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(er(s),s):(er(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Lt(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=ua(s),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Gt]=s}else Ns(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Lt(s),m=!1}else m=nf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(er(s),s):(er(s),null)}return er(s),(s.flags&128)!==0?(s.lanes=o,s):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(s.child.flags|=8192),Wc(s,s.updateQueue),Lt(s),null);case 4:return je(),r===null&&mh(s.stateNode.containerInfo),Lt(s),null;case 10:return ui(s.type),Lt(s),null;case 19:if(Q(Xt),d=s.memoizedState,d===null)return Lt(s),null;if(m=(s.flags&128)!==0,x=d.rendering,x===null)if(m)Hl(d,!1);else{if(qt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=Oc(r),x!==null){for(s.flags|=128,Hl(d,!1),r=x.updateQueue,s.updateQueue=r,Wc(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Zg(o,r),o=o.sibling;return A(Xt,Xt.current&1|2),lt&&oi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&Be()>eu&&(s.flags|=128,m=!0,Hl(d,!1),s.lanes=4194304)}else{if(!m)if(r=Oc(x),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,Wc(s,r),Hl(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!lt)return Lt(s),null}else 2*Be()-d.renderingStartTime>eu&&o!==536870912&&(s.flags|=128,m=!0,Hl(d,!1),s.lanes=4194304);d.isBackwards?(x.sibling=s.child,s.child=x):(r=d.last,r!==null?r.sibling=x:s.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Be(),r.sibling=null,o=Xt.current,A(Xt,m?o&1|2:o&1),lt&&oi(s,d.treeForkCount),r):(Lt(s),null);case 22:case 23:return er(s),gf(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(Lt(s),s.subtreeFlags&6&&(s.flags|=8192)):Lt(s),o=s.updateQueue,o!==null&&Wc(s,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==o&&(s.flags|=2048),r!==null&&Q(Ts),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ui(Zt),Lt(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Z2(r,s){switch(ef(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ui(Zt),je(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return At(s),null;case 31:if(s.memoizedState!==null){if(er(s),s.alternate===null)throw Error(i(340));Ns()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(er(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ns()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Q(Xt),null;case 4:return je(),null;case 10:return ui(s.type),null;case 22:case 23:return er(s),gf(),r!==null&&Q(Ts),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return ui(Zt),null;case 25:return null;default:return null}}function S0(r,s){switch(ef(s),s.tag){case 3:ui(Zt),je();break;case 26:case 27:case 5:At(s);break;case 4:je();break;case 31:s.memoizedState!==null&&er(s);break;case 13:er(s);break;case 19:Q(Xt);break;case 10:ui(s.type);break;case 22:case 23:er(s),gf(),r!==null&&Q(Ts);break;case 24:ui(Zt)}}function Il(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(N){xt(s,s.return,N)}}function Xi(r,s,o){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,m=s;var F=o,te=N;try{te()}catch(le){xt(m,F,le)}}}d=d.next}while(d!==x)}}catch(le){xt(s,s.return,le)}}function N0(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{gx(s,o)}catch(d){xt(r,r.return,d)}}}function C0(r,s,o){o.props=Ds(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){xt(r,s,d)}}function ql(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){xt(r,s,m)}}function Yr(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){xt(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){xt(r,s,m)}else o.current=null}function E0(r){var s=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){xt(r,r.return,m)}}function Yf(r,s,o){try{var d=r.stateNode;yj(d,r.type,o,s),d[fn]=s}catch(m){xt(r,r.return,m)}}function T0(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&es(r.type)||r.tag===4}function Wf(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||T0(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&es(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Qf(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(r),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=$e));else if(d!==4&&(d===27&&es(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(Qf(r,s,o),r=r.sibling;r!==null;)Qf(r,s,o),r=r.sibling}function Qc(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(d!==4&&(d===27&&es(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(Qc(r,s,o),r=r.sibling;r!==null;)Qc(r,s,o),r=r.sibling}function A0(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);bn(s,d,o),s[Gt]=r,s[fn]=o}catch(x){xt(r,r.return,x)}}var mi=!1,tn=!1,Kf=!1,M0=typeof WeakSet=="function"?WeakSet:Set,hn=null;function J2(r,s){if(r=r.containerInfo,vh=xu,r=Ig(r),Id(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,N=-1,F=-1,te=0,le=0,de=r,ne=null;t:for(;;){for(var ie;de!==o||m!==0&&de.nodeType!==3||(N=w+m),de!==x||d!==0&&de.nodeType!==3||(F=w+d),de.nodeType===3&&(w+=de.nodeValue.length),(ie=de.firstChild)!==null;)ne=de,de=ie;for(;;){if(de===r)break t;if(ne===o&&++te===m&&(N=w),ne===x&&++le===d&&(F=w),(ie=de.nextSibling)!==null)break;de=ne,ne=de.parentNode}de=ie}o=N===-1||F===-1?null:{start:N,end:F}}else o=null}o=o||{start:0,end:0}}else o=null;for(bh={focusedElem:r,selectionRange:o},xu=!1,hn=s;hn!==null;)if(s=hn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,hn=r;else for(;hn!==null;){switch(s=hn,x=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=s,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Ae=Ds(o.type,m);r=d.getSnapshotBeforeUpdate(Ae,x),d.__reactInternalSnapshotBeforeUpdate=r}catch(Pe){xt(o,o.return,Pe)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)wh(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":wh(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,hn=r;break}hn=s.return}}function R0(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:xi(r,o),d&4&&Il(5,o);break;case 1:if(xi(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(w){xt(o,o.return,w)}else{var m=Ds(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){xt(o,o.return,w)}}d&64&&N0(o),d&512&&ql(o,o.return);break;case 3:if(xi(r,o),d&64&&(r=o.updateQueue,r!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{gx(r,s)}catch(w){xt(o,o.return,w)}}break;case 27:s===null&&d&4&&A0(o);case 26:case 5:xi(r,o),s===null&&d&4&&E0(o),d&512&&ql(o,o.return);break;case 12:xi(r,o);break;case 31:xi(r,o),d&4&&z0(r,o);break;case 13:xi(r,o),d&4&&O0(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=oj.bind(null,o),Ej(r,o))));break;case 22:if(d=o.memoizedState!==null||mi,!d){s=s!==null&&s.memoizedState!==null||tn,m=mi;var x=tn;mi=d,(tn=s)&&!x?vi(r,o,(o.subtreeFlags&8772)!==0):xi(r,o),mi=m,tn=x}break;case 30:break;default:xi(r,o)}}function L0(r){var s=r.alternate;s!==null&&(r.alternate=null,L0(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&hl(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ot=null,Pn=!1;function gi(r,s,o){for(o=o.child;o!==null;)D0(r,s,o),o=o.sibling}function D0(r,s,o){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(jt,o)}catch{}switch(o.tag){case 26:tn||Yr(o,s),gi(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:tn||Yr(o,s);var d=Ot,m=Pn;es(o.type)&&(Ot=o.stateNode,Pn=!1),gi(r,s,o),Jl(o.stateNode),Ot=d,Pn=m;break;case 5:tn||Yr(o,s);case 6:if(d=Ot,m=Pn,Ot=null,gi(r,s,o),Ot=d,Pn=m,Ot!==null)if(Pn)try{(Ot.nodeType===9?Ot.body:Ot.nodeName==="HTML"?Ot.ownerDocument.body:Ot).removeChild(o.stateNode)}catch(x){xt(o,s,x)}else try{Ot.removeChild(o.stateNode)}catch(x){xt(o,s,x)}break;case 18:Ot!==null&&(Pn?(r=Ot,Nv(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),Ma(r)):Nv(Ot,o.stateNode));break;case 4:d=Ot,m=Pn,Ot=o.stateNode.containerInfo,Pn=!0,gi(r,s,o),Ot=d,Pn=m;break;case 0:case 11:case 14:case 15:Xi(2,o,s),tn||Xi(4,o,s),gi(r,s,o);break;case 1:tn||(Yr(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&C0(o,s,d)),gi(r,s,o);break;case 21:gi(r,s,o);break;case 22:tn=(d=tn)||o.memoizedState!==null,gi(r,s,o),tn=d;break;default:gi(r,s,o)}}function z0(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Ma(r)}catch(o){xt(s,s.return,o)}}}function O0(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Ma(r)}catch(o){xt(s,s.return,o)}}function ej(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new M0),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new M0),s;default:throw Error(i(435,r.tag))}}function Kc(r,s){var o=ej(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var m=cj.bind(null,r,d);d.then(m,m)}})}function $n(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=s,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(es(N.type)){Ot=N.stateNode,Pn=!1;break e}break;case 5:Ot=N.stateNode,Pn=!1;break e;case 3:case 4:Ot=N.stateNode.containerInfo,Pn=!0;break e}N=N.return}if(Ot===null)throw Error(i(160));D0(x,w,m),Ot=null,Pn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)B0(s,r),s=s.sibling}var Dr=null;function B0(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:$n(s,r),Fn(r),d&4&&(Xi(3,r,r.return),Il(3,r),Xi(5,r,r.return));break;case 1:$n(s,r),Fn(r),d&512&&(tn||o===null||Yr(o,o.return)),d&64&&mi&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Dr;if($n(s,r),Fn(r),d&512&&(tn||o===null||Yr(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[bs]||x[Gt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),bn(x,d,o),x[Gt]=r,Ht(x),d=x;break e;case"link":var w=Bv("link","href",m).get(d+(o.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(N,1);break t}}x=m.createElement(d),bn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=Bv("meta","content",m).get(d+(o.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(N,1);break t}}x=m.createElement(d),bn(x,d,o),m.head.appendChild(x);break;default:throw Error(i(468,d))}x[Gt]=r,Ht(x),d=x}r.stateNode=d}else Uv(m,r.type,r.stateNode);else r.stateNode=Ov(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?Uv(m,r.type,r.stateNode):Ov(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Yf(r,r.memoizedProps,o.memoizedProps)}break;case 27:$n(s,r),Fn(r),d&512&&(tn||o===null||Yr(o,o.return)),o!==null&&d&4&&Yf(r,r.memoizedProps,o.memoizedProps);break;case 5:if($n(s,r),Fn(r),d&512&&(tn||o===null||Yr(o,o.return)),r.flags&32){m=r.stateNode;try{si(m,"")}catch(Ae){xt(r,r.return,Ae)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Yf(r,m,o!==null?o.memoizedProps:m)),d&1024&&(Kf=!0);break;case 6:if($n(s,r),Fn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ae){xt(r,r.return,Ae)}}break;case 3:if(hu=null,m=Dr,Dr=du(s.containerInfo),$n(s,r),Dr=m,Fn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{Ma(s.containerInfo)}catch(Ae){xt(r,r.return,Ae)}Kf&&(Kf=!1,U0(r));break;case 4:d=Dr,Dr=du(r.stateNode.containerInfo),$n(s,r),Fn(r),Dr=d;break;case 12:$n(s,r),Fn(r);break;case 31:$n(s,r),Fn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Kc(r,d)));break;case 13:$n(s,r),Fn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Jc=Be()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Kc(r,d)));break;case 22:m=r.memoizedState!==null;var F=o!==null&&o.memoizedState!==null,te=mi,le=tn;if(mi=te||m,tn=le||F,$n(s,r),tn=le,mi=te,Fn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(o===null||F||mi||tn||zs(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){F=o=s;try{if(x=F.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=F.stateNode;var de=F.memoizedProps.style,ne=de!=null&&de.hasOwnProperty("display")?de.display:null;N.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ae){xt(F,F.return,Ae)}}}else if(s.tag===6){if(o===null){F=s;try{F.stateNode.nodeValue=m?"":F.memoizedProps}catch(Ae){xt(F,F.return,Ae)}}}else if(s.tag===18){if(o===null){F=s;try{var ie=F.stateNode;m?Cv(ie,!0):Cv(F.stateNode,!1)}catch(Ae){xt(F,F.return,Ae)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,Kc(r,o))));break;case 19:$n(s,r),Fn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Kc(r,d)));break;case 30:break;case 21:break;default:$n(s,r),Fn(r)}}function Fn(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(T0(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var m=o.stateNode,x=Wf(r);Qc(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(si(w,""),o.flags&=-33);var N=Wf(r);Qc(r,N,w);break;case 3:case 4:var F=o.stateNode.containerInfo,te=Wf(r);Qf(r,te,F);break;default:throw Error(i(161))}}catch(le){xt(r,r.return,le)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function U0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;U0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function xi(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)R0(r,s.alternate,s),s=s.sibling}function zs(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:Xi(4,s,s.return),zs(s);break;case 1:Yr(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&C0(s,s.return,o),zs(s);break;case 27:Jl(s.stateNode);case 26:case 5:Yr(s,s.return),zs(s);break;case 22:s.memoizedState===null&&zs(s);break;case 30:zs(s);break;default:zs(s)}r=r.sibling}}function vi(r,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,x=s,w=x.flags;switch(x.tag){case 0:case 11:case 15:vi(m,x,o),Il(4,x);break;case 1:if(vi(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){xt(d,d.return,te)}if(d=x,m=d.updateQueue,m!==null){var N=d.stateNode;try{var F=m.shared.hiddenCallbacks;if(F!==null)for(m.shared.hiddenCallbacks=null,m=0;m<F.length;m++)mx(F[m],N)}catch(te){xt(d,d.return,te)}}o&&w&64&&N0(x),ql(x,x.return);break;case 27:A0(x);case 26:case 5:vi(m,x,o),o&&d===null&&w&4&&E0(x),ql(x,x.return);break;case 12:vi(m,x,o);break;case 31:vi(m,x,o),o&&w&4&&z0(m,x);break;case 13:vi(m,x,o),o&&w&4&&O0(m,x);break;case 22:x.memoizedState===null&&vi(m,x,o),ql(x,x.return);break;case 30:break;default:vi(m,x,o)}s=s.sibling}}function Zf(r,s){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&Al(o))}function Jf(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Al(r))}function zr(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)P0(r,s,o,d),s=s.sibling}function P0(r,s,o,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:zr(r,s,o,d),m&2048&&Il(9,s);break;case 1:zr(r,s,o,d);break;case 3:zr(r,s,o,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Al(r)));break;case 12:if(m&2048){zr(r,s,o,d),r=s.stateNode;try{var x=s.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(F){xt(s,s.return,F)}}else zr(r,s,o,d);break;case 31:zr(r,s,o,d);break;case 13:zr(r,s,o,d);break;case 23:break;case 22:x=s.stateNode,w=s.alternate,s.memoizedState!==null?x._visibility&2?zr(r,s,o,d):Vl(r,s):x._visibility&2?zr(r,s,o,d):(x._visibility|=2,ya(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&Zf(w,s);break;case 24:zr(r,s,o,d),m&2048&&Jf(s.alternate,s);break;default:zr(r,s,o,d)}}function ya(r,s,o,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var x=r,w=s,N=o,F=d,te=w.flags;switch(w.tag){case 0:case 11:case 15:ya(x,w,N,F,m),Il(8,w);break;case 23:break;case 22:var le=w.stateNode;w.memoizedState!==null?le._visibility&2?ya(x,w,N,F,m):Vl(x,w):(le._visibility|=2,ya(x,w,N,F,m)),m&&te&2048&&Zf(w.alternate,w);break;case 24:ya(x,w,N,F,m),m&&te&2048&&Jf(w.alternate,w);break;default:ya(x,w,N,F,m)}s=s.sibling}}function Vl(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=r,d=s,m=d.flags;switch(d.tag){case 22:Vl(o,d),m&2048&&Zf(d.alternate,d);break;case 24:Vl(o,d),m&2048&&Jf(d.alternate,d);break;default:Vl(o,d)}s=s.sibling}}var Gl=8192;function _a(r,s,o){if(r.subtreeFlags&Gl)for(r=r.child;r!==null;)$0(r,s,o),r=r.sibling}function $0(r,s,o){switch(r.tag){case 26:_a(r,s,o),r.flags&Gl&&r.memoizedState!==null&&$j(o,Dr,r.memoizedState,r.memoizedProps);break;case 5:_a(r,s,o);break;case 3:case 4:var d=Dr;Dr=du(r.stateNode.containerInfo),_a(r,s,o),Dr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=Gl,Gl=16777216,_a(r,s,o),Gl=d):_a(r,s,o));break;default:_a(r,s,o)}}function F0(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function Xl(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];hn=d,I0(d,r)}F0(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)H0(r),r=r.sibling}function H0(r){switch(r.tag){case 0:case 11:case 15:Xl(r),r.flags&2048&&Xi(9,r,r.return);break;case 3:Xl(r);break;case 12:Xl(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,Zc(r)):Xl(r);break;default:Xl(r)}}function Zc(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];hn=d,I0(d,r)}F0(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:Xi(8,s,s.return),Zc(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,Zc(s));break;default:Zc(s)}r=r.sibling}}function I0(r,s){for(;hn!==null;){var o=hn;switch(o.tag){case 0:case 11:case 15:Xi(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Al(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,hn=d;else e:for(o=r;hn!==null;){d=hn;var m=d.sibling,x=d.return;if(L0(d),d===o){hn=null;break e}if(m!==null){m.return=x,hn=m;break e}hn=x}}}var tj={getCacheForType:function(r){var s=xn(Zt),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return xn(Zt).controller.signal}},nj=typeof WeakMap=="function"?WeakMap:Map,ht=0,Ct=null,Je=null,it=0,gt=0,tr=null,Yi=!1,wa=!1,eh=!1,bi=0,qt=0,Wi=0,Os=0,th=0,nr=0,ja=0,Yl=null,Hn=null,nh=!1,Jc=0,q0=0,eu=1/0,tu=null,Qi=null,on=0,Ki=null,ka=null,yi=0,rh=0,ih=null,V0=null,Wl=0,sh=null;function rr(){return(ht&2)!==0&&it!==0?it&-it:B.T!==null?dh():Qs()}function G0(){if(nr===0)if((it&536870912)===0||lt){var r=Vt;Vt<<=1,(Vt&3932160)===0&&(Vt=262144),nr=r}else nr=536870912;return r=Jn.current,r!==null&&(r.flags|=32),nr}function In(r,s,o){(r===Ct&&(gt===2||gt===9)||r.cancelPendingCommit!==null)&&(Sa(r,0),Zi(r,it,nr,!1)),kr(r,o),((ht&2)===0||r!==Ct)&&(r===Ct&&((ht&2)===0&&(Os|=o),qt===4&&Zi(r,it,nr,!1)),Wr(r))}function X0(r,s,o){if((ht&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||Hr(r,s),m=d?sj(r,s):lh(r,s,!0),x=d;do{if(m===0){wa&&!d&&Zi(r,s,0,!1);break}else{if(o=r.current.alternate,x&&!rj(o)){m=lh(r,s,!1),x=!1;continue}if(m===2){if(x=s,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var N=r;m=Yl;var F=N.current.memoizedState.isDehydrated;if(F&&(Sa(N,w).flags|=256),w=lh(N,w,!1),w!==2){if(eh&&!F){N.errorRecoveryDisabledLanes|=x,Os|=x,m=4;break e}x=Hn,Hn=m,x!==null&&(Hn===null?Hn=x:Hn.push.apply(Hn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){Sa(r,0),Zi(r,s,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:Zi(d,s,nr,!Yi);break e;case 2:Hn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=Jc+300-Be(),10<m)){if(Zi(d,s,nr,!Yi),Qt(d,0,!0)!==0)break e;yi=s,d.timeoutHandle=kv(Y0.bind(null,d,o,Hn,tu,nh,s,nr,Os,ja,Yi,x,"Throttled",-0,0),m);break e}Y0(d,o,Hn,tu,nh,s,nr,Os,ja,Yi,x,null,-0,0)}}break}while(!0);Wr(r)}function Y0(r,s,o,d,m,x,w,N,F,te,le,de,ne,ie){if(r.timeoutHandle=-1,de=s.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$e},$0(s,x,de);var Ae=(x&62914560)===x?Jc-Be():(x&4194048)===x?q0-Be():0;if(Ae=Fj(de,Ae),Ae!==null){yi=x,r.cancelPendingCommit=Ae(nv.bind(null,r,s,x,o,d,m,w,N,F,le,de,null,ne,ie)),Zi(r,x,w,!te);return}}nv(r,s,x,o,d,m,w,N,F)}function rj(r){for(var s=r;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!Kn(x(),m))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Zi(r,s,o,d){s&=~th,s&=~Os,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var x=31-K(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&gs(r,o,s)}function nu(){return(ht&6)===0?(Ql(0),!1):!0}function ah(){if(Je!==null){if(gt===0)var r=Je.return;else r=Je,ci=Cs=null,wf(r),ma=null,Rl=0,r=Je;for(;r!==null;)S0(r.alternate,r),r=r.return;Je=null}}function Sa(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,jj(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),yi=0,ah(),Ct=r,Je=o=li(r.current,null),it=s,gt=0,tr=null,Yi=!1,wa=Hr(r,s),eh=!1,ja=nr=th=Os=Wi=qt=0,Hn=Yl=null,nh=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var m=31-K(d),x=1<<m;s|=r[m],d&=~x}return bi=s,jc(),o}function W0(r,s){Xe=null,B.H=$l,s===pa||s===Mc?(s=dx(),gt=3):s===uf?(s=dx(),gt=4):gt=s===Uf?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,tr=s,Je===null&&(qt=1,Vc(r,ur(s,r.current)))}function Q0(){var r=Jn.current;return r===null?!0:(it&4194048)===it?pr===null:(it&62914560)===it||(it&536870912)!==0?r===pr:!1}function K0(){var r=B.H;return B.H=$l,r===null?$l:r}function Z0(){var r=B.A;return B.A=tj,r}function ru(){qt=4,Yi||(it&4194048)!==it&&Jn.current!==null||(wa=!0),(Wi&134217727)===0&&(Os&134217727)===0||Ct===null||Zi(Ct,it,nr,!1)}function lh(r,s,o){var d=ht;ht|=2;var m=K0(),x=Z0();(Ct!==r||it!==s)&&(tu=null,Sa(r,s)),s=!1;var w=qt;e:do try{if(gt!==0&&Je!==null){var N=Je,F=tr;switch(gt){case 8:ah(),w=6;break e;case 3:case 2:case 9:case 6:Jn.current===null&&(s=!0);var te=gt;if(gt=0,tr=null,Na(r,N,F,te),o&&wa){w=0;break e}break;default:te=gt,gt=0,tr=null,Na(r,N,F,te)}}ij(),w=qt;break}catch(le){W0(r,le)}while(!0);return s&&r.shellSuspendCounter++,ci=Cs=null,ht=d,B.H=m,B.A=x,Je===null&&(Ct=null,it=0,jc()),w}function ij(){for(;Je!==null;)J0(Je)}function sj(r,s){var o=ht;ht|=2;var d=K0(),m=Z0();Ct!==r||it!==s?(tu=null,eu=Be()+500,Sa(r,s)):wa=Hr(r,s);e:do try{if(gt!==0&&Je!==null){s=Je;var x=tr;t:switch(gt){case 1:gt=0,tr=null,Na(r,s,x,1);break;case 2:case 9:if(cx(x)){gt=0,tr=null,ev(s);break}s=function(){gt!==2&&gt!==9||Ct!==r||(gt=7),Wr(r)},x.then(s,s);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:cx(x)?(gt=0,tr=null,ev(s)):(gt=0,tr=null,Na(r,s,x,7));break;case 5:var w=null;switch(Je.tag){case 26:w=Je.memoizedState;case 5:case 27:var N=Je;if(w?Pv(w):N.stateNode.complete){gt=0,tr=null;var F=N.sibling;if(F!==null)Je=F;else{var te=N.return;te!==null?(Je=te,iu(te)):Je=null}break t}}gt=0,tr=null,Na(r,s,x,5);break;case 6:gt=0,tr=null,Na(r,s,x,6);break;case 8:ah(),qt=6;break e;default:throw Error(i(462))}}aj();break}catch(le){W0(r,le)}while(!0);return ci=Cs=null,B.H=d,B.A=m,ht=o,Je!==null?0:(Ct=null,it=0,jc(),qt)}function aj(){for(;Je!==null&&!Se();)J0(Je)}function J0(r){var s=j0(r.alternate,r,bi);r.memoizedProps=r.pendingProps,s===null?iu(r):Je=s}function ev(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=x0(o,s,s.pendingProps,s.type,void 0,it);break;case 11:s=x0(o,s,s.pendingProps,s.type.render,s.ref,it);break;case 5:wf(s);default:S0(o,s),s=Je=Zg(s,bi),s=j0(o,s,bi)}r.memoizedProps=r.pendingProps,s===null?iu(r):Je=s}function Na(r,s,o,d){ci=Cs=null,wf(s),ma=null,Rl=0;var m=s.return;try{if(Y2(r,m,s,o,it)){qt=1,Vc(r,ur(o,r.current)),Je=null;return}}catch(x){if(m!==null)throw Je=m,x;qt=1,Vc(r,ur(o,r.current)),Je=null;return}s.flags&32768?(lt||d===1?r=!0:wa||(it&536870912)!==0?r=!1:(Yi=r=!0,(d===2||d===9||d===3||d===6)&&(d=Jn.current,d!==null&&d.tag===13&&(d.flags|=16384))),tv(s,r)):iu(s)}function iu(r){var s=r;do{if((s.flags&32768)!==0){tv(s,Yi);return}r=s.return;var o=K2(s.alternate,s,bi);if(o!==null){Je=o;return}if(s=s.sibling,s!==null){Je=s;return}Je=s=r}while(s!==null);qt===0&&(qt=5)}function tv(r,s){do{var o=Z2(r.alternate,r);if(o!==null){o.flags&=32767,Je=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){Je=r;return}Je=r=o}while(r!==null);qt=6,Je=null}function nv(r,s,o,d,m,x,w,N,F){r.cancelPendingCommit=null;do su();while(on!==0);if((ht&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(x=s.lanes|s.childLanes,x|=Yd,Ws(r,o,x,w,N,F),r===Ct&&(Je=Ct=null,it=0),ka=s,Ki=r,yi=o,rh=x,ih=m,V0=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,uj(De,function(){return lv(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=B.T,B.T=null,m=U.p,U.p=2,w=ht,ht|=4;try{J2(r,s,o)}finally{ht=w,U.p=m,B.T=d}}on=1,rv(),iv(),sv()}}function rv(){if(on===1){on=0;var r=Ki,s=ka,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=B.T,B.T=null;var d=U.p;U.p=2;var m=ht;ht|=4;try{B0(s,r);var x=bh,w=Ig(r.containerInfo),N=x.focusedElem,F=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&Hg(N.ownerDocument.documentElement,N)){if(F!==null&&Id(N)){var te=F.start,le=F.end;if(le===void 0&&(le=te),"selectionStart"in N)N.selectionStart=te,N.selectionEnd=Math.min(le,N.value.length);else{var de=N.ownerDocument||document,ne=de&&de.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),Ae=N.textContent.length,Pe=Math.min(F.start,Ae),wt=F.end===void 0?Pe:Math.min(F.end,Ae);!ie.extend&&Pe>wt&&(w=wt,wt=Pe,Pe=w);var W=Fg(N,Pe),q=Fg(N,wt);if(W&&q&&(ie.rangeCount!==1||ie.anchorNode!==W.node||ie.anchorOffset!==W.offset||ie.focusNode!==q.node||ie.focusOffset!==q.offset)){var ee=de.createRange();ee.setStart(W.node,W.offset),ie.removeAllRanges(),Pe>wt?(ie.addRange(ee),ie.extend(q.node,q.offset)):(ee.setEnd(q.node,q.offset),ie.addRange(ee))}}}}for(de=[],ie=N;ie=ie.parentNode;)ie.nodeType===1&&de.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<de.length;N++){var ue=de[N];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}xu=!!vh,bh=vh=null}finally{ht=m,U.p=d,B.T=o}}r.current=s,on=2}}function iv(){if(on===2){on=0;var r=Ki,s=ka,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=B.T,B.T=null;var d=U.p;U.p=2;var m=ht;ht|=4;try{R0(r,s.alternate,s)}finally{ht=m,U.p=d,B.T=o}}on=3}}function sv(){if(on===4||on===3){on=0,Ze();var r=Ki,s=ka,o=yi,d=V0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?on=5:(on=0,ka=Ki=null,av(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(Qi=null),dl(o),s=s.stateNode,kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(jt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=B.T,m=U.p,U.p=2,B.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var N=d[w];x(N.value,{componentStack:N.stack})}}finally{B.T=s,U.p=m}}(yi&3)!==0&&su(),Wr(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===sh?Wl++:(Wl=0,sh=r):Wl=0,Ql(0)}}function av(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,Al(s)))}function su(){return rv(),iv(),sv(),lv()}function lv(){if(on!==5)return!1;var r=Ki,s=rh;rh=0;var o=dl(yi),d=B.T,m=U.p;try{U.p=32>o?32:o,B.T=null,o=ih,ih=null;var x=Ki,w=yi;if(on=0,ka=Ki=null,yi=0,(ht&6)!==0)throw Error(i(331));var N=ht;if(ht|=4,H0(x.current),P0(x,x.current,w,o),ht=N,Ql(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(jt,x)}catch{}return!0}finally{U.p=m,B.T=d,av(r,s)}}function ov(r,s,o){s=ur(o,s),s=Bf(r.stateNode,s,2),r=qi(r,s,2),r!==null&&(kr(r,2),Wr(r))}function xt(r,s,o){if(r.tag===3)ov(r,r,o);else for(;s!==null;){if(s.tag===3){ov(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Qi===null||!Qi.has(d))){r=ur(o,r),o=c0(2),d=qi(s,o,2),d!==null&&(u0(o,d,s,r),kr(d,2),Wr(d));break}}s=s.return}}function oh(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new nj;var m=new Set;d.set(s,m)}else m=d.get(s),m===void 0&&(m=new Set,d.set(s,m));m.has(o)||(eh=!0,m.add(o),r=lj.bind(null,r,s,o),s.then(r,r))}function lj(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Ct===r&&(it&o)===o&&(qt===4||qt===3&&(it&62914560)===it&&300>Be()-Jc?(ht&2)===0&&Sa(r,0):th|=o,ja===it&&(ja=0)),Wr(r)}function cv(r,s){s===0&&(s=oc()),r=ks(r,s),r!==null&&(kr(r,s),Wr(r))}function oj(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),cv(r,o)}function cj(r,s){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),cv(r,o)}function uj(r,s){return Ce(r,s)}var au=null,Ca=null,ch=!1,lu=!1,uh=!1,Ji=0;function Wr(r){r!==Ca&&r.next===null&&(Ca===null?au=Ca=r:Ca=Ca.next=r),lu=!0,ch||(ch=!0,fj())}function Ql(r,s){if(!uh&&lu){uh=!0;do for(var o=!1,d=au;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,N=d.pingedLanes;x=(1<<31-K(42|r)+1)-1,x&=m&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,hv(d,x))}else x=it,x=Qt(d,d===Ct?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||Hr(d,x)||(o=!0,hv(d,x));d=d.next}while(o);uh=!1}}function dj(){uv()}function uv(){lu=ch=!1;var r=0;Ji!==0&&wj()&&(r=Ji);for(var s=Be(),o=null,d=au;d!==null;){var m=d.next,x=dv(d,s);x===0?(d.next=null,o===null?au=m:o.next=m,m===null&&(Ca=o)):(o=d,(r!==0||(x&3)!==0)&&(lu=!0)),d=m}on!==0&&on!==5||Ql(r),Ji!==0&&(Ji=0)}function dv(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-K(x),N=1<<w,F=m[w];F===-1?((N&o)===0||(N&d)!==0)&&(m[w]=Li(N,s)):F<=s&&(r.expiredLanes|=N),x&=~N}if(s=Ct,o=it,o=Qt(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(gt===2||gt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&fe(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||Hr(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&fe(d),dl(o)){case 2:case 8:o=ve;break;case 32:o=De;break;case 268435456:o=Qe;break;default:o=De}return d=fv.bind(null,r),o=Ce(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&fe(d),r.callbackPriority=2,r.callbackNode=null,2}function fv(r,s){if(on!==0&&on!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(su()&&r.callbackNode!==o)return null;var d=it;return d=Qt(r,r===Ct?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(X0(r,d,s),dv(r,Be()),r.callbackNode!=null&&r.callbackNode===o?fv.bind(null,r):null)}function hv(r,s){if(su())return null;X0(r,s,!0)}function fj(){kj(function(){(ht&6)!==0?Ce(ae,dj):uv()})}function dh(){if(Ji===0){var r=fa;r===0&&(r=mt,mt<<=1,(mt&261888)===0&&(mt=256)),Ji=r}return Ji}function pv(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Nt(""+r)}function mv(r,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,r.id&&o.setAttribute("form",r.id),s.parentNode.insertBefore(o,s),r=new FormData(r),o.parentNode.removeChild(o),r}function hj(r,s,o,d,m){if(s==="submit"&&o&&o.stateNode===m){var x=pv((m[fn]||null).action),w=d.submitter;w&&(s=(s=w[fn]||null)?pv(s.formAction):w.getAttribute("formAction"),s!==null&&(x=s,w=null));var N=new bc("action","action",null,d,m);r.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ji!==0){var F=w?mv(m,w):new FormData(m);Mf(o,{pending:!0,data:F,method:m.method,action:x},null,F)}}else typeof x=="function"&&(N.preventDefault(),F=w?mv(m,w):new FormData(m),Mf(o,{pending:!0,data:F,method:m.method,action:x},x,F))},currentTarget:m}]})}}for(var fh=0;fh<Xd.length;fh++){var hh=Xd[fh],pj=hh.toLowerCase(),mj=hh[0].toUpperCase()+hh.slice(1);Lr(pj,"on"+mj)}Lr(Gg,"onAnimationEnd"),Lr(Xg,"onAnimationIteration"),Lr(Yg,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(M2,"onTransitionRun"),Lr(R2,"onTransitionStart"),Lr(L2,"onTransitionCancel"),Lr(Wg,"onTransitionEnd"),Oi("onMouseEnter",["mouseout","mouseover"]),Oi("onMouseLeave",["mouseout","mouseover"]),Oi("onPointerEnter",["pointerout","pointerover"]),Oi("onPointerLeave",["pointerout","pointerover"]),Cr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Cr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Cr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Cr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Cr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Cr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kl="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(" "),gj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kl));function gv(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(s)for(var w=d.length-1;0<=w;w--){var N=d[w],F=N.instance,te=N.currentTarget;if(N=N.listener,F!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=te;try{x(m)}catch(le){wc(le)}m.currentTarget=null,x=F}else for(w=0;w<d.length;w++){if(N=d[w],F=N.instance,te=N.currentTarget,N=N.listener,F!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=te;try{x(m)}catch(le){wc(le)}m.currentTarget=null,x=F}}}}function et(r,s){var o=s[Ks];o===void 0&&(o=s[Ks]=new Set);var d=r+"__bubble";o.has(d)||(xv(s,r,2,!1),o.add(d))}function ph(r,s,o){var d=0;s&&(d|=4),xv(o,r,d,s)}var ou="_reactListening"+Math.random().toString(36).slice(2);function mh(r){if(!r[ou]){r[ou]=!0,Qn.forEach(function(o){o!=="selectionchange"&&(gj.has(o)||ph(o,!1,r),ph(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[ou]||(s[ou]=!0,ph("selectionchange",!1,s))}}function xv(r,s,o,d){switch(Gv(s)){case 2:var m=qj;break;case 8:m=Vj;break;default:m=Ah}o=m.bind(null,s,o,r),m=void 0,!na||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,o,{capture:!0,passive:m}):r.addEventListener(s,o,!0):m!==void 0?r.addEventListener(s,o,{passive:m}):r.addEventListener(s,o,!1)}function gh(r,s,o,d,m){var x=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var N=d.stateNode.containerInfo;if(N===m)break;if(w===4)for(w=d.return;w!==null;){var F=w.tag;if((F===3||F===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;N!==null;){if(w=Di(N),w===null)return;if(F=w.tag,F===5||F===6||F===26||F===27){d=x=w;continue e}N=N.parentNode}}d=d.return}mc(function(){var te=x,le=Vr(o),de=[];e:{var ne=Qg.get(r);if(ne!==void 0){var ie=bc,Ae=r;switch(r){case"keypress":if(xc(o)===0)break e;case"keydown":case"keyup":ie=c2;break;case"focusin":Ae="focus",ie=Ud;break;case"focusout":Ae="blur",ie=Ud;break;case"beforeblur":case"afterblur":ie=Ud;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Sg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=Kw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=f2;break;case Gg:case Xg:case Yg:ie=e2;break;case Wg:ie=p2;break;case"scroll":case"scrollend":ie=Ww;break;case"wheel":ie=g2;break;case"copy":case"cut":case"paste":ie=n2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Cg;break;case"toggle":case"beforetoggle":ie=v2}var Pe=(s&4)!==0,wt=!Pe&&(r==="scroll"||r==="scrollend"),W=Pe?ne!==null?ne+"Capture":null:ne;Pe=[];for(var q=te,ee;q!==null;){var ue=q;if(ee=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||ee===null||W===null||(ue=ys(q,W),ue!=null&&Pe.push(Zl(q,ue,ee))),wt)break;q=q.return}0<Pe.length&&(ne=new ie(ne,Ae,null,o,le),de.push({event:ne,listeners:Pe}))}}if((s&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",ie=r==="mouseout"||r==="pointerout",ne&&o!==Bn&&(Ae=o.relatedTarget||o.fromElement)&&(Di(Ae)||Ae[Ir]))break e;if((ie||ne)&&(ne=le.window===le?le:(ne=le.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(Ae=o.relatedTarget||o.toElement,ie=te,Ae=Ae?Di(Ae):null,Ae!==null&&(wt=c(Ae),Pe=Ae.tag,Ae!==wt||Pe!==5&&Pe!==27&&Pe!==6)&&(Ae=null)):(ie=null,Ae=te),ie!==Ae)){if(Pe=Sg,ue="onMouseLeave",W="onMouseEnter",q="mouse",(r==="pointerout"||r==="pointerover")&&(Pe=Cg,ue="onPointerLeave",W="onPointerEnter",q="pointer"),wt=ie==null?ne:zi(ie),ee=Ae==null?ne:zi(Ae),ne=new Pe(ue,q+"leave",ie,o,le),ne.target=wt,ne.relatedTarget=ee,ue=null,Di(le)===te&&(Pe=new Pe(W,q+"enter",Ae,o,le),Pe.target=ee,Pe.relatedTarget=wt,ue=Pe),wt=ue,ie&&Ae)t:{for(Pe=xj,W=ie,q=Ae,ee=0,ue=W;ue;ue=Pe(ue))ee++;ue=0;for(var Oe=q;Oe;Oe=Pe(Oe))ue++;for(;0<ee-ue;)W=Pe(W),ee--;for(;0<ue-ee;)q=Pe(q),ue--;for(;ee--;){if(W===q||q!==null&&W===q.alternate){Pe=W;break t}W=Pe(W),q=Pe(q)}Pe=null}else Pe=null;ie!==null&&vv(de,ne,ie,Pe,!1),Ae!==null&&wt!==null&&vv(de,wt,Ae,Pe,!0)}}e:{if(ne=te?zi(te):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var dt=zg;else if(Lg(ne))if(Og)dt=E2;else{dt=N2;var Me=S2}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&xe(te.elementType)&&(dt=zg):dt=C2;if(dt&&(dt=dt(r,te))){Dg(de,dt,o,le);break e}Me&&Me(r,ne,te),r==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&vl(ne,"number",ne.value)}switch(Me=te?zi(te):window,r){case"focusin":(Lg(Me)||Me.contentEditable==="true")&&(ia=Me,qd=te,Cl=null);break;case"focusout":Cl=qd=ia=null;break;case"mousedown":Vd=!0;break;case"contextmenu":case"mouseup":case"dragend":Vd=!1,qg(de,o,le);break;case"selectionchange":if(A2)break;case"keydown":case"keyup":qg(de,o,le)}var Ye;if($d)e:{switch(r){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else ra?Mg(r,o)&&(st="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(st="onCompositionStart");st&&(Eg&&o.locale!=="ko"&&(ra||st!=="onCompositionStart"?st==="onCompositionEnd"&&ra&&(Ye=jg()):(Rr=le,ai="value"in Rr?Rr.value:Rr.textContent,ra=!0)),Me=cu(te,st),0<Me.length&&(st=new Ng(st,r,null,o,le),de.push({event:st,listeners:Me}),Ye?st.data=Ye:(Ye=Rg(o),Ye!==null&&(st.data=Ye)))),(Ye=y2?_2(r,o):w2(r,o))&&(st=cu(te,"onBeforeInput"),0<st.length&&(Me=new Ng("onBeforeInput","beforeinput",null,o,le),de.push({event:Me,listeners:st}),Me.data=Ye)),hj(de,r,te,o,le)}gv(de,s)})}function Zl(r,s,o){return{instance:r,listener:s,currentTarget:o}}function cu(r,s){for(var o=s+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=ys(r,o),m!=null&&d.unshift(Zl(r,m,x)),m=ys(r,s),m!=null&&d.push(Zl(r,m,x))),r.tag===3)return d;r=r.return}return[]}function xj(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function vv(r,s,o,d,m){for(var x=s._reactName,w=[];o!==null&&o!==d;){var N=o,F=N.alternate,te=N.stateNode;if(N=N.tag,F!==null&&F===d)break;N!==5&&N!==26&&N!==27||te===null||(F=te,m?(te=ys(o,x),te!=null&&w.unshift(Zl(o,te,F))):m||(te=ys(o,x),te!=null&&w.push(Zl(o,te,F)))),o=o.return}w.length!==0&&r.push({event:s,listeners:w})}var vj=/\r\n?/g,bj=/\u0000|\uFFFD/g;function bv(r){return(typeof r=="string"?r:""+r).replace(vj,`
49
+ `).replace(bj,"")}function yv(r,s){return s=bv(s),bv(r)===s}function _t(r,s,o,d,m,x){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||si(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&si(r,""+d);break;case"className":ea(r,"class",d);break;case"tabIndex":ea(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ea(r,o,d);break;case"style":V(r,d,x);break;case"data":if(s!=="object"){ea(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Nt(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"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 x=="function"&&(o==="formAction"?(s!=="input"&&_t(r,s,"name",m.name,m,null),_t(r,s,"formEncType",m.formEncType,m,null),_t(r,s,"formMethod",m.formMethod,m,null),_t(r,s,"formTarget",m.formTarget,m,null)):(_t(r,s,"encType",m.encType,m,null),_t(r,s,"method",m.method,m,null),_t(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Nt(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=$e);break;case"onScroll":d!=null&&et("scroll",r);break;case"onScrollEnd":d!=null&&et("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=Nt(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);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":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":et("beforetoggle",r),et("toggle",r),Js(r,"popover",d);break;case"xlinkActuate":Er(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Er(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Er(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Er(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Er(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Er(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Er(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Er(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Er(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Js(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=rt.get(o)||o,Js(r,o,d))}}function xh(r,s,o,d,m,x){switch(o){case"style":V(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"children":typeof d=="string"?si(r,d):(typeof d=="number"||typeof d=="bigint")&&si(r,""+d);break;case"onScroll":d!=null&&et("scroll",r);break;case"onScrollEnd":d!=null&&et("scrollend",r);break;case"onClick":d!=null&&(r.onclick=$e);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Nr.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),s=o.slice(2,m?o.length-7:void 0),x=r[fn]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(s,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(s,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):Js(r,o,d)}}}function bn(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",r),et("load",r);var d=!1,m=!1,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:_t(r,s,x,w,o,null)}}m&&_t(r,s,"srcSet",o.srcSet,o,null),d&&_t(r,s,"src",o.src,o,null);return;case"input":et("invalid",r);var N=x=w=m=null,F=null,te=null;for(d in o)if(o.hasOwnProperty(d)){var le=o[d];if(le!=null)switch(d){case"name":m=le;break;case"type":w=le;break;case"checked":F=le;break;case"defaultChecked":te=le;break;case"value":x=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,s));break;default:_t(r,s,d,le,o,null)}}fc(r,x,N,F,te,w,m,!1);return;case"select":et("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":d=N;default:_t(r,s,m,N,o,null)}s=x,o=w,r.multiple=!!d,s!=null?Bi(r,!!d,s,!1):o!=null&&Bi(r,!!d,o,!0);return;case"textarea":et("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(N=o[w],N!=null))switch(w){case"value":d=N;break;case"defaultValue":m=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:_t(r,s,w,N,o,null)}bl(r,d,m,x);return;case"option":for(F in o)if(o.hasOwnProperty(F)&&(d=o[F],d!=null))switch(F){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:_t(r,s,F,d,o,null)}return;case"dialog":et("beforetoggle",r),et("toggle",r),et("cancel",r),et("close",r);break;case"iframe":case"object":et("load",r);break;case"video":case"audio":for(d=0;d<Kl.length;d++)et(Kl[d],r);break;case"image":et("error",r),et("load",r);break;case"details":et("toggle",r);break;case"embed":case"source":case"link":et("error",r),et("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in o)if(o.hasOwnProperty(te)&&(d=o[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:_t(r,s,te,d,o,null)}return;default:if(xe(s)){for(le in o)o.hasOwnProperty(le)&&(d=o[le],d!==void 0&&xh(r,s,le,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&_t(r,s,N,d,o,null))}function yj(r,s,o,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,N=null,F=null,te=null,le=null;for(ie in o){var de=o[ie];if(o.hasOwnProperty(ie)&&de!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":F=de;default:d.hasOwnProperty(ie)||_t(r,s,ie,null,d,de)}}for(var ne in d){var ie=d[ne];if(de=o[ne],d.hasOwnProperty(ne)&&(ie!=null||de!=null))switch(ne){case"type":x=ie;break;case"name":m=ie;break;case"checked":te=ie;break;case"defaultChecked":le=ie;break;case"value":w=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,s));break;default:ie!==de&&_t(r,s,ne,ie,d,de)}}xl(r,w,N,F,te,le,x,m);return;case"select":ie=w=N=ne=null;for(x in o)if(F=o[x],o.hasOwnProperty(x)&&F!=null)switch(x){case"value":break;case"multiple":ie=F;default:d.hasOwnProperty(x)||_t(r,s,x,null,d,F)}for(m in d)if(x=d[m],F=o[m],d.hasOwnProperty(m)&&(x!=null||F!=null))switch(m){case"value":ne=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==F&&_t(r,s,m,x,d,F)}s=N,o=w,d=ie,ne!=null?Bi(r,!!o,ne,!1):!!d!=!!o&&(s!=null?Bi(r,!!o,s,!0):Bi(r,!!o,o?[]:"",!1));return;case"textarea":ie=ne=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:_t(r,s,N,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":ne=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&_t(r,s,w,m,d,x)}hc(r,ne,ie);return;case"option":for(var Ae in o)if(ne=o[Ae],o.hasOwnProperty(Ae)&&ne!=null&&!d.hasOwnProperty(Ae))switch(Ae){case"selected":r.selected=!1;break;default:_t(r,s,Ae,null,d,ne)}for(F in d)if(ne=d[F],ie=o[F],d.hasOwnProperty(F)&&ne!==ie&&(ne!=null||ie!=null))switch(F){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:_t(r,s,F,ne,d,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Pe in o)ne=o[Pe],o.hasOwnProperty(Pe)&&ne!=null&&!d.hasOwnProperty(Pe)&&_t(r,s,Pe,null,d,ne);for(te in d)if(ne=d[te],ie=o[te],d.hasOwnProperty(te)&&ne!==ie&&(ne!=null||ie!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,s));break;default:_t(r,s,te,ne,d,ie)}return;default:if(xe(s)){for(var wt in o)ne=o[wt],o.hasOwnProperty(wt)&&ne!==void 0&&!d.hasOwnProperty(wt)&&xh(r,s,wt,void 0,d,ne);for(le in d)ne=d[le],ie=o[le],!d.hasOwnProperty(le)||ne===ie||ne===void 0&&ie===void 0||xh(r,s,le,ne,d,ie);return}}for(var W in o)ne=o[W],o.hasOwnProperty(W)&&ne!=null&&!d.hasOwnProperty(W)&&_t(r,s,W,null,d,ne);for(de in d)ne=d[de],ie=o[de],!d.hasOwnProperty(de)||ne===ie||ne==null&&ie==null||_t(r,s,de,ne,d,ie)}function _v(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _j(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,N=m.duration;if(x&&N&&_v(w)){for(w=0,N=m.responseEnd,d+=1;d<o.length;d++){var F=o[d],te=F.startTime;if(te>N)break;var le=F.transferSize,de=F.initiatorType;le&&_v(de)&&(F=F.responseEnd,w+=le*(F<N?1:(N-te)/(F-te)))}if(--d,s+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var vh=null,bh=null;function uu(r){return r.nodeType===9?r:r.ownerDocument}function wv(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jv(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function yh(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var _h=null;function wj(){var r=window.event;return r&&r.type==="popstate"?r===_h?!1:(_h=r,!0):(_h=null,!1)}var kv=typeof setTimeout=="function"?setTimeout:void 0,jj=typeof clearTimeout=="function"?clearTimeout:void 0,Sv=typeof Promise=="function"?Promise:void 0,kj=typeof queueMicrotask=="function"?queueMicrotask:typeof Sv<"u"?function(r){return Sv.resolve(null).then(r).catch(Sj)}:kv;function Sj(r){setTimeout(function(){throw r})}function es(r){return r==="head"}function Nv(r,s){var o=s,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),Ma(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Jl(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,Jl(o);for(var x=o.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[bs]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&Jl(r.ownerDocument.body);o=m}while(o);Ma(s)}function Cv(r,s){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function wh(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":wh(o),hl(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function Nj(r,s,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[bs])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=mr(r.nextSibling),r===null)break}return null}function Cj(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=mr(r.nextSibling),r===null))return null;return r}function Ev(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=mr(r.nextSibling),r===null))return null;return r}function jh(r){return r.data==="$?"||r.data==="$~"}function kh(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Ej(r,s){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||o.readyState!=="loading")s();else{var d=function(){s(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function mr(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var Sh=null;function Tv(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return mr(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function Av(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return r;s--}else o!=="/$"&&o!=="/&"||s++}r=r.previousSibling}return null}function Mv(r,s,o){switch(s=uu(o),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function Jl(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);hl(r)}var gr=new Map,Rv=new Set;function du(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var _i=U.d;U.d={f:Tj,r:Aj,D:Mj,C:Rj,L:Lj,m:Dj,X:Oj,S:zj,M:Bj};function Tj(){var r=_i.f(),s=nu();return r||s}function Aj(r){var s=qr(r);s!==null&&s.tag===5&&s.type==="form"?Wx(s):_i.r(r)}var Ea=typeof document>"u"?null:document;function Lv(r,s,o){var d=Ea;if(d&&typeof s=="string"&&s){var m=On(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),Rv.has(m)||(Rv.add(m),r={rel:r,crossOrigin:o,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),bn(s,"link",r),Ht(s),d.head.appendChild(s)))}}function Mj(r){_i.D(r),Lv("dns-prefetch",r,null)}function Rj(r,s){_i.C(r,s),Lv("preconnect",r,s)}function Lj(r,s,o){_i.L(r,s,o);var d=Ea;if(d&&r&&s){var m='link[rel="preload"][as="'+On(s)+'"]';s==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+On(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+On(o.imageSizes)+'"]')):m+='[href="'+On(r)+'"]';var x=m;switch(s){case"style":x=Ta(r);break;case"script":x=Aa(r)}gr.has(x)||(r=v({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),gr.set(x,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(eo(x))||s==="script"&&d.querySelector(to(x))||(s=d.createElement("link"),bn(s,"link",r),Ht(s),d.head.appendChild(s)))}}function Dj(r,s){_i.m(r,s);var o=Ea;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+On(d)+'"][href="'+On(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Aa(r)}if(!gr.has(x)&&(r=v({rel:"modulepreload",href:r},s),gr.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(to(x)))return}d=o.createElement("link"),bn(d,"link",r),Ht(d),o.head.appendChild(d)}}}function zj(r,s,o){_i.S(r,s,o);var d=Ea;if(d&&r){var m=zn(d).hoistableStyles,x=Ta(r);s=s||"default";var w=m.get(x);if(!w){var N={loading:0,preload:null};if(w=d.querySelector(eo(x)))N.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":s},o),(o=gr.get(x))&&Nh(r,o);var F=w=d.createElement("link");Ht(F),bn(F,"link",r),F._p=new Promise(function(te,le){F.onload=te,F.onerror=le}),F.addEventListener("load",function(){N.loading|=1}),F.addEventListener("error",function(){N.loading|=2}),N.loading|=4,fu(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:N},m.set(x,w)}}}function Oj(r,s){_i.X(r,s);var o=Ea;if(o&&r){var d=zn(o).hoistableScripts,m=Aa(r),x=d.get(m);x||(x=o.querySelector(to(m)),x||(r=v({src:r,async:!0},s),(s=gr.get(m))&&Ch(r,s),x=o.createElement("script"),Ht(x),bn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Bj(r,s){_i.M(r,s);var o=Ea;if(o&&r){var d=zn(o).hoistableScripts,m=Aa(r),x=d.get(m);x||(x=o.querySelector(to(m)),x||(r=v({src:r,async:!0,type:"module"},s),(s=gr.get(m))&&Ch(r,s),x=o.createElement("script"),Ht(x),bn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Dv(r,s,o,d){var m=(m=ke.current)?du(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=Ta(o.href),o=zn(m).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=Ta(o.href);var x=zn(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(eo(r)))&&!x._p&&(w.instance=x,w.state.loading=5),gr.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},gr.set(r,o),x||Uj(m,r,o,w.state))),s&&d===null)throw Error(i(528,""));return w}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Aa(o),o=zn(m).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Ta(r){return'href="'+On(r)+'"'}function eo(r){return'link[rel="stylesheet"]['+r+"]"}function zv(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function Uj(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),bn(s,"link",o),Ht(s),r.head.appendChild(s))}function Aa(r){return'[src="'+On(r)+'"]'}function to(r){return"script[async]"+r}function Ov(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+On(o.href)+'"]');if(d)return s.instance=d,Ht(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Ht(d),bn(d,"style",m),fu(d,o.precedence,r),s.instance=d;case"stylesheet":m=Ta(o.href);var x=r.querySelector(eo(m));if(x)return s.state.loading|=4,s.instance=x,Ht(x),x;d=zv(o),(m=gr.get(m))&&Nh(d,m),x=(r.ownerDocument||r).createElement("link"),Ht(x);var w=x;return w._p=new Promise(function(N,F){w.onload=N,w.onerror=F}),bn(x,"link",d),s.state.loading|=4,fu(x,o.precedence,r),s.instance=x;case"script":return x=Aa(o.src),(m=r.querySelector(to(x)))?(s.instance=m,Ht(m),m):(d=o,(m=gr.get(x))&&(d=v({},o),Ch(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Ht(m),bn(m,"link",d),r.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,fu(d,o.precedence,r));return s.instance}function fu(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var N=d[w];if(N.dataset.precedence===s)x=N;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(r,s.firstChild))}function Nh(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Ch(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var hu=null;function Bv(r,s,o){if(hu===null){var d=new Map,m=hu=new Map;m.set(o,d)}else m=hu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[bs]||x[Gt]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(s)||"";w=r+w;var N=d.get(w);N?N.push(x):d.set(w,[x])}}return d}function Uv(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function Pj(r,s,o){if(o===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Pv(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function $j(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=Ta(d.href),x=s.querySelector(eo(m));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=pu.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=x,Ht(x);return}x=s.ownerDocument||s,d=zv(d),(m=gr.get(m))&&Nh(d,m),x=x.createElement("link"),Ht(x);var w=x;w._p=new Promise(function(N,F){w.onload=N,w.onerror=F}),bn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=pu.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var Eh=0;function Fj(r,s){return r.stylesheets&&r.count===0&&gu(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&gu(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+s);0<r.imgBytes&&Eh===0&&(Eh=62500*_j());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&gu(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>Eh?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function pu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var mu=null;function gu(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,mu=new Map,s.forEach(Hj,r),mu=null,pu.call(r))}function Hj(r,s){if(!(s.state.loading&4)){var o=mu.get(r);if(o)var d=o.get(null);else{o=new Map,mu.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=pu.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var no={$$typeof:C,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function Ij(r,s,o,d,m,x,w,N,F){this.tag=1,this.containerInfo=r,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=cl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cl(0),this.hiddenUpdates=cl(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function $v(r,s,o,d,m,x,w,N,F,te,le,de){return r=new Ij(r,s,o,w,F,te,le,de,N),s=1,x===!0&&(s|=24),x=Zn(3,null,null,s),r.current=x,x.stateNode=r,s=lf(),s.refCount++,r.pooledCache=s,s.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:s},df(x),r}function Fv(r){return r?(r=la,r):la}function Hv(r,s,o,d,m,x){m=Fv(m),d.context===null?d.context=m:d.pendingContext=m,d=Ii(s),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=qi(r,d,s),o!==null&&(In(o,r,s),Dl(o,r,s))}function Iv(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function Th(r,s){Iv(r,s),(r=r.alternate)&&Iv(r,s)}function qv(r){if(r.tag===13||r.tag===31){var s=ks(r,67108864);s!==null&&In(s,r,67108864),Th(r,67108864)}}function Vv(r){if(r.tag===13||r.tag===31){var s=rr();s=Sr(s);var o=ks(r,s);o!==null&&In(o,r,s),Th(r,s)}}var xu=!0;function qj(r,s,o,d){var m=B.T;B.T=null;var x=U.p;try{U.p=2,Ah(r,s,o,d)}finally{U.p=x,B.T=m}}function Vj(r,s,o,d){var m=B.T;B.T=null;var x=U.p;try{U.p=8,Ah(r,s,o,d)}finally{U.p=x,B.T=m}}function Ah(r,s,o,d){if(xu){var m=Mh(d);if(m===null)gh(r,s,d,vu,o),Xv(r,d);else if(Xj(m,r,s,o,d))d.stopPropagation();else if(Xv(r,d),s&4&&-1<Gj.indexOf(r)){for(;m!==null;){var x=qr(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=St(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var F=1<<31-K(w);N.entanglements[1]|=F,w&=~F}Wr(x),(ht&6)===0&&(eu=Be()+500,Ql(0))}}break;case 31:case 13:N=ks(x,2),N!==null&&In(N,x,2),nu(),Th(x,2)}if(x=Mh(d),x===null&&gh(r,s,d,vu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else gh(r,s,d,null,o)}}function Mh(r){return r=Vr(r),Rh(r)}var vu=null;function Rh(r){if(vu=null,r=Di(r),r!==null){var s=c(r);if(s===null)r=null;else{var o=s.tag;if(o===13){if(r=u(s),r!==null)return r;r=null}else if(o===31){if(r=f(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return vu=r,null}function Gv(r){switch(r){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(mn()){case ae:return 2;case ve:return 8;case De:case Ge:return 32;case Qe:return 268435456;default:return 32}default:return 32}}var Lh=!1,ts=null,ns=null,rs=null,ro=new Map,io=new Map,is=[],Gj="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Xv(r,s){switch(r){case"focusin":case"focusout":ts=null;break;case"dragenter":case"dragleave":ns=null;break;case"mouseover":case"mouseout":rs=null;break;case"pointerover":case"pointerout":ro.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":io.delete(s.pointerId)}}function so(r,s,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:s,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},s!==null&&(s=qr(s),s!==null&&qv(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function Xj(r,s,o,d,m){switch(s){case"focusin":return ts=so(ts,r,s,o,d,m),!0;case"dragenter":return ns=so(ns,r,s,o,d,m),!0;case"mouseover":return rs=so(rs,r,s,o,d,m),!0;case"pointerover":var x=m.pointerId;return ro.set(x,so(ro.get(x)||null,r,s,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,io.set(x,so(io.get(x)||null,r,s,o,d,m)),!0}return!1}function Yv(r){var s=Di(r.target);if(s!==null){var o=c(s);if(o!==null){if(s=o.tag,s===13){if(s=u(o),s!==null){r.blockedOn=s,vs(r.priority,function(){Vv(o)});return}}else if(s===31){if(s=f(o),s!==null){r.blockedOn=s,vs(r.priority,function(){Vv(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function bu(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=Mh(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Bn=d,o.target.dispatchEvent(d),Bn=null}else return s=qr(o),s!==null&&qv(s),r.blockedOn=o,!1;s.shift()}return!0}function Wv(r,s,o){bu(r)&&o.delete(s)}function Yj(){Lh=!1,ts!==null&&bu(ts)&&(ts=null),ns!==null&&bu(ns)&&(ns=null),rs!==null&&bu(rs)&&(rs=null),ro.forEach(Wv),io.forEach(Wv)}function yu(r,s){r.blockedOn===s&&(r.blockedOn=null,Lh||(Lh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Yj)))}var _u=null;function Qv(r){_u!==r&&(_u=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){_u===r&&(_u=null);for(var s=0;s<r.length;s+=3){var o=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(Rh(d||o)===null)continue;break}var x=qr(o);x!==null&&(r.splice(s,3),s-=3,Mf(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function Ma(r){function s(F){return yu(F,r)}ts!==null&&yu(ts,r),ns!==null&&yu(ns,r),rs!==null&&yu(rs,r),ro.forEach(s),io.forEach(s);for(var o=0;o<is.length;o++){var d=is[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<is.length&&(o=is[0],o.blockedOn===null);)Yv(o),o.blockedOn===null&&is.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[fn]||null;if(typeof x=="function")w||Qv(o);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[fn]||null)N=w.formAction;else if(Rh(m)!==null)continue}else N=w.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),Qv(o)}}}function Kv(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function Dh(r){this._internalRoot=r}wu.prototype.render=Dh.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=rr();Hv(o,d,r,s,null,null)},wu.prototype.unmount=Dh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;Hv(r.current,2,null,r,null,null),nu(),s[Ir]=null}};function wu(r){this._internalRoot=r}wu.prototype.unstable_scheduleHydration=function(r){if(r){var s=Qs();r={blockedOn:null,target:r,priority:s};for(var o=0;o<is.length&&s!==0&&s<is[o].priority;o++);is.splice(o,0,r),o===0&&Yv(r)}};var Zv=t.version;if(Zv!=="19.2.5")throw Error(i(527,Zv,"19.2.5"));U.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(s),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var Wj={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ju=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ju.isDisabled&&ju.supportsFiber)try{jt=ju.inject(Wj),kt=ju}catch{}}return lo.createRoot=function(r,s){if(!l(r))throw Error(i(299));var o=!1,d="",m=s0,x=a0,w=l0;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=$v(r,1,!1,null,null,o,d,null,m,x,w,Kv),r[Ir]=s.current,mh(r),new Dh(s)},lo.hydrateRoot=function(r,s,o){if(!l(r))throw Error(i(299));var d=!1,m="",x=s0,w=a0,N=l0,F=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&(F=o.formState)),s=$v(r,1,!0,s,o??null,d,m,F,x,w,N,Kv),s.context=Fv(null),o=s.current,d=rr(),d=Sr(d),m=Ii(d),m.callback=null,qi(o,m,d),o=d,s.current.lanes=o,kr(s,o),Wr(s),r[Ir]=s.current,mh(r),new wu(s)},lo.version="19.2.5",lo}var u1;function ok(){if(u1)return Bh.exports;u1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Bh.exports=lk(),Bh.exports}var ck=ok();const d1=e=>{let t;const n=new Set,i=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},l=()=>t,f={setState:i,getState:l,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,l,f);return f},uk=(e=>e?d1(e):d1),dk=e=>e;function fk(e,t=dk){const n=ku.useSyncExternalStore(e.subscribe,ku.useCallback(()=>t(e.getState()),[e,t]),ku.useCallback(()=>t(e.getInitialState()),[e,t]));return ku.useDebugValue(n),n}const f1=e=>{const t=uk(e),n=i=>fk(t,i);return Object.assign(n,t),n},hk=(e=>e?f1(e):f1),Op="companion_auth_token";function h1(){return typeof window>"u"?null:localStorage.getItem(Op)||null}const pk=e=>({authToken:h1(),isAuthenticated:h1()!==null,setAuthToken:t=>{localStorage.setItem(Op,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(Op),e({authToken:null,isAuthenticated:!1})}});function Bt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function mk(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function gk(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function xk(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function vk(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const bk=e=>({sessions:new Map,sdkSessions:[],currentSessionId:xk(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:gk(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:vk(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const l=new Map(n.messages);return l.has(t.session_id)||l.set(t.session_id,[]),{sessions:i,messages:l}}),updateSession:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c&&l.set(t,{...c,...n}),{sessions:l}}),removeSession:t=>e(n=>{const i=Bt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Bt(n.sessions,t),connectionStatus:Bt(n.connectionStatus,t),cliConnected:Bt(n.cliConnected,t),cliReconnecting:Bt(n.cliReconnecting,t),sessionStatus:Bt(n.sessionStatus,t),previousPermissionMode:Bt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:mk(n.recentlyRenamed,t),mcpServers:Bt(n.mcpServers,t),prStatus:Bt(n.prStatus,t),linkedLinearIssues:Bt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(l=>l.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Bt(n.messages,t),streaming:Bt(n.streaming,t),streamingStartedAt:Bt(n.streamingStartedAt,t),streamingOutputTokens:Bt(n.streamingOutputTokens,t),pendingPermissions:Bt(n.pendingPermissions,t),aiResolvedPermissions:Bt(n.aiResolvedPermissions,t),sessionTasks:Bt(n.sessionTasks,t),changedFilesTick:Bt(n.changedFilesTick,t),gitChangedFilesCount:Bt(n.gitChangedFilesCount,t),sessionProcesses:Bt(n.sessionProcesses,t),toolProgress:Bt(n.toolProgress,t),toolActivity:Bt(n.toolActivity,t),diffPanelSelectedFile:Bt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Bt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const l=new Map(i.connectionStatus);return l.set(t,n),{connectionStatus:l}}),setCliConnected:(t,n)=>e(i=>{const l=new Map(i.cliConnected);return l.set(t,n),{cliConnected:l}}),setCliReconnecting:(t,n)=>e(i=>{const l=new Map(i.cliReconnecting);return n?l.set(t,!0):l.delete(t),{cliReconnecting:l}}),setSessionStatus:(t,n)=>e(i=>{const l=new Map(i.sessionStatus);return l.set(t,n),{sessionStatus:l}}),setPreviousPermissionMode:(t,n)=>e(i=>{const l=new Map(i.previousPermissionMode);return l.set(t,n),{previousPermissionMode:l}}),setSessionName:(t,n)=>e(i=>{const l=new Map(i.sessionNames);return l.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(l.entries()))),{sessionNames:l}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const l=new Map(i.prStatus);return l.set(t,n),{prStatus:l}}),setLinkedLinearIssue:(t,n)=>e(i=>{const l=new Map(i.linkedLinearIssues);return n?l.set(t,n):l.delete(t),{linkedLinearIssues:l}}),setMcpServers:(t,n)=>e(i=>{const l=new Map(i.mcpServers);return l.set(t,n),{mcpServers:l}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c?(l.set(t,{...c,...n}),{sessions:l}):{}})}),yk=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,appendMessage:(t,n)=>e(i=>{const l=i.messages.get(t)||[];if(n.id&&l.some(u=>u.id===n.id))return i;const c=new Map(i.messages);return c.set(t,[...l,n]),{messages:c}}),setMessages:(t,n)=>e(i=>{const l=new Map(i.messages);return l.set(t,n),{messages:l}}),updateLastAssistantMessage:(t,n)=>e(i=>{const l=new Map(i.messages),c=[...l.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return l.set(t,c),{messages:l}}),setStreaming:(t,n)=>e(i=>{const l=new Map(i.streaming);return n===null?l.delete(t):l.set(t,n),{streaming:l}}),setStreamingStats:(t,n)=>e(i=>{const l=new Map(i.streamingStartedAt),c=new Map(i.streamingOutputTokens);return n===null?(l.delete(t),c.delete(t)):(n.startedAt!==void 0&&l.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:l,streamingOutputTokens:c}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const l=new Map(i.promptSuggestions);return l.set(t,n),{promptSuggestions:l}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),_k=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=new Map(l.get(t)||[]);return c.set(n.request_id,n),l.set(t,c),{pendingPermissions:l}}),removePermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}return{pendingPermissions:l}}),addAiResolvedPermission:(t,n)=>e(i=>{const l=new Map(i.aiResolvedPermissions),c=[...l.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),l.set(t,c),{aiResolvedPermissions:l}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),wk=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const l=new Map(i.sessionTasks),c=[...l.get(t)||[],n];return l.set(t,c),{sessionTasks:l}}),setTasks:(t,n)=>e(i=>{const l=new Map(i.sessionTasks);return l.set(t,n),{sessionTasks:l}}),updateTask:(t,n,i)=>e(l=>{const c=new Map(l.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(i=>{const l=new Map(i.sessionProcesses),c=[...l.get(t)||[],n];return l.set(t,c),{sessionProcesses:l}}),updateProcess:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(i=>{const l=new Map(i.sessionBackgroundAgents),c=[...l.get(t)||[],n];return l.set(t,c),{sessionBackgroundAgents:l}}),updateBackgroundAgent:(t,n,i)=>e(l=>{const c=new Map(l.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const l=new Map(i.gitChangedFilesCount);return l.set(t,n),{gitChangedFilesCount:l}}),setToolProgress:(t,n,i)=>e(l=>{const c=new Map(l.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,i),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(i=>{const l=new Map(i.toolProgress);if(n){const c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}}else l.delete(t);return{toolProgress:l}}),setToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity);return n.length===0?l.delete(t):l.set(t,n),{toolActivity:l}}),addToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity),c=[...l.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return l.set(t,c),{toolActivity:l}}),updateToolActivity:(t,n,i)=>e(l=>{const c=new Map(l.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:c}})}),Ti=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],jk=Ti.map(e=>e.id),e5="cc-task-panel-config";function Bp(){return{order:[...jk],enabled:Object.fromEntries(Ti.map(e=>[e.id,!0]))}}function kk(){if(typeof window>"u")return Bp();try{const e=localStorage.getItem(e5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const l of Ti)n.has(l.id)||(t.order.push(l.id),t.enabled[l.id]=!0);const i=new Set(Ti.map(l=>l.id));return t.order=t.order.filter(l=>i.has(l)),t}}catch{}return Bp()}function Su(e){try{localStorage.setItem(e5,JSON.stringify(e))}catch{}}function Sk(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function Nk(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function Ck(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function t5(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}const Ek=e=>({darkMode:Sk(),notificationSound:Nk(),notificationDesktop:Ck(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:kk(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:t5(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Su(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<=0)return n;[i[l-1],i[l]]=[i[l],i[l-1]];const c={...n.taskPanelConfig,order:i};return Su(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<0||l>=i.length-1)return n;[i[l],i[l+1]]=[i[l+1],i[l]];const c={...n.taskPanelConfig,order:i};return Su(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=Bp();Su(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),l=(i.get(t)??0)+1;return i.set(t,l),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const l=new Map(i.diffPanelSelectedFile);return n?l.set(t,n):l.delete(t),{diffPanelSelectedFile:l}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function n5(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const Tk=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:n5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",l=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=i?l:l+1,f=i?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${c}`:l===1?"Terminal":`Terminal ${l}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var c;const i=n.quickTerminalTabs.filter(u=>u.id!==t),l=n.activeQuickTerminalTabId===t?((c=i[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:l,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function Ak(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const Mk=e=>({updateInfo:null,updateDismissedVersion:Ak(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],l=i.findIndex(c=>c.step===t.step);if(l>=0){const c=[...i];return c[l]=t,{creationProgress:c}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t})}),Y=hk((...e)=>({...pk(...e),...bk(...e),...yk(...e),..._k(...e),...wk(...e),...Ek(...e),...Tk(...e),...Mk(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:t5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:n5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),Rk=Object.freeze(Object.defineProperty({__proto__:null,useStore:Y},Symbol.toStringTag,{value:"Module"})),p1=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],m1=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function g1(){const e=p1[Math.floor(Math.random()*p1.length)],t=m1[Math.floor(Math.random()*m1.length)];return`${e} ${t}`}function r5(e){for(let t=0;t<100;t++){const n=g1();if(!e.has(n))return n}return g1()}let Fh=null;function Lk(){return Fh||(Fh=new AudioContext),Fh}function Dk(){try{const e=Lk();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const l=e.createOscillator(),c=e.createGain();l.type="sine",l.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),l.connect(c),c.connect(e.destination),l.start(t+.15),l.stop(t+.5)}catch{}}class i5{diff(t,n,i={}){let l;typeof i=="function"?(l=i,i={}):"callback"in i&&(l=i.callback);const c=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(c,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,l)}diffWithOptionsObj(t,n,i,l){var c;const u=M=>{if(M=this.postProcess(M,i),l){setTimeout(function(){l(M)},0);return}else return M},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(c=i.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,i);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let k=-1/0,E=1/0;const S=()=>{for(let M=Math.max(k,-p);M<=Math.min(E,p);M+=2){let C;const $=b[M-1],L=b[M+1];$&&(b[M-1]=void 0);let T=!1;if(L){const z=L.oldPos-M;T=L&&0<=z&&z<f}const H=$&&$.oldPos+1<h;if(!T&&!H){b[M]=void 0;continue}if(!H||T&&$.oldPos<L.oldPos?C=this.addToPath(L,!0,!1,0,i):C=this.addToPath($,!1,!0,1,i),_=this.extractCommon(C,n,t,M,i),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;b[M]=C,C.oldPos+1>=h&&(E=Math.min(E,M-1)),_+1>=f&&(k=Math.max(k,M+1))}p++};if(l)(function M(){setTimeout(function(){if(p>g||Date.now()>y)return l(void 0);S()||M()},0)})();else for(;p<=g&&Date.now()<=y;){const M=S();if(M)return M}}addToPath(t,n,i,l,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+l,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,l,c){const u=n.length,f=i.length;let h=t.oldPos,p=h-l,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const l=[];let c;for(;t;)l.push(t),c=t.previousComponent,delete t.previousComponent,t=c;l.reverse();const u=l.length;let f=0,h=0,p=0;for(;f<u;f++){const g=l[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=i[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return l}}function x1(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function v1(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Up(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Pp(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function oo(e,t){return Up(e,t,"")}function Nu(e,t){return Pp(e,t,"")}function b1(e,t){return t.slice(0,zk(e,t))}function zk(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const l=Array(i);let c=0;l[0]=0;for(let u=1;u<i;u++){for(t[u]==t[c]?l[u]=l[c]:l[u]=c;c>0&&t[u]!=t[c];)c=l[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=l[c];e[u]==t[c]&&c++}return c}function s5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const l=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(l)?n[n.length-1]+=l:n.push(l)}return n}function $p(e,t){if(t)return Mo(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Pa(e,t){if(t)return Mo(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Mo(e,t){if(!t)return[Pa(e),$p(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=s5(e,t),i=n[0],l=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(l)?l:"";return[c,u]}const y1="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Ok=new RegExp(`[${y1}]+|\\s+|[^${y1}]`,"ug");class Bk extends i5{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=s5(t,u)}else i=t.match(Ok)||[];const l=[];let c=null;return i.forEach(u=>{/\s/.test(u)?c==null?l.push(u):l.push(l.pop()+u):c!=null&&/\s/.test(c)?l[l.length-1]==c?l.push(l.pop()+u):l.push(c+u):l.push(u),c=u}),l}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,l=null,c=null;return t.forEach(u=>{u.added?l=u:u.removed?c=u:((l||c)&&_1(i,c,l,u,n.intlSegmenter),i=u,l=null,c=null)}),(l||c)&&_1(i,c,l,null,n.intlSegmenter),t}}const Uk=new Bk;function Pk(e,t,n){return Uk.diff(e,t,n)}function _1(e,t,n,i,l){if(t&&n){const[c,u]=Mo(t.value,l),[f,h]=Mo(n.value,l);if(e){const p=x1(c,f);e.value=Pp(e.value,f,p),t.value=oo(t.value,p),n.value=oo(n.value,p)}if(i){const p=v1(u,h);i.value=Up(i.value,h,p),t.value=Nu(t.value,p),n.value=Nu(n.value,p)}}else if(n){if(e){const c=Pa(n.value,l);n.value=n.value.substring(c.length)}if(i){const c=Pa(i.value,l);i.value=i.value.substring(c.length)}}else if(e&&i){const c=Pa(i.value,l),[u,f]=Mo(t.value,l),h=x1(c,u);t.value=oo(t.value,h);const p=v1(oo(c,h),f);t.value=Nu(t.value,p),i.value=Up(i.value,c,p),e.value=Pp(e.value,c,c.slice(0,c.length-p.length))}else if(i){const c=Pa(i.value,l),u=$p(t.value,l),f=b1(u,c);t.value=Nu(t.value,f)}else if(e){const c=$p(e.value,l),u=Pa(t.value,l),f=b1(c,u);t.value=oo(t.value,f)}}class $k extends i5{constructor(){super(...arguments),this.tokenize=Hk}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
50
+ `))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
51
+ `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
52
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
53
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const Fk=new $k;function w1(e,t,n){return Fk.diff(e,t,n)}function Hk(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
54
+ `));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let l=0;l<i.length;l++){const c=i[l];l%2&&!t.newlineIsToken?n[n.length-1]+=c:n.push(c)}return n}function Ik(e,t,n,i,l,c,u){let f;u?typeof u=="function"?f={callback:u}:f=u:f={},typeof f.context>"u"&&(f.context=4);const h=f.context;if(f.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(f.callback){const{callback:g}=f;w1(n,i,Object.assign(Object.assign({},f),{callback:v=>{const y=p(v);g(y)}}))}else return p(w1(n,i,f));function p(g){if(!g)return;g.push({value:"",lines:[]});function v(M){return M.map(function(C){return" "+C})}const y=[];let b=0,_=0,k=[],E=1,S=1;for(let M=0;M<g.length;M++){const C=g[M],$=C.lines||qk(C.value);if(C.lines=$,C.added||C.removed){if(!b){const L=g[M-1];b=E,_=S,L&&(k=h>0?v(L.lines.slice(-h)):[],b-=k.length,_-=k.length)}for(const L of $)k.push((C.added?"+":"-")+L);C.added?S+=$.length:E+=$.length}else{if(b)if($.length<=h*2&&M<g.length-2)for(const L of v($))k.push(L);else{const L=Math.min($.length,h);for(const H of v($.slice(0,L)))k.push(H);const T={oldStart:b,oldLines:E-b+L,newStart:_,newLines:S-_+L,lines:k};y.push(T),b=0,_=0,k=[]}E+=$.length,S+=$.length}}for(const M of y)for(let C=0;C<M.lines.length;C++)M.lines[C].endsWith(`
55
+ `)?M.lines[C]=M.lines[C].slice(0,-1):(M.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:l,newHeader:c,hunks:y}}}function qk(e){const t=e.endsWith(`
56
+ `),n=e.split(`
57
+ `).map(i=>i+`
58
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Vk(e,t){return Ik("","",e,t,"","",{context:3}).hunks.map(i=>{const l=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,c=[];let u=i.oldStart,f=i.newStart;for(const h of i.lines){const p=h[0],g=h.slice(1);p==="-"?c.push({type:"del",content:g,oldLineNo:u++}):p==="+"?c.push({type:"add",content:g,newLineNo:f++}):c.push({type:"context",content:g,oldLineNo:u++,newLineNo:f++})}return a5(c),{header:l,lines:c}})}function Gk(e){const t=[],n=e.split(`
59
+ `);let i=null,l=null,c=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){l&&i&&i.hunks.push(l),i&&t.push(i),i={fileName:"",hunks:[]},l=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){i&&(i.fileName=f.slice(6));continue}if(f.startsWith("+++ /dev/null")||f.startsWith("index ")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from")||f.startsWith("rename to")||f.startsWith("similarity index")||f.startsWith("Binary files"))continue;const h=f.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(h){l&&i&&i.hunks.push(l),c=parseInt(h[1],10),u=parseInt(h[2],10),l={header:f,lines:[]};continue}l&&(f.startsWith("+")?l.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?l.lines.push({type:"del",content:f.slice(1),oldLineNo:c++}):f.startsWith(" ")&&l.lines.push({type:"context",content:f.slice(1),oldLineNo:c++,newLineNo:u++}))}l&&i&&i.hunks.push(l),i&&t.push(i);for(const f of t)for(const h of f.hunks)a5(h.lines);return t}function a5(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,l=t;for(;t<e.length&&e[t].type==="add";)t++;const c=t,u=i-n,f=c-l;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const g=e[n+p],v=e[l+p],y=Pk(g.content,v.content);g.wordChanges=y.filter(b=>!b.added).map(b=>({value:b.value,removed:b.removed})),v.wordChanges=y.filter(b=>!b.removed).map(b=>({value:b.value,added:b.added}))}}t===n&&t++}}function Xk({line:e}){return e.wordChanges?a.jsx(a.Fragment,{children:e.wordChanges.map((t,n)=>t.added?a.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?a.jsx("span",{className:"diff-word-del",children:t.value},n):a.jsx("span",{children:t.value},n))}):a.jsx(a.Fragment,{children:e.content})}function Yk({hunk:e,showLineNumbers:t}){return a.jsxs("div",{className:"diff-hunk",children:[a.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>a.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),a.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),a.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),a.jsxs("span",{className:"diff-content",children:[a.jsx(Xk,{line:n}),!n.content&&" "]})]},i))]})}function Wk({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return a.jsxs("div",{className:"diff-file-header",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&a.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),a.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function il({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:l="compact"}){const c=l==="compact",u=!c,f=j.useMemo(()=>{if(n)return Gk(n);const h=e??"",p=t??"";if(!h&&!p)return[];const g=Vk(h,p);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return f.length===0||f.every(h=>h.hunks.length===0)?a.jsx("div",{className:"diff-viewer diff-empty",children:a.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):a.jsx("div",{className:`diff-viewer ${c?"diff-compact":"diff-full"}`,children:f.map((h,p)=>a.jsxs("div",{className:"diff-file",children:[(h.fileName||i)&&a.jsx(Wk,{fileName:h.fileName||i||""}),h.hunks.map((g,v)=>a.jsx(Yk,{hunk:g,showLineNumbers:u},v))]},p))})}const Qk={Bash:"terminal",Read:"file",Write:"file-plus",Edit:"file-edit",Glob:"search",Grep:"search",WebFetch:"globe",WebSearch:"globe",NotebookEdit:"notebook",Task:"agent",TodoWrite:"checklist",TaskCreate:"list",TaskUpdate:"list",SendMessage:"message",web_search:"globe",mcp_tool_call:"tool"};function tc(e){return Qk[e]||"tool"}function ps(e){return e==="Bash"?"Terminal":e==="Read"?"Read File":e==="Write"?"Write File":e==="Edit"?"Edit File":e==="Glob"?"Find Files":e==="Grep"?"Search Content":e==="WebSearch"?"Web Search":e==="WebFetch"?"Web Fetch":e==="Task"?"Subagent":e==="TodoWrite"?"Tasks":e==="NotebookEdit"?"Notebook":e==="SendMessage"?"Message":e==="web_search"?"Web Search":e==="mcp_tool_call"?"MCP Tool":e.startsWith("mcp:")?e.split(":").slice(1).join(":"):e}function l5({name:e,input:t,toolUseId:n}){const[i,l]=j.useState(e==="Edit"),c=tc(e),u=ps(e),f=Ho(e,t);return e==="Edit"?a.jsx(Kk,{input:t,toolUseId:n}):e==="Bash"?a.jsx(Zk,{input:t,toolUseId:n}):a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[a.jsxs("button",{onClick:()=>l(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(Ka,{type:c}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),i&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:a.jsx("div",{className:"mt-2",children:a.jsx(Jk,{name:e,input:t})})})]})}function Kk({input:e,toolUseId:t}){const n=String(e.file_path||""),i=n?n.split("/").pop()||n:"",l=String(e.old_string||""),c=String(e.new_string||""),u=!!(l||c),f=!!e.replace_all,[h,p]=j.useState(!1),v=(Array.isArray(e.changes)?e.changes:[]).map(_=>({path:typeof _.path=="string"?_.path:"",kind:typeof _.kind=="string"?_.kind:"update"})).filter(_=>_.path),y=(l+c).split(`
60
+ `).length,b=y>15;return a.jsxs("div",{"data-tool-use-id":t,children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[a.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),i&&a.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:i}),f&&a.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),u?a.jsxs("div",{className:"relative mt-1",children:[a.jsx("div",{className:`overflow-hidden ${b&&!h?"max-h-[240px]":""}`,children:a.jsx(il,{oldText:l,newText:c,mode:"compact"})}),b&&!h&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),b&&a.jsx("button",{type:"button",onClick:()=>p(!h),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:h?"Show less":`Show all ${y} lines`})]}):v.length>0?a.jsx("div",{className:"mt-1 space-y-1",children:v.map((_,k)=>{const E=_.path.split("/").pop()||_.path;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:`text-[9px] font-semibold uppercase ${_.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":_.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:_.kind}),a.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:E})]},`${_.path}-${k}`)})}):a.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})]})}function Zk({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"";return a.jsxs("div",{"data-tool-use-id":t,children:[i&&a.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),a.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:a.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function Jk({name:e,input:t}){switch(e){case"Bash":return a.jsx(eS,{input:t});case"Edit":return a.jsx(tS,{input:t});case"Write":return a.jsx(nS,{input:t});case"Read":return a.jsx(rS,{input:t});case"Glob":return a.jsx(iS,{input:t});case"Grep":return a.jsx(sS,{input:t});case"WebSearch":case"web_search":return a.jsx(aS,{input:t});case"WebFetch":return a.jsx(lS,{input:t});case"Task":return a.jsx(oS,{input:t});case"TodoWrite":return a.jsx(cS,{input:t});case"NotebookEdit":return a.jsx(uS,{input:t});case"SendMessage":return a.jsx(dS,{input:t});default:return a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function eS({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),a.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function tS({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),c=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return a.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?a.jsx(il,{oldText:n,newText:i,fileName:t,mode:"compact"}):c.length>0?a.jsxs("div",{className:"space-y-1.5",children:[!!t&&a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),c.map((u,f)=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),a.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function nS({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(il,{newText:n,fileName:t,mode:"compact"})}function rS({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&a.jsxs("span",{children:["offset: ",n]}),i!=null&&a.jsxs("span",{children:["limit: ",i]})]})]})}function iS({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function sS({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&a.jsxs("span",{children:["path: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&a.jsxs("span",{children:["glob: ",a.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&a.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&a.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&a.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function aS({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function lS({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.url&&a.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&a.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function oS({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function cS({input:e}){const t=e.todos;return Array.isArray(t)?a.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const l=n.status||"pending";return a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("span",{className:"shrink-0 mt-0.5",children:l==="completed"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l==="in_progress"?a.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.jsx("span",{className:`text-[11px] leading-snug ${l==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):a.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function uS({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&a.jsxs("span",{children:["type: ",n]}),i&&a.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&a.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&a.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function dS({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&a.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",a.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&a.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function Ho(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",l=n+i;return l.length>60?l.slice(0,60)+"...":l}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function Ka({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("polyline",{points:"3 11 6 8 3 5"}),a.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"5",r:"3"}),a.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),a.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const fS=2e3,Pr=new Map,Ei=new Map,Ku=new Map,Iu=new Map,ds=new Map,Ro=new Map,Io=new Map,Zu=new Map;function o5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function c5(e){const t=Y.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function hS(){const e=Y.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let qo=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){qo=!0;for(const[e,t]of Ei)clearTimeout(t),Ei.delete(e)}else{qo=!1;for(const e of hS()){if(!c5(e))continue;const t=Pr.get(e);if(!o5(t)){if(t){try{t.close()}catch{}Pr.delete(e)}nc(e)}}}});function qu(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const l of n)if(!(!l||l===".")){if(l===".."){i.length>0&&i.pop();continue}i.push(l)}return`${t?"/":""}${i.join("/")}`}function pS(e,t){return e.startsWith("/")||!t?qu(e):qu(`${t}/${e}`)}function mS(e,t){if(!t)return!0;const n=qu(t);return e===n||e.startsWith(`${n}/`)}function gS(e){let t=Zu.get(e);return t||(t=new Set,Zu.set(e,t)),t}function Hh(e,t){const n=Y.getState(),i=gS(e);for(const l of t){if(l.type!=="tool_use")continue;const{name:c,input:u,id:f}=l;if(f){if(i.has(f))continue;i.add(f)}if(c==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),Iu.set(e,p.length)}continue}if(c==="TaskCreate"){const h=(Iu.get(e)||0)+1;Iu.set(e,h);const p={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(c==="TaskUpdate"){const h=u.taskId;if(h){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,h,p)}}}}function Ih(e,t){var c,u;const n=Y.getState(),i=((c=n.sessions.get(e))==null?void 0:c.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let l=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:p}=f;if((h==="Edit"||h==="Write")&&typeof p.file_path=="string"){const g=pS(p.file_path,i);mS(g,i)&&(l=!0)}}l&&n.bumpChangedFilesTick(e)}const wo=new Map,xS=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function qh(e,t){const n=Y.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const l=i.input;if(l.run_in_background===!0){let c=wo.get(e);c||(c=new Map,wo.set(e,c)),c.set(i.id,{command:l.command||"",description:l.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const l=i.tool_use_id,c=wo.get(e),u=c==null?void 0:c.get(l);if(c&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(xS);if(h){const p={taskId:h[1],toolUseId:l,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}c.delete(l),c.size===0&&wo.delete(e)}}}}const Cu=new Map,Ju=new Map;function Vh(e,t){const n=Y.getState();let i=Ju.get(e);i||(i=new Set,Ju.set(e,i));for(const l of t){if(l.type==="tool_use"&&l.name==="Agent"){if(l.id&&i.has(l.id))continue;const c=l.input;if(c.run_in_background===!0){l.id&&i.add(l.id);let u=Cu.get(e);u||(u=new Map,Cu.set(e,u));const f={toolUseId:l.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(l.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(l.type==="tool_result"){const c=l.tool_use_id,u=Cu.get(e),f=u==null?void 0:u.get(c);if(u&&f){const h=typeof l.content=="string"?l.content:Array.isArray(l.content)?l.content.map(g=>"text"in g?g.text:"").join(""):"",p=l.is_error===!0;n.updateBackgroundAgent(e,c,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(c),u.size===0&&Cu.delete(e)}}}}function j1(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function k1(e){if(e.subtype==="compact_boundary")return`Context compacted (${e.compact_metadata.trigger}, pre-tokens: ${e.compact_metadata.pre_tokens}).`;if(e.subtype==="task_notification"){const t=e.summary?` ${e.summary}`:"";return`Task ${e.status}: ${e.task_id}.${t}`}if(e.subtype==="files_persisted"){const t=e.files.length,n=e.failed.length;return n>0?`Persisted ${t} file(s), ${n} failed.`:`Persisted ${t} file(s).`}if(e.subtype==="hook_started")return`Hook started: ${e.hook_name} (${e.hook_event}).`;if(e.subtype==="hook_response"){const t=typeof e.exit_code=="number"?` (exit ${e.exit_code})`:"";return`Hook ${e.outcome}: ${e.hook_name} (${e.hook_event})${t}.`}return null}let vS=0,bS=0;function Qr(){return`msg-${Date.now()}-${++vS}`}function yS(e,t){const n=Io.get(e)||[];n.push(t),Io.set(e,n)}function _S(e,t){const n=Io.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){Io.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const ki=new Map;function S1(e,t,n){const i=Y.getState(),l=i.messages.get(e)||[],c=Ro.get(e);let u=l.filter(h=>!h.isStreaming||h.id===c),f=-1;if(c&&(f=u.findIndex(h=>h.id===c),f===-1&&Ro.delete(e)),f===-1){const h=`stream-${e}-${Qr()}`;Ro.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function Eu(e){Ro.delete(e);const t=Y.getState(),n=t.messages.get(e)||[],i=n.filter(l=>!l.isStreaming);i.length!==n.length&&t.setMessages(e,i)}function u5(){return`cmsg-${Date.now()}-${++bS}`}function Fp(){return u5()}const wS=new Set(["user_message","permission_response","interrupt","set_model","set_permission_mode","mcp_get_status","mcp_toggle","mcp_reconnect","mcp_set_servers","set_ai_validation"]);function jS(e){const t=location.protocol==="https:"?"wss:":"ws:",n=localStorage.getItem("companion_auth_token")||"";return`${t}//${location.host}/ws/browser/${e}?token=${encodeURIComponent(n)}`}function d5(e){return`companion:last-seq:${e}`}function Hp(e){const t=Ku.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(d5(e)),i=n?Number(n):0,l=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return Ku.set(e,l),l}catch{return 0}}function N1(e,t){const n=Math.max(0,Math.floor(t));Ku.set(e,n);try{localStorage.setItem(d5(e),String(n))}catch{}}function C1(e,t){Ln(e,{type:"session_ack",last_seq:t})}function Ip(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
61
+ `)}function Gh(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function kS(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const l=new Map;for(const f of i)l.set(Gh(f),f);const c=[],u=new Set;for(const f of n){const h=Gh(f);u.has(h)||(u.add(h),c.push(l.get(h)||f))}for(const f of i){const h=Gh(f);u.has(h)||(u.add(h),c.push(f))}return c}function E1(e,t,n,i,l){return{toolUseId:e,toolName:t,preview:Ho(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:l||void 0}}function qp(e,t){const n=kS(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Ip(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function SS(e,t){const n=Y.getState(),i=n.messages.get(e)||[],l=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(l===-1){n.appendMessage(e,t);return}const c=[...i];c[l]=qp(c[l],t),n.setMessages(e,c)}function NS(e,t){var l,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(l=t.data)==null?void 0:l.substring)==null?void 0:c.call(l,0,120));return}const i=Y.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),f5(e,n)}function f5(e,t,n={}){var u,f,h,p,g,v,y,b;const{processSeq:i=!0,ackSeqMessage:l=!0}=n,c=Y.getState();if(i&&typeof t.seq=="number"){const _=Hp(e);if(t.seq<=_)return;N1(e,t.seq),l&&C1(e,t.seq)}switch(t.type){case"session_init":{const _=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const k=new Set(c.sessionNames.values()),E=r5(k);c.setSessionName(e,E)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const _=t.message,k=Ip(_.content),E={id:_.id,role:"assistant",content:k,contentBlocks:_.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:_.model,stopReason:_.stop_reason};if(Eu(e),SS(e,E),c.setStreaming(e,null),ds.delete(e),ki.delete(e),(u=_.content)!=null&&u.length)for(const S of _.content)S.type==="tool_result"&&c.clearToolProgress(e,S.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=_.content)!=null&&f.length)for(const S of _.content){if(S.type==="tool_use"){const M=S.input||{};c.addToolActivity(e,E1(S.id,S.name,M,t.timestamp||Date.now(),t.parent_tool_use_id))}S.type==="tool_result"&&c.updateToolActivity(e,S.tool_use_id,{completedAt:Date.now(),isError:!!S.is_error})}(h=_.content)!=null&&h.length&&(Hh(e,_.content),Ih(e,_.content),qh(e,_.content),Vh(e,_.content));break}case"stream_event":{const _=t.event;if(_&&typeof _=="object"){if(_.type==="message_start"&&(ds.delete(e),ki.delete(e),Eu(e),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),_.type==="content_block_delta"){const k=_.delta;if((k==null?void 0:k.type)==="text_delta"&&typeof k.text=="string"){const E=ki.get(e)||{thinking:"",text:""};ds.get(e)==="thinking"&&(E.thinking=""),E.text+=k.text,ki.set(e,E),ds.set(e,"text"),c.setStreaming(e,E.text),S1(e,E.text,"text")}if((k==null?void 0:k.type)==="thinking_delta"&&typeof k.thinking=="string"){const E=ki.get(e)||{thinking:"",text:""};E.thinking+=k.thinking,ki.set(e,E),ds.set(e,"thinking"),c.setStreaming(e,E.thinking),S1(e,E.thinking,"thinking")}}if(_.type==="message_delta"){const k=_.usage;k!=null&&k.output_tokens&&c.setStreamingStats(e,{outputTokens:k.output_tokens})}}break}case"result":{Zu.delete(e),Ju.delete(e);const _=t.data,k={total_cost_usd:_.total_cost_usd,num_turns:_.num_turns};if(typeof _.total_lines_added=="number"&&(k.total_lines_added=_.total_lines_added),typeof _.total_lines_removed=="number"&&(k.total_lines_removed=_.total_lines_removed),_.modelUsage){for(const E of Object.values(_.modelUsage))if(E.contextWindow>0){const S=Math.round((E.inputTokens+E.outputTokens)/E.contextWindow*100);k.context_used_percent=Math.max(0,Math.min(S,100))}}c.updateSession(e,k),Eu(e),c.setStreaming(e,null),ds.delete(e),ki.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&Dk(),!document.hasFocus()&&c.notificationDesktop&&j1("Session completed","Claude finished the task",e),_.is_error&&((p=_.errors)!=null&&p.length)&&c.appendMessage(e,{id:Qr(),role:"system",content:`Error: ${_.errors.join(", ")}`,timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const k=t.request;j1("Permission needed",`${k.tool_name}: approve or deny`,k.request_id)}const _=t.request;if(_.tool_name&&_.input){const k=[{type:"tool_use",id:_.tool_use_id,name:_.tool_name,input:_.input}];Hh(e,k),Ih(e,k),qh(e,k),Vh(e,k)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((g=c.sdkSessions.find(k=>k.sessionId===e))==null?void 0:g.backendType)==="codex"&&c.appendMessage(e,{id:Qr(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||Qr(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((v=t.event)==null?void 0:v.subtype)==="task_notification"){const{task_id:k,status:E,summary:S}=t.event;k&&E&&c.updateProcess(e,k,{status:E,completedAt:Date.now(),summary:S||void 0})}const _=k1(t.event);if(!_)break;c.appendMessage(e,{id:Qr(),role:"system",content:_,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:Qr(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:Qr(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const _=t.phase;_==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null)):_==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null)):_==="starting"||_==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_==="ready"?c.setSessionStatus(e,"idle"):_==="streaming"?c.setSessionStatus(e,"running"):_==="compacting"?c.setSessionStatus(e,"compacting"):_==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null);break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const _=c.sessionNames.get(e),k=_&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_);(!_||k)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const _=[],k=new Map;for(let S=0;S<t.messages.length;S++){const M=t.messages[S];if(M.type==="user_message")_.push({id:M.id||Qr(),role:"user",content:M.content,timestamp:M.timestamp});else if(M.type==="assistant"){const C=M.message,$=Ip(C.content),L={id:C.id,role:"assistant",content:$,contentBlocks:C.content,timestamp:M.timestamp||Date.now(),parentToolUseId:M.parent_tool_use_id,model:C.model,stopReason:C.stop_reason},T=_.findIndex(H=>H.role==="assistant"&&H.id===L.id);if(T===-1?_.push(L):_[T]=qp(_[T],L),(y=C.content)!=null&&y.length){Hh(e,C.content),Ih(e,C.content),qh(e,C.content),Vh(e,C.content);const H=M.timestamp||Date.now();for(const z of C.content){if(z.type==="tool_use"){const G=z.input||{},O=k.get(z.id);k.set(z.id,O??E1(z.id,z.name,G,H,M.parent_tool_use_id))}if(z.type==="tool_result"){const G=k.get(z.tool_use_id);G&&k.set(z.tool_use_id,{...G,completedAt:H,isError:G.isError||!!z.is_error,elapsedSeconds:Math.max(G.elapsedSeconds,G.completedAt?G.elapsedSeconds:Math.max(0,(H-G.startedAt)/1e3))})}}}}else if(M.type==="result"){const C=M.data;C.is_error&&((b=C.errors)!=null&&b.length)&&_.push({id:`hist-error-${S}`,role:"system",content:`Error: ${C.errors.join(", ")}`,timestamp:Date.now()});const $={total_cost_usd:C.total_cost_usd,num_turns:C.num_turns};if(typeof C.total_lines_added=="number"&&($.total_lines_added=C.total_lines_added),typeof C.total_lines_removed=="number"&&($.total_lines_removed=C.total_lines_removed),C.modelUsage){for(const L of Object.values(C.modelUsage))if(L.contextWindow>0){const T=L,H=Math.round((T.inputTokens+T.outputTokens)/T.contextWindow*100);$.context_used_percent=Math.max(0,Math.min(H,100))}}c.updateSession(e,$)}else if(M.type==="system_event"){const C=k1(M.event);if(!C)continue;_.push({id:`hist-system-event-${S}`,role:"system",content:C,timestamp:M.timestamp||Date.now()})}}if(_.length>0){const S=c.messages.get(e)||[];if(S.length===0)c.setMessages(e,_);else{const M=[...S];for(const C of _){const $=M.findIndex(T=>T.id===C.id);if($===-1){M.push(C);continue}const L=M[$];L.role==="assistant"&&C.role==="assistant"?M[$]=qp(L,C):M[$]=C}M.sort((C,$)=>(C.timestamp??0)-($.timestamp??0)),c.setMessages(e,M)}}c.setToolActivity(e,Array.from(k.values()).sort((S,M)=>S.startedAt-M.startedAt));const E=t.messages[t.messages.length-1];(E==null?void 0:E.type)==="result"&&(Eu(e),c.setStreaming(e,null),ds.delete(e),ki.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let _;for(const k of t.events){const E=Hp(e);k.seq<=E||(N1(e,k.seq),_=k.seq,f5(e,k.message,{processSeq:!1,ackSeqMessage:!1}))}typeof _=="number"&&C1(e,_);break}case"prompt_suggestion":{const _=t.suggestions;c.setPromptSuggestions(e,_);break}case"streamlined_text":{c.appendMessage(e,{id:Qr(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:Qr(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function nc(e){const t=Pr.get(e);if(o5(t))return;if(t){try{t.close()}catch{}Pr.delete(e)}Y.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(jS(e));Pr.set(e,i),i.onopen=()=>{const l=Hp(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:l})),_S(e,i);const c=Ei.get(e);c&&(clearTimeout(c),Ei.delete(e))},i.onmessage=l=>NS(e,l),i.onclose=()=>{Pr.get(e)===i&&(Pr.delete(e),Y.getState().setConnectionStatus(e,"disconnected"),CS(e))},i.onerror=()=>{i.close()}}function CS(e){if(Ei.has(e)||qo)return;const t=setTimeout(()=>{Ei.delete(e),!qo&&c5(e)&&nc(e)},fS);Ei.set(e,t)}function Vp(e){const t=Ei.get(e);t&&(clearTimeout(t),Ei.delete(e));const n=Pr.get(e);n&&(n.close(),Pr.delete(e)),Y.getState().setConnectionStatus(e,"disconnected"),Zu.delete(e),Ju.delete(e),wo.delete(e),Iu.delete(e),ds.delete(e),Ro.delete(e),ki.delete(e),Ku.delete(e),Io.delete(e)}function ES(e){if(!qo)for(const t of e)t.archived||nc(t.sessionId)}function TS(e){return new Promise((t,n)=>{const i=setInterval(()=>{const c=Pr.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(l),t())},50),l=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Ln(e,t){const n=Pr.get(e);let i=t;const l=wS.has(t.type);if(l)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":t.client_msg_id||(i={...t,client_msg_id:u5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}l&&yS(e,i)}function T1(e){Ln(e,{type:"mcp_get_status"})}function AS(e,t,n){Ln(e,{type:"mcp_toggle",serverName:t,enabled:n})}function MS(e,t){Ln(e,{type:"mcp_reconnect",serverName:t})}function RS(e,t){Ln(e,{type:"mcp_set_servers",servers:t})}function LS(e,t){Ln(e,{type:"set_ai_validation",...t})}var re=typeof window<"u"?window:void 0,un=typeof globalThis<"u"?globalThis:re;typeof self>"u"&&(un.self=un),typeof File>"u"&&(un.File=function(){});var sr=un==null?void 0:un.navigator,Ne=un==null?void 0:un.document,yn=un==null?void 0:un.location,Gp=un==null?void 0:un.fetch,Xp=un!=null&&un.XMLHttpRequest&&"withCredentials"in new un.XMLHttpRequest?un.XMLHttpRequest:void 0,A1=un==null?void 0:un.AbortController,DS=un==null?void 0:un.CompressionStream,Vn=sr==null?void 0:sr.userAgent,Le=re??{},M1="1.369.3",Rn={DEBUG:!1,LIB_VERSION:M1,LIB_NAME:"web",JS_SDK_VERSION:M1};function R1(e,t,n,i,l,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,l)}function Br(e){return function(){var t=this,n=arguments;return new Promise((function(i,l){var c=e.apply(t,n);function u(h){R1(c,i,l,u,f,"next",h)}function f(h){R1(c,i,l,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ye.apply(null,arguments)}function h5(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function p5(){return(p5=Br((function*(e,t,n){t===void 0&&(t=!0);try{var i=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(i).blob()}catch(l){if(n!=null&&n.rethrow)throw l;return t&&console.error("Failed to gzip compress data",l),null}}))).apply(this,arguments)}var zS=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],OS=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],L1=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return OS.concat(t).some((i=>{var l=i.toLowerCase();return n.indexOf(l)!==-1}))};function tt(e,t){return e.indexOf(t)!==-1}var jd=function(e){return e.trim()},Yp=function(e){return e.replace(/^\$/,"")},m5=Object.prototype,g5=m5.hasOwnProperty,kd=m5.toString,ut=Array.isArray||function(e){return kd.call(e)==="[object Array]"},Ni=e=>typeof e=="function",cn=e=>e===Object(e)&&!ut(e),Va=e=>{if(cn(e)){for(var t in e)if(g5.call(e,t))return!1;return!0}return!1},Te=e=>e===void 0,sn=e=>kd.call(e)=="[object String]",Vu=e=>sn(e)&&e.trim().length===0,Ai=e=>e===null,at=e=>Te(e)||Ai(e),Fr=e=>kd.call(e)=="[object Number]"&&e==e,$a=e=>Fr(e)&&e>0,ei=e=>kd.call(e)==="[object Boolean]",BS=e=>e instanceof FormData,US=e=>tt(zS,e);function x5(e){return e===null||typeof e!="object"}function ed(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Um(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var PS=[!0,"true",1,"1","yes"],Xh=e=>tt(PS,e),$S=[!1,"false",0,"0","no"];function ti(e,t,n,i,l){return t>n&&(i.warn("min cannot be greater than max."),t=n),Fr(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),ti(l||n,t,n,i))}class FS{constructor(t){this.Pt={},this.Dt=t.Dt,this.jt=ti(t.bucketSize,0,100,t.qt),this.$t=ti(t.refillRate,0,this.jt,t.qt),this.Vt=ti(t.refillInterval,0,864e5,t.qt)}Ht(t,n){var i=Math.floor((n-t.lastAccess)/this.Vt);i>0&&(t.tokens=Math.min(t.tokens+i*this.$t,this.jt),t.lastAccess=t.lastAccess+i*this.Vt)}consumeRateLimit(t){var n,i=Date.now(),l=String(t),c=this.Pt[l];return c?this.Ht(c,i):this.Pt[l]=c={tokens:this.jt,lastAccess:i},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.Dt)==null||n.call(this,t)),c.tokens===0)}stop(){this.Pt={}}}var Tu,D1,Yh,ar="Mobile",td="iOS",Ci="Android",Za="Tablet",v5=Ci+" "+Za,b5="iPad",y5="Apple",_5=y5+" Watch",Lo="Safari",Ja="BlackBerry",w5="Samsung",j5=w5+"Browser",k5=w5+" Internet",Is="Chrome",HS=Is+" OS",S5=Is+" "+td,Pm="Internet Explorer",N5=Pm+" "+ar,$m="Opera",IS=$m+" Mini",Fm="Edge",C5="Microsoft "+Fm,Ya="Firefox",E5=Ya+" "+td,Vo="Nintendo",Go="PlayStation",Wa="Xbox",T5=Ci+" "+ar,A5=ar+" "+Lo,jo="Windows",Wp=jo+" Phone",z1="Nokia",Qp="Ouya",M5="Generic",qS=M5+" "+ar.toLowerCase(),R5=M5+" "+Za.toLowerCase(),Kp="Konqueror",Mn="(\\d+(\\.\\d+)?)",Wh=new RegExp("Version/"+Mn),VS=new RegExp(Wa,"i"),GS=new RegExp(Go+" \\w+","i"),XS=new RegExp(Vo+" \\w+","i"),Hm=new RegExp(Ja+"|PlayBook|BB10","i"),YS={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},L5=function(e,t){return t=t||"",tt(e," OPR/")&&tt(e,"Mini")?IS:tt(e," OPR/")?$m:Hm.test(e)?Ja:tt(e,"IE"+ar)||tt(e,"WPDesktop")?N5:tt(e,j5)?k5:tt(e,Fm)||tt(e,"Edg/")?C5:tt(e,"FBIOS")?"Facebook "+ar:tt(e,"UCWEB")||tt(e,"UCBrowser")?"UC Browser":tt(e,"CriOS")?S5:tt(e,"CrMo")||tt(e,Is)?Is:tt(e,Ci)&&tt(e,Lo)?T5:tt(e,"FxiOS")?E5:tt(e.toLowerCase(),Kp.toLowerCase())?Kp:((n,i)=>i&&tt(i,y5)||(function(l){return tt(l,Lo)&&!tt(l,Is)&&!tt(l,Ci)})(n))(e,t)?tt(e,ar)?A5:Lo:tt(e,Ya)?Ya:tt(e,"MSIE")||tt(e,"Trident/")?Pm:tt(e,"Gecko")?Ya:""},WS={[N5]:[new RegExp("rv:"+Mn)],[C5]:[new RegExp(Fm+"?\\/"+Mn)],[Is]:[new RegExp("("+Is+"|CrMo)\\/"+Mn)],[S5]:[new RegExp("CriOS\\/"+Mn)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Mn)],[Lo]:[Wh],[A5]:[Wh],[$m]:[new RegExp("(Opera|OPR)\\/"+Mn)],[Ya]:[new RegExp(Ya+"\\/"+Mn)],[E5]:[new RegExp("FxiOS\\/"+Mn)],[Kp]:[new RegExp("Konqueror[:/]?"+Mn,"i")],[Ja]:[new RegExp(Ja+" "+Mn),Wh],[T5]:[new RegExp("android\\s"+Mn,"i")],[k5]:[new RegExp(j5+"\\/"+Mn)],[Pm]:[new RegExp("(rv:|MSIE )"+Mn)],Mozilla:[new RegExp("rv:"+Mn)]},QS=function(e,t){var n=L5(e,t),i=WS[n];if(Te(i))return null;for(var l=0;i.length>l;l++){var c=e.match(i[l]);if(c)return parseFloat(c[c.length-2])}return null},O1=[[new RegExp(Wa+"; "+Wa+" (.*?)[);]","i"),e=>[Wa,e&&e[1]||""]],[new RegExp(Vo,"i"),[Vo,""]],[new RegExp(Go,"i"),[Go,""]],[Hm,[Ja,""]],[new RegExp(jo,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Wp,""];if(new RegExp(ar).test(t)&&!/IEMobile\b/.test(t))return[jo+" "+ar,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=YS[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[jo,i]}return[jo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[td,[e[3],e[4],e[5]||"0"].join(".")]:[td,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Te(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ci+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ci+")","i"),e=>e&&e[2]?[Ci,[e[2],e[3],e[4]||"0"].join(".")]:[Ci,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[HS,""]],[/Linux|debian/i,["Linux",""]]],B1=function(e){return XS.test(e)?Vo:GS.test(e)?Go:VS.test(e)?Wa:new RegExp(Qp,"i").test(e)?Qp:new RegExp("("+Wp+"|WPDesktop)","i").test(e)?Wp:/iPad/.test(e)?b5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?_5:Hm.test(e)?Ja:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(z1,"i").test(e)?z1:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ar).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ci:v5:new RegExp("(pda|"+ar+")","i").test(e)?qS:new RegExp(Za,"i").test(e)&&!new RegExp(Za+" pc","i").test(e)?R5:""},KS=e=>e instanceof Error;function ZS(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Yh&&n.length===D1||(D1=n.length,Yh=n.reduce(((i,l)=>{Tu||(Tu={});var c=Tu[l];if(c)i[c[0]]=c[1];else for(var u=e(l),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[l];if(p&&g){i[p]=g,Tu[l]=[p,g];break}}return i}),{})),Yh}}class JS{constructor(t,n,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}buildFromUnknown(t,n){n===void 0&&(n={});var i=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(i,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(l,c);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return Br((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&ut(i.stacktrace.frames)&&(i.stacktrace.frames=yield n.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var i,l;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:i,stack:l})}applyChunkIds(t,n){return t.map((i=>(i.filename&&n&&(i.chunk_id=n[i.filename]),i)))}applyCoercers(t,n){for(var i of this.coercers)if(i.match(t))return i.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Br((function*(){var i=t;for(var l of n.modifiers)i=yield l(i);return i}))()}convertToExceptionList(t,n){var i,l,c,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:ZS(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var l=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:c=>l(c,i),next:c=>l(c,i+1)})}}var el="?";function Zp(e,t,n,i,l){var c={platform:e,filename:t,function:n==="<anonymous>"?el:n,in_app:!0};return Te(i)||(c.lineno=i),Te(l)||(c.colno=l),c}var D5=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:el,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},eN=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tN=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nN=/\((\S*)(?::(\d+))(?::(\d+))\)/,rN=(e,t)=>{var n=eN.exec(e);if(n){var[,i,l,c]=n;return Zp(t,i,el,+l,+c)}var u=tN.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=nN.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=D5(u[1]||el,u[2]);return Zp(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},iN=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sN=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,aN=(e,t)=>{var n=iN.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=sN.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var l=n[3],c=n[1]||el;return[c,l]=D5(c,l),Zp(t,l,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},U1=/\(error: (.*)\)/;class lN{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=sn(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return ed(t,"DOMException")}isDOMError(t){return ed(t,"DOMError")}}class oN{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class cN{constructor(){}match(t){return ed(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var i;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var uN=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class dN{match(t){return typeof t=="string"}coerce(t,n){var i,[l,c]=this.getInfos(t);return{type:l??"Error",value:c??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,l=t.match(uN);return l&&(n=l[1],i=l[2]),[n,i]}}var fN=["fatal","error","warning","log","info","debug"];function z5(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var l=n.slice(0,i).join(", ");if(t>=l.length)return i===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class hN{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(i=n.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Um(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+z5(t)}isSeverityLevel(t){return sn(t)&&!Vu(t)&&fN.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(KS(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class pN{match(t){return Um(t)}coerce(t,n){var i,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+z5(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class mN{match(t){return x5(t)}coerce(t,n){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class gN{match(t){return ed(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Um(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i,l=this.getUnhandledRejectionReason(t);return x5(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(l)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var O5=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,i={C(l){if(re&&(Rn.DEBUG||Le.POSTHOG_DEBUG||n)&&!Te(re.console)&&re.console){for(var c=("__rrweb_original__"in re.console[l])?re.console[l].__rrweb_original__:re.console[l],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},info(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.C("log",...c)},warn(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.C("warn",...c)},error(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.C("error",...c)},critical(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(l){i.error("You must initialize PostHog before calling "+l)},createLogger:(l,c)=>O5(e+" "+l,c)};return i},Ee=O5("[PostHog.js]"),Ut=Ee.createLogger,xN=Ut("[ExternalScriptsLoader]"),Qh=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return xN.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Ne==null?void 0:Ne.querySelectorAll("script");if(i){for(var l,c=function(){if(i[u].src===t){var h=i[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;i.length>u;u++)if(l=c())return l.v}var f=()=>{if(!Ne)return n("document not found");var h=Ne.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ne.head.appendChild(h);else{var p,g=Ne.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ne.body.appendChild(h)}};Ne!=null&&Ne.body?f():Ne==null||Ne.addEventListener("DOMContentLoaded",f)};Le.__PosthogExtensions__=Le.__PosthogExtensions__||{},Le.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var i;if(e.config.__preview_external_dependency_versioned_paths)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;l=l+"&t="+Math.floor(Date.now()/c)*c}i=e.requestRouter.endpointFor("assets",l)}Qh(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Qh(e,u,n)}},Le.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);Qh(e,i,n)};var B5="$people_distinct_id",nd="$device_id",ko="__alias",So="__timers",P1="$autocapture_disabled_server_side",Jp="$heatmaps_enabled_server_side",$1="$exception_capture_enabled_server_side",em="$error_tracking_suppression_rules",F1="$error_tracking_capture_extension_exceptions",H1="$web_vitals_enabled_server_side",U5="$dead_clicks_enabled_server_side",tm="$product_tours_enabled_server_side",I1="$web_vitals_allowed_metrics",No="$session_recording_remote_config",rd="$sesid",P5="$session_is_sampled",Ga="$enabled_feature_flags",Co="$early_access_features",nm="$feature_flag_details",q1="$feature_flag_payloads",Fa="$override_feature_flag_payloads",Eo="$stored_person_properties",Hs="$stored_group_properties",rm="$surveys",Gu="ph_product_tours",Do="$flag_call_reported",im="$flag_call_reported_session_id",sm="$feature_flag_errors",id="$feature_flag_evaluated_at",Or="$user_state",am="$client_session_props",lm="$capture_rate_limit",om="$initial_campaign_params",cm="$initial_referrer_info",sd="$initial_person_info",ad="$epp",$5="__POSTHOG_TOOLBAR__",Au="$posthog_cookieless",vN=[B5,ko,"__cmpns",So,"$session_recording_enabled_server_side",Jp,rd,Ga,em,Or,Co,nm,Hs,Eo,rm,Do,im,sm,id,am,lm,om,cm,ad,sd,Gu,"$product_tours_activated",tm,No,Fa],Im="PostHog loadExternalDependency extension not found.",Si="on_reject",Ur="always",Ra="anonymous",La="identified",um="identified_only",ld="visibilitychange",od="beforeunload",Ha="$pageview",Kh="$pageleave",Zh="$identify",V1="$groupidentify";function Mu(e,t){ut(e)&&e.forEach(t)}function Dt(e,t){if(!at(e))if(ut(e))e.forEach(t);else if(BS(e))e.forEach(((i,l)=>t(i,l)));else for(var n in e)g5.call(e,n)&&t(e[n],n)}var Wt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var l of n)for(var c in l)l[c]!==void 0&&(e[c]=l[c]);return e};function Xu(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var G1=function(e){try{return e()}catch{return}},bN=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(l){Ee.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ee.critical(l)}}},qm=function(e){var t={};return Dt(e,(function(n,i){(sn(n)&&n.length>0||Fr(n))&&(t[i]=n)})),t},yN=["herokuapp.com","vercel.app","netlify.app"];function _N(e){var t=e==null?void 0:e.hostname;if(!sn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of yN)if(n===i)return!1;return!0}function rn(e,t,n,i){var{capture:l=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:l,passive:c})}function F5(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Fr(e)&&isFinite(e)&&Math.floor(e)===e});class cd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(l)||0>t||0>n||0>i||0>l||t>0xffffffffffff||n>4095||i>1073741823||l>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|i>>>24,c[9]=i>>>16,c[10]=i>>>8,c[11]=i,c[12]=l>>>24,c[13]=l>>>16,c[14]=l>>>8,c[15]=l,new cd(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new cd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}}class wN{constructor(){this.I=0,this.S=0,this.k=new jN}generate(){var t=this.generateOrAbort();if(Te(t)){this.I=0;var n=this.generateOrAbort();if(Te(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return cd.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var X1,H5=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};re&&!Te(re.crypto)&&crypto.getRandomValues&&(H5=e=>crypto.getRandomValues(e));class jN{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(H5(this.T),this.N=0),this.T[this.N++]}}var fs=()=>kN().toString(),kN=()=>(X1||(X1=new wN)).generate(),co="",SN=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Jr={Ut:()=>!!Ne,Yt(e){Ee.error("cookieStore error: "+e)},Gt(e){if(Ne){try{for(var t=e+"=",n=Ne.cookie.split(";").filter((c=>c.length)),i=0;n.length>i;i++){for(var l=n[i];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}},Wt(e){var t;try{t=JSON.parse(Jr.Gt(e))||{}}catch{}return t},Xt(e,t,n,i,l){if(Ne)try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,k){if(k===void 0&&(k=Ne),co)return co;if(!k||["localhost","127.0.0.1"].includes(_))return"";for(var E=_.split("."),S=Math.min(E.length,8),M="dmn_chk_"+fs();!co&&S--;){var C=E.slice(S).join("."),$=M+"=1;domain=."+C+";path=/";k.cookie=$+";max-age=3",k.cookie.includes(M)&&(k.cookie=$+";max-age=0",co=C)}return co})(g);if(!y){var b=(_=>{var k=_.match(SN);return k?k[0]:""})(g);b!==y&&Ee.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ne.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}l&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&Ee.warn("cookieStore warning: large cookie, len="+p.length),Ne.cookie=p,p}catch{return}},Jt(e,t){if(Ne!=null&&Ne.cookie)try{Jr.Xt(e,"",-1,t)}catch{return}}},Jh=null,Pt={Ut(){if(!Ai(Jh))return Jh;var e=!0;if(Te(re))e=!1;else try{var t="__mplssupport__";Pt.Xt(t,"xyz"),Pt.Gt(t)!=='"xyz"'&&(e=!1),Pt.Jt(t)}catch{e=!1}return e||Ee.error("localStorage unsupported; falling back to cookie store"),Jh=e,e},Yt(e){Ee.error("localStorage error: "+e)},Gt(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){Pt.Yt(t)}return null},Wt(e){try{return JSON.parse(Pt.Gt(e))||{}}catch{}return null},Xt(e,t){try{re==null||re.localStorage.setItem(e,JSON.stringify(t))}catch(n){Pt.Yt(n)}},Jt(e){try{re==null||re.localStorage.removeItem(e)}catch(t){Pt.Yt(t)}}},NN=[nd,"distinct_id",rd,P5,ad,sd,Or],Ru={},CN={Ut:()=>!0,Yt(e){Ee.error("memoryStorage error: "+e)},Gt:e=>Ru[e]||null,Wt:e=>Ru[e]||null,Xt(e,t){Ru[e]=t},Jt(e){delete Ru[e]}},Bs=null,_n={Ut(){if(!Ai(Bs))return Bs;if(Bs=!0,Te(re))Bs=!1;else try{var e="__support__";_n.Xt(e,"xyz"),_n.Gt(e)!=='"xyz"'&&(Bs=!1),_n.Jt(e)}catch{Bs=!1}return Bs},Yt(e){Ee.error("sessionStorage error: ",e)},Gt(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){_n.Yt(t)}return null},Wt(e){try{return JSON.parse(_n.Gt(e))||null}catch{}return null},Xt(e,t){try{re==null||re.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){_n.Yt(n)}},Jt(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){_n.Yt(t)}}};class EN{constructor(t){this._instance=t}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===Ur||this.consent===0||this.consent===-1&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===Si)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}optInOut(t){this.ti.Xt(this.ei,t?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ti.Jt(this.ei,this.Rt.cross_subdomain_cookie)}get ei(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:i}=this._instance.config;return i||(n?n+t:"__ph_opt_in_out_"+t)}get Qt(){var t=this.ti.Gt(this.ei);return Xh(t)?1:tt($S,t)?0:-1}get ti(){var t=this.Rt.opt_out_capturing_persistence_type,n=t==="localStorage"?Pt:Jr;if(!this.ii||this.ii!==n){this.ii=n;var i=t==="localStorage"?Jr:Pt;i.Gt(this.ei)&&(this.ii.Gt(this.ei)||this.optInOut(Xh(i.Gt(this.ei))),i.Jt(this.ei,this.Rt.cross_subdomain_cookie))}return this.ii}Kt(){return!!this.Rt.respect_dnt&&[sr==null?void 0:sr.doNotTrack,sr==null?void 0:sr.msDoNotTrack,Le.doNotTrack].some((t=>Xh(t)))}}var Lu=Ut("[Dead Clicks]"),TN=()=>!0,AN=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(U5)),i=e.instance.config.capture_dead_clicks;return ei(i)?i:!!cn(i)||n};class Y1{get lazyLoadedDeadClicksAutocapture(){return this.ri}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[U5]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ni((()=>{this.si()})):this.stop()}ni(t){var n,i;(n=Le.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&t(),(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?Lu.error("failed to load script",l):t()}))}si(){var t;if(Ne){if(!this.ri&&(t=Le.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=cn(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.ri=Le.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.ri.start(Ne),Lu.info("starting...")}}else Lu.error("`document` not found. Cannot start.")}stop(){this.ri&&(this.ri.stop(),this.ri=void 0,Lu.info("stopping..."))}}var ep=Ut("[SegmentIntegration]"),I5="posthog-js";function q5(e,t){var{organization:n,projectId:i,prefix:l,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,k=((h=f.exception)==null?void 0:h.values)||[],E=k.map((M=>ye({},M,{stacktrace:M.stacktrace?ye({},M.stacktrace,{type:"raw",frames:(M.stacktrace.frames||[]).map((C=>ye({},C,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((p=k[0])==null?void 0:p.value)||f.message,$exception_type:(g=k[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:E,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=k[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=k[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&i&&(S.$sentry_url=(l||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(S)),f}}class MN{constructor(t,n,i,l,c,u){this.name=I5,this.setupOnce=function(f){f(q5(t,{organization:n,projectId:i,prefix:l,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class W1{constructor(t){this.oi=(n,i,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength)&&(Ee.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),this.ai=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.li()}li(){var t;this.ui=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.oi)}destroy(){var t;(t=this.ui)==null||t.call(this),this.ui=void 0}doPageView(t,n){var i,l=this.hi(t,n);return this.ai={pathname:(i=re==null?void 0:re.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}doPageLeave(t){var n;return this.hi(t,(n=this.ai)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ai)==null?void 0:t.pageViewId}}hi(t,n){var i=this.ai;if(!i)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:i.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Te(u)||Te(f)||Te(h)||Te(p)||Te(g)||Te(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?ti(f/u,0,1,Ee):1,b=u>1?ti(h/u,0,1,Ee):1,_=p>1?ti(g/p,0,1,Ee):1,k=p>1?ti(v/p,0,1,Ee):1;l=Wt(l,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:k})}}return i.pathname&&(l.$prev_pageview_pathname=i.pathname),i.timestamp&&(l.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),l}}var ud=e=>{var t=Ne==null?void 0:Ne.createElement("a");return Te(t)?null:(t.href=e,t)},dd=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;i.length>l;l++){var c=i[l].split("=");if(c[0]===t){n=c;break}}if(!ut(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{Ee.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Xo=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),l=i[1],c=(i[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");ut(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),l!=null&&(y+="#"+l),y},fd=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Du="https?://(.*)",tl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],RN=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...tl],Yo="<masked>",LN=["li_fat_id"];function V5(e,t,n){if(!Ne)return{};var i,l=t?[...tl,...n||[]]:[],c=G5(Xo(Ne.URL,l,Yo),e),u=(i={},Dt(LN,(function(f){var h=Jr.Gt(f);i[f]=h||null})),i);return Wt(u,c)}function G5(e,t){var n=RN.concat(t||[]),i={};return Dt(n,(function(l){var c=dd(e,l);i[l]=c||null})),i}function X5(e){var t=(function(c){return c?c.search(Du+"google.([^/?]*)")===0?"google":c.search(Du+"bing.com")===0?"bing":c.search(Du+"yahoo.com")===0?"yahoo":c.search(Du+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Ai(t)){i.$search_engine=t;var l=Ne?dd(Ne.referrer,n):"";l.length&&(i.ph_keyword=l)}return i}function Q1(){return navigator.language||navigator.userLanguage}var hd="$direct";function Y5(){return(Ne==null?void 0:Ne.referrer)||hd}function W5(e,t){var n=e?[...tl,...t||[]]:[],i=yn==null?void 0:yn.href.substring(0,1e3);return{r:Y5().substring(0,1e3),u:i?Xo(i,n,Yo):void 0}}function Q5(e){var t,{r:n,u:i}=e,l={$referrer:n,$referring_domain:n==null?void 0:n==hd?hd:(t=ud(n))==null?void 0:t.host};if(i){l.$current_url=i;var c=ud(i);l.$host=c==null?void 0:c.host,l.$pathname=c==null?void 0:c.pathname;var u=G5(i);Wt(l,u)}if(n){var f=X5(n);Wt(l,f)}return l}function K5(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function DN(){try{return new Date().getTimezoneOffset()}catch{return}}var zN=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class tp{constructor(t,n){this.Rt=t,this.props={},this.ci=!1,this.di=(i=>{var l="";return i.token&&(l=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+l+"_posthog"})(t),this.ti=this.vi(t),this.load(),t.debug&&Ee.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.fi}vi(t){zN.indexOf(t.persistence.toLowerCase())===-1&&(Ee.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=(function(l){l===void 0&&(l=[]);var c=[...NN,...l];return ye({},Pt,{Wt(u){try{var f={};try{f=Jr.Wt(u)||{}}catch{}var h=Wt(f,JSON.parse(Pt.Gt(u)||"{}"));return Pt.Xt(u,h),h}catch{}return null},Xt(u,f,h,p,g,v){try{Pt.Xt(u,f,void 0,void 0,v);var y={};c.forEach((b=>{f[b]&&(y[b]=f[b])})),Object.keys(y).length&&Jr.Xt(u,y,h,p,g,v)}catch(b){Pt.Yt(b)}},Jt(u,f){try{re==null||re.localStorage.removeItem(u),Jr.Jt(u,f)}catch(h){Pt.Yt(h)}}})})(t.cookie_persisted_properties||[]),i=t.persistence.toLowerCase();return i==="localstorage"&&Pt.Ut()?Pt:i==="localstorage+cookie"&&n.Ut()?n:i==="sessionstorage"&&_n.Ut()?_n:i==="memory"?CN:i==="cookie"?Jr:n.Ut()?n:Jr}pi(t){var n=t??this.Rt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[id];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return Dt(this.props,((n,i)=>{if(i===Ga&&cn(n)){if(!this.pi())for(var l=Object.keys(n),c=0;l.length>c;c++)t["$feature/"+l[c]]=n[l[c]]}else vN.indexOf(i)===-1&&(t[i]=n)})),t}load(){if(!this.fi){var t=this.ti.Wt(this.di);t&&(this.props=Wt({},t))}}save(){this.fi||this.ti.Xt(this.di,this.props,this.gi,this.mi,this.yi,this.Rt.debug)}remove(){this.ti.Jt(this.di,!1),this.ti.Jt(this.di,!0)}clear(){this.remove(),this.props={}}register_once(t,n,i){if(cn(t)){Te(n)&&(n="None"),this.gi=Te(i)?this.bi:i;var l=!1;if(Dt(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.props[u]=c,l=!0)})),l)return this.save(),!0}return!1}register(t,n){if(cn(t)){this.gi=Te(n)?this.bi:n;var i=!1;if(Dt(t,((l,c)=>{t.hasOwnProperty(c)&&this.props[c]!==l&&(this.props[c]=l,i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.ci){var t=V5(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);Va(qm(t))||this.register(t),this.ci=!0}}update_search_keyword(){var t;this.register((t=Ne==null?void 0:Ne.referrer)?X5(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Y5(),$referring_domain:Ne!=null&&Ne.referrer&&((t=ud(Ne.referrer))==null?void 0:t.host)||hd},void 0)}set_initial_person_info(){this.props[om]||this.props[cm]||this.register_once({[sd]:W5(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Dt([cm,om],(u=>{var f=this.props[u];f&&Dt(f,(function(h,p){t["$initial_"+Yp(p)]=h}))}));var n,i,l=this.props[sd];if(l){var c=(n=Q5(l),i={},Dt(n,(function(u,f){i["$initial_"+Yp(f)]=u})),i);Wt(t,c)}return t}safe_merge(t){return Dt(this.props,(function(n,i){i in t||(t[i]=n)})),t}update_config(t,n,i){if(this.bi=this.gi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence||!((u,f)=>{if(u.length!==f.length)return!1;var h=[...u].sort(),p=[...f].sort();return h.every(((g,v)=>g===p[v]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var l=this.vi(t),c=this.props;this.clear(),this.ti=l,this.props=c,this.save()}}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.mi&&(this.mi=t,this.remove(),this.save())}set_secure(t){t!==this.yi&&(this.yi=t,this.remove(),this.save())}set_event_timer(t,n){var i=this.props[So]||{};i[t]=n,this.props[So]=i,this.save()}remove_event_timer(t){var n=(this.props[So]||{})[t];return Te(n)||(delete this.props[So][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var uo={Activation:"events",Cancellation:"cancelEvents"},np={Popover:"popover",API:"api",Widget:"widget"},To={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},rp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},dm={Popover:"popover",Inline:"inline"},ON={SHOWN:"product tour shown"},K1={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Z1=Ut("[RateLimiter]");class BN{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var i=n.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((l=>{Z1.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void Z1.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,i,l;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(lm))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(l=this.instance.persistence)==null||l.set_property(lm,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var fo=Ut("[RemoteConfig]");class Z5{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Le._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}wi(t){var n,i;(n=Le.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Ii(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return fo.info("Using preloaded remote config",this.remoteConfig),this.Ci(this.remoteConfig),void this.Si();if(this._instance.ki())return void fo.warn("Remote config is disabled. Falling back to local config.");this.wi((t=>{if(!t)return fo.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ii((n=>{this.Ci(n),this.Si()}));this.Ci(t),this.Si()}))}catch(t){fo.error("Error loading remote config",t)}}stop(){this.xi&&(clearInterval(this.xi),this.xi=void 0)}refresh(){this._instance.ki()||(Ne==null?void 0:Ne.visibilityState)==="hidden"||this._instance.reloadFeatureFlags()}Si(){var t;if(!this.xi){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.xi=setInterval((()=>{this.refresh()}),n))}}Ci(t){var n;t||fo.error("Failed to fetch remote config from PostHog."),this._instance.Ci(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var Zr={GZipJS:"gzip-js",Base64:"base64"},jr=Uint8Array,Gn=Uint16Array,nl=Uint32Array,Vm=new jr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gm=new jr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),J1=new jr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),J5=function(e,t){for(var n=new Gn(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var l=new nl(n[30]);for(i=1;30>i;++i)for(var c=n[i];n[i+1]>c;++c)l[c]=c-n[i]<<5|i;return[n,l]},e_=J5(Vm,2),fm=e_[1];e_[0][28]=258,fm[258]=28;for(var eb=J5(Gm,0)[1],t_=new Gn(32768),zt=0;32768>zt;++zt){var Da=(43690&zt)>>>1|(21845&zt)<<1;t_[zt]=((65280&(Da=(61680&(Da=(52428&Da)>>>2|(13107&Da)<<2))>>>4|(3855&Da)<<4))>>>8|(255&Da)<<8)>>>1}var zo=function(e,t,n){for(var i=e.length,l=0,c=new Gn(t);i>l;++l)++c[e[l]-1];var u,f=new Gn(t);for(l=0;t>l;++l)f[l]=f[l-1]+c[l-1]<<1;for(u=new Gn(i),l=0;i>l;++l)u[l]=t_[f[e[l]-1]++]>>>15-e[l];return u},qs=new jr(288);for(zt=0;144>zt;++zt)qs[zt]=8;for(zt=144;256>zt;++zt)qs[zt]=9;for(zt=256;280>zt;++zt)qs[zt]=7;for(zt=280;288>zt;++zt)qs[zt]=8;var pd=new jr(32);for(zt=0;32>zt;++zt)pd[zt]=5;var UN=zo(qs,9),PN=zo(pd,5),n_=function(e){return(e/8>>0)+(7&e&&1)},r_=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof Gn?Gn:e instanceof nl?nl:jr)(n-t);return i.set(e.subarray(t,n)),i},wi=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},ho=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},ip=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var l=n.length,c=n.slice();if(!l)return[new jr(0),0];if(l==1){var u=new jr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(L,T){return L.f-T.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=l-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(i=1;l>i;++i)c[i].s>y&&(y=c[i].s);var b=new Gn(y+1),_=hm(n[g-1],b,0);if(_>t){i=0;var k=0,E=_-t,S=1<<E;for(c.sort((function(L,T){return b[T.s]-b[L.s]||L.f-T.f}));l>i;++i){var M=c[i].s;if(t>=b[M])break;k+=S-(1<<_-b[M]),b[M]=t}for(k>>>=E;k>0;){var C=c[i].s;t>b[C]?k-=1<<t-b[C]++-1:++i}for(;i>=0&&k;--i){var $=c[i].s;b[$]==t&&(--b[$],++k)}_=t}return[new jr(b),_]},hm=function(e,t,n){return e.s==-1?Math.max(hm(e.l,t,n+1),hm(e.r,t,n+1)):t[e.s]=n},tb=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Gn(++t),i=0,l=e[0],c=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==l&&f!=t)++c;else{if(!l&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(l),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(l);c=1,l=e[f]}return[n.subarray(0,i),t]},po=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},pm=function(e,t,n){var i=n.length,l=n_(t+2);e[l]=255&i,e[l+1]=i>>>8,e[l+2]=255^e[l],e[l+3]=255^e[l+1];for(var c=0;i>c;++c)e[l+c+4]=n[c];return 8*(l+4+i)},nb=function(e,t,n,i,l,c,u,f,h,p,g){wi(t,g++,n),++l[256];for(var v=ip(l,15),y=v[0],b=v[1],_=ip(c,15),k=_[0],E=_[1],S=tb(y),M=S[0],C=S[1],$=tb(k),L=$[0],T=$[1],H=new Gn(19),z=0;M.length>z;++z)H[31&M[z]]++;for(z=0;L.length>z;++z)H[31&L[z]]++;for(var G=ip(H,7),O=G[0],I=G[1],R=19;R>4&&!O[J1[R-1]];--R);var oe,J,X,B,U=p+5<<3,Z=po(l,qs)+po(c,pd)+u,me=po(l,y)+po(c,k)+u+14+3*R+po(H,O)+(2*H[16]+3*H[17]+7*H[18]);if(Z>=U&&me>=U)return pm(t,g,e.subarray(h,h+p));if(wi(t,g,1+(Z>me)),g+=2,Z>me){oe=zo(y,b),J=y,X=zo(k,E),B=k;var D=zo(O,I);for(wi(t,g,C-257),wi(t,g+5,T-1),wi(t,g+10,R-4),g+=14,z=0;R>z;++z)wi(t,g+3*z,O[J1[z]]);g+=3*R;for(var P=[M,L],Q=0;2>Q;++Q){var A=P[Q];for(z=0;A.length>z;++z)wi(t,g,D[pe=31&A[z]]),g+=O[pe],pe>15&&(wi(t,g,A[z]>>>5&127),g+=A[z]>>>12)}}else oe=UN,J=qs,X=PN,B=pd;for(z=0;f>z;++z)if(i[z]>255){var pe;ho(t,g,oe[257+(pe=i[z]>>>18&31)]),g+=J[pe+257],pe>7&&(wi(t,g,i[z]>>>23&31),g+=Vm[pe]);var _e=31&i[z];ho(t,g,X[_e]),g+=B[_e],_e>3&&(ho(t,g,i[z]>>>5&8191),g+=Gm[_e])}else ho(t,g,oe[i[z]]),g+=J[i[z]];return ho(t,g,oe[256]),g+J[256]},$N=new nl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),FN=(function(){for(var e=new nl(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),sp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function HN(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=FN[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var l,c,u,f,h,p=(f=10+((l=t).filename&&l.filename.length+1||0),h=8,(function(v,y,b,_,k,E){var S=v.length,M=new jr(_+S+5*(1+Math.floor(S/7e3))+k),C=M.subarray(_,M.length-k),$=0;if(!y||8>S)for(var L=0;S>=L;L+=65535){var T=L+65535;S>T?$=pm(C,$,v.subarray(L,T)):(C[L]=!0,$=pm(C,$,v.subarray(L,S)))}else{for(var H=$N[y-1],z=H>>>13,G=8191&H,O=(1<<b)-1,I=new Gn(32768),R=new Gn(O+1),oe=Math.ceil(b/3),J=2*oe,X=function(Ze){return(v[Ze]^v[Ze+1]<<oe^v[Ze+2]<<J)&O},B=new nl(25e3),U=new Gn(288),Z=new Gn(32),me=0,D=0,P=(L=0,0),Q=0,A=0;S>L;++L){var pe=X(L),_e=32767&L,ke=R[pe];if(I[_e]=ke,R[pe]=_e,L>=Q){var ze=S-L;if((me>7e3||P>24576)&&ze>423){$=nb(v,C,0,B,U,Z,D,P,A,L-A,$),P=me=D=0,A=L;for(var ce=0;286>ce;++ce)U[ce]=0;for(ce=0;30>ce;++ce)Z[ce]=0}var je=2,Fe=0,At=G,Ke=_e-ke&32767;if(ze>2&&pe==X(L-Ke))for(var pt=Math.min(z,ze)-1,vt=Math.min(32767,L),qe=Math.min(258,ze);vt>=Ke&&--At&&_e!=ke;){if(v[L+je]==v[L+je-Ke]){for(var bt=0;qe>bt&&v[L+bt]==v[L+bt-Ke];++bt);if(bt>je){if(je=bt,Fe=Ke,bt>pt)break;var pn=Math.min(Ke,bt-2),dn=0;for(ce=0;pn>ce;++ce){var se=L-Ke+ce+32768&32767,Ce=se-I[se]+32768&32767;Ce>dn&&(dn=Ce,ke=se)}}}Ke+=(_e=ke)-(ke=I[_e])+32768&32767}if(Fe){B[P++]=268435456|fm[je]<<18|eb[Fe];var fe=31&fm[je],Se=31&eb[Fe];D+=Vm[fe]+Gm[Se],++U[257+fe],++Z[Se],Q=L+je,++me}else B[P++]=v[L],++U[v[L]]}}$=nb(v,C,!0,B,U,Z,D,P,A,L-A,$)}return r_(M,0,_+n_($)+k)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&sp(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),sp(p,g-8,n.d()),sp(p,g-4,i),p}var IN=!!Xp||!!Gp,i_="text/plain",rb=!1,Sd=function(e,t,n){var i;n===void 0&&(n=!0);var[l,c]=e.split("?"),u=ye({},t),f=(i=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&i!==void 0?i:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return Dt(p,(function(_,k){Te(_)||Te(k)||k==="undefined"||(v=encodeURIComponent((E=>E instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(k),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),l+"?"+f.join("&")},Xa=(e,t)=>JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t),ap=e=>{if(e.zt)return e.zt;var{data:t,compression:n}=e;if(t){if(n===Zr.GZipJS){var i=HN((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new jr(f.length+(f.length>>>1)),v=0,y=function(E){g[v++]=E},b=0;p>b;++b){if(v+5>g.length){var _=new jr(v+8+(p-b<<1));_.set(g),g=_}var k=f.charCodeAt(b);128>k?y(k):2048>k?(y(192|k>>>6),y(128|63&k)):k>55295&&57344>k?(y(240|(k=65536+(1047552&k)|1023&f.charCodeAt(++b))>>>18),y(128|k>>>12&63),y(128|k>>>6&63),y(128|63&k)):(y(224|k>>>12),y(128|k>>>6&63),y(128|63&k))}return r_(g,0,v)})(Xa(t)),{mtime:0});return{contentType:i_,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===Zr.Base64){var l=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(Xa(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:Xa(f)))(l);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=Xa(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},qN=(function(){var e=Br((function*(t){var n=Xa(t.data),i=yield(function(c,u,f){return p5.apply(this,arguments)})(n,Rn.DEBUG,{rethrow:!0});if(!i)return t;var l=yield i.arrayBuffer();return ye({},t,{zt:{contentType:i_,body:l,estimatedSize:l.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),ib=(e,t)=>Sd(e,{_:new Date().getTime().toString(),ver:Rn.JS_SDK_VERSION,compression:t}),Yu=[];Gp&&Yu.push({transport:"fetch",method(e){var t,n,{contentType:i,body:l,estimatedSize:c}=(t=ap(e))!==null&&t!==void 0?t:{},u=new Headers;Dt(e.headers,(function(g,v){u.append(v,g)})),i&&u.append("Content-Type",i);var f=e.url,h=null;if(A1){var p=new A1;h={signal:p.signal,timeout:setTimeout((()=>p.abort()),e.timeout)}}Gp(f,ye({method:(e==null?void 0:e.method)||"GET",headers:u,keepalive:e.method==="POST"&&52428.8>(c||0),body:l,signal:(n=h)==null?void 0:n.signal},e.fetchOptions)).then((g=>g.text().then((v=>{var y={statusCode:g.status,text:v};if(g.status===200)try{y.json=JSON.parse(v)}catch(b){Ee.error(b)}e.callback==null||e.callback(y)})))).catch((g=>{Ee.error(g),e.callback==null||e.callback({statusCode:0,error:g})})).finally((()=>h?clearTimeout(h.timeout):null))}}),Xp&&Yu.push({transport:"XHR",method(e){var t,n=new Xp;n.open(e.method||"GET",e.url,!0);var{contentType:i,body:l}=(t=ap(e))!==null&&t!==void 0?t:{};Dt(e.headers,(function(c,u){n.setRequestHeader(u,c)})),i&&n.setRequestHeader("Content-Type",i),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var c={statusCode:n.status,text:n.responseText};if(n.status===200)try{c.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(c)}},n.send(l)}}),sr!=null&&sr.sendBeacon&&Yu.push({transport:"sendBeacon",method(e){var t=Sd(e.url,{beacon:"1"});try{var n,{contentType:i,body:l}=(n=ap(e))!==null&&n!==void 0?n:{};if(!l)return;var c=l instanceof Blob?l:new Blob([l],{type:i});sr.sendBeacon(t,c)}catch{}}});var mm=3e3;class VN{constructor(t,n){this.Ti=!0,this.Ai=[],this.Ei=ti((n==null?void 0:n.flush_interval_ms)||mm,250,5e3,Ee.createLogger("flush interval"),mm),this.Ri=t}enqueue(t){this.Ai.push(t),this.Ni||this.Mi()}unload(){this.Fi();var t=this.Ai.length>0?this.Oi():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Ri(ye({},i,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Mi()}Mi(){var t=this;this.Ti||(this.Ni=setTimeout((()=>{if(this.Fi(),this.Ai.length>0){var n=this.Oi(),i=function(){var c=n[l],u=new Date().getTime();c.data&&ut(c.data)&&Dt(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.Ri(c)};for(var l in n)i()}}),this.Ei))}Fi(){clearTimeout(this.Ni),this.Ni=void 0}Oi(){var t={};return Dt(this.Ai,(n=>{var i,l=n,c=(l?l.batchKey:null)||l.url;Te(t[c])&&(t[c]=ye({},l,{data:[]})),(i=t[c].data)==null||i.push(l.data)})),this.Ai=[],t}}var GN=["retriesPerformedSoFar"];class XN{constructor(t){this.Pi=!1,this.Li=3e3,this.Ai=[],this._instance=t,this.Ai=[],this.Di=!0,!Te(re)&&"onLine"in re.navigator&&(this.Di=re.navigator.onLine,this.Bi=()=>{this.Di=!0,this.ji()},this.qi=()=>{this.Di=!1},rn(re,"online",this.Bi),rn(re,"offline",this.qi))}get length(){return this.Ai.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,i=h5(t,GN);$a(n)&&(i.url=Sd(i.url,{retry_count:n})),this._instance._send_request(ye({},i,{callback:l=>{l.statusCode===200||l.statusCode>=400&&500>l.statusCode||(n??0)>=10?i.callback==null||i.callback(l):this.Zi(ye({retriesPerformedSoFar:n},i))}}))}Zi(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var i=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),l=Date.now()+i;this.Ai.push({retryAt:l,requestOptions:t});var c="Enqueued failed request for retry in "+i;navigator.onLine||(c+=" (Browser is offline)"),Ee.warn(c),this.Pi||(this.Pi=!0,this.$i())}$i(){if(this.Vi&&clearTimeout(this.Vi),this.Ai.length===0)return this.Pi=!1,void(this.Vi=void 0);this.Vi=setTimeout((()=>{this.Di&&this.Ai.length>0&&this.ji(),this.$i()}),this.Li)}ji(){var t=Date.now(),n=[],i=this.Ai.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.Ai=n,i.length>0)for(var{requestOptions:l}of i)this.retriableRequest(l)}unload(){for(var{requestOptions:t}of(this.Vi&&(clearTimeout(this.Vi),this.Vi=void 0),this.Pi=!1,Te(re)||(this.Bi&&(re.removeEventListener("online",this.Bi),this.Bi=void 0),this.qi&&(re.removeEventListener("offline",this.qi),this.qi=void 0)),this.Ai))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){Ee.error(n)}this.Ai=[]}}class YN{constructor(t){this.Hi=()=>{var n,i,l,c;this.zi||(this.zi={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.zi.lastScrollY=Math.ceil(f),this.zi.maxScrollY=Math.max(f,(n=this.zi.maxScrollY)!==null&&n!==void 0?n:0),this.zi.maxScrollHeight=Math.max(h,(i=this.zi.maxScrollHeight)!==null&&i!==void 0?i:0),this.zi.lastContentY=p,this.zi.maxContentY=Math.max(p,(l=this.zi.maxContentY)!==null&&l!==void 0?l:0),this.zi.maxContentHeight=Math.max(g,(c=this.zi.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get Ui(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var t=this.zi;return setTimeout(this.Hi,0),t}startMeasuringScrollPosition(){rn(re,"scroll",this.Hi,{capture:!0}),rn(re,"scrollend",this.Hi,{capture:!0}),rn(re,"resize",this.Hi)}scrollElement(){if(!this.Ui)return re==null?void 0:re.document.documentElement;var t=ut(this.Ui)?this.Ui:[this.Ui];for(var n of t){var i=re==null?void 0:re.document.querySelector(n);if(i)return i}}scrollY(){if(this.Ui){var t=this.scrollElement();return t&&t.scrollTop||0}return re&&(re.scrollY||re.pageYOffset||re.document.documentElement.scrollTop)||0}scrollX(){if(this.Ui){var t=this.scrollElement();return t&&t.scrollLeft||0}return re&&(re.scrollX||re.pageXOffset||re.document.documentElement.scrollLeft)||0}}var WN=e=>W5(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class sb{constructor(t,n,i,l){this.Yi=c=>{var u=this.Gi();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Wi(this._instance)};this.Xi.register({[am]:f})}},this._instance=t,this.Ji=n,this.Xi=i,this.Wi=l||WN,this.Ji.onSessionId(this.Yi)}Gi(){return this.Xi.props[am]}getSetOnceProps(){var t,n=(t=this.Gi())==null?void 0:t.props;return n?"r"in n?Q5(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Dt(qm(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+Yp(i)]=n})),t}}class Xm{constructor(){this.Ki={}}on(t,n){return this.Ki[t]||(this.Ki[t]=[]),this.Ki[t].push(n),()=>{this.Ki[t]=this.Ki[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.Ki[t]||[])i(n);for(var l of this.Ki["*"]||[])l(t,n)}}var lp=Ut("[SessionId]");class ab{on(t,n){return this.Qi.on(t,n)}constructor(t,n,i){var l;if(this.tr=[],this.er=void 0,this.Qi=new Xm,this.ir=(p,g)=>!(!$a(p)||!$a(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Ur)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Xi=t.persistence,this.rr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.sr=n||fs,this.ar=i||fs;var c=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*ti(this.Rt.session_idle_timeout_seconds||1800,60,36e3,lp.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+c+"_window_id",this.hr="ph_"+c+"_primary_window_exists",this.cr()){var u=_n.Wt(this.ur),f=_n.Wt(this.hr);u&&!f?this.rr=u:_n.Jt(this.ur),_n.Xt(this.hr,!0)}if((l=this.Rt.bootstrap)!=null&&l.sessionID)try{var h=(p=>{var g=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.dr(this.Rt.bootstrap.sessionID,new Date().getTime(),h)}catch(p){lp.error("Invalid sessionID in bootstrap",p)}this.vr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.tr)&&(this.tr=[]),this.tr.push(t),this.nr&&t(this.nr,this.rr),()=>{this.tr=this.tr.filter((n=>n!==t))}}cr(){return this.Rt.persistence!=="memory"&&!this.Xi.fi&&_n.Ut()}pr(t){t!==this.rr&&(this.rr=t,this.cr()&&_n.Xt(this.ur,t))}gr(){return this.rr?this.rr:this.cr()?_n.Wt(this.ur):null}dr(t,n,i){t===this.nr&&n===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.nr=t,this.Xi.register({[rd]:[n,t,i]}))}mr(){var t=this.Xi.props[rd];return ut(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.dr(null,null,null)}destroy(){clearTimeout(this.yr),this.yr=void 0,this.er&&re&&(re.removeEventListener(od,this.er,{capture:!1}),this.er=void 0),this.tr=[]}vr(){this.er=()=>{this.cr()&&_n.Jt(this.hr)},rn(re,od,this.er,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Rt.cookieless_mode===Ur)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),[l,c,u]=this.mr(),f=this.gr(),h=$a(u)&&Math.abs(i-u)>864e5,p=!1,g=!c,v=!g&&!t&&this.ir(i,l);g||v||h?(c=this.sr(),f=this.ar(),lp.info("new session ID generated",{sessionId:c,windowId:f,changeReason:{noSessionId:g,activityTimeout:v,sessionPastMaximumLength:h}}),u=i,p=!0):f||(f=this.ar(),p=!0);var y=$a(l)&&t&&!h?l:i,b=$a(u)?u:new Date().getTime();return this.pr(f),this.dr(c,y,b),t||this.lr(),p&&this.tr.forEach((_=>_(c,f,p?{noSessionId:g,activityTimeout:v,sessionPastMaximumLength:h}:void 0))),{sessionId:c,windowId:f,sessionStartTimestamp:b,changeReason:p?{noSessionId:g,activityTimeout:v,sessionPastMaximumLength:h}:void 0,lastActivityTimestamp:l}}lr(){clearTimeout(this.yr),this.yr=setTimeout((()=>{var[t]=this.mr();if(this.ir(new Date().getTime(),t)){var n=this.nr;this.resetSessionId(),this.Qi.emit("forcedIdleReset",{idleSessionId:n})}}),1.1*this.sessionTimeoutMs)}}var s_=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&L1(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((l=>L1(l==null?void 0:l.brand,t))))return!0}catch{}return!!e.webdriver},md=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function lb(e,t,n){return Xa({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var a_={exact:(e,t)=>t.some((n=>e.some((i=>n===i)))),is_not:(e,t)=>t.every((n=>e.every((i=>n!==i)))),regex:(e,t)=>t.some((n=>e.some((i=>md(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!md(n,i))))),icontains:(e,t)=>t.map(zu).some((n=>e.map(zu).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(zu).every((n=>e.map(zu).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i>parseFloat(l)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i<parseFloat(l)))}))},zu=e=>e.toLowerCase();function l_(e,t){return!e||Object.entries(e).every((n=>{var[i,l]=n,c=t==null?void 0:t[i];if(Te(c)||Ai(c))return!1;var u=[String(c)],f=a_[l.operator];return!!f&&f(l.values,u)}))}var gm="custom",ob="i.posthog.com",QN=/^\/static\//;class KN{constructor(t){this.br={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+ob,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.br[this.apiHost]||(this.br[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":gm),this.br[this.apiHost]}wr(t){var n=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof n=="string"&&QN.test(t))return n.trim().replace(/\/$/,"")||void 0}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var i=this.wr(n);if(i)return""+i+n}if(this.region===gm)return this.apiHost+n;var l=ob+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}var Et=Ut("[Surveys]"),xm="seenSurvey_",ZN=(e,t)=>{var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n},cb=e=>((t,n)=>{var i=""+xm+n.id;return n.current_iteration&&n.current_iteration>0&&(i=""+xm+n.id+"_"+n.current_iteration),i})(0,e),JN=[np.Popover,np.Widget,np.API],e3={ignoreConditions:!1,ignoreDelay:!1,displayType:dm.Popover},t3=Ut("[PostHog ExternalIntegrations]"),n3={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class r3{constructor(t){this._instance=t}ni(t,n){var i;(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(l=>{if(l)return t3.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!l||(f=Le.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.ni(n3[u],(()=>{var g;(g=Le.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!l&&(h=Le.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=Le.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[i,l]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(i)}}}var za,Oo={},op=0,vm=()=>{},ub='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mo="Surveys module not available",db="sanitize_properties is deprecated. Use before_send instead",o_="Invalid value for property_denylist config: ",Ia="posthog",c_=!IN&&(Vn==null?void 0:Vn.indexOf("MSIE"))===-1&&(Vn==null?void 0:Vn.indexOf("Mozilla"))===-1,fb=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:_N(Ne==null?void 0:Ne.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:vm,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:yn&&sn(yn==null?void 0:yn.search)&&yn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){Ee.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:um,before_send:void 0,request_queue_config:{flush_interval_ms:mm},error_tracking:{},_onCapture:vm,__preview_eager_load_replay:!1},(n=>({rageclick:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},i3=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],hb=e=>{var t={};for(var[n,i]of i3)Te(e[n])||(t[i]=e[n]);var l=Wt({},t,e);return ut(e.property_blacklist)&&(Te(e.property_denylist)?l.property_denylist=e.property_blacklist:ut(e.property_denylist)?l.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ee.error(o_+e.property_denylist)),l};class s3{constructor(){this.__forceAllowLocalhost=!1}get _r(){return this.__forceAllowLocalhost}set _r(t){Ee.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class _r{Ir(t,n){if(t){var i=this.Cr.indexOf(t);i!==-1&&this.Cr.splice(i,1)}return this.Cr.push(n),n.initialize==null||n.initialize(),n}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new s3,this.Sr=!1,this.version=Rn.LIB_VERSION,this.kr=new Xm,this.Cr=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=fb(),this.SentryIntegration=MN,this.sentryIntegration=i=>(function(l,c){var u=q5(l,c);return{name:I5,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tr=!1,this.Ar=null,this.Er=null,this.Rr=null,this.scrollManager=new YN(this),this.pageViewManager=new W1(this),this.rateLimiter=new BN(this),this.requestRouter=new KN(this),this.consent=new EN(this),this.externalIntegrations=new r3(this);var n=(t=_r.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,l,c)=>{var u=sn(i)?{[i]:l}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,l,c)=>{var u=sn(i)?{[i]:l}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(i=>Ee.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==Ia){var l,c=(l=Oo[i])!==null&&l!==void 0?l:new _r;return c._init(t,n,i),Oo[i]=c,Oo[Ia][i]=c,c}return this._init(t,n,i)}_init(t,n,i){var l,c;if(n===void 0&&(n={}),Te(t)||Vu(t))return Ee.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Nr(n.debug),this.Mr=n,this.Fr=[],n.person_profiles?this.Er=n.person_profiles:n.process_person&&(this.Er=n.process_person),this.set_config(Wt({},fb(n.defaults),hb(n),{name:i,token:t})),this.config.on_xhr_error&&Ee.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Zr.GZipJS;var u=this.Or();this.persistence=new tp(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new tp(ye({},this.config,{persistence:"sessionStorage"}),u);var f=ye({},this.persistence.props),h=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Pr=new VN((E=>this.Lr(E)),this.config.request_queue_config),this.Dr=new XN(this),this.__request_queue=[];var p=this.config.cookieless_mode===Ur||this.config.cookieless_mode===Si&&this.consent.isExplicitlyOptedOut();if(p||(this.sessionManager=new ab(this),this.sessionPropsManager=new sb(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ee.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Br(p)}),0)):(Ee.info("Initializing extensions synchronously"),this.Br(p)),Rn.DEBUG=Rn.DEBUG||this.config.debug,Rn.DEBUG&&Ee.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:f,s:h}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var g=n.bootstrap.distinctID,v=this.get_distinct_id(),y=this.persistence.get_property(Or);if(n.bootstrap.isIdentifiedID&&v!=null&&v!==g&&y===Ra)this.identify(g);else if(n.bootstrap.isIdentifiedID&&v!=null&&v!==g&&y===La)Ee.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(fs()),_=n.bootstrap.isIdentifiedID?b:g;this.persistence.set_property(Or,n.bootstrap.isIdentifiedID?La:Ra),this.register({distinct_id:g,$device_id:_})}}if(p)this.register_once({distinct_id:Au,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(fs());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(Or,Ra)}return rn(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(E,S){var M=E.config.segment;if(!M)return S();(function(C,$){var L=C.config.segment;if(!L)return $();var T=z=>{var G=()=>z.anonymousId()||fs();C.config.get_device_id=G,z.id()&&(C.register({distinct_id:z.id(),$device_id:G()}),C.persistence.set_property(Or,La)),$()},H=L.user();"then"in H&&Ni(H.then)?H.then(T):T(H)})(E,(()=>{M.register((C=>{Promise&&Promise.resolve||ep.warn("This browser does not have Promise support, and can not use the segment integration");var $=(L,T)=>{if(!T)return L;L.event.userId||L.event.anonymousId===C.get_distinct_id()||(ep.info("No userId set, resetting PostHog"),C.reset()),L.event.userId&&L.event.userId!==C.get_distinct_id()&&(ep.info("UserId set, identifying with PostHog"),C.identify(L.event.userId));var H=C.calculateEventProperties(T,L.event.properties);return L.event.properties=Object.assign({},H,L.event.properties),L};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:L=>$(L,L.event.event),page:L=>$(L,Ha),identify:L=>$(L,Zh),screen:L=>$(L,"$screen")}})(E)).then((()=>{S()}))}))})(this,(()=>this.jr())):this.jr(),Ni(this.config._onCapture)&&this.config._onCapture!==vm&&(Ee.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(E=>this.config._onCapture(E.event,E)))),this.config.ip&&Ee.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Br(t){var n,i,l,c,u,f,h,p=performance.now(),g=ye({},_r.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.Cr.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.Cr.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new g.exceptions(this)),g.historyAutocapture&&this.Cr.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.Cr.push(new g.tracingHeaders(this)),g.siteApps&&this.Cr.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.Cr.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.Cr.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.Cr.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new g.surveys(this)),g.logs&&this.Cr.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.Cr.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.Cr.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.Cr.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.Cr.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.Cr.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.Cr.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,AN)),g.toolbar&&this.Cr.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.Cr.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.Cr.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.qr){var y=this.qr;this.qr=void 0,this.Ci(y)}})),this.Zr(v,p)}Zr(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Zr(t,n)}),0);var i=t.shift();if(i)try{i()}catch(c){Ee.error("Error initializing extension:",c)}}var l=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:l}),this.config.__preview_deferred_init_extensions&&Ee.info("PostHog extensions initialized ("+l+"ms)")}Ci(t){var n;if(!Ne||!Ne.body)return Ee.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ci(t)}),500);this.config.__preview_deferred_init_extensions&&(this.qr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=tt(t.supportedCompression,Zr.GZipJS)?Zr.GZipJS:tt(t.supportedCompression,Zr.Base64)?Zr.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Er?this.Er:um}),this.Cr.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(t)))}jr(){try{this.config.loaded(this)}catch(i){Ee.critical("`loaded` function failed",i)}if(this.$r(),this.config.internal_or_test_user_hostname&&yn!=null&&yn.hostname){var t=yn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===Ur)&&this.Vr()}),1),this.Hr=new Z5(this),this.Hr.load()}$r(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Pr)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Mu(this.__request_queue,(t=>this.Lr(t))),this.__request_queue=[],this.$r()}_handle_unload(){var t,n,i,l;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.zr()&&this.capture(Kh),(n=this.logs)==null||n.flushLogs("sendBeacon"),(i=this.Pr)==null||i.unload(),(l=this.Dr)==null||l.unload()):this.zr()&&this.capture(Kh,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(c_?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Sd(t.url,{ip:this.config.ip?1:0}),t.headers=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var i,l,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=ib(u.url,u.compression);var f=(i=u.transport)!==null&&i!==void 0?i:"fetch",h=Yu.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(l=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&l!==void 0?l:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===Zr.GZipJS&&DS&&!rb?qN(u).then((g=>{p(g)})).catch((g=>{if((v=>!(!v||typeof v!="object")&&("name"in v?String(v.name):"")==="NotReadableError")(g))return rb=!0,void p(ye({},u,{compression:void 0,url:ib(n.url,void 0)}));p(u)})):p(u)})(ye({},t,{callback:n=>{var i,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(l=this.config).on_request_error)==null||i.call(l,n),t.callback==null||t.callback(n)}}))))}Lr(t){this.Dr?this.Dr.retriableRequest(t):this._send_request(t)}_execute_array(t){op++;try{var n,i=[],l=[],c=[];Mu(t,(f=>{f&&(ut(n=f[0])?c.push(f):Ni(f)?f.call(this):ut(f)&&n==="alias"?i.push(f):ut(f)&&n.indexOf("capture")!==-1&&Ni(this[n])?c.push(f):l.push(f))}));var u=function(f,h){Mu(f,(function(p){if(ut(p[0])){var g=h;Dt(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}))};u(i,this),u(l,this),u(c,this)}finally{op--}}push(t){if(op>0&&ut(t)&&sn(t[0])){var n=_r.prototype[t[0]];Ni(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var l,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pr){if(this.is_capturing())if(!Te(t)&&sn(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!sn(n==null?void 0:n.$current_url)&&(Ee.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||i!=null&&i.Ur||Ee.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,y=(i==null?void 0:i.timestamp)||v,b=fs(),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===Ha&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),i!=null&&i.$set&&(_.$set=i==null?void 0:i.$set);var k,E=this.Yr(i==null?void 0:i.$set_once,t!==V1,t===Zh);if(E&&(_.$set_once=E),i!=null&&i._noTruncate||(c=this.config.properties_string_max_length,u=_,f=H=>sn(H)?H.slice(0,c):H,h=new Set,_=(function H(z,G){return z!==Object(z)?f?f(z):z:h.has(z)?void 0:(h.add(z),ut(z)?(O=[],Mu(z,(I=>{O.push(H(I))}))):(O={},Dt(z,((I,R)=>{h.has(I)||(O[R]=H(I))}))),O);var O})(u)),_.timestamp=y,Te(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===To.DISMISSED||t===To.SENT){var S=n==null?void 0:n[rp.SURVEY_ID],M=n==null?void 0:n[rp.SURVEY_ITERATION];k={id:S,current_iteration:M},localStorage.getItem(cb(k))||localStorage.setItem(cb(k),"true"),_.$set=ye({},_.$set,{[ZN({id:S,current_iteration:M},t===To.SENT?"responded":"dismissed")]:!0})}else t===To.SHOWN&&(_.$set=ye({},_.$set,{[rp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===ON.SHOWN){var C=n==null?void 0:n[K1.TOUR_TYPE];C&&(_.$set=ye({},_.$set,{[K1.TOUR_LAST_SEEN_DATE+"/"+C]:new Date().toISOString()}))}var $=ye({},_.properties.$set,_.$set);if(Va($)||this.setPersonPropertiesForFlags($),!at(this.config.before_send)){var L=this.Gr(_);if(!L)return;_=L}this.kr.emit("eventCaptured",_);var T={method:"POST",url:(l=i==null?void 0:i._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Lr(T):this.Pr.enqueue(T),_}Ee.critical("This capture call is ignored due to client rate limiting.")}}else Ee.error("No event name provided to posthog.capture")}else Ee.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,i,l,c){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,(this.config.cookieless_mode==Ur||this.config.cookieless_mode==Si&&this.consent.isExplicitlyOptedOut())&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!sn(f.distinct_id)&&!Fr(f.distinct_id)||Vu(f.distinct_id))&&Ee.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(S,M){var C,$,L,T;if(!Vn)return{};var H,z,G,O,I,R,oe,J,X=S?[...tl,...M||[]]:[],[B,U]=(function(Z){for(var me=0;O1.length>me;me++){var[D,P]=O1[me],Q=D.exec(Z),A=Q&&(Ni(P)?P(Q,Z):P);if(A)return A}return["",""]})(Vn);return Wt(qm({$os:B,$os_version:U,$browser:L5(Vn,navigator.vendor),$device:B1(Vn),$device_type:(z=Vn,G={userAgentDataPlatform:(C=navigator)==null||(C=C.userAgentData)==null?void 0:C.platform,maxTouchPoints:($=navigator)==null?void 0:$.maxTouchPoints,screenWidth:re==null||(L=re.screen)==null?void 0:L.width,screenHeight:re==null||(T=re.screen)==null?void 0:T.height,devicePixelRatio:re==null?void 0:re.devicePixelRatio},J=B1(z),J===b5||J===v5||J==="Kobo"||J==="Kindle Fire"||J===R5?Za:J===Vo||J===Wa||J===Go||J===Qp?"Console":J===_5?"Wearable":J?ar:(G==null?void 0:G.userAgentDataPlatform)==="Android"&&((O=G==null?void 0:G.maxTouchPoints)!==null&&O!==void 0?O:0)>0?600>Math.min((I=G==null?void 0:G.screenWidth)!==null&&I!==void 0?I:0,(R=G==null?void 0:G.screenHeight)!==null&&R!==void 0?R:0)/((oe=G==null?void 0:G.devicePixelRatio)!==null&&oe!==void 0?oe:1)?ar:Za:"Desktop"),$timezone:K5(),$timezone_offset:DN()}),{$current_url:Xo(yn==null?void 0:yn.href,X,Yo),$host:yn==null?void 0:yn.host,$pathname:yn==null?void 0:yn.pathname,$raw_user_agent:Vn.length>1e3?Vn.substring(0,997)+"...":Vn,$browser_version:QS(Vn,navigator.vendor),$browser_language:Q1(),$browser_language_prefix:(H=Q1(),typeof H=="string"?H.split("-")[0]:void 0),$screen_height:re==null?void 0:re.screen.height,$screen_width:re==null?void 0:re.screen.width,$viewport_height:re==null?void 0:re.innerHeight,$viewport_width:re==null?void 0:re.innerWidth,$lib:Rn.LIB_NAME,$lib_version:Rn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,i.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&Wt(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&Wt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.Dr)==null?void 0:b.length}catch(S){f.$sdk_debug_error_capturing_properties=String(S)}if(this.requestRouter.region===gm&&(f.$lib_custom_api_host=this.config.api_host),p=t!==Ha||c?t!==Kh||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,l),f=Wt(f,p),t===Ha&&Ne&&(f.title=Ne.title),!Te(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Vn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=Wt({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),ut(this.config.property_denylist)?Dt(this.config.property_denylist,(function(S){delete f[S]})):Ee.error(o_+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Ee.error(db),f=k(f,t));var E=this.Wr();return f.$process_person_profile=E,E&&!c&&this.Xr("_calculate_event_properties"),f}Yr(t,n,i){var l;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.Wr()||this.Sr&&!i)return t;var c=this.persistence.get_initial_props(),u=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),f=Wt({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(Ee.error(db),f=h(f,"$set_once")),n&&(this.Sr=!0),Va(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var l;(l=this.persistence)==null||l.register_once(t,n,i)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Jr(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,n)}isFeatureEnabled(t,n){var i;return(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.kr.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:mo}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)==null?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:mo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:mo})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=e3),(i=this.surveys)==null||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:mo}}canRenderSurveyAsync(t,n){var i,l;return n===void 0&&(n=!1),(i=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:mo})}Kr(t){return!t||Vu(t)?(Ee.critical("Unique user id has not been set in posthog.identify"),!1):t===Au?(Ee.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ee.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return Ee.uninitializedWarning("posthog.identify");if(Fr(t)&&(t=t.toString(),Ee.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Kr(t)&&this.Xr("posthog.identify")){var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(nd)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(ko)&&(this.unregister(ko),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(Or)||Ra)===Ra;t!==l&&u?(this.persistence.set_property(Or,La),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Zh,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:i||{}}),this.Rr=lb(t,n,i),(c=this.featureFlags)==null||c.setAnonymousDistinctId(l)):(n||i)&&this.setPersonProperties(n,i),t!==l&&(this.reloadFeatureFlags(),this.unregister(Do))}}setPersonProperties(t,n){if((t||n)&&this.Xr("posthog.setPersonProperties")){var i=lb(this.get_distinct_id(),t,n);this.Rr!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Rr=i):Ee.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,i){if(t&&n){var l=this.getGroups(),c=l[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},l,{[t]:n})}),c||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(V1,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),c&&!i&&this.reloadFeatureFlags()}else Ee.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),this.Xr("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,i,l,c,u,f,h,p;if(Ee.info("reset"),!this.__loaded)return Ee.uninitializedWarning("posthog.reset");var g=this.get_property(nd);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(i=this.sessionPersistence)==null||i.clear(),(l=this.surveys)==null||l.reset(),(c=this.Hr)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.persistence)==null||h.set_property(Or,Ra),(p=this.sessionManager)==null||p.resetSessionId(),this.Rr=null,this.config.cookieless_mode===Ur)this.register_once({distinct_id:Au,$device_id:null},"");else{var v=this.config.get_device_id(fs());this.register_once({distinct_id:v,$device_id:t?v:g},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.Qr()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.tn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&i){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!i)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return l}alias(t,n){return t===this.get_property(B5)?(Ee.critical("Attempting to create alias for existing People user - aborting."),-2):this.Xr("posthog.alias")?(Te(n)&&(n=this.get_distinct_id()),t!==n?(this.Jr(ko,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Ee.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if(cn(t)){var i,l,c,u,f,h,p,g,v;Wt(this.config,hb(t));var y=this.Or();(i=this.persistence)==null||i.update_config(this.config,n,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new tp(ye({},this.config,{persistence:"sessionStorage"}),y);var b=this.Nr(this.config.debug);ei(b)&&(this.config.debug=b),ei(this.config.debug)&&(this.config.debug?(Rn.DEBUG=!0,Pt.Ut()&&Pt.Xt("ph_debug",!0),Ee.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(Rn.DEBUG=!1,Pt.Ut()&&Pt.Jt("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(c=this.sessionRecording)==null||c.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(f=this.heatmaps)==null||f.startIfEnabled(),(h=this.exceptionObserver)==null||h.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(g=this.surveys)==null||g.loadIfEnabled(),this.en(),(v=this.externalIntegrations)==null||v.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Rn.LIB_NAME=t,Rn.LIB_VERSION=n}startSessionRecording(t){var n,i,l,c,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),h.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var i=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(ye({},l,n))}}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:_r.rn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)==null?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Ia;return n!==Ia&&(n=Ia+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Or))===La||((n=this.sessionPersistence)==null?void 0:n.get_property(Or))===La}Wr(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===um&&!this._isIdentified()&&Va(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[ko])&&((n=this.persistence)==null||(n=n.props)==null||!n[ad]))}zr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Wr()||this.Xr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Xr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Xr(t){return this.config.person_profiles==="never"?(Ee.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Jr(ad,!0),!0)}Or(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Si)}en(){var t,n,i,l,c=this.Or();return((t=this.persistence)==null?void 0:t.fi)!==c&&((i=this.persistence)==null||i.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.fi)!==c&&((l=this.sessionPersistence)==null||l.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Ur){if(this.config.cookieless_mode===Si&&this.consent.isExplicitlyOptedOut()){var i,l,c,u,f;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new ab(this),this.pageViewManager=new W1(this),this.persistence&&(this.sessionPropsManager=new sb(this,this.sessionManager,this.persistence));var h=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=_r.__defaultExtensionClasses)==null?void 0:f.sessionRecording;h&&(this.sessionRecording=this.Ir(this.sessionRecording,new h(this)))}var p,g;this.consent.optInOut(!0),this.en(),this.$r(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Si&&((p=this.surveys)==null||p.loadIfEnabled()),(Te(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((g=t==null?void 0:t.captureEventName)!==null&&g!==void 0?g:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vr()}else Ee.warn(ub)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==Ur?(this.config.cookieless_mode===Si&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.en(),this.config.cookieless_mode===Si&&(this.register({distinct_id:Au,$device_id:null}),(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(i=this.sessionRecording)==null||i.stopRecording(),this.sessionRecording=void 0,this.Vr())):Ee.warn(ub)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ur||(this.config.cookieless_mode===Si?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.en()}_is_bot(){return sr?s_(sr,this.config.custom_blocked_useragents):void 0}Vr(){Ne&&(Ne.visibilityState==="visible"?this.Tr||(this.Tr=!0,this.capture(Ha,{title:Ne.title},{send_instantly:!0}),this.Ar&&(Ne.removeEventListener(ld,this.Ar),this.Ar=null)):this.Ar||(this.Ar=this.Vr.bind(this),rn(Ne,ld,this.Ar)))}debug(t){t===!1?(re==null||re.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(re==null||re.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ki(){var t,n,i,l,c,u,f=this.Mr||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Ee.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",l=Ee,c=(n="advanced_disable_flags")in(t=f)&&!at(t[n]),u=i in t&&!at(t[i]),c?t[n]:!!u&&(l&&l.warn("Config field '"+i+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[i]))}Gr(t){if(at(this.config.before_send))return t;var n=ut(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var l of n){if(i=l(i),at(i)){var c="Event '"+t.event+"' was rejected in beforeSend function";return US(t.event)?Ee.warn(c+". This can cause unexpected behavior."):Ee.info(c),null}i.properties&&!Va(i.properties)||Ee.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return(t=this.pageViewManager.ai)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}Nr(t){var n=ei(t)&&!t,i=Pt.Ut()&&Pt.Gt("ph_debug")==="true";return!n&&(!!i||t)}}function pb(e){return e instanceof Element&&(e.id===$5||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Nd(e){return!!e&&e.nodeType===1}function hs(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function u_(e){return!!e&&e.nodeType===3}function d_(e){return!!e&&e.nodeType===11}function Ym(e){return e?jd(e).split(/\s+/):[]}function mb(e){var t=re==null?void 0:re.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function gd(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ym(t)}function f_(e){return at(e)?null:jd(e).split(/(\s+)/).filter((t=>Bo(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Wo(e){var t="";return ym(e)&&!p_(e)&&e.childNodes&&e.childNodes.length&&Dt(e.childNodes,(function(n){var i;u_(n)&&n.textContent&&(t+=(i=f_(n.textContent))!==null&&i!==void 0?i:"")})),jd(t)}function gb(e){return Te(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}_r.__defaultExtensionClasses={},_r.rn={trace:za=()=>{},debug:za,info:za,warn:za,error:za,fatal:za},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=bN(e.prototype[t[n]])})(_r,["identify"]);var Wm=["a","button","form","input","select","textarea","label"];function xb(e,t){if(Te(t))return!0;var n,i=function(c){if(t.some((u=>c.matches(u))))return{v:!0}};for(var l of e)if(n=i(l))return n.v;return!1}function h_(e){var t=e.parentNode;return!(!t||!Nd(t))&&t}var a3=["next","previous","prev",">","<"],vb=[".ph-no-rageclick",".ph-no-capture"],bm=e=>!e||hs(e,"html")||!Nd(e),bb=(e,t)=>{if(!re||bm(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],l=e;l.parentNode&&!hs(l,"body");)if(d_(l.parentNode))i.push(l.parentNode.host),l=l.parentNode.host;else{var c=h_(l);if(!c)break;if(t||Wm.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=re.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}i.push(c),l=c}return{parentIsUsefulElement:n,targetElementList:i}};function ym(e){for(var t=e;t.parentNode&&!hs(t,"body");t=t.parentNode){var n=gd(t);if(tt(n,"ph-sensitive")||tt(n,"ph-no-capture"))return!1}if(tt(gd(e),"ph-include"))return!0;var i=e.type||"";if(sn(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var l=e.name||e.id||"";return!sn(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function p_(e){return!!(hs(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||hs(e,"select")||hs(e,"textarea")||e.getAttribute("contenteditable")==="true")}var m_="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",l3=new RegExp("^(?:"+m_+")$"),o3=new RegExp(m_),g_="\\d{3}-?\\d{2}-?\\d{4}",c3=new RegExp("^("+g_+")$"),u3=new RegExp("("+g_+")");function Bo(e,t){return t===void 0&&(t=!0),!(at(e)||sn(e)&&(e=jd(e),(t?l3:o3).test((e||"").replace(/[- ]/g,""))||(t?c3:u3).test(e)))}function yb(e){var t=Wo(e);return Bo(t=(t+" "+x_(e)).trim())?t:""}function x_(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Dt(e.childNodes,(function(n){var i;if(n&&((i=n.tagName)==null?void 0:i.toLowerCase())==="span")try{var l=Wo(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+x_(n)).trim())}catch(c){Ee.error("[AutoCapture]",c)}})),t}function _b(e){return e.replace(/"|\\"/g,'\\"')}function d3(e){var t=e.attr__class;return t?ut(t)?t:Ym(t):void 0}class wb{constructor(t){this.disabled=t===!1;var n=cn(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,i){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>i-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:i}];return!1}}var cp="$copy_autocapture",jb=Ut("[AutoCapture]");function up(e,t){return t.length>e?t.slice(0,e)+"...":t}function f3(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Nd(t));return t}function h3(e,t){for(var n,i,{e:l,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h}=t,p=[e],g=e;g.parentNode&&!hs(g,"body");)d_(g.parentNode)?(p.push(g.parentNode.host),g=g.parentNode.host):(p.push(g.parentNode),g=g.parentNode);var v,y,b=[],_={},k=!1,E=!1;if(Dt(p,(L=>{var T=ym(L);L.tagName.toLowerCase()==="a"&&(k=L.getAttribute("href"),k=T&&k&&Bo(k)&&k),tt(gd(L),"ph-no-capture")&&(E=!0),b.push((function(z,G,O,I){var R=z.tagName.toLowerCase(),oe={tag_name:R};Wm.indexOf(R)>-1&&!O&&(oe.$el_text=R.toLowerCase()==="a"||R.toLowerCase()==="button"?up(1024,yb(z)):up(1024,Wo(z)));var J=gd(z);J.length>0&&(oe.classes=J.filter((function(Z){return Z!==""}))),Dt(z.attributes,(function(Z){var me;if((!p_(z)||["name","id","class","aria-label"].indexOf(Z.name)!==-1)&&(I==null||!I.includes(Z.name))&&!G&&Bo(Z.value)&&(!sn(me=Z.name)||me.substring(0,10)!=="_ngcontent"&&me.substring(0,7)!=="_nghost")){var D=Z.value;Z.name==="class"&&(D=Ym(D).join(" ")),oe["attr__"+Z.name]=up(1024,D)}}));for(var X=1,B=1,U=z;U=f3(U);)X++,U.tagName===z.tagName&&B++;return oe.nth_child=X,oe.nth_of_type=B,oe})(L,c,u,f));var H=(function(z){if(!ym(z))return{};var G={};return Dt(z.attributes,(function(O){if(O.name&&O.name.indexOf("data-ph-capture-attribute")===0){var I=O.name.replace("data-ph-capture-attribute-",""),R=O.value;I&&R&&Bo(R)&&(G[I]=R)}})),G})(L);Wt(_,H)})),E)return{props:{},explicitNoCapture:E};if(u||(b[0].$el_text=e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?yb(e):Wo(e)),k){var S,M;b[0].attr__href=k;var C=(S=ud(k))==null?void 0:S.host,$=re==null||(M=re.location)==null?void 0:M.host;C&&$&&C!==$&&(v=k)}return{props:Wt({$event_type:l.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(y=b,(function(L){return L.map((T=>{var H,z,G="";if(T.tag_name&&(G+=T.tag_name),T.attr_class)for(var O of(T.attr_class.sort(),T.attr_class))G+="."+O.replace(/"/g,"");var I=ye({},T.text?{text:T.text}:{},{"nth-child":(H=T.nth_child)!==null&&H!==void 0?H:0,"nth-of-type":(z=T.nth_of_type)!==null&&z!==void 0?z:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),R={};return Xu(I).sort(((oe,J)=>{var[X]=oe,[B]=J;return X.localeCompare(B)})).forEach((oe=>{var[J,X]=oe;return R[_b(J.toString())]=_b(X.toString())})),(G+=":")+Xu(R).map((oe=>{var[J,X]=oe;return J+'="'+X+'"'})).join("")})).join(";")})((function(L){return L.map((T=>{var H,z,G={text:(H=T.$el_text)==null?void 0:H.slice(0,400),tag_name:T.tag_name,href:(z=T.attr__href)==null?void 0:z.slice(0,2048),attr_class:d3(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return Xu(T).filter((O=>{var[I]=O;return I.indexOf("attr__")===0})).forEach((O=>{var[I,R]=O;return G.attributes[I]=R})),G}))})(y)))},(n=b[0])!=null&&n.$el_text?{$el_text:(i=b[0])==null?void 0:i.$el_text}:{},v&&l.type==="click"?{$external_click_url:v}:{},_)}}var go=Ut("[ExceptionAutocapture]");function kb(e,t,n){try{if(!(t in e))return()=>{};var i=e[t],l=n(i);return Ni(l)&&(l.prototype=l.prototype||{},Object.defineProperties(l,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=l,()=>{e[t]=i}}catch{return()=>{}}}var p3=Ut("[TracingHeaders]"),as=Ut("[Web Vitals]"),Sb=9e5,Nb="disabled",Cb="lazy_loading",xo="awaiting_config",Ou="missing_config";Ut("[SessionRecording]"),Ut("[SessionRecording]");var _m="[SessionRecording]",ls=Ut(_m),m3=Ut("[Heatmaps]");function Eb(e){return cn(e)&&"clientX"in e&&"clientY"in e&&Fr(e.clientX)&&Fr(e.clientY)}var Tb=Ut("[Product Tours]"),g3=["$set_once","$set"],os=Ut("[SiteApps]"),Ab="Error while initializing PostHog app with config id ";function Oa(e,t,n){if(at(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class x3{constructor(t){this.nn=new Xm,this.sn=(n,i)=>this.an(n,i)&&this.ln(n,i)&&this.un(n,i)&&this.hn(n,i),this.an=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this.cn=new Set,this.dn=new Set}init(){var t,n;Te((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,l)=>{this.on(i,l)}))}register(t){var n,i;if(!Te((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.dn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.cn)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var l,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(c)}}on(t,n){var i;n!=null&&t.length!=0&&(this.cn.has(t)||this.cn.has(n==null?void 0:n.event))&&this.dn&&((i=this.dn)==null?void 0:i.size)>0&&this.dn.forEach((l=>{this.vn(n,l)&&this.nn.emit("actionCaptured",l.name)}))}fn(t){this.onAction("actionCaptured",(n=>t(n)))}vn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.sn(t,i))return!0;return!1}onAction(t,n){return this.nn.on(t,n)}ln(t,n){if(n!=null&&n.url){var i,l=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!l||typeof l!="string"||!Oa(l,n.url,n.url_matching||"contains"))return!1}return!0}un(t,n){return!!this.pn(t,n)&&!!this.gn(t,n)&&!!this.mn(t,n)}pn(t,n){var i;if(n==null||!n.href)return!0;var l=this.yn(t);if(l.length>0)return l.some((f=>Oa(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&Oa((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}gn(t,n){var i;if(n==null||!n.text)return!0;var l=this.yn(t);if(l.length>0)return l.some((p=>Oa(p.text,n.text,n.text_matching||"exact")||Oa(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!at(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>Oa(p,u,f))))}mn(t,n){var i,l;if(n==null||!n.selector)return!0;var c=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}yn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}hn(t,n){return n==null||!n.properties||n.properties.length===0||l_(n.properties.reduce(((i,l)=>{var c=ut(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return i[l.key]={values:c,operator:l.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class v3{constructor(t){this._instance=t,this.bn=new Map,this.wn=new Map,this._n=new Map}In(t,n){return!!t&&l_(t.propertyFilters,n==null?void 0:n.properties)}Cn(t,n){var i=new Map;return t.forEach((l=>{var c;(c=l.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(l.id),i.set(u.name,f)}}))})),i}Sn(t,n,i){var l=(i===uo.Activation?this.bn:this.wn).get(t),c=[];return this.kn((u=>{c=u.filter((f=>l==null?void 0:l.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[i])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.In(h,n)}))}register(t){var n;Te((n=this._instance)==null?void 0:n._addCaptureHook)||(this.xn(t),this.Tn(t))}Tn(t){var n=t.filter((i=>{var l,c;return((l=i.conditions)==null?void 0:l.actions)&&((c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.An==null&&(this.An=new x3(this._instance),this.An.init(),this.An.fn((i=>{this.onAction(i)}))),n.forEach((i=>{var l,c,u,f,h;i.conditions&&(l=i.conditions)!=null&&l.actions&&(c=i.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.An)==null||f.register(i.conditions.actions.values),(h=i.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this._n.get(p.name);g&&g.push(i.id),this._n.set(p.name,g||[i.id])}})))})))}xn(t){var n,i=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),l=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this.bn=this.Cn(t,uo.Activation),this.wn=this.Cn(t,uo.Cancellation))}onEvent(t,n){var i,l=this.re(),c=this.En(),u=this.Rn(),f=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[c])||[];if(u===t&&n&&f.length>0){var h,p;l.info("event matched, removing item from activated items",{event:t,eventPayload:n,existingActivatedItems:f});var g=(n==null||(h=n.properties)==null?void 0:h.$survey_id)||(n==null||(p=n.properties)==null?void 0:p.$product_tour_id);if(g){var v=f.indexOf(g);0>v||(f.splice(v,1),this.Nn(f))}}else{if(this.wn.has(t)){var y=this.Sn(t,n,uo.Cancellation);y.length>0&&(l.info("cancel event matched, cancelling items",{event:t,itemsToCancel:y.map((_=>_.id))}),y.forEach((_=>{var k=f.indexOf(_.id);0>k||f.splice(k,1),this.Mn(_.id)})),this.Nn(f))}if(this.bn.has(t)){l.info("event name matched",{event:t,eventPayload:n,items:this.bn.get(t)});var b=this.Sn(t,n,uo.Activation);this.Nn(f.concat(b.map((_=>_.id))||[]))}}}onAction(t){var n,i=this.En(),l=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];this._n.has(t)&&this.Nn(l.concat(this._n.get(t)||[]))}Nn(t){var n,i=this.re(),l=this.En(),c=[...new Set(t)].filter((u=>!this.Fn(u)));i.info("updating activated items",{activatedItems:c}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[l]:c})}getActivatedIds(){var t,n=this.En();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getEventToItemsMap(){return this.bn}On(){return this.An}}class b3 extends v3{constructor(t){super(t)}En(){return"$surveys_activated"}Rn(){return To.SHOWN}kn(t){var n;(n=this._instance)==null||n.getSurveys(t)}Mn(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}re(){return Et}Fn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var dp="SDK is not enabled or survey functionality is not yet loaded",Mb="Disabled. Not loading surveys.",y3=re!=null&&re.location?fd(re.location.hash,"__posthog")||fd(location.hash,"state"):null,Rb="_postHogToolbarParams",Lb=Ut("[Toolbar]"),An=Ut("[FeatureFlags]"),Us=Ut("[FeatureFlags]",{debugEnabled:!0}),fp=`" failed. Feature flags didn't load in time.`,hp="$active_feature_flags",cs="$override_feature_flags",Db="$feature_flag_request_id",zb=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Ob=e=>{var t={};for(var[n,i]of Xu(e||{}))i&&(t[n]=i);return t},pp=Ut("[Error tracking]"),Bb="Refusing to render web experiment since the viewer is a likely bot",_3={icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!re&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!re&&md(t.href,e),not_regex:(e,t)=>!!re&&!md(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class jn{get Rt(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((l=>{jn.Pn("retrieved web experiments from the server"),n.Ln=new Map,l.forEach((c=>{if(c.feature_flag_key){var u;n.Ln&&(jn.Pn("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.Ln)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);sn(f)&&c.variants[f]&&n.Dn(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];jn.Bn(p)&&n.Dn(c.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())jn.Pn(Bb);else if(!this.Rt.disable_web_experiments){if(at(this.Ln))return this.Ln=new Map,this.loadIfEnabled(),void this.previewWebExperiment();jn.Pn("applying feature flags",t),t.forEach((n=>{var i;if(this.Ln&&(i=this.Ln)!=null&&i.has(n)){var l,c=this._instance.getFeatureFlag(n),u=(l=this.Ln)==null?void 0:l.get(n);c&&u!=null&&u.variants[c]&&this.Dn(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=jn.getWindowLocation();if(t!=null&&t.search){var n=dd(t==null?void 0:t.search,"__experiment_id"),i=dd(t==null?void 0:t.search,"__experiment_variant");n&&i&&(jn.Pn("previewing web experiments "+n+" && "+i),this.getWebExperiments((l=>{this.jn(parseInt(n),i,l)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Rt.disable_web_experiments&&!i)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}jn(t,n,i){var l=i.filter((c=>c.id===t));l&&l.length>0&&(jn.Pn("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.Dn(l[0].name,n,l[0].variants[n].transforms))}static Bn(t){return!at(t.conditions)&&jn.qn(t)&&jn.Zn(t)}static qn(t){var n;if(at(t.conditions)||at((n=t.conditions)==null?void 0:n.url))return!0;var i,l,c,u=jn.getWindowLocation();return!!u&&((i=t.conditions)==null||!i.url||_3[(l=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](t.conditions.url,u))}static getWindowLocation(){return re==null?void 0:re.location}static Zn(t){var n;if(at(t.conditions)||at((n=t.conditions)==null?void 0:n.utm))return!0;var i=V5();if(i.utm_source){var l,c,u,f,h,p,g,v,y=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==i.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==i.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==i.utm_medium,k=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==i.utm_term;return y&&_&&k&&b}return!1}static Pn(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),l=1;n>l;l++)i[l-1]=arguments[l];Ee.info("[WebExperiments] "+t,i)}Dn(t,n,i){this._is_bot()?jn.Pn(Bb):n!=="control"?i.forEach((l=>{if(l.selector){var c;jn.Pn("applying transform of variant "+n+" for experiment "+t+" ",l);var u=(c=document)==null?void 0:c.querySelectorAll(l.selector);u==null||u.forEach((f=>{var h=f;l.html&&(h.innerHTML=l.html),l.css&&h.setAttribute("style",l.css)}))}})):jn.Pn("Control variants leave the page unmodified.")}_is_bot(){return sr&&this._instance?s_(sr,this.Rt.custom_blocked_useragents):void 0}}var xr=Ut("[Conversations]"),Ps="Conversations not available yet.",v_={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},w3=v_.info;function b_(e){if(ei(e))return{boolValue:e};if(Fr(e))return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(typeof e=="string")return{stringValue:e};if(ut(e))return{arrayValue:{values:e.map((t=>b_(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Ub(e){var t=[];for(var n in e){var i=e[n];Ai(i)||Te(i)||t.push({key:n,value:b_(i)})}return t}var Cd={featureFlags:class{constructor(e){this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.Yn=!1,this.Gn=!1,this.Wn=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}Xn(e){return this._instance.get_property(e)}Jn(){var e,t;return(e=(t=this.Xi)==null?void 0:t.pi(this.Rt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}Kn(){return!!this.Jn()&&(this.Wn||this.Hn||(this.Wn=!0,An.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qn(){var e,t=(e=this.Rt.evaluation_contexts)!==null&&e!==void 0?e:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Gn||(An.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gn=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||An.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}ts(){return this.Qn().length>0}initialize(){var e,t,{config:n}=this._instance,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var l,c,u=(l=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&l!==void 0?l:{},f=Object.keys(i).filter((p=>!!i[p])).reduce(((p,g)=>(p[g]=i[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var i=n!=null&&n.merge?this.getFlagVariants():{},l=n!=null&&n.merge?this.getFlagPayloads():{},c=ye({},i,e),u=ye({},l,t),f={};for(var[h,p]of Object.entries(c)){var g=typeof p=="string";f[h]={key:h,enabled:!!g||!!p,variant:g?p:void 0,reason:void 0,metadata:Te(u==null?void 0:u[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this.receivedFeatureFlags({flags:f})}get hasLoadedFlags(){return this.Vn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Xn(nm),t=this.Xn(cs),n=this.Xn(Fa);if(!n&&!t)return e||{};var i=Wt({},e||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of l){var u,f,h=i[c],p=t==null?void 0:t[c],g=Te(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Te(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[c]=b}return this.$n||(An.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.$n=!0),i}getFlagVariants(){var e=this.Xn(Ga),t=this.Xn(cs);if(!t)return e||{};for(var n=Wt({},e),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.$n||(An.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.$n=!0),n}getFlagPayloads(){var e=this.Xn(q1),t=this.Xn(Fa);if(!t)return e||{};for(var n=Wt({},e||{}),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.$n||(An.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.$n=!0),n}reloadFeatureFlags(){this.zn||this.Rt.advanced_disable_feature_flags||this.es||(this._instance.kr.emit("featureFlagsReloading",!0),this.es=setTimeout((()=>{this.rs()}),5))}ns(){clearTimeout(this.es),this.es=void 0}ensureFlagsLoaded(){this.Vn||this.Hn||this.es||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.zn=e}rs(e){var t;if(this.ns(),!this._instance.ki())if(this.Hn)this.Un=!0;else{var n=this.Rt.token,i=this.Xn(nd),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.Xi)==null?void 0:t.get_initial_props())||{},this.Xn(Eo)||{}),group_properties:this.Xn(Hs),timezone:K5()};Ai(i)||Te(i)||(l.$device_id=i),(e!=null&&e.disableFlags||this.Rt.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.ts()&&(l.evaluation_contexts=this.Qn());var c=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Hn=!0,this._instance._send_request({method:"POST",url:c,data:l,compression:this.Rt.disable_compression?void 0:Zr.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback:u=>{var f,h,p,g=!0;if(u.statusCode===200&&(this.Un||(this.$anon_distinct_id=void 0),g=!1),this.Hn=!1,!l.disable_flags||this.Un){this.Yn=!g;var v=[];u.error?u.error instanceof Error?v.push(u.error.name==="AbortError"?"timeout":"connection_error"):v.push("unknown_error"):u.statusCode!==200&&v.push("api_error_"+u.statusCode),(f=u.json)!=null&&f.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");var y,b=!((h=u.json)==null||(h=h.quotaLimited)==null||!h.includes("feature_flags"));b&&v.push("quota_limited"),(p=this.Xi)==null||p.register({[sm]:v}),b?An.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(l.disable_flags||this.receivedFeatureFlags((y=u.json)!==null&&y!==void 0?y:{},g,{partialResponse:!!this.Rt.advanced_only_evaluate_survey_feature_flags}),this.Un&&(this.Un=!1,this.rs()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Yn)if(this.Vn||this.getFlags()&&this.getFlags().length>0){if(!this.Kn()){var i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}}else An.warn('getFeatureFlag for key "'+e+fp)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Yn)if(this.Vn||this.getFlags()&&this.getFlags().length>0){if(!this.Kn()){var n=this.getFlagVariants(),i=e in n,l=n[e],c=this.getFlagPayloads()[e],u=String(l),f=this.Xn(Db)||void 0,h=this.Xn(id)||void 0,p=this.Xn(Do)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.Xn(im);v&&v!==y&&(p={},(g=this.Xi)==null||g.register({[Do]:p,[im]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,k,E,S,M,C,$,L,T;ut(p[e])?p[e].push(u):p[e]=[u],(b=this.Xi)==null||b.register({[Do]:p});var H=this.getFeatureFlagDetails(e),z=[...(_=this.Xn(sm))!==null&&_!==void 0?_:[]];Te(l)&&z.push("flag_missing");var G={$feature_flag:e,$feature_flag_response:l,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((k=this.Rt.bootstrap)==null||(k=k.featureFlags)==null?void 0:k[e])||null,$feature_flag_bootstrapped_payload:((E=this.Rt.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])||null,$used_bootstrap_value:!this.Yn};Te(H==null||(S=H.metadata)==null?void 0:S.version)||(G.$feature_flag_version=H.metadata.version);var O,I=(M=H==null||(C=H.reason)==null?void 0:C.description)!==null&&M!==void 0?M:H==null||($=H.reason)==null?void 0:$.code;I&&(G.$feature_flag_reason=I),H!=null&&(L=H.metadata)!=null&&L.id&&(G.$feature_flag_id=H.metadata.id),Te(H==null?void 0:H.original_variant)&&Te(H==null?void 0:H.original_enabled)||(G.$feature_flag_original_response=Te(H.original_variant)?H.original_enabled:H.original_variant),H!=null&&(T=H.metadata)!=null&&T.original_payload&&(G.$feature_flag_original_payload=H==null||(O=H.metadata)==null?void 0:O.original_payload),z.length&&(G.$feature_flag_error=z.join(",")),this._instance.capture("$feature_flag_called",G)}if(i){var R=c;if(!Te(c))try{R=JSON.parse(c)}catch{}return{key:e,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:R}}}}else An.warn('getFeatureFlagResult for key "'+e+fp)}getRemoteConfigPayload(e,t){var n=this.Rt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.ts()&&(i.evaluation_contexts=this.Qn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Rt.disable_compression?void 0:Zr.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback(l){var c,u=(c=l.json)==null?void 0:c.featureFlagPayloads;t((u==null?void 0:u[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.Yn){if(this.Vn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Te(n)?void 0:!!n}An.warn('isFeatureEnabled for key "'+e+fp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.Xi){this.Vn=!0;var i=this.getFlagVariants(),l=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=(z=>{var G=z.flags;return G?(z.featureFlags=Object.fromEntries(Object.keys(G).map((O=>{var I;return[O,(I=G[O].variant)!==null&&I!==void 0?I:G[O].enabled]}))),z.featureFlagPayloads=Object.fromEntries(Object.keys(G).filter((O=>G[O].enabled)).filter((O=>{var I;return(I=G[O].metadata)==null?void 0:I.payload})).map((O=>{var I;return[O,(I=G[O].metadata)==null?void 0:I.payload]})))):An.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),z})(u),b=y.flags,_=y.featureFlags,k=y.featureFlagPayloads;if(_){var E=u.requestId,S=u.evaluatedAt;if(ut(_)){An.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var M={};if(_)for(var C=0;_.length>C;C++)M[_[C]]=!0;f&&f.register({[hp]:_,[Ga]:M})}else{var $=_,L=k,T=b;if(v!=null&&v.partialResponse)$=ye({},h,$),L=ye({},p,L),T=ye({},g,T);else if(u.errorsWhileComputingFlags)if(b){var H=new Set(Object.keys(b).filter((z=>{var G;return!((G=b[z])!=null&&G.failed)})));$=ye({},h,Object.fromEntries(Object.entries($).filter((z=>{var[G]=z;return H.has(G)})))),L=ye({},p,Object.fromEntries(Object.entries(L||{}).filter((z=>{var[G]=z;return H.has(G)})))),T=ye({},g,Object.fromEntries(Object.entries(T||{}).filter((z=>{var[G]=z;return H.has(G)}))))}else $=ye({},h,$),L=ye({},p,L),T=ye({},g,T);f&&f.register(ye({[hp]:Object.keys(Ob($)),[Ga]:$||{},[q1]:L||{},[nm]:T||{}},E?{[Db]:E}:{},S?{[id]:S}:{}))}}})(e,this.Xi,i,l,c,n),t||(this.Wn=!1),this.ss(t)}}override(e,t){t===void 0&&(t=!1),An.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Xi)return An.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.Xi.unregister(cs),this.Xi.unregister(Fa),this.ss(),Us.info("All overrides cleared");if(ut(e)){var t=zb(e);return this.Xi.register({[cs]:t}),this.ss(),Us.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.$n=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.Xi.unregister(cs),Us.info("Flag overrides cleared");else if(i.flags){if(ut(i.flags)){var l=zb(i.flags);this.Xi.register({[cs]:l})}else this.Xi.register({[cs]:i.flags});Us.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.Xi.unregister(Fa),Us.info("Payload overrides cleared")):i.payloads&&(this.Xi.register({[Fa]:i.payloads}),Us.info("Payload overrides set",{payloads:i.payloads}))),void this.ss()}if(e&&typeof e=="object")return this.Xi.register({[cs]:e}),this.ss(),Us.info("Flag overrides set",{flags:e});An.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Vn){var{flags:t,flagVariants:n}=this.os();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,l=(this.Xn(Co)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};l&&(u.$early_access_feature_name=l.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(i=this.Xi)==null||i.register({[hp]:Object.keys(Ob(f)),[Ga]:f}),this.ss()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.Xn(Co),l=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+l),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.Xi)==null||u.unregister(Co),(f=this.Xi)==null||f.register({[Co]:h}),e(h)}}})}os(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}ss(e){var{flags:t,flagVariants:n}=this.os();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Xn(Eo)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),l=e==null?void 0:e.$set_once,c={};if(l)for(var u in l)({}).hasOwnProperty.call(l,u)&&(u in n||(c[u]=l[u]));this._instance.register({[Eo]:ye({},n,c,i)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Eo)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Xn(Hs)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=ye({},n[i],e[i]),delete e[i]})),this._instance.register({[Hs]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Xn(Hs)||{};this._instance.register({[Hs]:ye({},t,{[e]:{}})})}else this._instance.unregister(Hs)}reset(){this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.Yn=!1,this.$anon_distinct_id=void 0,this.ns(),this.$n=!1}}},j3={sessionRecording:class{get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}get started(){var e;return!((e=this.ls)==null||!e.isStarted)}get status(){var e,t;return this.us===xo||this.us===Ou?this.us:(e=(t=this.ls)==null?void 0:t.status)!==null&&e!==void 0?e:this.us}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.us=Nb,this.hs=void 0,this._instance=e,!this._instance.sessionManager)throw ls.error("started without valid sessionManager"),new Error(_m+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===Ur)throw new Error(_m+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get cs(){var e,t=!((e=this._instance.get_property(No))==null||!e.enabled),n=!this.Rt.disable_session_recording,i=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.cs||(t=this.ls)==null||!t.isStarted){var n=!Te(Object.assign)&&!Te(Array.from);this.cs&&n?(this.ds(e),ls.info("starting")):(this.us=Nb,this.stopRecording())}}ds(e){var t,n,i;this.cs&&(this.us!==xo&&this.us!==Ou&&(this.us=Cb),Le!=null&&(t=Le.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Le.__PosthogExtensions__)!=null&&n.initSessionRecording?this.vs(e):(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.fs,(l=>{if(l)return ls.error("could not load recorder",l);this.vs(e)})))}stopRecording(){var e,t;(e=this.hs)==null||e.call(this),this.hs=void 0,(t=this.ls)==null||t.stop()}ps(){var e,t;(e=this.hs)==null||e.call(this),this.hs=void 0,(t=this.ls)==null||t.discard()}gs(){var e;(e=this.Xi)==null||e.unregister(P5)}ys(e,t){if(at(e))return null;var n,i=Fr(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(ls.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}bs(e){if(this.Xi){var t,n,i=this.Xi,l=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.ys((c=this.Rt.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.ys(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;at(p)&&this.gs();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[No]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:Te(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};l(),(t=this.hs)==null||t.call(this),this.hs=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.bs(e),void this.ps()):(this.bs(e),void this.startIfEnabledOrStop()):(this.us===xo&&(this.us=Ou,ls.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.ls)!=null&&n.log?this.ls.log(e,t):ls.warn("log called before recorder was ready")}get fs(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(No);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}ws(){var e,t=this._instance.get_property(No);if(!t)return!1;var n=(e=(typeof t=="object"?t:JSON.parse(t)).cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-n}vs(e){var t,n;if((t=Le.__PosthogExtensions__)==null||!t.initSessionRecording)return ls.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ls||(this.ls=(n=Le.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.ls._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ws())return this.us===Ou||this.us===xo?void 0:(this.us=xo,ls.info("persisted remote config is stale, requesting fresh config before starting"),void new Z5(this._instance).load());this.us=Cb,this.ls.start(e)}onRRwebEmit(e){var t;(t=this.ls)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ls||(t=this.Xi)==null||t.register({$replay_override_linked_flag:!0}),(e=this.ls)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ls||(t=this.Xi)==null||t.register({$replay_override_sampling:!0}),(e=this.ls)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.ls||(n=this.Xi)==null||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.ls)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ls)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.ls)==null||!n.tryAddCustomEvent(e,t))}}},k3={autocapture:class{constructor(e){this._s=!1,this.Is=null,this.Cs=!1,this.instance=e,this.rageclicks=new wb(e.config.rageclick),this.Ss=null}initialize(){this.startIfEnabled()}get Rt(){var e,t,n=cn(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}ks(){if(this.isBrowserSupported()){if(re&&Ne){var e=n=>{n=n||(re==null?void 0:re.event);try{this.xs(n)}catch(i){jb.error("Failed to capture event",i)}};if(rn(Ne,"submit",e,{capture:!0}),rn(Ne,"change",e,{capture:!0}),rn(Ne,"click",e,{capture:!0}),this.Rt.capture_copied_text){var t=n=>{this.xs(n=n||(re==null?void 0:re.event),cp)};rn(Ne,"copy",t,{capture:!0}),rn(Ne,"cut",t,{capture:!0})}}}else jb.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._s&&(this.ks(),this._s=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Cs=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[P1]:!!e.autocapture_opt_out}),this.Is=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Ss=e}getElementSelectors(e){var t,n=[];return(t=this.Ss)==null||t.forEach((i=>{var l=Ne==null?void 0:Ne.querySelectorAll(i);l==null||l.forEach((c=>{e===c&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[P1];if(Ai(this.Is)&&!ei(n)&&!this.instance.ki())return!1;var i=(t=this.Is)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!i}xs(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=gb(e);u_(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&(function(v,y){if(!re||bm(v))return!1;var b,_,k;if(ei(y)?(b=!!y&&vb,_=void 0):(b=(k=y==null?void 0:y.css_selector_ignorelist)!==null&&k!==void 0?k:vb,_=y==null?void 0:y.content_ignorelist),b===!1)return!1;var{targetElementList:E}=bb(v,!1);return!(function(S,M){if(S===!1||Te(S))return!1;var C;if(S===!0)C=a3;else{if(!ut(S))return!1;if(S.length>10)return Ee.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;C=S.map(($=>$.toLowerCase()))}return M.some(($=>{var{safeText:L,ariaLabel:T}=$;return C.some((H=>L.includes(H)||T.includes(H)))}))})(_,E.map((S=>{var M;return{safeText:Wo(S).toLowerCase(),ariaLabel:((M=S.getAttribute("aria-label"))==null?void 0:M.toLowerCase().trim())||""}})))&&!xb(E,b)})(i,this.instance.config.rageclick)&&this.xs(e,"$rageclick");var l=t===cp;if(i&&(function(v,y,b,_,k){var E,S,M,C;if(b===void 0&&(b=void 0),!re||bm(v)||(E=b)!=null&&E.url_allowlist&&!mb(b.url_allowlist)||(S=b)!=null&&S.url_ignorelist&&mb(b.url_ignorelist))return!1;if((M=b)!=null&&M.dom_event_allowlist){var $=b.dom_event_allowlist;if($&&!$.some((G=>y.type===G)))return!1}var{parentIsUsefulElement:L,targetElementList:T}=bb(v,_);if(!(function(G,O){var I=O==null?void 0:O.element_allowlist;if(Te(I))return!0;var R,oe=function(X){if(I.some((B=>X.tagName.toLowerCase()===B)))return{v:!0}};for(var J of G)if(R=oe(J))return R.v;return!1})(T,b)||!xb(T,(C=b)==null?void 0:C.css_selector_allowlist))return!1;var H=re.getComputedStyle(v);if(H&&H.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var z=v.tagName.toLowerCase();switch(z){case"html":return!1;case"form":return(k||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(k||["change","click"]).indexOf(y.type)>=0;default:return L?(k||["click"]).indexOf(y.type)>=0:(k||["click"]).indexOf(y.type)>=0&&(Wm.indexOf(z)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,this.Rt,l,l?["copy","cut"]:void 0)){var{props:c,explicitNoCapture:u}=h3(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this.Cs});if(u)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(c.$element_selectors=f),t===cp){var h,p=f_(re==null||(h=re.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return Ni(Ne==null?void 0:Ne.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ts=(re==null||(t=re.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Ee.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.As&&this.As(),this.As=void 0,Ee.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(re&&re.history){var n=this;(e=re.history.pushState)!=null&&e.__posthog_wrapped__||kb(re.history,"pushState",(i=>function(l,c,u){i.call(this,l,c,u),n.Es("pushState")})),(t=re.history.replaceState)!=null&&t.__posthog_wrapped__||kb(re.history,"replaceState",(i=>function(l,c,u){i.call(this,l,c,u),n.Es("replaceState")})),this.Rs()}}Es(e){try{var t,n=re==null||(t=re.location)==null?void 0:t.pathname;if(!n)return;n!==this.Ts&&this.isEnabled&&this._instance.capture(Ha,{navigation_type:e}),this.Ts=n}catch(i){Ee.error("Error capturing "+e+" pageview",i)}}Rs(){if(!this.As){var e=()=>{this.Es("popstate")};rn(re,"popstate",e),this.As=()=>{re&&re.removeEventListener("popstate",e)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(e){var t;this.Ns=!1,this._s=!1,this.Ms=null,this.instance=e,this.Ns=!((t=this.instance.persistence)==null||!t.props[Jp]),this.rageclicks=new wb(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return cn(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return at(this.Rt.capture_heatmaps)?at(this.Rt.enable_heatmaps)?this.Ns:this.Rt.enable_heatmaps:this.Rt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._s)return;m3.info("starting..."),this.Fs(),this.Tt()}else{var e;clearInterval((e=this.Ms)!==null&&e!==void 0?e:void 0),this.Os(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Jp]:t}),this.Ns=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Ps(e){this.wt(e.originalEvent,"deadclick")}Tt(){this.Ms&&clearInterval(this.Ms),this.Ms=(Ne==null?void 0:Ne.visibilityState)==="visible"?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Fs(){re&&Ne&&(this.Ls=this.ji.bind(this),rn(re,od,this.Ls),this.Ds=e=>this.wt(e||(re==null?void 0:re.event)),rn(Ne,"click",this.Ds,{capture:!0}),this.Bs=e=>this.js(e||(re==null?void 0:re.event)),rn(Ne,"mousemove",this.Bs,{capture:!0}),this.qs=new Y1(this.instance,TN,this.Ps.bind(this)),this.qs.startIfEnabledOrStop(),this.Zs=this.Tt.bind(this),rn(Ne,ld,this.Zs),this._s=!0)}Os(){var e;re&&Ne&&(this.Ls&&re.removeEventListener(od,this.Ls),this.Ds&&Ne.removeEventListener("click",this.Ds,{capture:!0}),this.Bs&&Ne.removeEventListener("mousemove",this.Bs,{capture:!0}),this.Zs&&Ne.removeEventListener(ld,this.Zs),clearTimeout(this.$s),(e=this.qs)==null||e.stop(),this._s=!1)}Vs(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&Nd(p)&&!hs(p,"body");){if(p===h)return!1;if(tt(f,re==null?void 0:re.getComputedStyle(p).position))return!0;p=h_(p)}return!1})(gb(e),["fixed","sticky"],l);return{x:e.clientX+(c?0:i),y:e.clientY+(c?0:n),target_fixed:c,type:t}}wt(e,t){var n;if(t===void 0&&(t="click"),!pb(e.target)&&Eb(e)){var i=this.Vs(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Hs(ye({},i,{type:"rageclick"})),this.Hs(i)}}js(e){!pb(e.target)&&Eb(e)&&(clearTimeout(this.$s),this.$s=setTimeout((()=>{this.Hs(this.Vs(e,"mousemove"))}),500))}Hs(e){if(re){var t=re.location.href,n=this.Rt.custom_personal_data_properties,i=this.Rt.mask_personal_data_properties?[...tl,...n||[]]:[],l=Xo(t,i,Yo);this.T=this.T||{},this.T[l]||(this.T[l]=[]),this.T[l].push(e)}}ji(){this.T&&!Va(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Y1,webVitalsAutocapture:class{constructor(e){var t;this.Ns=!1,this._s=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.zs=()=>{clearTimeout(this.Us),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((n,i)=>ye({},n,{["$web_vitals_"+i.name+"_event"]:ye({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=n=>{var i,l=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(Te(l))as.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var c=this.Ys();Te(c)||(at(n==null?void 0:n.name)||at(n==null?void 0:n.value)?as.error("Invalid metric received",n):!this.Gs||this.Gs>n.value?(this.T.url!==c&&(this.zs(),this.Us=setTimeout(this.zs,this.flushToCaptureTimeoutMs)),Te(this.T.url)&&(this.T.url=c),this.T.firstMetricTimestamp=Te(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.T.metrics.push(ye({},n,{$current_url:c,$session_id:l.sessionId,$window_id:l.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.zs()):as.error("Ignoring metric with value >= "+this.Gs,n))}},this.Ws=()=>{if(!this._s){var n,i,l,c,u=Le.__PosthogExtensions__;Te(u)||Te(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:l,onINP:c}=u.postHogWebVitalsCallbacks),n&&i&&l&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.nt.bind(this)),this._s=!0):as.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Ns=!((t=this._instance.persistence)==null||!t.props[H1]),this.startIfEnabled()}get Xs(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=cn(this.Xs)?(e=this.Xs)==null?void 0:e.web_vitals_allowed_metrics:void 0;return at(n)?((t=this._instance.persistence)==null?void 0:t.props[I1])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(cn(this.Xs)?this.Xs.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=cn(this.Xs)?this.Xs.web_vitals_attribution:void 0;return e!=null&&e}get Gs(){var e=cn(this.Xs)&&Fr(this.Xs.__web_vitals_max_value)?this.Xs.__web_vitals_max_value:Sb;return e>0&&6e4>=e?Sb:e}get isEnabled(){var e=yn==null?void 0:yn.protocol;if(e!=="http:"&&e!=="https:")return as.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=cn(this.Xs)?this.Xs.web_vitals:ei(this.Xs)?this.Xs:void 0;return ei(t)?t:this.Ns}startIfEnabled(){this.isEnabled&&!this._s&&(as.info("enabled, starting..."),this.ni(this.Ws))}onRemoteConfig(e){if("capturePerformance"in e){var t=cn(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=cn(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[H1]:t}),this._instance.persistence.register({[I1]:n})),this.Ns=t,this.startIfEnabled()}}ni(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?as.error("failed to load script",i):e()}))}Ys(){var e=re?re.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...tl,...t||[]]:[];return Xo(e,n,Yo)}as.error("Could not determine current URL")}}},S3={exceptionObserver:class{constructor(e){var t,n,i;this.Ws=()=>{var l;if(re&&this.isEnabled&&(l=Le.__PosthogExtensions__)!=null&&l.errorWrappingFunctions){var c=Le.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=Le.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=Le.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Js&&this.Rt.capture_unhandled_errors&&(this.Js=c(this.captureException.bind(this))),!this.Ks&&this.Rt.capture_unhandled_rejections&&(this.Ks=u(this.captureException.bind(this))),!this.Qs&&this.Rt.capture_console_errors&&(this.Qs=f(this.captureException.bind(this)))}catch(h){go.error("failed to start",h),this.eo()}}},this._instance=e,this.io=!((t=this._instance.persistence)==null||!t.props[$1]),this.ro=new FS({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,qt:go}),this.Rt=this.no(),this.startIfEnabledOrStop()}no(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return cn(e)?t=ye({},t,e):(Te(e)?this.io:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(go.info("enabled"),this.eo(),this.ni(this.Ws)):this.eo()}ni(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return go.error("failed to load script",i);e()}))}eo(){var e,t,n;(e=this.Js)==null||e.call(this),this.Js=void 0,(t=this.Ks)==null||t.call(this),this.Ks=void 0,(n=this.Qs)==null||n.call(this),this.Qs=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.io=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[$1]:this.io}),this.Rt=this.no(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.no()}captureException(e){var t,n,i,l=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.ro.consumeRateLimit(l)?go.info("Skipping exception capture because of client rate limiting.",{exception:l}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.so=[],this.oo=new JS([new lN,new gN,new cN,new oN,new pN,new hN,new dN,new mN],(function(i){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
62
+ `),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=U1.test(y)?y.replace(U1,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var k=_(b,i);if(k){p.push(k);break}}if(p.length>=50)break}}}return(function(E){if(!E.length)return[];var S=Array.from(E);return S.reverse(),S.slice(0,50).map((M=>{return ye({},M,{filename:M.filename||(C=S,C[C.length-1]||{}).filename,function:M.function||el});var C}))})(p)}})("web:javascript",rN,aN)),this._instance=e,this.so=(t=(n=this._instance.persistence)==null?void 0:n.get_property(em))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,i;if("errorTracking"in e){var l=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.so=l,this._instance.persistence&&this._instance.persistence.register({[em]:this.so,[F1]:c})}}get ao(){var e,t=!!this._instance.get_property(F1),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.oo.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.lo(t)){if(this.uo(t))return void pp.info("Skipping exception capture because a suppression rule matched");if(!this.ao&&this.ho(t))return void pp.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.co(t))return void pp.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Ur:!0})}uo(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:l,value:c}=i;return sn(l)&&l.length>0&&n.$exception_types.push(l),sn(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.so.some((n=>{var i=n.values.map((l=>{var c,u=a_[l.operator],f=ut(l.value)?l.value:[l.value],h=(c=t[l.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}ho(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}co(e){if(e.length>0){var t,n,i,l,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(i=u==null||(l=u.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}lo(e){return!at(e)&&ut(e)}}},N3=ye({productTours:class{get Xi(){return this._instance.persistence}constructor(e){this.do=null,this.vo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Xi&&this.Xi.register({[tm]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.do||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(tm)||this.ni((()=>this.fo()))}ni(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?Tb.error("Could not load product tours script",i):e()}))}fo(){var e;!this.do&&(e=Le.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.do=Le.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!ut(this.vo)||t){var n=this.Xi;if(n){var i=n.props[Gu];if(ut(i)&&!t)return this.vo=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:l=>{var c=l.statusCode;if(c!==200||!l.json){var u="Product Tours API could not be loaded, status: "+c;return Tb.error(u),void e([],{isLoaded:!1,error:u})}var f=ut(l.json.product_tours)?l.json.product_tours:[];this.vo=f,n&&n.register({[Gu]:f}),e(f,{isLoaded:!0})}})}else e(this.vo,{isLoaded:!0})}getActiveProductTours(e){at(this.do)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.do.getActiveProductTours(e)}showProductTour(e){var t;(t=this.do)==null||t.showTourById(e)}previewTour(e){this.do?this.do.previewTour(e):this.ni((()=>{var t;this.fo(),(t=this.do)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.do)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.do)==null||e.nextStep()}previousStep(){var e;(e=this.do)==null||e.previousStep()}clearCache(){var e;this.vo=null,(e=this.Xi)==null||e.unregister(Gu)}resetTour(e){var t;(t=this.do)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.do)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.do)==null||t.cancelPendingTour(e)}}},Cd),C3={siteApps:class{constructor(e){this._instance=e,this.po=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mo(e,t){if(t){var n=this.globalsForEvent(t);this.po.push(n),this.po.length>1e3&&(this.po=this.po.slice(10))}}get siteAppLoaders(){var e;return(e=Le._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.mo.bind(this));this.yo=()=>{e(),this.po=[],this.yo=void 0}}}globalsForEvent(e){var t,n,i,l,c,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},h5(e,g3),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(i=(l=e.properties)==null?void 0:l.$set_once)!==null&&i!==void 0?i:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.po.length&&(os.info("Processing "+this.po.length+" events for site app with id "+e.id),this.po.forEach((f=>t.processEvent==null?void 0:t.processEvent(f))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.yo)==null||u.call(this))},i=!1,l=u=>{t.errored=!u,t.loaded=!0,os.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var{processEvent:c}=e.init({posthog:this._instance,callback(u){l(u)}});c&&(t.processEvent=c),i=!0}catch(u){os.error(Ab+e.id,u),l(!1)}if(i&&t.loaded)try{n()}catch(u){os.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}bo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}wo(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(i){os.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,i,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.bo(),void this._instance.on("eventCaptured",(h=>this.wo(h)))):void os.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.yo)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var c=function(h){var p;Le["__$$ph_site_app_"+h]=l._instance,(p=Le.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(l._instance,f,(g=>{if(g)return os.error(Ab+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else os.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},E3={tracingHeaders:class{constructor(e){this._o=void 0,this.Io=void 0,this.Ws=()=>{var t,n;Te(this._o)&&((t=Le.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Te(this.Io)&&((n=Le.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}ni(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return p3.error("failed to load script",i);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.ni(this.Ws):((e=this._o)==null||e.call(this),(t=this.Io)==null||t.call(this),this._o=void 0,this.Io=void 0)}}},T3=ye({surveys:class{get Rt(){return this._instance.config}constructor(e){this.Co=void 0,this._surveyManager=null,this.So=!1,this.ko=[],this.xo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Rt.disable_surveys){var t=e.surveys;if(at(t))return Et.warn("Flags not loaded yet. Not loading surveys.");var n=ut(t);this.Co=n?t.length>0:t,Et.info("flags response received, isSurveysEnabled: "+this.Co),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(xm)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.So)Et.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Et.info(Mb);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Et.info("Not loading surveys in cookieless mode without consent.");else{var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){if(!Te(this.Co)||this.Rt.advanced_enable_surveys){var t=this.Co||this.Rt.advanced_enable_surveys;this.So=!0;try{var n=e.generateSurveys;if(n)return void this.To(n,t);var i=e.loadExternalDependency;if(!i)return void this.Ao(Im);i(this._instance,"surveys",(l=>{l||!e.generateSurveys?this.Ao("Could not load surveys script",l):this.To(e.generateSurveys,t)}))}catch(l){throw this.Ao("Error initializing surveys",l),l}finally{this.So=!1}}}else Et.error("PostHog Extensions not found.")}}To(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new b3(this._instance),Et.info("Surveys loaded successfully"),this.Eo({isLoaded:!0})}Ao(e,t){Et.error(e,t),this.Eo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ko.push(e),this._surveyManager&&this.Eo({isLoaded:!0}),()=>{this.ko=this.ko.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Rt.disable_surveys)return Et.info(Mb),e([]);var n,i=this._instance.get_property(rm);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.xo?this.xo.then((l=>{var{surveys:c,context:u}=l;return e(c,u)})):(typeof Promise<"u"&&(this.xo=new Promise((l=>{n=l}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:l=>{var c;this.xo=null;var u=l.statusCode;if(u!==200||!l.json){var f="Surveys API could not be loaded, status: "+u;Et.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=l.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var k;return!((k=_.conditions)==null||(k=k.events)==null||(k=k.values)==null||!k.length)})(b)||(function(_){var k;return!((k=_.conditions)==null||(k=k.actions)==null||(k=k.values)==null||!k.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[rm]:g});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}Eo(e){for(var t of this.ko)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Et.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!at(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Et.warn("init was not called")}Ro(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((l=>l.id===e)))!==null&&i!==void 0?i:null})),t}No(e){if(at(this._surveyManager))return{eligible:!1,reason:dp};var t=typeof e=="string"?this.Ro(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(at(this._surveyManager))return Et.warn("init was not called"),{visible:!1,disabledReason:dp};var t=this.No(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return at(this._surveyManager)?(Et.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dp})):new Promise((n=>{this.getSurveys((i=>{var l,c=(l=i.find((f=>f.id===e)))!==null&&l!==void 0?l:null;if(c){var u=this.No(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(at(this._surveyManager))Et.warn("init was not called");else{var l=typeof e=="string"?this.Ro(e):e;if(l!=null&&l.id)if(JN.includes(l.type)){var c=Ne==null?void 0:Ne.querySelector(t);if(c)return(i=l.appearance)!=null&&i.surveyPopupDelaySeconds?(Et.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Et.info("Rendering survey "+l.id+" with delay of "+((u=l.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(l,c,n),Et.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,c,n);Et.warn("Survey element not found")}else Et.warn("Surveys of type "+l.type+" cannot be rendered in the app");else Et.warn("Survey not found")}}displaySurvey(e,t){var n;if(at(this._surveyManager))Et.warn("init was not called");else{var i=this.Ro(e);if(i){var l=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=ye({},i,{appearance:ye({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==dm.Popover&&t.initialResponses&&Et.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(i);if(!c.visible)return void Et.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==dm.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else Et.warn("Survey not found")}}cancelPendingSurvey(e){at(this._surveyManager)?Et.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},Cd),A3={toolbar:class{constructor(e){this.instance=e}Mo(e){Le.ph_toolbar_state=e}Fo(){var e;return(e=Le.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),F5(this.instance.config)||!re||!Ne)return!1;e=e??re.location,n=n??re.history;try{if(!t){try{re.localStorage.setItem("test","test"),re.localStorage.removeItem("test")}catch{return!1}t=re==null?void 0:re.localStorage}var i,l=y3||fd(e.hash,"__posthog")||fd(e.hash,"state"),c=l?G1((()=>JSON.parse(atob(decodeURIComponent(l)))))||G1((()=>JSON.parse(decodeURIComponent(l)))):null;return c&&c.action==="ph_authorize"?((i=c).source="url",i&&Object.keys(i).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Rb)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Oo(e){var t=Le.ph_load_toolbar||Le.ph_load_editor;!at(t)&&Ni(t)?t(e,this.instance):Lb.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ne==null||!Ne.getElementById($5));if(!re||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(Rb,JSON.stringify(ye({},i,{source:void 0}))),this.Fo()===2)this.Oo(i);else if(this.Fo()===0){var l;this.Mo(1),(l=Le.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return Lb.error("[Toolbar] Failed to load",c),void this.Mo(0);this.Mo(2),this.Oo(i)})),rn(re,"turbolinks:load",(()=>{this.Mo(0),this.loadToolbar(i)}))}return!0}Po(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},M3=ye({experiments:jn},Cd),R3={conversations:class{constructor(e){this.Lo=void 0,this._conversationsManager=null,this.Do=!1,this.Bo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;at(t)||(ei(t)?this.Lo=t:(this.Lo=t.enabled,this.Bo=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Lo=void 0,this.Bo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Do||this._instance.config.disable_conversations||F5(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e&&!Te(this.Lo)&&this.Lo)if(this.Bo&&this.Bo.token){this.Do=!0;try{var t=e.initConversations;if(t)return this.jo(t),void(this.Do=!1);var n=e.loadExternalDependency;if(!n)return void this.qo(Im);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.qo("Could not load conversations script",i):this.jo(e.initConversations),this.Do=!1}))}catch(i){this.qo("Error initializing conversations",i),this.Do=!1}}else xr.error("Conversations enabled but missing token in remote config.")}}jo(e){if(this.Bo)try{this._conversationsManager=e(this.Bo,this._instance),xr.info("Conversations loaded successfully")}catch(t){this.qo("Error completing conversations initialization",t)}else xr.error("Cannot complete initialization: remote config is null")}qo(e,t){xr.error(e,t),this._conversationsManager=null,this.Do=!1}show(){this._conversationsManager?this._conversationsManager.show():xr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Lo===!0&&!Ai(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Br((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(xr.warn(Ps),null)}))()}getMessages(e,t){var n=this;return Br((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(xr.warn(Ps),null)}))()}markAsRead(e){var t=this;return Br((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(xr.warn(Ps),null)}))()}getTickets(e){var t=this;return Br((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(xr.warn(Ps),null)}))()}requestRestoreLink(e){var t=this;return Br((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(xr.warn(Ps),null)}))()}restoreFromToken(e){var t=this;return Br((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(xr.warn(Ps),null)}))()}restoreFromUrlToken(){var e=this;return Br((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(xr.warn(Ps),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Qr(){var e;(e=this._conversationsManager)==null||e.setIdentity()}tn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},L3={logs:class{constructor(e){var t;this.Zo=!1,this.$o=!1,this.qt=Ut("[logs]"),this.Vo=[],this.Ho=0,this.zo=0,this.Uo=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Zo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!at(n)&&n&&(this.Zo=!0,this.loadIfEnabled())}reset(){this.Vo=[],this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.Ho=0,this.zo=0,this.Uo=!1}loadIfEnabled(){if(this.Zo&&!this.$o){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.qt.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.$o=!0)})):this.qt.error(Im)}else this.qt.error("PostHog Extensions not found.")}}captureLog(e){var t,n,i,l,c,u;if(this._instance.is_capturing())if(e&&e.body){var f=(t=(n=this._instance.config.logs)==null?void 0:n.flushIntervalMs)!==null&&t!==void 0?t:3e3,h=(i=(l=this._instance.config.logs)==null?void 0:l.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,p=Date.now();if(f>p-this.zo||(this.zo=p,this.Ho=0,this.Uo=!1),h>this.Ho){this.Ho++;var g=(function(v,y){var b=v.level||"info",{text:_,number:k}=v_[b]||w3,E=String(Date.now())+"000000",S={};y.distinctId&&(S.posthogDistinctId=y.distinctId),y.sessionId&&(S.sessionId=y.sessionId),y.currentUrl&&(S["url.full"]=y.currentUrl),y.activeFeatureFlags&&y.activeFeatureFlags.length>0&&(S.feature_flags=y.activeFeatureFlags);var M=ye({},S,v.attributes||{}),C={timeUnixNano:E,observedTimeUnixNano:E,severityNumber:k,severityText:_,body:{stringValue:v.body},attributes:Ub(M)};return v.trace_id&&(C.traceId=v.trace_id),v.span_id&&(C.spanId=v.span_id),Te(v.trace_flags)||(C.flags=v.trace_flags),C})(e,this.Yo());this.Vo.push({record:g}),((c=(u=this._instance.config.logs)==null?void 0:u.maxBufferSize)!==null&&c!==void 0?c:100)>this.Vo.length?this.Go():this.flushLogs()}else this.Uo||(this.qt.warn("captureLog dropping logs: exceeded "+h+" logs per "+f+"ms"),this.Uo=!0)}else this.qt.warn("captureLog requires a body")}get logger(){return this.Wo||(this.Wo={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Wo}flushLogs(e){if(this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.Vo.length!==0){var t=this.Vo;this.Vo=[];var n=this._instance.config.logs,i=ye({"service.name":(n==null?void 0:n.serviceName)||"unknown_service"},(n==null?void 0:n.environment)&&{"deployment.environment":n.environment},(n==null?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},n==null?void 0:n.resourceAttributes),l=(function(u,f){return{resourceLogs:[{resource:{attributes:Ub(f)},scopeLogs:[{scope:{name:Rn.LIB_NAME},logRecords:u}]}]}})(t.map((u=>u.record)),i),c=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Lr({method:"POST",url:c,data:l,compression:"best-available",batchKey:"logs",transport:e})}}Go(){var e,t;this.Ni||(this.Ni=setTimeout((()=>{this.Ni=void 0,this.flushLogs()}),(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3))}Yo(){var e,t={lib:Rn.LIB_NAME};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(Le!=null&&(e=Le.location)!=null&&e.href&&(t.currentUrl=Le.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},D3=ye({},Cd,j3,k3,S3,N3,C3,T3,E3,A3,M3,R3,L3);_r.__defaultExtensionClasses=ye({},D3);var Pb,Qo=(Pb=Oo[Ia]=new _r,(function(){function e(){e.done||(e.done=!0,c_=!1,Dt(Oo,(function(t){t._dom_loaded()})))}Ne!=null&&Ne.addEventListener?Ne.readyState==="complete"?e():rn(Ne,"DOMContentLoaded",e,{capture:!1}):re&&Ee.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Pb);const z3="https://us.i.posthog.com",y_="cc-telemetry-enabled";let wm=!1,Ko=!1;function O3(){return z3}function B3(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(y_);return e===null?!0:e==="true"}function __(e){wm&&(e?(Qo.opt_in_capturing({captureEventName:null}),Ko=!0):(Qo.opt_out_capturing(),Ko=!1))}function tR(e){typeof localStorage<"u"&&localStorage.setItem(y_,String(e)),__(e)}function U3(){const e=void 0;return e?(Qo.init(e,{api_host:O3(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),wm=!0,__(B3()),!0):(wm=!1,Ko=!1,!1)}function Qm(e,t){Ko&&Qo.capture(e,t)}function Vs(e,t){Ko&&Qo.captureException(e,t)}function P3(e){Qm("$pageview",{$current_url:e})}const Mi="/api",w_="companion_auth_token";function Xs(){if(typeof window>"u")return{};const e=localStorage.getItem(w_);return e?{Authorization:`Bearer ${e}`}:{}}function sl(e){e===401&&typeof window<"u"&&(localStorage.removeItem(w_),Xn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>Rk);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function an(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function rc(e,t,n,i){Qm("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function ni(e,t,n,i,l){Qm("api_request_failed",{method:e,path:t,status:l,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),Vs(i,{method:e,path:t,status:l})}async function Ie(e,t){const n=an();let i=!1;try{const l=await fetch(`${Mi}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Xs()},body:t?JSON.stringify(t):void 0});if(!l.ok){sl(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ni("POST",e,an()-n,u,l.status),i=!0,u}return rc("POST",e,an()-n,l.status),l.json()}catch(l){throw i||ni("POST",e,an()-n,l),l}}async function Re(e){const t=an();let n=!1;try{const i=await fetch(`${Mi}${e}`,{headers:{...Xs()}});if(!i.ok){sl(i.status);const l=await i.json().catch(()=>({error:i.statusText})),c=new Error(l.error||i.statusText);throw ni("GET",e,an()-t,c,i.status),n=!0,c}return rc("GET",e,an()-t,i.status),i.json()}catch(i){throw n||ni("GET",e,an()-t,i),i}}async function vr(e,t){const n=an();let i=!1;try{const l=await fetch(`${Mi}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Xs()},body:t?JSON.stringify(t):void 0});if(!l.ok){sl(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ni("PUT",e,an()-n,u,l.status),i=!0,u}return rc("PUT",e,an()-n,l.status),l.json()}catch(l){throw i||ni("PUT",e,an()-n,l),l}}async function $3(e,t){const n=an();let i=!1;try{const l=await fetch(`${Mi}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Xs()},body:t?JSON.stringify(t):void 0});if(!l.ok){sl(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ni("PATCH",e,an()-n,u,l.status),i=!0,u}return rc("PATCH",e,an()-n,l.status),l.json()}catch(l){throw i||ni("PATCH",e,an()-n,l),l}}async function br(e,t){const n=an();let i=!1;try{const l=await fetch(`${Mi}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Xs()},body:t?JSON.stringify(t):void 0});if(!l.ok){sl(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ni("DELETE",e,an()-n,u,l.status),i=!0,u}return rc("DELETE",e,an()-n,l.status),l.json()}catch(l){throw i||ni("DELETE",e,an()-n,l),l}}async function F3(e,t){const n=await fetch(`${Mi}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Xs()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const i=n.body.getReader(),l=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;c+=l.decode(h,{stream:!0});const p=c.split(`
63
+
64
+ `);c=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",y="";for(const _ of g.split(`
65
+ `))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function H3(){try{const e=await fetch(`${Mi}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function $b(e){try{const t=await fetch(`${Mi}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const we={getAuthQr:()=>Re("/auth/qr"),getAuthToken:()=>Re("/auth/token"),regenerateAuthToken:()=>Ie("/auth/regenerate"),createSession:e=>Ie("/sessions/create",e),listSessions:()=>Re("/sessions"),discoverClaudeSessions:(e=200)=>Re(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Re(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>br(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/relaunch`),archiveSession:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Re(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Ie(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>$3(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Re(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Re("/fs/home"),listEnvs:()=>Re("/envs"),getEnv:e=>Re(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Ie("/envs",{name:e,variables:t}),updateEnv:(e,t)=>vr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>br(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Re("/sandboxes"),getSandbox:e=>Re(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Ie("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>vr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>br(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Ie(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Ie("/docker/build-base"),getBaseImageStatus:()=>Re("/docker/base-image"),getSettings:()=>Re("/settings"),updateSettings:e=>vr("/settings",e),verifyAnthropicKey:e=>Ie("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Re("/tailscale/status"),startTailscaleFunnel:()=>Ie("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Ie("/tailscale/funnel/stop"),listLinearConnections:()=>Re("/linear/connections"),createLinearConnection:e=>Ie("/linear/connections",e),updateLinearConnection:(e,t)=>vr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>br(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Ie(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Re(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Re(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Re(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Ie(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Re(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Re(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Re(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>vr("/linear/project-mappings",e),removeLinearProjectMapping:e=>br("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>vr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>br(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Re(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Ie("/linear/issues",e),addLinearComment:(e,t,n)=>Ie(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Re(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Re(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Ie("/git/fetch",{repoRoot:e}),gitPull:e=>Ie("/git/pull",{cwd:e}),listWorktrees:e=>Re(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Ie("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>br("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Re(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Re("/backends"),getBackendModels:e=>Re(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Re("/containers/status"),getContainerImages:()=>Re("/containers/images"),getImageStatus:e=>Re(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Ie(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Re(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Ie(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Re(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Re(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${Mi}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Xs()}});if(!t.ok){sl(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>vr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Re(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Re(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Re(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>vr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Re(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Re("/usage-limits"),getSessionUsageLimits:e=>Re(`/sessions/${encodeURIComponent(e)}/usage-limits`),spawnTerminal:(e,t,n,i)=>Ie("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Ie("/terminal/kill",{terminalId:e}),getTerminal:e=>Re(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Re("/update-check"),forceCheckForUpdate:()=>Ie("/update-check"),triggerUpdate:()=>Ie("/update"),listCronJobs:()=>Re("/cron/jobs"),getCronJob:e=>Re(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Ie("/cron/jobs",e),updateCronJob:(e,t)=>vr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>br(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Ie(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Ie(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Re(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Re(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Re("/agents"),getAgent:e=>Re(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Ie("/agents",e),updateAgent:(e,t)=>vr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>br(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Ie(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Ie(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Re(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Ie("/agents/import",e),exportAgent:e=>Re(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Ie(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Re(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Re(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return Re(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Ie("/linear/oauth/disconnect"),createLinearStaging:e=>Ie("/linear/oauth/staging",e),getLinearStagingStatus:e=>Re(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>br(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Re("/linear/oauth-connections"),createLinearOAuthConnection:e=>Ie("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>vr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>br(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Re(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Re("/skills"),sendSessionMessage:(e,t)=>Ie(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return Re(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Ie("/prompts",e),updatePrompt:(e,t)=>vr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>br(`/prompts/${encodeURIComponent(e)}`)};let Fb=!1;function Hb(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const l=document.execCommand("copy");if(document.body.removeChild(i),!l){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function Ib(){return new Promise(()=>{})}function I3(){if(Fb||typeof window>"u")return;Fb=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await Hb(i)}catch{return Ib()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Hb(n)}catch{return Ib()}}}})}catch{}}const qb="#/session/",Vb="#/agents/";let Gb=!1;function Km(){Gb||(I3(),Gb=!0)}function Zm(e){if(Km(),e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(Vb)){const n=e.slice(Vb.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(qb)){const n=e.slice(qb.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function q3(e){return`#/session/${e}`}function Jm(e,t=!1){Km();const n=q3(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function mp(e=!1){Km(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function V3(){const[e,t]=j.useState(""),[n,i]=j.useState(null),[l,c]=j.useState(!1),u=Y(g=>g.setAuthToken),f=j.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}c(!0),i(null),await $b(v)?u(v):i("Invalid token"),c(!1)},[e,u]);j.useEffect(()=>{H3().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),$b(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=j.useState(!1);return a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:a.jsxs("div",{className:"w-full max-w-sm px-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),a.jsxs("form",{onSubmit:f,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:l}),a.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&a.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),a.jsx("button",{type:"submit",disabled:l||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:l?"Verifying...":"Login"})]}),a.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var al=Jy();function G3({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:l,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=j.useState("none");return al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:a.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&a.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),a.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",a.jsx("strong",{className:"text-cc-fg",children:e})," ",a.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),a.jsxs("fieldset",{className:"space-y-2 mb-4",children:[a.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),a.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),a.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&l&&a.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),a.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",l]})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function X3(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function Y3({status:e}){switch(e){case"running":return a.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function W3({type:e}){return e==="codex"?a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function Wu({session:e,isActive:t,isArchived:n,sessionName:i,permCount:l,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:k,onCancelRename:E,editInputRef:S}){const M=e.id.slice(0,8),C=i||e.model||M,$=y===e.id,[L,T]=j.useState(!1),H=j.useRef(null),z=j.useRef(null),G=n?"exited":X3(e,l),O=e.cwd||"";j.useEffect(()=>{if(!L)return;function R(J){var X;H.current&&!H.current.contains(J.target)&&z.current&&!z.current.contains(J.target)&&(T(!1),(X=z.current)==null||X.focus())}function oe(J){var X,B,U;if(J.key==="Escape"){T(!1),(X=z.current)==null||X.focus();return}if(J.key==="Tab"){T(!1);return}if((J.key==="ArrowDown"||J.key==="ArrowUp")&&((B=H.current)!=null&&B.contains(document.activeElement)||z.current===document.activeElement)){J.preventDefault();const Z=(U=H.current)==null?void 0:U.querySelectorAll("[role='menuitem']");if(!Z||Z.length===0)return;const me=document.activeElement,D=Array.from(Z).indexOf(me);J.key==="ArrowDown"?Z[D<Z.length-1?D+1:0].focus():Z[D>0?D-1:Z.length-1].focus()}}return document.addEventListener("mousedown",R),document.addEventListener("touchstart",R),document.addEventListener("keydown",oe),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("touchstart",R),document.removeEventListener("keydown",oe)}},[L]),j.useEffect(()=>{L&&requestAnimationFrame(()=>{var R,oe;(oe=(R=H.current)==null?void 0:R.querySelector("[role='menuitem']"))==null||oe.focus()})},[L]);const I=j.useCallback(R=>{T(!1),R()},[]);return a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:R=>{R.preventDefault(),f(e.id,C)},onKeyDown:R=>{R.key==="F2"&&!$&&(R.preventDefault(),f(e.id,C))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!$&&a.jsx(Y3,{status:G}),$?a.jsx("input",{ref:S,value:b,onChange:R=>_(R.target.value),onKeyDown:R=>{R.key==="Enter"?(R.preventDefault(),k()):R.key==="Escape"&&(R.preventDefault(),E()),R.stopPropagation()},onBlur:k,onClick:R=>R.stopPropagation(),onDoubleClick:R=>R.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:C}),O&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!$&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(W3,{type:e.backendType}),e.isContainerized&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:a.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!$&&!L&&a.jsx("button",{onClick:R=>{R.stopPropagation(),h(R,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),a.jsx("button",{ref:z,onClick:R=>{R.stopPropagation(),T(!L)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":L,children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),L&&a.jsxs("div",{ref:H,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,C)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?a.jsxs(a.Fragment,{children:[a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:R=>I(()=>p(R,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[a.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),a.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),a.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:R=>I(()=>g(R,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[a.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),a.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:R=>I(()=>h(R,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function Q3({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:l,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:k,onConfirmRename:E,onCancelRename:S,editInputRef:M,isFirst:C}){const $=t?e.sessions.slice(0,2).map(L=>l.get(L.id)||L.model||L.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return a.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),a.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&$&&a.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:$}),!t&&a.jsx("div",{className:"mt-0.5",children:e.sessions.map(L=>{var H;const T=((H=c.get(L.id))==null?void 0:H.size)??0;return a.jsx(Wu,{session:L,isActive:i===L.id,sessionName:l.get(L.id),permCount:T,isRecentlyRenamed:u.has(L.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:k,onConfirmRename:E,onCancelRename:S,editInputRef:M},L.id)})})]})}function K3(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function Z3(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function J3(e){const t=new Map;for(const i of e){const l=K3(i.cwd,i.repoRoot||void 0,i.isContainerized),c=Z3(l);t.has(l)||t.set(l,{key:l,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(l);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,l)=>i.label.localeCompare(l.label));for(const i of n)i.sessions.sort((l,c)=>c.createdAt-l.createdAt);return n}const eC=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],tC=[{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],nC=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],rC=new Map(tC.map(e=>[e.id,e]));function iC(){var kt,$t;const[e,t]=j.useState(null),[n,i]=j.useState(""),[l,c]=j.useState(!1),[u,f]=j.useState(null),[h,p]=j.useState(null),[g,v]=j.useState(null),[y,b]=j.useState(!1),[_,k]=j.useState(null),[E,S]=j.useState(!1),[M,C]=j.useState(()=>typeof window<"u"?window.location.hash:""),$=j.useRef(null),L=j.useRef(null),T=Y(K=>K.sessions),H=Y(K=>K.sdkSessions),z=Y(K=>K.currentSessionId),G=Y(K=>K.cliConnected),O=Y(K=>K.cliReconnecting),I=Y(K=>K.sessionStatus),R=Y(K=>K.removeSession),oe=Y(K=>K.sessionNames),J=Y(K=>K.recentlyRenamed),X=Y(K=>K.clearRecentlyRenamed),B=Y(K=>K.pendingPermissions),U=Y(K=>K.linkedLinearIssues),Z=Y(K=>K.collapsedProjects),me=Y(K=>K.toggleProjectCollapse),D=Zm(M);j.useEffect(()=>{let K=!0;async function he(){try{const He=await we.listSessions();if(K){const mt=Y.getState();mt.setSdkSessions(He);const Vt=Y.getState(),Wn=new Set(He.map(St=>St.sessionId));for(const St of Vt.sessions.keys())!Wn.has(St)&&Vt.connectionStatus.get(St)!=="connected"&&Vt.removeSession(St);ES(He);for(const St of He)if(St.name&&(!mt.sessionNames.has(St.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(mt.sessionNames.get(St.sessionId)))){const Qt=mt.sessionNames.get(St.sessionId),Hr=!!Qt&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Qt);Qt!==St.name&&(mt.setSessionName(St.sessionId,St.name),Hr&&mt.markRecentlyRenamed(St.sessionId))}}}catch{}}he();const ge=setInterval(he,5e3);return()=>{K=!1,clearInterval(ge)}},[]),j.useEffect(()=>{const K=()=>C(window.location.hash);return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[]);function P(K){Jm(K),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}function Q(){mp(),Y.getState().newSession(),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}j.useEffect(()=>{e&&$.current&&($.current.focus(),$.current.select())},[e]);function A(){e&&n.trim()&&(Y.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function pe(){t(null),i("")}function _e(K,he){t(K),i(he)}const ke=j.useCallback((K,he)=>{K.stopPropagation(),k(he)},[]),ze=j.useCallback(async K=>{try{Vp(K),await we.deleteSession(K)}catch{}Y.getState().currentSessionId===K&&mp(),R(K)},[R]),ce=j.useCallback(()=>{_&&(ze(_),k(null))},[_,ze]),je=j.useCallback(()=>{k(null)},[]),Fe=j.useCallback(()=>{S(!0)},[]),At=j.useCallback(async()=>{S(!1);const K=Y.getState(),he=new Set;for(const He of K.sessions.keys())he.add(He);for(const He of K.sdkSessions)he.add(He.sessionId);const ge=Array.from(he).filter(He=>{const mt=K.sdkSessions.find(Vt=>Vt.sessionId===He);return(mt==null?void 0:mt.archived)??!1});for(const He of ge)await ze(He)},[ze]),Ke=j.useCallback(()=>{S(!1)},[]);j.useEffect(()=>{if(!_&&!E)return;requestAnimationFrame(()=>{var he,ge;(ge=(he=L.current)==null?void 0:he.querySelector("button"))==null||ge.focus()});function K(he){var Vt;if(he.key==="Escape"){E?Ke():je();return}if(he.key!=="Tab")return;const ge=(Vt=L.current)==null?void 0:Vt.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ge||ge.length===0)return;const He=ge[0],mt=ge[ge.length-1];he.shiftKey&&document.activeElement===He?(he.preventDefault(),mt.focus()):!he.shiftKey&&document.activeElement===mt&&(he.preventDefault(),He.focus())}return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[_,E,je,Ke]);const pt=j.useCallback(async(K,he)=>{K.stopPropagation();const ge=H.find(Qt=>Qt.sessionId===he),He=T.get(he),mt=(He==null?void 0:He.is_containerized)||!!(ge!=null&&ge.containerId)||!1,Vt=U.get(he),Wn=((Vt==null?void 0:Vt.stateType)||"").toLowerCase();if(Vt&&!(Wn==="completed"||Wn==="canceled"||Wn==="cancelled"))try{const Qt=await we.getArchiveInfo(he);if(Qt.issueNotDone){p(he),v(Qt),b(mt);return}}catch{}if(mt){f(he);return}vt(he)},[H,T,U]),vt=j.useCallback(async(K,he,ge)=>{try{Vp(K);const He={};he&&(He.force=!0),ge&&ge!=="none"&&(He.linearTransition=ge),await we.archiveSession(K,Object.keys(He).length>0?He:void 0)}catch{}Y.getState().currentSessionId===K&&(mp(),Y.getState().newSession());try{const He=await we.listSessions();Y.getState().setSdkSessions(He)}catch{}},[]),qe=j.useCallback(()=>{u&&(vt(u,!0),f(null))},[u,vt]),bt=j.useCallback(()=>{f(null)},[]),pn=j.useCallback((K,he)=>{h&&(vt(h,he,K),p(null),v(null))},[h,vt]),dn=j.useCallback(()=>{p(null),v(null)},[]),se=j.useCallback(async(K,he)=>{K.stopPropagation();try{await we.unarchiveSession(he)}catch{}try{const ge=await we.listSessions();Y.getState().setSdkSessions(ge)}catch{}},[]),Ce=new Set;for(const K of T.keys())Ce.add(K);for(const K of H)Ce.add(K.sessionId);const fe=Array.from(Ce).map(K=>{var He;const he=T.get(K),ge=H.find(mt=>mt.sessionId===K);return{id:K,model:(he==null?void 0:he.model)||(ge==null?void 0:ge.model)||"",cwd:(he==null?void 0:he.cwd)||(ge==null?void 0:ge.cwd)||"",gitBranch:(he==null?void 0:he.git_branch)||(ge==null?void 0:ge.gitBranch)||"",isContainerized:(he==null?void 0:he.is_containerized)||!!(ge!=null&&ge.containerId)||!1,gitAhead:(he==null?void 0:he.git_ahead)||(ge==null?void 0:ge.gitAhead)||0,gitBehind:(he==null?void 0:he.git_behind)||(ge==null?void 0:ge.gitBehind)||0,linesAdded:(he==null?void 0:he.total_lines_added)||(ge==null?void 0:ge.totalLinesAdded)||0,linesRemoved:(he==null?void 0:he.total_lines_removed)||(ge==null?void 0:ge.totalLinesRemoved)||0,isConnected:G.get(K)??!1,isReconnecting:O.get(K)??!1,status:I.get(K)??null,sdkState:(ge==null?void 0:ge.state)??null,createdAt:(ge==null?void 0:ge.createdAt)??0,archived:(ge==null?void 0:ge.archived)??!1,backendType:(he==null?void 0:he.backend_type)||(ge==null?void 0:ge.backendType)||"claude",repoRoot:(he==null?void 0:he.repo_root)||"",permCount:((He=B.get(K))==null?void 0:He.size)??0,cronJobId:(he==null?void 0:he.cronJobId)||(ge==null?void 0:ge.cronJobId),cronJobName:(he==null?void 0:he.cronJobName)||(ge==null?void 0:ge.cronJobName),agentId:(he==null?void 0:he.agentId)||(ge==null?void 0:ge.agentId),agentName:(he==null?void 0:he.agentName)||(ge==null?void 0:ge.agentName)}}).sort((K,he)=>he.createdAt-K.createdAt),Se=fe.filter(K=>!K.archived&&!K.cronJobId&&!K.agentId),Ze=fe.filter(K=>!K.archived&&!!K.cronJobId),Be=fe.filter(K=>!K.archived&&!!K.agentId),mn=fe.filter(K=>K.archived),ae=z?fe.find(K=>K.id===z):null,ve=(ae==null?void 0:ae.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[De,Ge]=j.useState(!0),[Qe,ln]=j.useState(!0),Nn=j.useMemo(()=>J3(Se),[Se]),jt={onSelect:P,onStartRename:_e,onArchive:pt,onUnarchive:se,onDelete:ke,onClearRecentlyRenamed:X,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:A,onCancelRename:pe,editInputRef:$};return a.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[a.jsx("div",{className:"p-3.5 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("img",{src:ve,alt:"",className:"w-6 h-6"}),a.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),a.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),a.jsx("button",{onClick:Q,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}),a.jsx("button",{onClick:()=>Y.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),u&&a.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:bt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:qe,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Se.length===0&&Ze.length===0&&mn.length===0?a.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):a.jsxs(a.Fragment,{children:[Nn.map((K,he)=>a.jsx(Q3,{group:K,isCollapsed:Z.has(K.key),onToggleCollapse:me,currentSessionId:z,sessionNames:oe,pendingPermissions:B,recentlyRenamed:J,isFirst:he===0,...jt},K.key)),Ze.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>Ge(!De),"aria-expanded":De,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${De?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",Ze.length,")"]}),De&&a.jsx("div",{className:"mt-0.5",children:Ze.map(K=>{var he;return a.jsx(Wu,{session:K,isActive:z===K.id,sessionName:oe.get(K.id),permCount:((he=B.get(K.id))==null?void 0:he.size)??0,isRecentlyRenamed:J.has(K.id),...jt},K.id)})})]}),Be.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>ln(!Qe),"aria-expanded":Qe,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${Qe?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Be.length,")"]}),Qe&&a.jsx("div",{className:"mt-0.5",children:Be.map(K=>{var he;return a.jsx(Wu,{session:K,isActive:z===K.id,sessionName:oe.get(K.id),permCount:((he=B.get(K.id))==null?void 0:he.size)??0,isRecentlyRenamed:J.has(K.id),...jt},K.id)})})]}),mn.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsxs("button",{onClick:()=>c(!l),"aria-expanded":l,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${l?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",mn.length,")"]}),l&&mn.length>1&&a.jsx("button",{onClick:Fe,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),l&&a.jsx("div",{className:"mt-0.5",children:mn.map(K=>{var he;return a.jsx(Wu,{session:K,isActive:z===K.id,isArchived:!0,sessionName:oe.get(K.id),permCount:((he=B.get(K.id))==null?void 0:he.size)??0,isRecentlyRenamed:J.has(K.id),...jt},K.id)})})]})]})}),a.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:a.jsx("button",{onClick:Q,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})})}),a.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[a.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:nC.map(K=>a.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:K.label}),a.jsx("div",{className:"flex flex-col",children:K.itemIds.map(he=>{const ge=rC.get(he);if(!ge)return null;const He=ge.activePages?ge.activePages.some(mt=>D.page===mt):D.page===ge.id;return a.jsxs("button",{onClick:()=>{window.location.hash=ge.hash,window.innerWidth<768&&Y.getState().setSidebarOpen(!1)},title:ge.label,"aria-current":He?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${He?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${He?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),a.jsx("svg",{viewBox:ge.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:a.jsx("path",{d:ge.iconPath,fillRule:ge.fillRule,clipRule:ge.clipRule})}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ge.label})]},ge.id)})})]},K.id))}),a.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),a.jsx("div",{className:"flex items-center gap-0.5",children:eC.map(K=>a.jsx("a",{href:K.url,target:"_blank",rel:"noopener noreferrer",title:K.label,"aria-label":`Open ${K.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:a.jsx("svg",{viewBox:K.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:K.iconPath})})},K.label))})]})})]}),(_||E)&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:E?Ke:je,children:a.jsxs("div",{ref:L,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:K=>K.stopPropagation(),children:[a.jsx("div",{className:"flex justify-center mb-3",children:a.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[a.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),a.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),a.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:E?"Delete all archived?":"Delete session?"}),a.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:E?`This will permanently delete ${mn.length} archived session${mn.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),a.jsxs("div",{className:"flex gap-2.5 mt-4",children:[a.jsx("button",{onClick:E?Ke:je,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:E?At:ce,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:E?"Delete all":"Delete"})]})]})}),h&&g&&a.jsx(G3,{issueIdentifier:((kt=g.issue)==null?void 0:kt.identifier)||"",issueStateName:(($t=g.issue)==null?void 0:$t.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:pn,onCancel:dn})]})}function sC(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const aC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oC={};function Xb(e,t){return(oC.jsx?lC:aC).test(e)}const cC=/[ \t\n\f\r]/g;function uC(e){return typeof e=="object"?e.type==="text"?Yb(e.value):!1:Yb(e)}function Yb(e){return e.replace(cC,"")===""}class ic{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}ic.prototype.normal={};ic.prototype.property={};ic.prototype.space=void 0;function j_(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new ic(n,i,t)}function jm(e){return e.toLowerCase()}class Yn{constructor(t,n){this.attribute=n,this.property=t}}Yn.prototype.attribute="";Yn.prototype.booleanish=!1;Yn.prototype.boolean=!1;Yn.prototype.commaOrSpaceSeparated=!1;Yn.prototype.commaSeparated=!1;Yn.prototype.defined=!1;Yn.prototype.mustUseProperty=!1;Yn.prototype.number=!1;Yn.prototype.overloadedBoolean=!1;Yn.prototype.property="";Yn.prototype.spaceSeparated=!1;Yn.prototype.space=void 0;let dC=0;const We=Ys(),nn=Ys(),km=Ys(),be=Ys(),Mt=Ys(),Qa=Ys(),ir=Ys();function Ys(){return 2**++dC}const Sm=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:nn,commaOrSpaceSeparated:ir,commaSeparated:Qa,number:be,overloadedBoolean:km,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),gp=Object.keys(Sm);class eg extends Yn{constructor(t,n,i,l){let c=-1;if(super(t,n),Wb(this,"space",l),typeof i=="number")for(;++c<gp.length;){const u=gp[c];Wb(this,gp[c],(i&Sm[u])===Sm[u])}}}eg.prototype.defined=!0;function Wb(e,t,n){n&&(e[t]=n)}function ll(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const c=new eg(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[jm(i)]=i,n[jm(c.attribute)]=i}return new ic(t,n,e.space)}const k_=ll({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Mt,ariaCurrent:null,ariaDescribedBy:Mt,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Mt,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Mt,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Mt,ariaLevel:be,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Mt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Mt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:nn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function S_(e,t){return t in e?e[t]:t}function N_(e,t){return S_(e,t.toLowerCase())}const fC=ll({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qa,acceptCharset:Mt,accessKey:Mt,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:Mt,autoFocus:We,autoPlay:We,blocking:Mt,capture:null,charSet:null,checked:We,cite:null,className:Mt,cols:be,colSpan:null,content:null,contentEditable:nn,controls:We,controlsList:Mt,coords:be|Qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:km,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:Mt,height:be,hidden:km,high:be,href:null,hrefLang:null,htmlFor:Mt,httpEquiv:Mt,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:Mt,itemRef:Mt,itemScope:We,itemType:Mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:We,optimum:be,pattern:null,ping:Mt,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:Mt,required:We,reversed:We,rows:be,rowSpan:be,sandbox:Mt,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:nn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Mt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:We,disableRemotePlayback:We,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:N_}),hC=ll({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ir,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Mt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Qa,g2:Qa,glyphName:Qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ir,rev:ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ir,requiredFeatures:ir,requiredFonts:ir,requiredFormats:ir,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ir,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:S_}),C_=ll({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),E_=ll({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:N_}),T_=ll({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},mC=/[A-Z]/g,Qb=/-[a-z]/g,gC=/^data[-\w.:]+$/i;function xC(e,t){const n=jm(t);let i=t,l=Yn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&gC.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Qb,bC);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Qb.test(c)){let u=c.replace(mC,vC);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=eg}return new l(i,t)}function vC(e){return"-"+e.toLowerCase()}function bC(e){return e.charAt(1).toUpperCase()}const yC=j_([k_,fC,C_,E_,T_],"html"),tg=j_([k_,hC,C_,E_,T_],"svg");function _C(e){return e.join(" ").trim()}var Ba={},xp,Kb;function wC(){if(Kb)return xp;Kb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
66
+ `,p="/",g="*",v="",y="comment",b="declaration";function _(E,S){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];S=S||{};var M=1,C=1;function $(J){var X=J.match(t);X&&(M+=X.length);var B=J.lastIndexOf(h);C=~B?J.length-B:C+J.length}function L(){var J={line:M,column:C};return function(X){return X.position=new T(J),G(),X}}function T(J){this.start=J,this.end={line:M,column:C},this.source=S.source}T.prototype.content=E;function H(J){var X=new Error(S.source+":"+M+":"+C+": "+J);if(X.reason=J,X.filename=S.source,X.line=M,X.column=C,X.source=E,!S.silent)throw X}function z(J){var X=J.exec(E);if(X){var B=X[0];return $(B),E=E.slice(B.length),X}}function G(){z(n)}function O(J){var X;for(J=J||[];X=I();)X!==!1&&J.push(X);return J}function I(){var J=L();if(!(p!=E.charAt(0)||g!=E.charAt(1))){for(var X=2;v!=E.charAt(X)&&(g!=E.charAt(X)||p!=E.charAt(X+1));)++X;if(X+=2,v===E.charAt(X-1))return H("End of comment missing");var B=E.slice(2,X-2);return C+=2,$(B),E=E.slice(X),C+=2,J({type:y,comment:B})}}function R(){var J=L(),X=z(i);if(X){if(I(),!z(l))return H("property missing ':'");var B=z(c),U=J({type:b,property:k(X[0].replace(e,v)),value:B?k(B[0].replace(e,v)):v});return z(u),U}}function oe(){var J=[];O(J);for(var X;X=R();)X!==!1&&(J.push(X),O(J));return J}return G(),oe()}function k(E){return E?E.replace(f,v):v}return xp=_,xp}var Zb;function jC(){if(Zb)return Ba;Zb=1;var e=Ba&&Ba.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.default=n;const t=e(wC());function n(i,l){let c=null;if(!i||typeof i!="string")return c;const u=(0,t.default)(i),f=typeof l=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?l(p,g,h):g&&(c=c||{},c[p]=g)}),c}return Ba}var vo={},Jb;function kC(){if(Jb)return vo;Jb=1,Object.defineProperty(vo,"__esModule",{value:!0}),vo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},f=function(p,g){return"".concat(g,"-")},h=function(p,g){return g===void 0&&(g={}),c(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(l,f):p=p.replace(i,f),p.replace(t,u))};return vo.camelCase=h,vo}var bo,ey;function SC(){if(ey)return bo;ey=1;var e=bo&&bo.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(jC()),n=kC();function i(l,c){var u={};return!l||typeof l!="string"||(0,t.default)(l,function(f,h){f&&h&&(u[(0,n.camelCase)(f,c)]=h)}),u}return i.default=i,bo=i,bo}var NC=SC();const CC=Om(NC),A_=M_("end"),ng=M_("start");function M_(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function EC(e){const t=ng(e),n=A_(e);if(t&&n)return{start:t,end:n}}function Uo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ty(e.position):"start"in e||"end"in e?ty(e):"line"in e||"column"in e?Nm(e):""}function Nm(e){return ny(e&&e.line)+":"+ny(e&&e.column)}function ty(e){return Nm(e&&e.start)+"-"+Nm(e&&e.end)}function ny(e){return e&&typeof e=="number"?e:1}class Sn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let l="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?l=t:!c.cause&&t&&(u=!0,l=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?c.ruleId=i:(c.source=i.slice(0,h),c.ruleId=i.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Uo(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Sn.prototype.file="";Sn.prototype.name="";Sn.prototype.reason="";Sn.prototype.message="";Sn.prototype.stack="";Sn.prototype.column=void 0;Sn.prototype.line=void 0;Sn.prototype.ancestors=void 0;Sn.prototype.cause=void 0;Sn.prototype.fatal=void 0;Sn.prototype.place=void 0;Sn.prototype.ruleId=void 0;Sn.prototype.source=void 0;const rg={}.hasOwnProperty,TC=new Map,AC=/[A-Z]/g,MC=new Set(["table","tbody","thead","tfoot","tr"]),RC=new Set(["td","th"]),R_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function LC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=FC(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=$C(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tg:yC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=L_(l,e,void 0);return c&&typeof c!="string"?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}function L_(e,t,n){if(t.type==="element")return DC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return zC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BC(e,t,n);if(t.type==="mdxjsEsm")return OC(e,t);if(t.type==="root")return UC(e,t,n);if(t.type==="text")return PC(e,t)}function DC(e,t,n){const i=e.schema;let l=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=tg,e.schema=l),e.ancestors.push(t);const c=z_(e,t.tagName,!1),u=HC(e,t);let f=sg(e,t);return MC.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!uC(h):!0})),D_(e,u,c,t),ig(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function zC(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Zo(e,t.position)}function OC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zo(e,t.position)}function BC(e,t,n){const i=e.schema;let l=i;t.name==="svg"&&i.space==="html"&&(l=tg,e.schema=l),e.ancestors.push(t);const c=t.name===null?e.Fragment:z_(e,t.name,!0),u=IC(e,t),f=sg(e,t);return D_(e,u,c,t),ig(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function UC(e,t,n){const i={};return ig(i,sg(e,t)),e.create(t,e.Fragment,i,n)}function PC(e,t){return t.value}function D_(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function ig(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function $C(e,t,n){return i;function i(l,c,u,f){const p=Array.isArray(u.children)?n:t;return f?p(c,u,f):p(c,u)}}function FC(e,t){return n;function n(i,l,c,u){const f=Array.isArray(c.children),h=ng(i);return t(l,c,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function HC(e,t){const n={};let i,l;for(l in t.properties)if(l!=="children"&&rg.call(t.properties,l)){const c=qC(e,l,t.properties[l]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&RC.has(t.tagName)?i=f:n[u]=f}}if(i){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function IC(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const u=c.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Zo(e,t.position);else{const l=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else Zo(e,t.position);else c=i.value===null?!0:i.value;n[l]=c}return n}function sg(e,t){const n=[];let i=-1;const l=e.passKeys?new Map:TC;for(;++i<t.children.length;){const c=t.children[i];let u;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const p=l.get(h)||0;u=h+"-"+p,l.set(h,p+1)}}const f=L_(e,c,u);f!==void 0&&n.push(f)}return n}function qC(e,t,n){const i=xC(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?sC(n):_C(n)),i.property==="style"){let l=typeof n=="object"?n:VC(e,String(n));return e.stylePropertyNameCase==="css"&&(l=GC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?pC[i.property]||i.property:i.attribute,n]}}function VC(e,t){try{return CC(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,l=new Sn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=R_+"#cannot-parse-style-attribute",l}}function z_(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let c=-1,u;for(;++c<l.length;){const f=Xb(l[c])?{type:"Identifier",name:l[c]}:{type:"Literal",value:l[c]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}i=u}else i=Xb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const l=i.value;return rg.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(i);Zo(e)}function Zo(e,t){const n=new Sn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=R_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function GC(e){const t={};let n;for(n in e)rg.call(e,n)&&(t[XC(n)]=e[n]);return t}function XC(e){let t=e.replace(AC,YC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YC(e){return"-"+e.toLowerCase()}const vp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},WC={};function ag(e,t){const n=WC,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return O_(e,i,l)}function O_(e,t,n){if(QC(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ry(e.children,t,n)}return Array.isArray(e)?ry(e,t,n):""}function ry(e,t,n){const i=[];let l=-1;for(;++l<e.length;)i[l]=O_(e[l],t,n);return i.join("")}function QC(e){return!!(e&&typeof e=="object")}const iy=document.createElement("i");function lg(e){const t="&"+e+";";iy.innerHTML=t;const n=iy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function lr(e,t,n,i){const l=e.length;let c=0,u;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<i.length;)u=i.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function wr(e,t){return e.length>0?(lr(e,e.length,0,t),e):t}const sy={}.hasOwnProperty;function B_(e){const t={};let n=-1;for(;++n<e.length;)KC(t,e[n]);return t}function KC(e,t){let n;for(n in t){const l=(sy.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){sy.call(l,u)||(l[u]=[]);const f=c[u];ZC(l[u],Array.isArray(f)?f:f?[f]:[])}}}function ZC(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);lr(e,0,0,i)}function U_(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function $r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dn=ms(/[A-Za-z]/),kn=ms(/[\dA-Za-z]/),JC=ms(/[#-'*+\--9=?A-Z^-~]/);function xd(e){return e!==null&&(e<32||e===127)}const Cm=ms(/\d/),e4=ms(/[\dA-Fa-f]/),t4=ms(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function nt(e){return e===-2||e===-1||e===32}const Ed=ms(new RegExp("\\p{P}|\\p{S}","u")),Gs=ms(/\s/);function ms(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ol(e){const t=[];let n=-1,i=0,l=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&kn(e.charCodeAt(n+1))&&kn(e.charCodeAt(n+2)))l=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(n+1);c<56320&&f>56319&&f<57344?(u=String.fromCharCode(c,f),l=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+l+1,u=""),l&&(n+=l,l=0)}return t.join("")+e.slice(i)}function ot(e,t,n,i){const l=i?i-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(h){return nt(h)?(e.enter(n),f(h)):t(h)}function f(h){return nt(h)&&c++<l?(e.consume(h),f):(e.exit(n),t(h))}}const n4={tokenize:r4};function r4(e){const t=e.attempt(this.parser.constructs.contentInitial,i,l);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),c(f)}function c(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ue(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),u)}}const i4={tokenize:s4},ay={tokenize:a4};function s4(e){const t=this,n=[];let i=0,l,c,u;return f;function f(C){if(i<n.length){const $=n[i];return t.containerState=$[1],e.attempt($[0].continuation,h,p)(C)}return p(C)}function h(C){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&M();const $=t.events.length;let L=$,T;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){T=t.events[L][1].end;break}S(i);let H=$;for(;H<t.events.length;)t.events[H][1].end={...T},H++;return lr(t.events,L+1,0,t.events.slice($)),t.events.length=H,p(C)}return f(C)}function p(C){if(i===n.length){if(!l)return y(C);if(l.currentConstruct&&l.currentConstruct.concrete)return _(C);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ay,g,v)(C)}function g(C){return l&&M(),S(i),y(C)}function v(C){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(C)}function y(C){return t.containerState={},e.attempt(ay,b,_)(C)}function b(C){return i++,n.push([t.currentConstruct,t.containerState]),y(C)}function _(C){if(C===null){l&&M(),S(0),e.consume(C);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:c}),k(C)}function k(C){if(C===null){E(e.exit("chunkFlow"),!0),S(0),e.consume(C);return}return Ue(C)?(e.consume(C),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(C),k)}function E(C,$){const L=t.sliceStream(C);if($&&L.push(null),C.previous=c,c&&(c.next=C),c=C,l.defineSkip(C.start),l.write(L),t.parser.lazy[C.start.line]){let T=l.events.length;for(;T--;)if(l.events[T][1].start.offset<u&&(!l.events[T][1].end||l.events[T][1].end.offset>u))return;const H=t.events.length;let z=H,G,O;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(G){O=t.events[z][1].end;break}G=!0}for(S(i),T=H;T<t.events.length;)t.events[T][1].end={...O},T++;lr(t.events,z+1,0,t.events.slice(H)),t.events.length=T}}function S(C){let $=n.length;for(;$-- >C;){const L=n[$];t.containerState=L[1],L[0].exit.call(t,e)}n.length=C}function M(){l.write([null]),c=void 0,l=void 0,t.containerState._closeFlow=void 0}}function a4(e,t,n){return ot(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rl(e){if(e===null||Tt(e)||Gs(e))return 1;if(Ed(e))return 2}function Td(e,t,n){const i=[];let l=-1;for(;++l<e.length;){const c=e[l].resolveAll;c&&!i.includes(c)&&(t=c(t,n),i.push(c))}return t}const Em={name:"attention",resolveAll:l4,tokenize:o4};function l4(e,t){let n=-1,i,l,c,u,f,h,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[i][1].end},y={...e[n][1].start};ly(v,-h),ly(y,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},l={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=wr(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=wr(p,[["enter",l,t],["enter",u,t],["exit",u,t],["enter",c,t]]),p=wr(p,Td(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=wr(p,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=wr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,lr(e,i-1,n-i+3,p),n=i+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function o4(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,l=rl(i);let c;return u;function u(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const p=e.exit("attentionSequence"),g=rl(h),v=!g||g===2&&l||n.includes(h),y=!l||l===2&&g||n.includes(i);return p._open=!!(c===42?v:v&&(l||!y)),p._close=!!(c===42?y:y&&(g||!v)),t(h)}}function ly(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const c4={name:"autolink",tokenize:u4};function u4(e,t,n){let i=0;return l;function l(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return Dn(b)?(e.consume(b),u):b===64?n(b):p(b)}function u(b){return b===43||b===45||b===46||kn(b)?(i=1,f(b)):p(b)}function f(b){return b===58?(e.consume(b),i=0,h):(b===43||b===45||b===46||kn(b))&&i++<32?(e.consume(b),f):(i=0,p(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||xd(b)?n(b):(e.consume(b),h)}function p(b){return b===64?(e.consume(b),g):JC(b)?(e.consume(b),p):n(b)}function g(b){return kn(b)?v(b):n(b)}function v(b){return b===46?(e.consume(b),i=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||kn(b))&&i++<63){const _=b===45?y:v;return e.consume(b),_}return n(b)}}const sc={partial:!0,tokenize:d4};function d4(e,t,n){return i;function i(c){return nt(c)?ot(e,l,"linePrefix")(c):l(c)}function l(c){return c===null||Ue(c)?t(c):n(c)}}const P_={continuation:{tokenize:h4},exit:p4,name:"blockQuote",tokenize:f4};function f4(e,t,n){const i=this;return l;function l(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return nt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function h4(e,t,n){const i=this;return l;function l(u){return nt(u)?ot(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(P_,t,n)(u)}}function p4(e){e.exit("blockQuote")}const $_={name:"characterEscape",tokenize:m4};function m4(e,t,n){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),l}function l(c){return t4(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const F_={name:"characterReference",tokenize:g4};function g4(e,t,n){const i=this;let l=0,c,u;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,u=kn,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=e4,g):(e.enter("characterReferenceValue"),c=7,u=Cm,g(v))}function g(v){if(v===59&&l){const y=e.exit("characterReferenceValue");return u===kn&&!lg(i.sliceSerialize(y))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&l++<c?(e.consume(v),g):n(v)}}const oy={partial:!0,tokenize:v4},cy={concrete:!0,name:"codeFenced",tokenize:x4};function x4(e,t,n){const i=this,l={partial:!0,tokenize:L};let c=0,u=0,f;return h;function h(T){return p(T)}function p(T){const H=i.events[i.events.length-1];return c=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,f=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(T)}function g(T){return T===f?(u++,e.consume(T),g):u<3?n(T):(e.exit("codeFencedFenceSequence"),nt(T)?ot(e,v,"whitespace")(T):v(T))}function v(T){return T===null||Ue(T)?(e.exit("codeFencedFence"),i.interrupt?t(T):e.check(oy,k,$)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===null||Ue(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(T)):nt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,b,"whitespace")(T)):T===96&&T===f?n(T):(e.consume(T),y)}function b(T){return T===null||Ue(T)?v(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(T))}function _(T){return T===null||Ue(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(T)):T===96&&T===f?n(T):(e.consume(T),_)}function k(T){return e.attempt(l,$,E)(T)}function E(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),S}function S(T){return c>0&&nt(T)?ot(e,M,"linePrefix",c+1)(T):M(T)}function M(T){return T===null||Ue(T)?e.check(oy,k,$)(T):(e.enter("codeFlowValue"),C(T))}function C(T){return T===null||Ue(T)?(e.exit("codeFlowValue"),M(T)):(e.consume(T),C)}function $(T){return e.exit("codeFenced"),t(T)}function L(T,H,z){let G=0;return O;function O(X){return T.enter("lineEnding"),T.consume(X),T.exit("lineEnding"),I}function I(X){return T.enter("codeFencedFence"),nt(X)?ot(T,R,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):R(X)}function R(X){return X===f?(T.enter("codeFencedFenceSequence"),oe(X)):z(X)}function oe(X){return X===f?(G++,T.consume(X),oe):G>=u?(T.exit("codeFencedFenceSequence"),nt(X)?ot(T,J,"whitespace")(X):J(X)):z(X)}function J(X){return X===null||Ue(X)?(T.exit("codeFencedFence"),H(X)):z(X)}}}function v4(e,t,n){const i=this;return l;function l(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const bp={name:"codeIndented",tokenize:y4},b4={partial:!0,tokenize:_4};function y4(e,t,n){const i=this;return l;function l(p){return e.enter("codeIndented"),ot(e,c,"linePrefix",5)(p)}function c(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?h(p):Ue(p)?e.attempt(b4,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||Ue(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function _4(e,t,n){const i=this;return l;function l(u){return i.parser.lazy[i.now().line]?n(u):Ue(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):ot(e,c,"linePrefix",5)(u)}function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Ue(u)?l(u):n(u)}}const w4={name:"codeText",previous:k4,resolve:j4,tokenize:S4};function j4(e){let t=e.length-4,n=3,i,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)l===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(l=i):(i===t||e[i][1].type==="lineEnding")&&(e[l][1].type="codeTextData",i!==l+2&&(e[l][1].end=e[i-1][1].end,e.splice(l+2,i-l-2),t-=i-l-2,i=l+2),l=void 0);return e}function k4(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function S4(e,t,n){let i=0,l,c;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),i++,f):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(c=e.enter("codeTextSequence"),l=0,g(v)):Ue(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||Ue(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),l++,g):l===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",p(v))}}class N4{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const l=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&yo(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),yo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yo(this.left,n.reverse())}}}function yo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function H_(e){const t={};let n=-1,i,l,c,u,f,h,p;const g=new N4(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,C4(g,n)),n=t[n],p=!0);else if(i[1]._container){for(c=n,l=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),u[1].type="lineEnding",l=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;l&&(i[1].end={...g.get(l)[1].start},f=g.slice(l,n),f.unshift(i),g.splice(l,n-l+1,f))}}return lr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function C4(e,t){const n=e.get(t)[1],i=e.get(t)[2];let l=t-1;const c=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let g,v,y=-1,b=n,_=0,k=0;const E=[k];for(;b;){for(;e.get(++l)[1]!==b;);c.push(l),b._tokenizer||(g=i.sliceStream(b),b.next||g.push(null),v&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=b,b=b.next}for(b=n;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(k=y+1,E.push(k),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):E.pop(),y=E.length;y--;){const S=f.slice(E[y],E[y+1]),M=c.pop();h.push([M,M+S.length-1]),e.splice(M,2,S)}for(h.reverse(),y=-1;++y<h.length;)p[_+h[y][0]]=_+h[y][1],_+=h[y][1]-h[y][0]-1;return p}const E4={resolve:A4,tokenize:M4},T4={partial:!0,tokenize:R4};function A4(e){return H_(e),e}function M4(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?c(f):Ue(f)?e.check(T4,u,c)(f):(e.consume(f),l)}function c(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,l}}function R4(e,t,n){const i=this;return l;function l(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),ot(e,c,"linePrefix")}function c(u){if(u===null||Ue(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function I_(e,t,n,i,l,c,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return v;function v(S){return S===60?(e.enter(i),e.enter(l),e.enter(c),e.consume(S),e.exit(c),y):S===null||S===32||S===41||xd(S)?n(S):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(S))}function y(S){return S===62?(e.enter(c),e.consume(S),e.exit(c),e.exit(l),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(e.exit("chunkString"),e.exit(f),y(S)):S===null||S===60||Ue(S)?n(S):(e.consume(S),S===92?_:b)}function _(S){return S===60||S===62||S===92?(e.consume(S),b):b(S)}function k(S){return!g&&(S===null||S===41||Tt(S))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(S)):g<p&&S===40?(e.consume(S),g++,k):S===41?(e.consume(S),g--,k):S===null||S===32||S===40||xd(S)?n(S):(e.consume(S),S===92?E:k)}function E(S){return S===40||S===41||S===92?(e.consume(S),k):k(S)}}function q_(e,t,n,i,l,c){const u=this;let f=0,h;return p;function p(b){return e.enter(i),e.enter(l),e.consume(b),e.exit(l),e.enter(c),g}function g(b){return f>999||b===null||b===91||b===93&&!h||b===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(c),e.enter(l),e.consume(b),e.exit(l),e.exit(i),t):Ue(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===null||b===91||b===93||Ue(b)||f++>999?(e.exit("chunkString"),g(b)):(e.consume(b),h||(h=!nt(b)),b===92?y:v)}function y(b){return b===91||b===92||b===93?(e.consume(b),f++,v):v(b)}}function V_(e,t,n,i,l,c){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(i),e.enter(l),e.consume(y),e.exit(l),u=y===40?41:y,h):n(y)}function h(y){return y===u?(e.enter(l),e.consume(y),e.exit(l),e.exit(i),t):(e.enter(c),p(y))}function p(y){return y===u?(e.exit(c),h(u)):y===null?n(y):Ue(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ot(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||Ue(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?v:g)}function v(y){return y===u||y===92?(e.consume(y),g):g(y)}}function Po(e,t){let n;return i;function i(l){return Ue(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,i):nt(l)?ot(e,i,n?"linePrefix":"lineSuffix")(l):t(l)}}const L4={name:"definition",tokenize:z4},D4={partial:!0,tokenize:O4};function z4(e,t,n){const i=this;let l;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return q_.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return l=$r(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return Tt(b)?Po(e,p)(b):p(b)}function p(b){return I_(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(D4,v,v)(b)}function v(b){return nt(b)?ot(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Ue(b)?(e.exit("definition"),i.parser.defined.push(l),t(b)):n(b)}}function O4(e,t,n){return i;function i(f){return Tt(f)?Po(e,l)(f):n(f)}function l(f){return V_(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return nt(f)?ot(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Ue(f)?t(f):n(f)}}const B4={name:"hardBreakEscape",tokenize:U4};function U4(e,t,n){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),l}function l(c){return Ue(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const P4={name:"headingAtx",resolve:$4,tokenize:F4};function $4(e,t){let n=e.length-2,i=3,l,c;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(l={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},c={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},lr(e,i,n-i+1,[["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t]])),e}function F4(e,t,n){let i=0;return l;function l(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Tt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||Ue(g)?(e.exit("atxHeading"),t(g)):nt(g)?ot(e,f,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),f(g))}function p(g){return g===null||g===35||Tt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const H4=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],uy=["pre","script","style","textarea"],I4={concrete:!0,name:"htmlFlow",resolveTo:G4,tokenize:X4},q4={partial:!0,tokenize:W4},V4={partial:!0,tokenize:Y4};function G4(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function X4(e,t,n){const i=this;let l,c,u,f,h;return p;function p(A){return g(A)}function g(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),v}function v(A){return A===33?(e.consume(A),y):A===47?(e.consume(A),c=!0,k):A===63?(e.consume(A),l=3,i.interrupt?t:D):Dn(A)?(e.consume(A),u=String.fromCharCode(A),E):n(A)}function y(A){return A===45?(e.consume(A),l=2,b):A===91?(e.consume(A),l=5,f=0,_):Dn(A)?(e.consume(A),l=4,i.interrupt?t:D):n(A)}function b(A){return A===45?(e.consume(A),i.interrupt?t:D):n(A)}function _(A){const pe="CDATA[";return A===pe.charCodeAt(f++)?(e.consume(A),f===pe.length?i.interrupt?t:R:_):n(A)}function k(A){return Dn(A)?(e.consume(A),u=String.fromCharCode(A),E):n(A)}function E(A){if(A===null||A===47||A===62||Tt(A)){const pe=A===47,_e=u.toLowerCase();return!pe&&!c&&uy.includes(_e)?(l=1,i.interrupt?t(A):R(A)):H4.includes(u.toLowerCase())?(l=6,pe?(e.consume(A),S):i.interrupt?t(A):R(A)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(A):c?M(A):C(A))}return A===45||kn(A)?(e.consume(A),u+=String.fromCharCode(A),E):n(A)}function S(A){return A===62?(e.consume(A),i.interrupt?t:R):n(A)}function M(A){return nt(A)?(e.consume(A),M):O(A)}function C(A){return A===47?(e.consume(A),O):A===58||A===95||Dn(A)?(e.consume(A),$):nt(A)?(e.consume(A),C):O(A)}function $(A){return A===45||A===46||A===58||A===95||kn(A)?(e.consume(A),$):L(A)}function L(A){return A===61?(e.consume(A),T):nt(A)?(e.consume(A),L):C(A)}function T(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,H):nt(A)?(e.consume(A),T):z(A)}function H(A){return A===h?(e.consume(A),h=null,G):A===null||Ue(A)?n(A):(e.consume(A),H)}function z(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?L(A):(e.consume(A),z)}function G(A){return A===47||A===62||nt(A)?C(A):n(A)}function O(A){return A===62?(e.consume(A),I):n(A)}function I(A){return A===null||Ue(A)?R(A):nt(A)?(e.consume(A),I):n(A)}function R(A){return A===45&&l===2?(e.consume(A),B):A===60&&l===1?(e.consume(A),U):A===62&&l===4?(e.consume(A),P):A===63&&l===3?(e.consume(A),D):A===93&&l===5?(e.consume(A),me):Ue(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(q4,Q,oe)(A)):A===null||Ue(A)?(e.exit("htmlFlowData"),oe(A)):(e.consume(A),R)}function oe(A){return e.check(V4,J,Q)(A)}function J(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),X}function X(A){return A===null||Ue(A)?oe(A):(e.enter("htmlFlowData"),R(A))}function B(A){return A===45?(e.consume(A),D):R(A)}function U(A){return A===47?(e.consume(A),u="",Z):R(A)}function Z(A){if(A===62){const pe=u.toLowerCase();return uy.includes(pe)?(e.consume(A),P):R(A)}return Dn(A)&&u.length<8?(e.consume(A),u+=String.fromCharCode(A),Z):R(A)}function me(A){return A===93?(e.consume(A),D):R(A)}function D(A){return A===62?(e.consume(A),P):A===45&&l===2?(e.consume(A),D):R(A)}function P(A){return A===null||Ue(A)?(e.exit("htmlFlowData"),Q(A)):(e.consume(A),P)}function Q(A){return e.exit("htmlFlow"),t(A)}}function Y4(e,t,n){const i=this;return l;function l(u){return Ue(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function W4(e,t,n){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(sc,t,n)}}const Q4={name:"htmlText",tokenize:K4};function K4(e,t,n){const i=this;let l,c,u;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),h}function h(D){return D===33?(e.consume(D),p):D===47?(e.consume(D),L):D===63?(e.consume(D),C):Dn(D)?(e.consume(D),z):n(D)}function p(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),c=0,_):Dn(D)?(e.consume(D),M):n(D)}function g(D){return D===45?(e.consume(D),b):n(D)}function v(D){return D===null?n(D):D===45?(e.consume(D),y):Ue(D)?(u=v,U(D)):(e.consume(D),v)}function y(D){return D===45?(e.consume(D),b):v(D)}function b(D){return D===62?B(D):D===45?y(D):v(D)}function _(D){const P="CDATA[";return D===P.charCodeAt(c++)?(e.consume(D),c===P.length?k:_):n(D)}function k(D){return D===null?n(D):D===93?(e.consume(D),E):Ue(D)?(u=k,U(D)):(e.consume(D),k)}function E(D){return D===93?(e.consume(D),S):k(D)}function S(D){return D===62?B(D):D===93?(e.consume(D),S):k(D)}function M(D){return D===null||D===62?B(D):Ue(D)?(u=M,U(D)):(e.consume(D),M)}function C(D){return D===null?n(D):D===63?(e.consume(D),$):Ue(D)?(u=C,U(D)):(e.consume(D),C)}function $(D){return D===62?B(D):C(D)}function L(D){return Dn(D)?(e.consume(D),T):n(D)}function T(D){return D===45||kn(D)?(e.consume(D),T):H(D)}function H(D){return Ue(D)?(u=H,U(D)):nt(D)?(e.consume(D),H):B(D)}function z(D){return D===45||kn(D)?(e.consume(D),z):D===47||D===62||Tt(D)?G(D):n(D)}function G(D){return D===47?(e.consume(D),B):D===58||D===95||Dn(D)?(e.consume(D),O):Ue(D)?(u=G,U(D)):nt(D)?(e.consume(D),G):B(D)}function O(D){return D===45||D===46||D===58||D===95||kn(D)?(e.consume(D),O):I(D)}function I(D){return D===61?(e.consume(D),R):Ue(D)?(u=I,U(D)):nt(D)?(e.consume(D),I):G(D)}function R(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),l=D,oe):Ue(D)?(u=R,U(D)):nt(D)?(e.consume(D),R):(e.consume(D),J)}function oe(D){return D===l?(e.consume(D),l=void 0,X):D===null?n(D):Ue(D)?(u=oe,U(D)):(e.consume(D),oe)}function J(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||Tt(D)?G(D):(e.consume(D),J)}function X(D){return D===47||D===62||Tt(D)?G(D):n(D)}function B(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function U(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Z}function Z(D){return nt(D)?ot(e,me,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):me(D)}function me(D){return e.enter("htmlTextData"),u(D)}}const og={name:"labelEnd",resolveAll:t6,resolveTo:n6,tokenize:r6},Z4={tokenize:i6},J4={tokenize:s6},e6={tokenize:a6};function t6(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",t+=l}}return e.length!==n.length&&lr(e,0,e.length,n),e}function n6(e,t){let n=e.length,i=0,l,c,u,f;for(;n--;)if(l=e[n][1],c){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(c=n,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(u=n);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=wr(f,e.slice(c+1,c+i+3)),f=wr(f,[["enter",g,t]]),f=wr(f,Td(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),f=wr(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=wr(f,e.slice(u+1)),f=wr(f,[["exit",h,t]]),lr(e,c,e.length,f),e}function r6(e,t,n){const i=this;let l=i.events.length,c,u;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){c=i.events[l][1];break}return f;function f(y){return c?c._inactive?v(y):(u=i.parser.defined.includes($r(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):n(y)}function h(y){return y===40?e.attempt(Z4,g,u?g:v)(y):y===91?e.attempt(J4,g,u?p:v)(y):u?g(y):v(y)}function p(y){return e.attempt(e6,g,v)(y)}function g(y){return t(y)}function v(y){return c._balanced=!0,n(y)}}function i6(e,t,n){return i;function i(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),l}function l(v){return Tt(v)?Po(e,c)(v):c(v)}function c(v){return v===41?g(v):I_(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Tt(v)?Po(e,h)(v):g(v)}function f(v){return n(v)}function h(v){return v===34||v===39||v===40?V_(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Tt(v)?Po(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function s6(e,t,n){const i=this;return l;function l(f){return q_.call(i,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes($r(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function a6(e,t,n){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),l}function l(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const l6={name:"labelStartImage",resolveAll:og.resolveAll,tokenize:o6};function o6(e,t,n){const i=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):t(f)}}const c6={name:"labelStartLink",resolveAll:og.resolveAll,tokenize:u6};function u6(e,t,n){const i=this;return l;function l(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const yp={name:"lineEnding",tokenize:d6};function d6(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),ot(e,t,"linePrefix")}}const Qu={name:"thematicBreak",tokenize:f6};function f6(e,t,n){let i=0,l;return c;function c(p){return e.enter("thematicBreak"),u(p)}function u(p){return l=p,f(p)}function f(p){return p===l?(e.enter("thematicBreakSequence"),h(p)):i>=3&&(p===null||Ue(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===l?(e.consume(p),i++,h):(e.exit("thematicBreakSequence"),nt(p)?ot(e,f,"whitespace")(p):f(p))}}const qn={continuation:{tokenize:g6},exit:v6,name:"list",tokenize:m6},h6={partial:!0,tokenize:b6},p6={partial:!0,tokenize:x6};function m6(e,t,n){const i=this,l=i.events[i.events.length-1];let c=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return f;function f(b){const _=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:Cm(b)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Qu,n,p)(b):p(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return Cm(b)&&++u<10?(e.consume(b),h):(!i.interrupt||u<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(sc,i.interrupt?n:g,e.attempt(h6,y,v))}function g(b){return i.containerState.initialBlankLine=!0,c++,y(b)}function v(b){return nt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function g6(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(sc,l,c);function l(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ot(e,t,"listItemIndent",i.containerState.size+1)(f)}function c(f){return i.containerState.furtherBlankLines||!nt(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(p6,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,ot(e,e.attempt(qn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function x6(e,t,n){const i=this;return ot(e,l,"listItemIndent",i.containerState.size+1);function l(c){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(c):n(c)}}function v6(e){e.exit(this.containerState.type)}function b6(e,t,n){const i=this;return ot(e,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(c){const u=i.events[i.events.length-1];return!nt(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const dy={name:"setextUnderline",resolveTo:y6,tokenize:_6};function y6(e,t){let n=e.length,i,l,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",c?(e.splice(l,0,["enter",u,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function _6(e,t,n){const i=this;let l;return c;function c(p){let g=i.events.length,v;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){v=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(e.enter("setextHeadingLine"),l=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===l?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),nt(p)?ot(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||Ue(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const w6={tokenize:j6};function j6(e){const t=this,n=e.attempt(sc,i,e.attempt(this.parser.constructs.flowInitial,l,ot(e,e.attempt(this.parser.constructs.flow,l,e.attempt(E4,l)),"linePrefix")));return n;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const k6={resolveAll:X_()},S6=G_("string"),N6=G_("text");function G_(e){return{resolveAll:X_(e==="text"?C6:void 0),tokenize:t};function t(n){const i=this,l=this.parser.constructs[e],c=n.attempt(l,u,f);return u;function u(g){return p(g)?c(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return p(g)?(n.exit("data"),c(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const v=l[g];let y=-1;if(v)for(;++y<v.length;){const b=v[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function X_(e){return t;function t(n,i){let l=-1,c;for(;++l<=n.length;)c===void 0?n[l]&&n[l][1].type==="data"&&(c=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==c+2&&(n[c][1].end=n[l-1][1].end,n.splice(c+2,l-c-2),l=c+2),c=void 0);return e?e(n,i):n}}function C6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],l=t.sliceStream(i);let c=l.length,u=-1,f=0,h;for(;c--;){const p=l[c];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(p===-2)h=!0,f++;else if(p!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:i.start._bufferIndex+u,_index:i.start._index+c,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const E6={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:P_},T6={91:L4},A6={[-2]:bp,[-1]:bp,32:bp},M6={35:P4,42:Qu,45:[dy,Qu],60:I4,61:dy,95:Qu,96:cy,126:cy},R6={38:F_,92:$_},L6={[-5]:yp,[-4]:yp,[-3]:yp,33:l6,38:F_,42:Em,60:[c4,Q4],91:c6,92:[B4,$_],93:og,95:Em,96:w4},D6={null:[Em,k6]},z6={null:[42,95]},O6={null:[]},B6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:z6,contentInitial:T6,disable:O6,document:E6,flow:M6,flowInitial:A6,insideSpan:D6,string:R6,text:L6},Symbol.toStringTag,{value:"Module"}));function U6(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},c=[];let u=[],f=[];const h={attempt:H(L),check:H(T),consume:M,enter:C,exit:$,interrupt:H(T,{interrupt:!0})},p={code:null,containerState:{},defineSkip:k,events:[],now:_,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:v};let g=t.tokenize.call(p,h);return t.resolveAll&&c.push(t),p;function v(I){return u=wr(u,I),E(),u[u.length-1]!==null?[]:(z(t,0),p.events=Td(c,p.events,p),p.events)}function y(I,R){return $6(b(I),R)}function b(I){return P6(u,I)}function _(){const{_bufferIndex:I,_index:R,line:oe,column:J,offset:X}=i;return{_bufferIndex:I,_index:R,line:oe,column:J,offset:X}}function k(I){l[I.line]=I.column,O()}function E(){let I;for(;i._index<u.length;){const R=u[i._index];if(typeof R=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<R.length;)S(R.charCodeAt(i._bufferIndex));else S(R)}}function S(I){g=g(I)}function M(I){Ue(I)?(i.line++,i.column=1,i.offset+=I===-3?2:1,O()):I!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=I}function C(I,R){const oe=R||{};return oe.type=I,oe.start=_(),p.events.push(["enter",oe,p]),f.push(oe),oe}function $(I){const R=f.pop();return R.end=_(),p.events.push(["exit",R,p]),R}function L(I,R){z(I,R.from)}function T(I,R){R.restore()}function H(I,R){return oe;function oe(J,X,B){let U,Z,me,D;return Array.isArray(J)?Q(J):"tokenize"in J?Q([J]):P(J);function P(ke){return ze;function ze(ce){const je=ce!==null&&ke[ce],Fe=ce!==null&&ke.null,At=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return Q(At)(ce)}}function Q(ke){return U=ke,Z=0,ke.length===0?B:A(ke[Z])}function A(ke){return ze;function ze(ce){return D=G(),me=ke,ke.partial||(p.currentConstruct=ke),ke.name&&p.parser.constructs.disable.null.includes(ke.name)?_e():ke.tokenize.call(R?Object.assign(Object.create(p),R):p,h,pe,_e)(ce)}}function pe(ke){return I(me,D),X}function _e(ke){return D.restore(),++Z<U.length?A(U[Z]):B}}}function z(I,R){I.resolveAll&&!c.includes(I)&&c.push(I),I.resolve&&lr(p.events,R,p.events.length-R,I.resolve(p.events.slice(R),p)),I.resolveTo&&(p.events=I.resolveTo(p.events,p))}function G(){const I=_(),R=p.previous,oe=p.currentConstruct,J=p.events.length,X=Array.from(f);return{from:J,restore:B};function B(){i=I,p.previous=R,p.currentConstruct=oe,p.events.length=J,f=X,O()}}function O(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function P6(e,t){const n=t.start._index,i=t.start._bufferIndex,l=t.end._index,c=t.end._bufferIndex;let u;if(n===l)u=[e[n].slice(i,c)];else{if(u=e.slice(n,l),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}c>0&&u.push(e[l].slice(0,c))}return u}function $6(e,t){let n=-1;const i=[];let l;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
67
+ `;break}case-3:{u=`\r
68
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&l)continue;u=" ";break}default:u=String.fromCharCode(c)}l=c===-2,i.push(u)}return i.join("")}function F6(e){const i={constructs:B_([B6,...(e||{}).extensions||[]]),content:l(n4),defined:[],document:l(i4),flow:l(w6),lazy:{},string:l(S6),text:l(N6)};return i;function l(c){return u;function u(f){return U6(i,c,f)}}}function H6(e){for(;!H_(e););return e}const fy=/[\0\t\n\r]/g;function I6(){let e=1,t="",n=!0,i;return l;function l(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(fy.lastIndex=v,p=fy.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}v=y+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const q6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function V6(e){return e.replace(q6,G6)}function G6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),c=l===120||l===88;return U_(n.slice(c?2:1),c?16:10)}return lg(n)||e}const Y_={}.hasOwnProperty;function X6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Y6(n)(H6(F6(n).document().write(I6()(e,t,!0))))}function Y6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(se),autolinkProtocol:G,autolinkEmail:G,atxHeading:c(qe),blockQuote:c(Fe),characterEscape:G,characterReference:G,codeFenced:c(At),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(At,u),codeText:c(Ke,u),codeTextData:G,data:G,codeFlowValue:G,definition:c(pt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(vt),hardBreakEscape:c(bt),hardBreakTrailing:c(bt),htmlFlow:c(pn,u),htmlFlowData:G,htmlText:c(pn,u),htmlTextData:G,image:c(dn),label:u,link:c(se),listItem:c(fe),listItemValue:y,listOrdered:c(Ce,v),listUnordered:c(Ce),paragraph:c(Se),reference:A,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(qe),strong:c(Ze),thematicBreak:c(mn)},exit:{atxHeading:h(),atxHeadingSequence:L,autolink:h(),autolinkEmail:je,autolinkProtocol:ce,blockQuote:h(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:ke,characterReference:ze,codeFenced:h(E),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:O,codeIndented:h(S),codeText:h(X),codeTextData:O,data:O,definition:h(),definitionDestinationString:$,definitionLabelString:M,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(R),hardBreakTrailing:h(R),htmlFlow:h(oe),htmlFlowData:O,htmlText:h(J),htmlTextData:O,image:h(U),label:me,labelText:Z,lineEnding:I,link:h(B),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:D,resourceTitleString:P,resource:Q,setextHeading:h(z),setextHeadingLineSequence:H,setextHeadingText:T,strong:h(),thematicBreak:h()}};W_(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ae){let ve={type:"root",children:[]};const De={stack:[ve],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},Ge=[];let Qe=-1;for(;++Qe<ae.length;)if(ae[Qe][1].type==="listOrdered"||ae[Qe][1].type==="listUnordered")if(ae[Qe][0]==="enter")Ge.push(Qe);else{const ln=Ge.pop();Qe=l(ae,ln,Qe)}for(Qe=-1;++Qe<ae.length;){const ln=t[ae[Qe][0]];Y_.call(ln,ae[Qe][1].type)&&ln[ae[Qe][1].type].call(Object.assign({sliceSerialize:ae[Qe][2].sliceSerialize},De),ae[Qe][1])}if(De.tokenStack.length>0){const ln=De.tokenStack[De.tokenStack.length-1];(ln[1]||hy).call(De,void 0,ln[0])}for(ve.position={start:us(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:us(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Qe=-1;++Qe<t.transforms.length;)ve=t.transforms[Qe](ve)||ve;return ve}function l(ae,ve,De){let Ge=ve-1,Qe=-1,ln=!1,Nn,jt,kt,$t;for(;++Ge<=De;){const K=ae[Ge];switch(K[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{K[0]==="enter"?Qe++:Qe--,$t=void 0;break}case"lineEndingBlank":{K[0]==="enter"&&(Nn&&!$t&&!Qe&&!kt&&(kt=Ge),$t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$t=void 0}if(!Qe&&K[0]==="enter"&&K[1].type==="listItemPrefix"||Qe===-1&&K[0]==="exit"&&(K[1].type==="listUnordered"||K[1].type==="listOrdered")){if(Nn){let he=Ge;for(jt=void 0;he--;){const ge=ae[he];if(ge[1].type==="lineEnding"||ge[1].type==="lineEndingBlank"){if(ge[0]==="exit")continue;jt&&(ae[jt][1].type="lineEndingBlank",ln=!0),ge[1].type="lineEnding",jt=he}else if(!(ge[1].type==="linePrefix"||ge[1].type==="blockQuotePrefix"||ge[1].type==="blockQuotePrefixWhitespace"||ge[1].type==="blockQuoteMarker"||ge[1].type==="listItemIndent"))break}kt&&(!jt||kt<jt)&&(Nn._spread=!0),Nn.end=Object.assign({},jt?ae[jt][1].start:K[1].end),ae.splice(jt||Ge,0,["exit",Nn,K[2]]),Ge++,De++}if(K[1].type==="listItemPrefix"){const he={type:"listItem",_spread:!1,start:Object.assign({},K[1].start),end:void 0};Nn=he,ae.splice(Ge,0,["enter",he,K[2]]),Ge++,De++,kt=void 0,$t=!0}}}return ae[ve][1]._spread=ln,De}function c(ae,ve){return De;function De(Ge){f.call(this,ae(Ge),Ge),ve&&ve.call(this,Ge)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ae,ve,De){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([ve,De||void 0]),ae.position={start:us(ve.start),end:void 0}}function h(ae){return ve;function ve(De){ae&&ae.call(this,De),p.call(this,De)}}function p(ae,ve){const De=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==ae.type&&(ve?ve.call(this,ae,Ge[0]):(Ge[1]||hy).call(this,ae,Ge[0]));else throw new Error("Cannot close `"+ae.type+"` ("+Uo({start:ae.start,end:ae.end})+"): it’s not open");De.position.end=us(ae.end)}function g(){return ag(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ae}function _(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ae}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/(\r?\n|\r)$/g,"")}function M(ae){const ve=this.resume(),De=this.stack[this.stack.length-1];De.label=ve,De.identifier=$r(this.sliceSerialize(ae)).toLowerCase()}function C(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function $(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function L(ae){const ve=this.stack[this.stack.length-1];if(!ve.depth){const De=this.sliceSerialize(ae).length;ve.depth=De}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function H(ae){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function G(ae){const De=this.stack[this.stack.length-1].children;let Ge=De[De.length-1];(!Ge||Ge.type!=="text")&&(Ge=Be(),Ge.position={start:us(ae.start),end:void 0},De.push(Ge)),this.stack.push(Ge)}function O(ae){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ae),ve.position.end=us(ae.end)}function I(ae){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=ve.children[ve.children.length-1];De.position.end=us(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(G.call(this,ae),O.call(this,ae))}function R(){this.data.atHardBreak=!0}function oe(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function J(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function X(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function B(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function U(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Z(ae){const ve=this.sliceSerialize(ae),De=this.stack[this.stack.length-2];De.label=V6(ve),De.identifier=$r(ve).toLowerCase()}function me(){const ae=this.stack[this.stack.length-1],ve=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Ge=ae.children;De.children=Ge}else De.alt=ve}function D(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function P(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function Q(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function pe(ae){const ve=this.resume(),De=this.stack[this.stack.length-1];De.label=ve,De.identifier=$r(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function _e(ae){this.data.characterReferenceType=ae.type}function ke(ae){const ve=this.sliceSerialize(ae),De=this.data.characterReferenceType;let Ge;De?(Ge=U_(ve,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=lg(ve);const Qe=this.stack[this.stack.length-1];Qe.value+=Ge}function ze(ae){const ve=this.stack.pop();ve.position.end=us(ae.end)}function ce(ae){O.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ae)}function je(ae){O.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ae)}function Fe(){return{type:"blockquote",children:[]}}function At(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function pt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function vt(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function bt(){return{type:"break"}}function pn(){return{type:"html",value:""}}function dn(){return{type:"image",title:null,url:"",alt:null}}function se(){return{type:"link",title:null,url:"",children:[]}}function Ce(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function fe(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function Ze(){return{type:"strong",children:[]}}function Be(){return{type:"text",value:""}}function mn(){return{type:"thematicBreak"}}}function us(e){return{line:e.line,column:e.column,offset:e.offset}}function W_(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?W_(e,i):W6(e,i)}}function W6(e,t){let n;for(n in t)if(Y_.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function hy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Uo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Uo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Uo({start:t.start,end:t.end})+") is still open")}function Q6(e){const t=this;t.parser=n;function n(i){return X6(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function K6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Z6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
69
+ `}]}function J6(e,t){const n=t.value?t.value+`
70
+ `:"",i={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(i.className=["language-"+l[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function eE(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),l=ol(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let u,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=c+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const p={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,p),e.applyData(t,p)}function rE(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Q_(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const l=e.all(t),c=l[0];c&&c.type==="text"?c.value="["+c.value:l.unshift({type:"text",value:"["});const u=l[l.length-1];return u&&u.type==="text"?u.value+=i:l.push({type:"text",value:i}),l}function sE(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Q_(e,t);const l={src:ol(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const c={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,c),e.applyData(t,c)}function aE(e,t){const n={src:ol(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function lE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function oE(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Q_(e,t);const l={href:ol(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const c={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function cE(e,t){const n={href:ol(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function uE(e,t,n){const i=e.all(t),l=n?dE(n):K_(t),c={},u=[];if(typeof t.checked=="boolean"){const g=i[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(l||f!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
71
+ `}),g.type==="element"&&g.tagName==="p"&&!l?u.push(...g.children):u.push(g)}const h=i[i.length-1];h&&(l||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
72
+ `});const p={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,p),e.applyData(t,p)}function dE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=K_(n[i])}return t}function K_(e){const t=e.spread;return t??e.children.length>1}function fE(e,t){const n={},i=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l<i.length;){const u=i[l];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,c),e.applyData(t,c)}function hE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function mE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gE(e,t){const n=e.all(t),i=n.shift(),l=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),l.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=ng(t.children[1]),h=A_(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),l.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)}function xE(e,t,n){const i=n?n.children:void 0,c=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,f=u?u.length:t.children.length;let h=-1;const p=[];for(;++h<f;){const v=t.children[h],y={},b=u?u[h]:void 0;b&&(y.align=b);let _={type:"element",tagName:c,properties:y,children:[]};v&&(_.children=e.all(v),e.patch(v,_),_=e.applyData(v,_)),p.push(_)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,g),e.applyData(t,g)}function vE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const py=9,my=32;function bE(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),l=0;const c=[];for(;i;)c.push(gy(t.slice(l,i.index),l>0,!0),i[0]),l=i.index+i[0].length,i=n.exec(t);return c.push(gy(t.slice(l),l>0,!1)),c.join("")}function gy(e,t,n){let i=0,l=e.length;if(t){let c=e.codePointAt(i);for(;c===py||c===my;)i++,c=e.codePointAt(i)}if(n){let c=e.codePointAt(l-1);for(;c===py||c===my;)l--,c=e.codePointAt(l-1)}return l>i?e.slice(i,l):""}function yE(e,t){const n={type:"text",value:bE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _E(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wE={blockquote:K6,break:Z6,code:J6,delete:eE,emphasis:tE,footnoteReference:nE,heading:rE,html:iE,imageReference:sE,image:aE,inlineCode:lE,linkReference:oE,link:cE,listItem:uE,list:fE,paragraph:hE,root:pE,strong:mE,table:gE,tableCell:vE,tableRow:xE,text:yE,thematicBreak:_E,toml:Bu,yaml:Bu,definition:Bu,footnoteDefinition:Bu};function Bu(){}const Z_=-1,Ad=0,$o=1,vd=2,cg=3,ug=4,dg=5,fg=6,J_=7,ew=8,xy=typeof self=="object"?self:globalThis,jE=(e,t)=>{const n=(l,c)=>(e.set(c,l),l),i=l=>{if(e.has(l))return e.get(l);const[c,u]=t[l];switch(c){case Ad:case Z_:return n(u,l);case $o:{const f=n([],l);for(const h of u)f.push(i(h));return f}case vd:{const f=n({},l);for(const[h,p]of u)f[i(h)]=i(p);return f}case cg:return n(new Date(u),l);case ug:{const{source:f,flags:h}=u;return n(new RegExp(f,h),l)}case dg:{const f=n(new Map,l);for(const[h,p]of u)f.set(i(h),i(p));return f}case fg:{const f=n(new Set,l);for(const h of u)f.add(i(h));return f}case J_:{const{name:f,message:h}=u;return n(new xy[f](h),l)}case ew:return n(BigInt(u),l);case"BigInt":return n(Object(BigInt(u)),l);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return n(new DataView(f),u)}}return n(new xy[c](u),l)};return i},vy=e=>jE(new Map,e)(0),Ua="",{toString:kE}={},{keys:SE}=Object,_o=e=>{const t=typeof e;if(t!=="object"||!e)return[Ad,t];const n=kE.call(e).slice(8,-1);switch(n){case"Array":return[$o,Ua];case"Object":return[vd,Ua];case"Date":return[cg,Ua];case"RegExp":return[ug,Ua];case"Map":return[dg,Ua];case"Set":return[fg,Ua];case"DataView":return[$o,n]}return n.includes("Array")?[$o,n]:n.includes("Error")?[J_,n]:[vd,n]},Uu=([e,t])=>e===Ad&&(t==="function"||t==="symbol"),NE=(e,t,n,i)=>{const l=(u,f)=>{const h=i.push(u)-1;return n.set(f,h),h},c=u=>{if(n.has(u))return n.get(u);let[f,h]=_o(u);switch(f){case Ad:{let g=u;switch(h){case"bigint":f=ew,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return l([Z_],u)}return l([f,g],u)}case $o:{if(h){let y=u;return h==="DataView"?y=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(y=new Uint8Array(u)),l([h,[...y]],u)}const g=[],v=l([f,g],u);for(const y of u)g.push(c(y));return v}case vd:{if(h)switch(h){case"BigInt":return l([h,u.toString()],u);case"Boolean":case"Number":case"String":return l([h,u.valueOf()],u)}if(t&&"toJSON"in u)return c(u.toJSON());const g=[],v=l([f,g],u);for(const y of SE(u))(e||!Uu(_o(u[y])))&&g.push([c(y),c(u[y])]);return v}case cg:return l([f,u.toISOString()],u);case ug:{const{source:g,flags:v}=u;return l([f,{source:g,flags:v}],u)}case dg:{const g=[],v=l([f,g],u);for(const[y,b]of u)(e||!(Uu(_o(y))||Uu(_o(b))))&&g.push([c(y),c(b)]);return v}case fg:{const g=[],v=l([f,g],u);for(const y of u)(e||!Uu(_o(y)))&&g.push(c(y));return v}}const{message:p}=u;return l([f,{name:h,message:p}],u)};return c},by=(e,{json:t,lossy:n}={})=>{const i=[];return NE(!(t||n),!!t,new Map,i)(e),i},bd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vy(by(e,t)):structuredClone(e):(e,t)=>vy(by(e,t));function CE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function EE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function TE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||CE,i=e.options.footnoteBackLabel||EE,l=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let h=-1;for(;++h<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[h]);if(!p)continue;const g=e.all(p),v=String(p.identifier).toUpperCase(),y=ol(v.toLowerCase());let b=0;const _=[],k=e.footnoteCounts.get(v);for(;k!==void 0&&++b<=k;){_.length>0&&_.push({type:"text",value:" "});let M=typeof n=="string"?n:n(h,b);typeof M=="string"&&(M={type:"text",value:M}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(h,b),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const M=E.children[E.children.length-1];M&&M.type==="text"?M.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(..._)}else g.push(..._);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(g,!0)};e.patch(p,S),f.push(S)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...bd(u),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
73
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
74
+ `}]}}const Md=(function(e){if(e==null)return LE;if(typeof e=="function")return Rd(e);if(typeof e=="object")return Array.isArray(e)?AE(e):ME(e);if(typeof e=="string")return RE(e);throw new Error("Expected function, string, or object as test")});function AE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Md(e[n]);return Rd(i);function i(...l){let c=-1;for(;++c<t.length;)if(t[c].apply(this,l))return!0;return!1}}function ME(e){const t=e;return Rd(n);function n(i){const l=i;let c;for(c in e)if(l[c]!==t[c])return!1;return!0}}function RE(e){return Rd(t);function t(n){return n&&n.type===e}}function Rd(e){return t;function t(n,i,l){return!!(DE(n)&&e.call(this,n,typeof i=="number"?i:void 0,l||void 0))}}function LE(){return!0}function DE(e){return e!==null&&typeof e=="object"&&"type"in e}const tw=[],zE=!0,Tm=!1,OE="skip";function nw(e,t,n,i){let l;typeof t=="function"&&typeof n!="function"?(i=n,n=t):l=t;const c=Md(l),u=i?-1:1;f(e,void 0,[])();function f(h,p,g){const v=h&&typeof h=="object"?h:{};if(typeof v.type=="string"){const b=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(h.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=tw,_,k,E;if((!t||c(h,p,g[g.length-1]||void 0))&&(b=BE(n(h,g)),b[0]===Tm))return b;if("children"in h&&h.children){const S=h;if(S.children&&b[0]!==OE)for(k=(i?S.children.length:-1)+u,E=g.concat(S);k>-1&&k<S.children.length;){const M=S.children[k];if(_=f(M,k,E)(),_[0]===Tm)return _;k=typeof _[1]=="number"?_[1]:k+u}}return b}}}function BE(e){return Array.isArray(e)?e:typeof e=="number"?[zE,e]:e==null?tw:[e]}function hg(e,t,n,i){let l,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,l=n):(c=t,u=n,l=i),nw(e,c,f,l);function f(h,p){const g=p[p.length-1],v=g?g.children.indexOf(h):void 0;return u(h,v,g)}}const Am={}.hasOwnProperty,UE={};function PE(e,t){const n=t||UE,i=new Map,l=new Map,c=new Map,u={...wE,...n.handlers},f={all:p,applyData:FE,definitionById:i,footnoteById:l,footnoteCounts:c,footnoteOrder:[],handlers:u,one:h,options:n,patch:$E,wrap:IE};return hg(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?i:l,y=String(g.identifier).toUpperCase();v.has(y)||v.set(y,g)}}),f;function h(g,v){const y=g.type,b=f.handlers[y];if(Am.call(f.handlers,y)&&b)return b(f,g,v);if(f.options.passThrough&&f.options.passThrough.includes(y)){if("children"in g){const{children:k,...E}=g,S=bd(E);return S.children=f.all(g),S}return bd(g)}return(f.options.unknownHandler||HE)(f,g,v)}function p(g){const v=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const _=f.one(y[b],g);if(_){if(b&&y[b-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=yy(_.value)),!Array.isArray(_)&&_.type==="element")){const k=_.children[0];k&&k.type==="text"&&(k.value=yy(k.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function $E(e,t){e.position&&(t.position=EC(e))}function FE(e,t){let n=t;if(e&&e.data){const i=e.data.hName,l=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,bd(c)),"children"in n&&n.children&&l!==null&&l!==void 0&&(n.children=l)}return n}function HE(e,t){const n=t.data||{},i="value"in t&&!(Am.call(n,"hProperties")||Am.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function IE(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
75
+ `});++i<e.length;)i&&n.push({type:"text",value:`
76
+ `}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
77
+ `}),n}function yy(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _y(e,t){const n=PE(e,t),i=n.one(e,void 0),l=TE(n),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&c.children.push({type:"text",value:`
78
+ `},l),c}function qE(e,t){return e&&"run"in e?async function(n,i){const l=_y(n,{file:i,...t});await e.run(l,i)}:function(n,i){return _y(n,{file:i,...e||t})}}function wy(e){if(e)throw e}var _p,jy;function VE(){if(jy)return _p;jy=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),v=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!v)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},u=function(p,g){n&&g.name==="__proto__"?n(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},f=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return _p=function h(){var p,g,v,y,b,_,k=arguments[0],E=1,S=arguments.length,M=!1;for(typeof k=="boolean"&&(M=k,k=arguments[1]||{},E=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});E<S;++E)if(p=arguments[E],p!=null)for(g in p)v=f(k,g),y=f(p,g),k!==y&&(M&&y&&(c(y)||(b=l(y)))?(b?(b=!1,_=v&&l(v)?v:[]):_=v&&c(v)?v:{},u(k,{name:g,newValue:h(M,_,y)})):typeof y<"u"&&u(k,{name:g,newValue:y}));return k},_p}var GE=VE();const wp=Om(GE);function Mm(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function XE(){const e=[],t={run:n,use:i};return t;function n(...l){let c=-1;const u=l.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...l);function f(h,...p){const g=e[++c];let v=-1;if(h){u(h);return}for(;++v<l.length;)(p[v]===null||p[v]===void 0)&&(p[v]=l[v]);l=p,g?YE(g,f)(...p):u(null,...p)}}function i(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function YE(e,t){let n;return i;function i(...u){const f=e.length>u.length;let h;f&&u.push(l);try{h=e.apply(this,u)}catch(p){const g=p;if(f&&n)throw g;return l(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(c,l):h instanceof Error?l(h):c(h))}function l(u,...f){n||(n=!0,t(u,...f))}function c(u){l(null,u)}}const Kr={basename:WE,dirname:QE,extname:KE,join:ZE,sep:"/"};function WE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ac(e);let n=0,i=-1,l=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(c){n=l+1;break}}else i<0&&(c=!0,i=l+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,f=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(c){n=l+1;break}}else u<0&&(c=!0,u=l+1),f>-1&&(e.codePointAt(l)===t.codePointAt(f--)?f<0&&(i=l):(f=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function QE(e){if(ac(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function KE(e){ac(e);let t=e.length,n=-1,i=0,l=-1,c=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?l<0?l=t:c!==1&&(c=1):l>-1&&(c=-1)}return l<0||n<0||c===0||c===1&&l===n-1&&l===i+1?"":e.slice(l,n)}function ZE(...e){let t=-1,n;for(;++t<e.length;)ac(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JE(n)}function JE(e){ac(e);const t=e.codePointAt(0)===47;let n=eT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function eT(e,t){let n="",i=0,l=-1,c=0,u=-1,f,h;for(;++u<=e.length;){if(u<e.length)f=e.codePointAt(u);else{if(f===47)break;f=47}if(f===47){if(!(l===u-1||c===1))if(l!==u-1&&c===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",i=0):(n=n.slice(0,h),i=n.length-1-n.lastIndexOf("/")),l=u,c=0;continue}}else if(n.length>0){n="",i=0,l=u,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(l+1,u):n=e.slice(l+1,u),i=u-l-1;l=u,c=0}else f===46&&c>-1?c++:c=-1}return n}function ac(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const tT={cwd:nT};function nT(){return"/"}function Rm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function rT(e){if(typeof e=="string")e=new URL(e);else if(!Rm(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return iT(e)}function iT(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const jp=["history","path","basename","stem","extname","dirname"];class rw{constructor(t){let n;t?Rm(t)?n={path:t}:typeof t=="string"||sT(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":tT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<jp.length;){const c=jp[i];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let l;for(l in n)jp.includes(l)||(this[l]=n[l])}get basename(){return typeof this.path=="string"?Kr.basename(this.path):void 0}set basename(t){Sp(t,"basename"),kp(t,"basename"),this.path=Kr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Kr.dirname(this.path):void 0}set dirname(t){ky(this.basename,"dirname"),this.path=Kr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Kr.extname(this.path):void 0}set extname(t){if(kp(t,"extname"),ky(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Kr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Rm(t)&&(t=rT(t)),Sp(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Kr.basename(this.path,this.extname):void 0}set stem(t){Sp(t,"stem"),kp(t,"stem"),this.path=Kr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const l=this.message(t,n,i);throw l.fatal=!0,l}info(t,n,i){const l=this.message(t,n,i);return l.fatal=void 0,l}message(t,n,i){const l=new Sn(t,n,i);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function kp(e,t){if(e&&e.includes(Kr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Kr.sep+"`")}function Sp(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ky(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function sT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const aT=(function(e){const i=this.constructor.prototype,l=i[e],c=function(){return l.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),lT={}.hasOwnProperty;class pg extends aT{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=XE()}copy(){const t=new pg;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(wp(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ep("data",this.frozen),this.namespace[t]=n,this):lT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ep("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const l=n.call(t,...i);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Pu(t),i=this.parser||this.Parser;return Np("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Np("process",this.parser||this.Parser),Cp("process",this.compiler||this.Compiler),n?l(void 0,n):new Promise(l);function l(c,u){const f=Pu(t),h=i.parse(f);i.run(h,f,function(g,v,y){if(g||!v||!y)return p(g);const b=v,_=i.stringify(b,y);uT(_)?y.value=_:y.result=_,p(g,y)});function p(g,v){g||!v?u(g):c?c(v):n(void 0,v)}}}processSync(t){let n=!1,i;return this.freeze(),Np("processSync",this.parser||this.Parser),Cp("processSync",this.compiler||this.Compiler),this.process(t,l),Ny("processSync","process",n),i;function l(c,u){n=!0,wy(c),i=u}}run(t,n,i){Sy(t),this.freeze();const l=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?c(void 0,i):new Promise(c);function c(u,f){const h=Pu(n);l.run(t,h,p);function p(g,v,y){const b=v||t;g?f(g):u?u(b):i(void 0,b,y)}}}runSync(t,n){let i=!1,l;return this.run(t,n,c),Ny("runSync","run",i),l;function c(u,f){wy(u),l=f,i=!0}}stringify(t,n){this.freeze();const i=Pu(n),l=this.compiler||this.Compiler;return Cp("stringify",l),Sy(t),l(t,i)}use(t,...n){const i=this.attachers,l=this.namespace;if(Ep("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...v]=p;h(g,v)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(p.plugins),p.settings&&(l.settings=wp(!0,l.settings,p.settings))}function f(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const v=p[g];c(v)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,g){let v=-1,y=-1;for(;++v<i.length;)if(i[v][0]===p){y=v;break}if(y===-1)i.push([p,...g]);else if(g.length>0){let[b,..._]=g;const k=i[y][1];Mm(k)&&Mm(b)&&(b=wp(!0,k,b)),i[y]=[p,b,..._]}}}}const oT=new pg().freeze();function Np(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ep(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sy(e){if(!Mm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ny(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pu(e){return cT(e)?e:new rw(e)}function cT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function uT(e){return typeof e=="string"||dT(e)}function dT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Cy=[],Ey={allowDangerousHtml:!0},hT=/^(https?|ircs?|mailto|xmpp)$/i,pT=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function mg(e){const t=mT(e),n=gT(e);return xT(t.runSync(t.parse(n),n),e)}function mT(e){const t=e.rehypePlugins||Cy,n=e.remarkPlugins||Cy,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ey}:Ey;return oT().use(Q6).use(n).use(qE,i).use(t)}function gT(e){const t=e.children||"",n=new rw;return typeof t=="string"&&(n.value=t),n}function xT(e,t){const n=t.allowedElements,i=t.allowElement,l=t.components,c=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||vT;for(const g of pT)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+fT+g.id,void 0);return hg(e,p),LC(e,{Fragment:a.Fragment,components:l,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function p(g,v,y){if(g.type==="raw"&&y&&typeof v=="number")return u?y.children.splice(v,1):y.children[v]={type:"text",value:g.value},v;if(g.type==="element"){let b;for(b in vp)if(Object.hasOwn(vp,b)&&Object.hasOwn(g.properties,b)){const _=g.properties[b],k=vp[b];(k===null||k.includes(g.tagName))&&(g.properties[b]=h(String(_||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):c?c.includes(g.tagName):!1;if(!b&&i&&typeof v=="number"&&(b=!i(g,v,y)),b&&y&&typeof v=="number")return f&&g.children?y.children.splice(v,1,...g.children):y.children.splice(v,1),v}}}function vT(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||i!==-1&&t>i||hT.test(e.slice(0,t))?e:""}function Ty(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,l=n.indexOf(t);for(;l!==-1;)i++,l=n.indexOf(t,l+t.length);return i}function bT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function yT(e,t,n){const l=Md((n||{}).ignore||[]),c=_T(t);let u=-1;for(;++u<c.length;)nw(e,"text",f);function f(p,g){let v=-1,y;for(;++v<g.length;){const b=g[v],_=y?y.children:void 0;if(l(b,_?_.indexOf(b):void 0,y))return;y=b}if(y)return h(p,g)}function h(p,g){const v=g[g.length-1],y=c[u][0],b=c[u][1];let _=0;const E=v.children.indexOf(p);let S=!1,M=[];y.lastIndex=0;let C=y.exec(p.value);for(;C;){const $=C.index,L={index:C.index,input:C.input,stack:[...g,p]};let T=b(...C,L);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?y.lastIndex=$+1:(_!==$&&M.push({type:"text",value:p.value.slice(_,$)}),Array.isArray(T)?M.push(...T):T&&M.push(T),_=$+C[0].length,S=!0),!y.global)break;C=y.exec(p.value)}return S?(_<p.value.length&&M.push({type:"text",value:p.value.slice(_)}),v.children.splice(E,1,...M)):M=[p],E+M.length}}function _T(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const l=n[i];t.push([wT(l[0]),jT(l[1])])}return t}function wT(e){return typeof e=="string"?new RegExp(bT(e),"g"):e}function jT(e){return typeof e=="function"?e:function(){return e}}const Tp="phrasing",Ap=["autolink","link","image","label"];function kT(){return{transforms:[MT],enter:{literalAutolink:NT,literalAutolinkEmail:Mp,literalAutolinkHttp:Mp,literalAutolinkWww:Mp},exit:{literalAutolink:AT,literalAutolinkEmail:TT,literalAutolinkHttp:CT,literalAutolinkWww:ET}}}function ST(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Tp,notInConstruct:Ap},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Tp,notInConstruct:Ap},{character:":",before:"[ps]",after:"\\/",inConstruct:Tp,notInConstruct:Ap}]}}function NT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Mp(e){this.config.enter.autolinkProtocol.call(this,e)}function CT(e){this.config.exit.autolinkProtocol.call(this,e)}function ET(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function TT(e){this.config.exit.autolinkEmail.call(this,e)}function AT(e){this.exit(e)}function MT(e){yT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,RT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),LT]],{ignore:["link","linkReference"]})}function RT(e,t,n,i,l){let c="";if(!iw(l)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!DT(n)))return!1;const u=zT(n+i);if(!u[0])return!1;const f={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function LT(e,t,n,i){return!iw(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function DT(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function zT(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const l=Ty(e,"(");let c=Ty(e,")");for(;i!==-1&&l>c;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),c++;return[e,n]}function iw(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Gs(n)||Ed(n))&&(!t||n!==47)}sw.peek=qT;function OT(){this.buffer()}function BT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function UT(){this.buffer()}function PT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function $T(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$r(this.sliceSerialize(e)).toLowerCase(),n.label=t}function FT(e){this.exit(e)}function HT(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$r(this.sliceSerialize(e)).toLowerCase(),n.label=t}function IT(e){this.exit(e)}function qT(){return"["}function sw(e,t,n,i){const l=n.createTracker(i);let c=l.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return c+=l.move(n.safe(n.associationId(e),{after:"]",before:c})),f(),u(),c+=l.move("]"),c}function VT(){return{enter:{gfmFootnoteCallString:OT,gfmFootnoteCall:BT,gfmFootnoteDefinitionLabelString:UT,gfmFootnoteDefinition:PT},exit:{gfmFootnoteCallString:$T,gfmFootnoteCall:FT,gfmFootnoteDefinitionLabelString:HT,gfmFootnoteDefinition:IT}}}function GT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sw},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,l,c,u){const f=c.createTracker(u);let h=f.move("[^");const p=c.enter("footnoteDefinition"),g=c.enter("label");return h+=f.move(c.safe(c.associationId(i),{before:h,after:"]"})),g(),h+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),h+=f.move((t?`
79
+ `:" ")+c.indentLines(c.containerFlow(i,f.current()),t?aw:XT))),p(),h}}function XT(e,t,n){return t===0?e:aw(e,t,n)}function aw(e,t,n){return(n?"":" ")+e}const YT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];lw.peek=JT;function WT(){return{canContainEols:["delete"],enter:{strikethrough:KT},exit:{strikethrough:ZT}}}function QT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:YT}],handlers:{delete:lw}}}function KT(e){this.enter({type:"delete",children:[]},e)}function ZT(e){this.exit(e)}function lw(e,t,n,i){const l=n.createTracker(i),c=n.enter("strikethrough");let u=l.move("~~");return u+=n.containerPhrasing(e,{...l.current(),before:u,after:"~"}),u+=l.move("~~"),c(),u}function JT(){return"~"}function eA(e){return e.length}function tA(e,t){const n=t||{},i=(n.align||[]).concat(),l=n.stringLength||eA,c=[],u=[],f=[],h=[];let p=0,g=-1;for(;++g<e.length;){const k=[],E=[];let S=-1;for(e[g].length>p&&(p=e[g].length);++S<e[g].length;){const M=nA(e[g][S]);if(n.alignDelimiters!==!1){const C=l(M);E[S]=C,(h[S]===void 0||C>h[S])&&(h[S]=C)}k.push(M)}u[g]=k,f[g]=E}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<p;)c[v]=Ay(i[v]);else{const k=Ay(i);for(;++v<p;)c[v]=k}v=-1;const y=[],b=[];for(;++v<p;){const k=c[v];let E="",S="";k===99?(E=":",S=":"):k===108?E=":":k===114&&(S=":");let M=n.alignDelimiters===!1?1:Math.max(1,h[v]-E.length-S.length);const C=E+"-".repeat(M)+S;n.alignDelimiters!==!1&&(M=E.length+M+S.length,M>h[v]&&(h[v]=M),b[v]=M),y[v]=C}u.splice(1,0,y),f.splice(1,0,b),g=-1;const _=[];for(;++g<u.length;){const k=u[g],E=f[g];v=-1;const S=[];for(;++v<p;){const M=k[v]||"";let C="",$="";if(n.alignDelimiters!==!1){const L=h[v]-(E[v]||0),T=c[v];T===114?C=" ".repeat(L):T===99?L%2?(C=" ".repeat(L/2+.5),$=" ".repeat(L/2-.5)):(C=" ".repeat(L/2),$=C):$=" ".repeat(L)}n.delimiterStart!==!1&&!v&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&M==="")&&(n.delimiterStart!==!1||v)&&S.push(" "),n.alignDelimiters!==!1&&S.push(C),S.push(M),n.alignDelimiters!==!1&&S.push($),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||v!==p-1)&&S.push("|")}_.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return _.join(`
80
+ `)}function nA(e){return e==null?"":String(e)}function Ay(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function rA(e,t,n,i){const l=n.enter("blockquote"),c=n.createTracker(i);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),iA);return l(),u}function iA(e,t,n){return">"+(n?"":" ")+e}function sA(e,t){return My(e,t.inConstruct,!0)&&!My(e,t.notInConstruct,!1)}function My(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function Ry(e,t,n,i){let l=-1;for(;++l<n.unsafe.length;)if(n.unsafe[l].character===`
81
+ `&&sA(n.stack,n.unsafe[l]))return/[ \t]/.test(i.before)?"":" ";return`\\
82
+ `}function aA(e,t){const n=String(e);let i=n.indexOf(t),l=i,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===l?++c>u&&(u=c):c=1,l=i+t.length,i=n.indexOf(t,l);return u}function lA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function oA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function cA(e,t,n,i){const l=oA(n),c=e.value||"",u=l==="`"?"GraveAccent":"Tilde";if(lA(e,n)){const v=n.enter("codeIndented"),y=n.indentLines(c,uA);return v(),y}const f=n.createTracker(i),h=l.repeat(Math.max(aA(c,l)+1,3)),p=n.enter("codeFenced");let g=f.move(h);if(e.lang){const v=n.enter(`codeFencedLang${u}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${u}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
83
+ `,encode:["`"],...f.current()})),v()}return g+=f.move(`
84
+ `),c&&(g+=f.move(c+`
85
+ `)),g+=f.move(h),p(),g}function uA(e,t,n){return(n?"":" ")+e}function gg(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function dA(e,t,n,i){const l=gg(n),c=l==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(i);let p=h.move("[");return p+=h.move(n.safe(n.associationId(e),{before:p,after:"]",...h.current()})),p+=h.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":`
86
+ `,...h.current()}))),f(),e.title&&(f=n.enter(`title${c}`),p+=h.move(" "+l),p+=h.move(n.safe(e.title,{before:p,after:l,...h.current()})),p+=h.move(l),f()),u(),p}function fA(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Jo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function yd(e,t,n){const i=rl(e),l=rl(t);return i===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ow.peek=hA;function ow(e,t,n,i){const l=fA(n),c=n.enter("emphasis"),u=n.createTracker(i),f=u.move(l);let h=u.move(n.containerPhrasing(e,{after:l,before:f,...u.current()}));const p=h.charCodeAt(0),g=yd(i.before.charCodeAt(i.before.length-1),p,l);g.inside&&(h=Jo(p)+h.slice(1));const v=h.charCodeAt(h.length-1),y=yd(i.after.charCodeAt(0),v,l);y.inside&&(h=h.slice(0,-1)+Jo(v));const b=u.move(l);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},f+h+b}function hA(e,t,n){return n.options.emphasis||"*"}function pA(e,t){let n=!1;return hg(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,Tm}),!!((!e.depth||e.depth<3)&&ag(e)&&(t.options.setext||n))}function mA(e,t,n,i){const l=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(i);if(pA(e,n)){const g=n.enter("headingSetext"),v=n.enter("phrasing"),y=n.containerPhrasing(e,{...c.current(),before:`
87
+ `,after:`
88
+ `});return v(),g(),y+`
89
+ `+(l===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
90
+ `))+1))}const u="#".repeat(l),f=n.enter("headingAtx"),h=n.enter("phrasing");c.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
91
+ `,...c.current()});return/^[\t ]/.test(p)&&(p=Jo(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),h(),f(),p}cw.peek=gA;function cw(e){return e.value||""}function gA(){return"<"}uw.peek=xA;function uw(e,t,n,i){const l=gg(n),c=l==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(i);let p=h.move("![");return p+=h.move(n.safe(e.alt,{before:p,after:"]",...h.current()})),p+=h.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":")",...h.current()}))),f(),e.title&&(f=n.enter(`title${c}`),p+=h.move(" "+l),p+=h.move(n.safe(e.title,{before:p,after:l,...h.current()})),p+=h.move(l),f()),p+=h.move(")"),u(),p}function xA(){return"!"}dw.peek=vA;function dw(e,t,n,i){const l=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("![");const p=n.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,c(),l==="full"||!p||p!==v?h+=f.move(v+"]"):l==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function vA(){return"!"}fw.peek=bA;function fw(e,t,n){let i=e.value||"",l="`",c=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<n.unsafe.length;){const u=n.unsafe[c],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(i);){let p=h.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(h.index+1)}}return l+i+l}function bA(){return"`"}function hw(e,t){const n=ag(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}pw.peek=yA;function pw(e,t,n,i){const l=gg(n),c=l==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let f,h;if(hw(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let v=u.move("<");return v+=u.move(n.containerPhrasing(e,{before:v,after:">",...u.current()})),v+=u.move(">"),f(),n.stack=g,v}f=n.enter("link"),h=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(h=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),h(),e.title&&(h=n.enter(`title${c}`),p+=u.move(" "+l),p+=u.move(n.safe(e.title,{before:p,after:l,...u.current()})),p+=u.move(l),h()),p+=u.move(")"),f(),p}function yA(e,t,n){return hw(e,n)?"<":"["}mw.peek=_A;function mw(e,t,n,i){const l=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("[");const p=n.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,c(),l==="full"||!p||p!==v?h+=f.move(v+"]"):l==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function _A(){return"["}function xg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wA(e){const t=xg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function jA(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function gw(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function kA(e,t,n,i){const l=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?jA(n):xg(n);const f=e.ordered?u==="."?")":".":wA(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),gw(n)===u&&g){let v=-1;for(;++v<e.children.length;){const y=e.children[v];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const p=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=c,l(),p}function SA(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function NA(e,t,n,i){const l=SA(n);let c=n.bulletCurrent||xg(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(i);f.move(c+" ".repeat(u-c.length)),f.shift(u);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,f.current()),g);return h(),p;function g(v,y,b){return y?(b?"":" ".repeat(u))+v:(b?c:c+" ".repeat(u-c.length))+v}}function CA(e,t,n,i){const l=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,i);return c(),l(),u}const EA=Md(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function TA(e,t,n,i){return(e.children.some(function(u){return EA(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function AA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}xw.peek=MA;function xw(e,t,n,i){const l=AA(n),c=n.enter("strong"),u=n.createTracker(i),f=u.move(l+l);let h=u.move(n.containerPhrasing(e,{after:l,before:f,...u.current()}));const p=h.charCodeAt(0),g=yd(i.before.charCodeAt(i.before.length-1),p,l);g.inside&&(h=Jo(p)+h.slice(1));const v=h.charCodeAt(h.length-1),y=yd(i.after.charCodeAt(0),v,l);y.inside&&(h=h.slice(0,-1)+Jo(v));const b=u.move(l+l);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},f+h+b}function MA(e,t,n){return n.options.strong||"*"}function RA(e,t,n,i){return n.safe(e.value,i)}function LA(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function DA(e,t,n){const i=(gw(n)+(n.options.ruleSpaces?" ":"")).repeat(LA(n));return n.options.ruleSpaces?i.slice(0,-1):i}const vw={blockquote:rA,break:Ry,code:cA,definition:dA,emphasis:ow,hardBreak:Ry,heading:mA,html:cw,image:uw,imageReference:dw,inlineCode:fw,link:pw,linkReference:mw,list:kA,listItem:NA,paragraph:CA,root:TA,strong:xw,text:RA,thematicBreak:DA};function zA(){return{enter:{table:OA,tableData:Ly,tableHeader:Ly,tableRow:UA},exit:{codeText:PA,table:BA,tableData:Rp,tableHeader:Rp,tableRow:Rp}}}function OA(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function BA(e){this.exit(e),this.data.inTable=void 0}function UA(e){this.enter({type:"tableRow",children:[]},e)}function Rp(e){this.exit(e)}function Ly(e){this.enter({type:"tableCell",children:[]},e)}function PA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,$A));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function $A(e,t){return t==="|"?t:e}function FA(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,l=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
92
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:h,tableRow:f}};function u(b,_,k,E){return p(g(b,k,E),b.align)}function f(b,_,k,E){const S=v(b,k,E),M=p([S]);return M.slice(0,M.indexOf(`
93
+ `))}function h(b,_,k,E){const S=k.enter("tableCell"),M=k.enter("phrasing"),C=k.containerPhrasing(b,{...E,before:c,after:c});return M(),S(),C}function p(b,_){return tA(b,{align:_,alignDelimiters:i,padding:n,stringLength:l})}function g(b,_,k){const E=b.children;let S=-1;const M=[],C=_.enter("table");for(;++S<E.length;)M[S]=v(E[S],_,k);return C(),M}function v(b,_,k){const E=b.children;let S=-1;const M=[],C=_.enter("tableRow");for(;++S<E.length;)M[S]=h(E[S],b,_,k);return C(),M}function y(b,_,k){let E=vw.inlineCode(b,_,k);return k.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function HA(){return{exit:{taskListCheckValueChecked:Dy,taskListCheckValueUnchecked:Dy,paragraph:qA}}}function IA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:VA}}}function Dy(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function qA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const l=t.children;let c=-1,u;for(;++c<l.length;){const f=l[c];if(f.type==="paragraph"){u=f;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function VA(e,t,n,i){const l=e.children[0],c=typeof e.checked=="boolean"&&l&&l.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(i);c&&f.move(u);let h=vw.listItem(e,t,n,{...i,...f.current()});return c&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(g){return g+u}}function GA(){return[kT(),VT(),WT(),zA(),HA()]}function XA(e){return{extensions:[ST(),GT(e),QT(),FA(e),IA()]}}const YA={tokenize:eM,partial:!0},bw={tokenize:tM,partial:!0},yw={tokenize:nM,partial:!0},_w={tokenize:rM,partial:!0},WA={tokenize:iM,partial:!0},ww={name:"wwwAutolink",tokenize:ZA,previous:kw},jw={name:"protocolAutolink",tokenize:JA,previous:Sw},Ri={name:"emailAutolink",tokenize:KA,previous:Nw},ri={};function QA(){return{text:ri}}let $s=48;for(;$s<123;)ri[$s]=Ri,$s++,$s===58?$s=65:$s===91&&($s=97);ri[43]=Ri;ri[45]=Ri;ri[46]=Ri;ri[95]=Ri;ri[72]=[Ri,jw];ri[104]=[Ri,jw];ri[87]=[Ri,ww];ri[119]=[Ri,ww];function KA(e,t,n){const i=this;let l,c;return u;function u(v){return!Lm(v)||!Nw.call(i,i.previous)||vg(i.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(v))}function f(v){return Lm(v)?(e.consume(v),f):v===64?(e.consume(v),h):n(v)}function h(v){return v===46?e.check(WA,g,p)(v):v===45||v===95||kn(v)?(c=!0,e.consume(v),h):g(v)}function p(v){return e.consume(v),l=!0,h}function g(v){return c&&l&&Dn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function ZA(e,t,n){const i=this;return l;function l(u){return u!==87&&u!==119||!kw.call(i,i.previous)||vg(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(YA,e.attempt(bw,e.attempt(yw,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function JA(e,t,n){const i=this;let l="",c=!1;return u;function u(v){return(v===72||v===104)&&Sw.call(i,i.previous)&&!vg(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(v),e.consume(v),f):n(v)}function f(v){if(Dn(v)&&l.length<5)return l+=String.fromCodePoint(v),e.consume(v),f;if(v===58){const y=l.toLowerCase();if(y==="http"||y==="https")return e.consume(v),h}return n(v)}function h(v){return v===47?(e.consume(v),c?p:(c=!0,h)):n(v)}function p(v){return v===null||xd(v)||Tt(v)||Gs(v)||Ed(v)?n(v):e.attempt(bw,e.attempt(yw,g),n)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function eM(e,t,n){let i=0;return l;function l(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),l):u===46&&i===3?(e.consume(u),c):n(u)}function c(u){return u===null?n(u):t(u)}}function tM(e,t,n){let i,l,c;return u;function u(p){return p===46||p===95?e.check(_w,h,f)(p):p===null||Tt(p)||Gs(p)||p!==45&&Ed(p)?h(p):(c=!0,e.consume(p),u)}function f(p){return p===95?i=!0:(l=i,i=void 0),e.consume(p),u}function h(p){return l||i||!c?n(p):t(p)}}function nM(e,t){let n=0,i=0;return l;function l(u){return u===40?(n++,e.consume(u),l):u===41&&i<n?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(_w,t,c)(u):u===null||Tt(u)||Gs(u)?t(u):(e.consume(u),l)}function c(u){return u===41&&i++,e.consume(u),l}}function rM(e,t,n){return i;function i(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),i):f===38?(e.consume(f),c):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||Gs(f)?t(f):n(f)}function l(f){return f===null||f===40||f===91||Tt(f)||Gs(f)?t(f):i(f)}function c(f){return Dn(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),i):Dn(f)?(e.consume(f),u):n(f)}}function iM(e,t,n){return i;function i(c){return e.consume(c),l}function l(c){return kn(c)?n(c):t(c)}}function kw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function Sw(e){return!Dn(e)}function Nw(e){return!(e===47||Lm(e))}function Lm(e){return e===43||e===45||e===46||e===95||kn(e)}function vg(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const sM={tokenize:hM,partial:!0};function aM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:uM,continuation:{tokenize:dM},exit:fM}},text:{91:{name:"gfmFootnoteCall",tokenize:cM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lM,resolveTo:oM}}}}function lM(e,t,n){const i=this;let l=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;l--;){const h=i.events[l][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return f;function f(h){if(!u||!u._balanced)return n(h);const p=$r(i.sliceSerialize({start:u.end,end:i.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function oM(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...f),e}function cM(e,t,n){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,u;return f;function f(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),h}function h(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(v){if(c>999||v===93&&!u||v===null||v===91||Tt(v))return n(v);if(v===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return l.includes($r(i.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Tt(v)||(u=!0),c++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function uM(e,t,n){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,u=0,f;return h;function h(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(_)}function g(_){if(u>999||_===93&&!f||_===null||_===91||Tt(_))return n(_);if(_===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return c=$r(i.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Tt(_)||(f=!0),u++,e.consume(_),_===92?v:g}function v(_){return _===91||_===92||_===93?(e.consume(_),u++,g):g(_)}function y(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),l.includes(c)||l.push(c),ot(e,b,"gfmFootnoteDefinitionWhitespace")):n(_)}function b(_){return t(_)}}function dM(e,t,n){return e.check(sc,t,e.attempt(sM,t,n))}function fM(e){e.exit("gfmFootnoteDefinition")}function hM(e,t,n){const i=this;return ot(e,l,"gfmFootnoteDefinitionIndent",5);function l(c){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function pM(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:l};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(u,f){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let p=h;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[h][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[h][1].end)},v={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[h][1].start)},y=[["enter",g,f],["enter",u[p][1],f],["exit",u[p][1],f],["enter",v,f]],b=f.parser.constructs.insideSpan.null;b&&lr(y,y.length,0,Td(b,u.slice(p+1,h),f)),lr(y,y.length,0,[["exit",v,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",g,f]]),lr(u,p-1,h-p+3,y),h=p+y.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function c(u,f,h){const p=this.previous,g=this.events;let v=0;return y;function y(_){return p===126&&g[g.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),b(_))}function b(_){const k=rl(p);if(_===126)return v>1?h(_):(u.consume(_),v++,b);if(v<2&&!n)return h(_);const E=u.exit("strikethroughSequenceTemporary"),S=rl(_);return E._open=!S||S===2&&!!k,E._close=!k||k===2&&!!S,f(_)}}}class mM{constructor(){this.map=[]}add(t,n,i){gM(this,t,n,i)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let l=i.pop();for(;l;){for(const c of l)t.push(c);l=i.pop()}this.map.length=0}}function gM(e,t,n,i){let l=0;if(!(n===0&&i.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=n,e.map[l][2].push(...i);return}l+=1}e.map.push([t,n,i])}}function xM(e,t){let n=!1;const i=[];for(;t<e.length;){const l=e[t];if(n){if(l[0]==="enter")l[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function vM(){return{flow:{null:{name:"table",tokenize:bM,resolveAll:yM}}}}function bM(e,t,n){const i=this;let l=0,c=0,u;return f;function f(O){let I=i.events.length-1;for(;I>-1;){const J=i.events[I][1].type;if(J==="lineEnding"||J==="linePrefix")I--;else break}const R=I>-1?i.events[I][1].type:null,oe=R==="tableHead"||R==="tableRow"?T:h;return oe===T&&i.parser.lazy[i.now().line]?n(O):oe(O)}function h(O){return e.enter("tableHead"),e.enter("tableRow"),p(O)}function p(O){return O===124||(u=!0,c+=1),g(O)}function g(O){return O===null?n(O):Ue(O)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),b):n(O):nt(O)?ot(e,g,"whitespace")(O):(c+=1,u&&(u=!1,l+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),v(O)))}function v(O){return O===null||O===124||Tt(O)?(e.exit("data"),g(O)):(e.consume(O),O===92?y:v)}function y(O){return O===92||O===124?(e.consume(O),v):v(O)}function b(O){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(O):(e.enter("tableDelimiterRow"),u=!1,nt(O)?ot(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):_(O))}function _(O){return O===45||O===58?E(O):O===124?(u=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),k):L(O)}function k(O){return nt(O)?ot(e,E,"whitespace")(O):E(O)}function E(O){return O===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),S):O===45?(c+=1,S(O)):O===null||Ue(O)?$(O):L(O)}function S(O){return O===45?(e.enter("tableDelimiterFiller"),M(O)):L(O)}function M(O){return O===45?(e.consume(O),M):O===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(O))}function C(O){return nt(O)?ot(e,$,"whitespace")(O):$(O)}function $(O){return O===124?_(O):O===null||Ue(O)?!u||l!==c?L(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(O)):L(O)}function L(O){return n(O)}function T(O){return e.enter("tableRow"),H(O)}function H(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),H):O===null||Ue(O)?(e.exit("tableRow"),t(O)):nt(O)?ot(e,H,"whitespace")(O):(e.enter("data"),z(O))}function z(O){return O===null||O===124||Tt(O)?(e.exit("data"),H(O)):(e.consume(O),O===92?G:z)}function G(O){return O===92||O===124?(e.consume(O),z):z(O)}}function yM(e,t){let n=-1,i=!0,l=0,c=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,p,g,v;const y=new mM;for(;++n<e.length;){const b=e[n],_=b[1];b[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(zy(y,t,h,p,g),g=void 0,h=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,v=void 0,c=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",g,t]])),l=_.type==="tableDelimiterRow"?2:g?3:1):l&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],v=$u(y,t,c,l,void 0,v),c=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(u[0]=u[1],v=$u(y,t,c,l,void 0,v)),c=u,u=[c[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,c[1]!==0?(u[0]=u[1],v=$u(y,t,c,l,n,v)):u[1]!==0&&(v=$u(y,t,u,l,n,v)),l=0):l&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&zy(y,t,h,p,g),y.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=xM(t.events,n))}return e}function $u(e,t,n,i,l,c){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(c.end=Object.assign({},qa(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const h=qa(t.events,n[1]);if(c={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const p=qa(t.events,n[2]),g=qa(t.events,n[3]),v={type:f,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",v,t]]),i!==2){const y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,k=n[3]-n[2]-1;e.add(_,k,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return l!==void 0&&(c.end=Object.assign({},qa(t.events,l)),e.add(l,0,[["exit",c,t]]),c=void 0),c}function zy(e,t,n,i,l){const c=[],u=qa(t.events,n);l&&(l.end=Object.assign({},u),c.push(["exit",l,t])),i.end=Object.assign({},u),c.push(["exit",i,t]),e.add(n+1,0,c)}function qa(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const _M={name:"tasklistCheck",tokenize:jM};function wM(){return{text:{91:_M}}}function jM(e,t,n){const i=this;return l;function l(h){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),c)}function c(h){return Tt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(h)}function f(h){return Ue(h)?t(h):nt(h)?e.check({tokenize:kM},t,n)(h):n(h)}}function kM(e,t,n){return ot(e,i,"whitespace");function i(l){return l===null?n(l):t(l)}}function SM(e){return B_([QA(),aM(),pM(e),vM(),wM()])}const NM={};function bg(e){const t=this,n=e||NM,i=t.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(SM(n)),c.push(GA()),u.push(XA(n))}function CM({message:e}){return e.role==="system"?a.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-0",children:[a.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),a.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),a.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):e.role==="user"?a.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] px-3.5 sm:px-4 py-2.5 rounded-[16px] rounded-br-[6px] user-bubble-gradient text-cc-fg shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:[e.images&&e.images.length>0&&a.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.images.map((t,n)=>a.jsx("img",{src:`data:${t.media_type};base64,${t.data}`,alt:"attachment",className:"max-w-[150px] sm:max-w-[200px] max-h-[120px] sm:max-h-[150px] rounded-xl object-cover border border-cc-border/30"},n))}),a.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:a.jsx(yg,{text:e.content})})]})}):a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsx(AM,{message:e})})}function EM(e){const t=[];for(const n of e)if(n.type==="tool_use"){const i=t[t.length-1];(i==null?void 0:i.kind)==="tool_group"&&i.name===n.name?i.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function TM(e){const t=new Map;for(const n of e)n.type==="tool_use"&&t.set(n.id,{name:n.name,input:n.input});return t}function AM({message:e}){const t=e.contentBlocks||[],n=j.useMemo(()=>EM(t),[t]),i=j.useMemo(()=>TM(t),[t]);if(t.length===0&&e.content){const l=e.isStreaming&&e.streamingPhase==="thinking";return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Oy,{}),a.jsx("div",{className:"flex-1 min-w-0",children:l?a.jsx(Cw,{text:e.content}):a.jsx(yg,{text:e.content,showCursor:!!e.isStreaming})})]})}return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Oy,{}),a.jsx("div",{className:"flex-1 min-w-0 space-y-3",children:n.map((l,c)=>{if(l.kind==="content")return a.jsx(MM,{block:l.block,toolUseById:i},c);if(l.items.length===1){const u=l.items[0];return a.jsx(l5,{name:u.name,input:u.input,toolUseId:u.id},c)}return a.jsx(LM,{name:l.name,items:l.items},c)})})]})}function Oy(){return a.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function yg({text:e,showCursor:t=!1}){return a.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[a.jsx(mg,{remarkPlugins:[bg],components:{p:({children:n})=>a.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>a.jsx("em",{className:"italic",children:n}),h1:({children:n})=>a.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>a.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>a.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>a.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>a.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>a.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>a.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>a.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:l}=n,c=/language-(\w+)/.exec(l||"");if(c||typeof i=="string"&&i.includes(`
94
+ `)){const f=(c==null?void 0:c[1])||"";return a.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[f&&a.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),a.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f})]}),a.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:a.jsx("code",{children:i})})]})}return a.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-[12.5px] font-mono-code text-cc-fg/80 border border-cc-border/40",children:i})},pre:({children:n})=>a.jsx(a.Fragment,{children:n}),table:({children:n})=>a.jsx("div",{className:"overflow-x-auto my-2",children:a.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>a.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>a.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>a.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&a.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function MM({block:e,toolUseById:t}){if(e.type==="text")return a.jsx(yg,{text:e.text});if(e.type==="thinking")return a.jsx(Cw,{text:e.thinking});if(e.type==="tool_use")return a.jsx(l5,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),l=i==null?void 0:i.name,c=e.is_error??!1;return l==="Bash"?a.jsx(RM,{text:n,isError:c}):a.jsx("div",{className:"rounded-lg bg-cc-code-bg overflow-hidden",children:a.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${c?"text-cc-error":"text-cc-code-fg/60"}`,children:n})})}return null}function RM({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[l,c]=j.useState(!1),u=l||!i?e:n.slice(-20).join(`
95
+ `);return a.jsxs("div",{className:"rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:u}),i&&a.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[a.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:l?`${n.length} lines`:`last 20 of ${n.length}`}),a.jsx("button",{onClick:()=>c(!l),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:l?"Show tail":"Show all"})]})]})}function LM({name:e,items:t}){const[n,i]=j.useState(!1),l=tc(e),c=ps(e);return a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(Ka,{type:l}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:c}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=Ho(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function Cw({text:e}){const t=e.trim(),[n,i]=j.useState(!1),l=t.split(`
96
+ `),c=l.length>8||t.length>600,u=c&&!n?l.slice(0,8).join(`
97
+ `):t;return a.jsxs("div",{children:[a.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:a.jsx(mg,{remarkPlugins:[bg],components:{p:({children:f})=>a.jsx("p",{className:"mb-2 last:mb-0",children:f}),ul:({children:f})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:f}),ol:({children:f})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:f}),li:({children:f})=>a.jsx("li",{children:f}),code:({children:f})=>a.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:f})},children:u||"No thinking text captured."})}),c&&!n&&a.jsx("button",{onClick:()=>i(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function Ao(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function DM(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function By(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":zM(t):"N/A"}catch{return"N/A"}}function Uy(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4);return i>0?`${i}d ${l}h`:l>0?`${l}h${c}m`:`${c}m`}function Py(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function zM(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function OM({tools:e}){return e.length===0?null:a.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[a.jsx(Ka,{type:tc(t.toolName)}),a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),a.jsx("span",{className:"text-cc-fg/70",children:ps(t.toolName)}),a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function BM({entries:e}){const[t,n]=j.useState(!1),i=j.useMemo(()=>{const l=e.reduce((h,p)=>h+p.elapsedSeconds,0),c=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:l,maxTime:c,errorCount:u,running:f}},[e]);return e.length===0?null:a.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&a.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(l=>a.jsx("span",{className:`h-full rounded-full ${l.isError?"bg-cc-error/40":l.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,l.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${ps(l.toolName)} ${l.elapsedSeconds}s`},l.toolUseId))})]}),t&&a.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(l=>a.jsx(UM,{entry:l,maxTime:i.maxTime},l.toolUseId))})]})}function UM({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),a.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[a.jsx(Ka,{type:tc(e.toolName)}),a.jsx("span",{className:"text-cc-fg/70 truncate",children:ps(e.toolName)})]}),a.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:a.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),a.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&a.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const Fu=100,PM=40,$M=120,Lp=new Map,FM=[],HM=[];function IM(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function qM(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function $y(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function VM(e){return e.kind==="message"?(e.msg.contentBlocks||[]).filter(n=>n.type==="tool_use").filter(n=>n.name==="Task").map(n=>n.id):e.kind==="tool_msg_group"&&e.toolName==="Task"?e.items.map(t=>t.id):[]}function Ew(e){const t=[];for(const n of e){const i=qM(n);if(i){const l=t[t.length-1];if((l==null?void 0:l.kind)==="tool_msg_group"&&l.toolName===i){l.items.push(...$y(n));continue}t.push({kind:"tool_msg_group",toolName:i,items:$y(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function Tw(e,t,n){const i=Ew(e),l=[];for(const c of i){l.push(c);const u=VM(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},g=Tw(h,t,n);l.push({kind:"subagent",taskToolUseId:f,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:g})}}}return l}function GM(e){const t=new Map;for(const l of e)if(l.contentBlocks){for(const c of l.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:f}=c,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(y=>typeof y=="string"&&y.length>0):void 0,p=h&&h.length>0?h.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||p!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:v?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:g,receiverThreadIds:h})}}if(t.size===0)return Ew(e);const n=new Map,i=[];for(const l of e)if(l.parentToolUseId&&t.has(l.parentToolUseId)){let c=n.get(l.parentToolUseId);c||(c=[],n.set(l.parentToolUseId,c)),c.push(l)}else i.push(l);return Tw(i,t,n)}function XM({group:e}){const[t,n]=j.useState(!1),i=tc(e.toolName),l=ps(e.toolName),c=e.items.length;if(c===1){const u=e.items[0];return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Fy,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(Ka,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:Ho(u.name,u.input)})]}),t&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:a.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Fy,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(Ka,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:c})]}),t&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=Ho(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function Aw({entries:e,toolActivity:t}){return a.jsx(a.Fragment,{children:e.map((n,i)=>{if(n.kind==="tool_msg_group")return a.jsx(XM,{group:n},n.firstId||i);if(n.kind==="subagent")return a.jsx(QM,{group:n},n.taskToolUseId);const l=n.msg,c=YM(l),u=t&&c.length>0?t.filter(h=>c.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return a.jsxs("div",{children:[a.jsx(CM,{message:l}),f&&a.jsx(BM,{entries:u})]},l.id)})})}function YM(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function WM(e){if(!e)return null;const t=e.trim().toLowerCase();return t?t==="completed"?{label:"completed",summaryLabel:"completed",className:"text-green-600 bg-green-500/15"}:t==="failed"||t==="error"||t==="errored"?{label:"failed",summaryLabel:"failed",className:"text-cc-error bg-cc-error/10"}:t==="pending"||t==="pendinginit"||t==="pending_init"?{label:"pending",summaryLabel:"pending",className:"text-amber-700 bg-amber-500/15"}:t==="running"||t==="inprogress"||t==="in_progress"||t==="started"?{label:"running",summaryLabel:"running",className:"text-blue-600 bg-blue-500/15"}:{label:e,summaryLabel:"running",className:"text-amber-700 bg-amber-500/15"}:null}function QM({group:e}){const[t,n]=j.useState(!1),i=e.description||"Subagent",l=e.agentType,c=e.children.length,u=WM(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",v=e.children[e.children.length-1],y=j.useMemo(()=>{var b,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${ps(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const k=(b=v.msg.content)==null?void 0:b.trim();if(k)return k.length>60?k.slice(0,60)+"...":k;const E=(_=v.msg.contentBlocks)==null?void 0:_.find(S=>S.type==="tool_use");if(E)return ps(E.name)}return""},[v]);return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[a.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),l&&a.jsx("span",{className:"text-[10px] text-cc-muted/50",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&a.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&a.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&y&&a.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:y}),a.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&a.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&a.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&a.jsxs("span",{children:["receivers: ",p.map(b=>a.jsx("span",{className:"font-mono-code ml-1",children:b},b))]})]}),a.jsx(Aw,{entries:e.children})]})]})})}function Fy(){return a.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function KM({sessionId:e}){const t=Y(ce=>ce.messages.get(e)??FM),n=Y(ce=>(ce.sdkSessions||HM).find(je=>je.sessionId===e)),i=Y(ce=>ce.streamingStartedAt.get(e)),l=Y(ce=>ce.streamingOutputTokens.get(e)),c=Y(ce=>ce.sessionStatus.get(e)),u=Y(ce=>ce.toolProgress.get(e)),f=Y(ce=>ce.toolActivity.get(e)),h=j.useRef(null),p=j.useRef(null),g=j.useRef(!0),[v,y]=j.useState(0),[b,_]=j.useState(Fu),[k,E]=j.useState([]),[S,M]=j.useState(0),[C,$]=j.useState(!1),[L,T]=j.useState(!1),[H,z]=j.useState(!1),[G,O]=j.useState(""),I=j.useRef(new Set),R=Y(ce=>ce.chatTabReentryTickBySession.get(e)??0),oe=j.useMemo(()=>t.some(ce=>ce.role==="assistant"&&ce.isStreaming),[t]),J=j.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),X=J.length>0,B=n!=null&&n.forkSession?"Forked from":"Continuing from",U=j.useMemo(()=>{if(k.length===0)return t;const ce=[],je=new Set;for(const Fe of k)je.has(Fe.id)||(je.add(Fe.id),ce.push(Fe));for(const Fe of t)je.has(Fe.id)||(je.add(Fe.id),ce.push(Fe));return ce},[k,t]),Z=j.useMemo(()=>GM(U),[U]);j.useEffect(()=>{_(Fu),E([]),M(0),$(!1),T(!1),z(!1),O(""),I.current=new Set},[e,J]);const me=Z.length,D=me>b,P=D?Z.slice(me-b):Z,Q=me-P.length,A=j.useCallback(()=>{const ce=p.current,je=(ce==null?void 0:ce.scrollHeight)??0;_(Fe=>Fe+Fu),requestAnimationFrame(()=>{if(ce){const Fe=ce.scrollHeight;ce.scrollTop+=Fe-je}})},[]),pe=j.useCallback(async(ce={})=>{if(!X||!J||H)return;const je=p.current,Fe=(je==null?void 0:je.scrollHeight)??0,At=L?S:0;z(!0),O("");try{const Ke=await we.getClaudeSessionHistory(J,{cursor:At,limit:PM}),pt=Ke.messages.map(qe=>({id:qe.id,role:qe.role,content:qe.content,contentBlocks:qe.role==="assistant"?qe.contentBlocks:void 0,timestamp:qe.timestamp||Date.now(),model:qe.role==="assistant"?qe.model:void 0,stopReason:qe.role==="assistant"?qe.stopReason:void 0})),vt=[];for(const qe of pt)I.current.has(qe.id)||(I.current.add(qe.id),vt.push(qe));E(qe=>[...vt,...qe]),M(Ke.nextCursor),$(Ke.hasMore),T(!0),vt.length>0&&_(qe=>qe+vt.length),ce.preserveScroll!==!1&&je&&requestAnimationFrame(()=>{const qe=je.scrollHeight;je.scrollTop+=qe-Fe})}catch(Ke){const pt=Ke instanceof Error?Ke.message:String(Ke);O(pt||"Failed to load previous history"),L||(E([]),M(0),$(!1))}finally{z(!1)}},[X,J,H,L,S]);j.useEffect(()=>{if(!i&&c!=="running"){y(0);return}const ce=i||Date.now();y(Date.now()-ce);const je=setInterval(()=>y(Date.now()-ce),1e3);return()=>clearInterval(je)},[i,c]);function _e(){const ce=p.current;if(!ce)return;g.current=ce.scrollHeight-ce.scrollTop-ce.clientHeight<120;const je=Math.max(0,ce.scrollHeight-ce.clientHeight-ce.scrollTop);Lp.set(e,je),X&&L&&C&&!H&&ce.scrollTop<=$M&&pe({preserveScroll:!0})}const ke=j.useCallback(()=>{const ce=p.current;if(!ce)return;const je=ce.style.scrollBehavior;ce.style.scrollBehavior="auto",ce.scrollTop=ce.scrollHeight,ce.style.scrollBehavior=je},[]),ze=j.useCallback(()=>{const ce=p.current;if(!ce)return;const je=ce.style.scrollBehavior;ce.style.scrollBehavior="auto";const Fe=Lp.get(e);typeof Fe=="number"?ce.scrollTop=Math.max(0,ce.scrollHeight-ce.clientHeight-Fe):ce.scrollTop=ce.scrollHeight,ce.style.scrollBehavior=je},[e]);return j.useEffect(()=>{requestAnimationFrame(()=>ze())},[e,ze]),j.useEffect(()=>()=>{const ce=p.current;if(!ce)return;const je=Math.max(0,ce.scrollHeight-ce.clientHeight-ce.scrollTop);Lp.set(e,je)},[e]),j.useEffect(()=>{R&&requestAnimationFrame(()=>ke())},[R,ke]),j.useEffect(()=>{var ce;g.current&&((ce=h.current)==null||ce.scrollIntoView({behavior:"smooth"}))},[t]),U.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[a.jsx("polyline",{points:"4 17 10 11 4 5"}),a.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),a.jsx("div",{className:"text-center max-w-xs",children:X?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),a.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[B," ",a.jsx("span",{className:"font-mono-code text-cc-fg/70",children:J.slice(0,8)}),". Load earlier messages when needed."]}),a.jsxs("button",{onClick:()=>void pe({preserveScroll:!1}),disabled:H,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),H?"Loading...":"Load previous history"]}),G&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:G})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]}):a.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[a.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),a.jsx("div",{ref:p,onScroll:_e,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:a.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[X&&!L&&a.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[B," existing Claude thread"]}),a.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[J," ",n!=null&&n.cwd?`· ${IM(n.cwd)}`:""]})]}),a.jsx("button",{onClick:()=>void pe({preserveScroll:!0}),disabled:H,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:H?"Loading...":"Load previous history"})]}),G&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:G})]}),X&&L&&a.jsx("div",{className:"flex justify-center",children:a.jsx("p",{className:"text-[11px] text-cc-muted",children:C?H?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),D&&a.jsx("div",{className:"flex justify-center pb-3",children:a.jsxs("button",{onClick:A,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(Fu,Q)," more",a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Q," hidden)"]})]})}),a.jsx(Aw,{entries:P,toolActivity:f}),u&&u.size>0&&!oe&&a.jsx(OM,{tools:Array.from(u.values())}),c==="compacting"&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),a.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),a.jsx("span",{children:"Compacting context..."})]}),c==="running"&&v>0&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-muted font-mono-code pl-10 stats-glow py-1",children:[a.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsx("span",{className:"tabular-nums",children:DM(v)}),(l??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:[Ao(l)," tokens"]})]})]}),a.jsx("div",{ref:h})]})})]})}const ZM={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function JM(e,t){for(const[i,l]of Object.entries(ZM))if(e.includes(i))return l;const n=["◆","●","◕","✦"];return n[t%n.length]}function e8(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:JM(t.value,n)}))}const Mw=[{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-4-6",label:"Sonnet 4.6",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],Rw=[{value:"gpt-5.3-codex-max",label:"GPT-5.3 Max",icon:"■"},{value:"gpt-5.3-codex-xhigh",label:"GPT-5.3 xHigh",icon:"★"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"✳"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex",icon:"◆"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Max",icon:"■"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"},{value:"gpt-5.1-codex-mini",label:"GPT-5.1 Mini",icon:"⚡"}],_g=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],wg=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],Lw=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],Dw=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function zw(e){return e==="codex"?Rw:Mw}function Hy(e){return e==="codex"?wg:_g}function nR(e){return e==="codex"?Dw:Lw}function Iy(e){return e==="codex"?Rw[0].value:Mw[0].value}function qy(e){return e==="codex"?wg[0].value:_g[0].value}function rR(e){return e==="codex"?Dw[0].value:Lw[0].value}function Vy({sessionId:e}){const[t,n]=j.useState(!1),i=j.useRef(null),l=Y(y=>y.sdkSessions.find(b=>b.sessionId===e)||null),c=Y(y=>y.sessions.get(e)),u=Y(y=>y.cliConnected.get(e)??!1),f=(l==null?void 0:l.backendType)??(c==null?void 0:c.backend_type)??"claude",h=(c==null?void 0:c.model)??(l==null?void 0:l.model)??"",p=zw(f),g=p.find(y=>y.value===h)||(h?{label:h,icon:"?"}:null),v=j.useCallback(y=>{if(n(!1),y===h)return;Ln(e,{type:"set_model",model:y});const{sdkSessions:b,setSdkSessions:_}=Y.getState();_(b.map(k=>k.sessionId===e?{...k,model:y}:k))},[e,h]);return j.useEffect(()=>{if(!t)return;const y=b=>{i.current&&!i.current.contains(b.target)&&n(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[t]),j.useEffect(()=>{if(!t)return;const y=b=>{b.key==="Escape"&&n(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t]),f==="codex"||!u||!g?null:a.jsxs("div",{ref:i,className:"relative shrink-0",children:[a.jsxs("button",{onClick:()=>n(y=>!y),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&a.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),a.jsx("span",{children:g.label}),a.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:a.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&a.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(y=>a.jsxs("button",{onClick:()=>v(y.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${y.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":y.value===h,children:[y.icon&&a.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:y.icon}),a.jsx("span",{className:"flex-1 text-left",children:y.label}),y.value===h&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},y.value))})]})}function Ow({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:l,menuRef:c,className:u=""}){return e?a.jsx("div",{ref:c,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>a.jsxs("button",{"data-prompt-index":h,onClick:()=>l(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),a.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function Bw({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[l,c]=j.useState(!1),[u,f]=j.useState(0),[h,p]=j.useState([]),[g,v]=j.useState(!1),y=j.useRef(null),b=j.useCallback(async()=>{v(!0);try{const S=await we.listPrompts(n);p(S.filter(M=>!!M.name.trim()))}catch{p([])}finally{v(!1)}},[n]);j.useEffect(()=>{b()},[b]);const _=j.useMemo(()=>{const S=e.slice(0,t),M=S.match(/(^|\s)@([^\s@]*)$/);if(!M||M.index===void 0)return null;const C=S.length-M[0].length+M[1].length;return{query:M[2]||"",start:C,end:t}},[e,t]),k=j.useMemo(()=>{if(!l||!_)return[];const S=_.query.toLowerCase();if(!S)return h;const M=h.filter($=>$.name.toLowerCase().startsWith(S)),C=h.filter($=>!$.name.toLowerCase().startsWith(S)&&$.name.toLowerCase().includes(S));return[...M,...C]},[l,_,h]);j.useEffect(()=>{const S=i&&!!_;S&&!l?(c(!0),f(0)):!S&&l&&c(!1)},[i,_,l]),j.useEffect(()=>{u>=k.length&&f(Math.max(0,k.length-1))},[k.length,u]),j.useEffect(()=>{if(!y.current||!l)return;const M=y.current.querySelectorAll("[data-prompt-index]")[u];M&&M.scrollIntoView({block:"nearest"})},[u,l]);const E=j.useCallback(S=>{if(!_)return{nextText:e,nextCursor:t};const M=`${S.content} `,C=`${e.slice(0,_.start)}${M}${e.slice(_.end)}`,$=_.start+M.length;return{nextText:C,nextCursor:$}},[_,e,t]);return{mentionMenuOpen:l,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:k,promptsLoading:g,savedPrompts:h,selectPrompt:E,refreshPrompts:b,mentionMenuRef:y}}function _d(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const c=i.result.split(",")[1];t({base64:c,mediaType:e.type})},i.onerror=n,i.readAsDataURL(e)})}const t8=[];function n8({sessionId:e}){var pn,dn;const[t,n]=j.useState(""),[i,l]=j.useState([]),[c,u]=j.useState(!1),[f,h]=j.useState(0),[p,g]=j.useState(!1),[v,y]=j.useState(""),[b,_]=j.useState("global"),[k,E]=j.useState(null),[S,M]=j.useState(0),C=j.useRef(null),$=j.useRef(null),L=j.useRef(null),T=j.useRef(null),H=Y(se=>se.cliConnected),z=Y(se=>se.sessions.get(e)),G=Y(se=>se.previousPermissionMode.get(e)||"acceptEdits"),O=H.get(e)??!1,I=(z==null?void 0:z.permissionMode)||"acceptEdits",R=I==="plan",oe=(z==null?void 0:z.backend_type)==="codex",X=((dn=(pn=(oe?wg:_g).find(se=>se.value===I))==null?void 0:pn.label)==null?void 0:dn.toLowerCase())||I,B=Bw({text:t,caretPos:S,cwd:z==null?void 0:z.cwd,enabled:!c}),U=j.useMemo(()=>{const se=[];if(z!=null&&z.slash_commands)for(const Ce of z.slash_commands)se.push({name:Ce,type:"command"});if(z!=null&&z.skills)for(const Ce of z.skills)se.push({name:Ce,type:"skill"});return se},[z==null?void 0:z.slash_commands,z==null?void 0:z.skills]),Z=j.useMemo(()=>{if(!c)return[];const se=t.match(/^\/(\S*)$/);if(!se)return[];const Ce=se[1].toLowerCase();return Ce===""?U:U.filter(fe=>fe.name.toLowerCase().includes(Ce))},[t,c,U]);j.useEffect(()=>{const se=t.startsWith("/")&&/^\/\S*$/.test(t)&&U.length>0;se&&!c?(u(!0),h(0)):!se&&c&&u(!1)},[t,U.length,c]),j.useEffect(()=>{f>=Z.length&&h(Math.max(0,Z.length-1))},[Z.length,f]),j.useEffect(()=>{if(!L.current||!c)return;const Ce=L.current.querySelectorAll("[data-cmd-index]")[f];Ce&&Ce.scrollIntoView({block:"nearest"})},[f,c]),j.useEffect(()=>{if(T.current===null||!C.current)return;const se=T.current;C.current.setSelectionRange(se,se),T.current=null},[t]);const me=j.useCallback(se=>{var Ce;n(`/${se.name} `),u(!1),(Ce=C.current)==null||Ce.focus()},[]),D=j.useCallback(se=>{var fe;const Ce=B.selectPrompt(se);T.current=Ce.nextCursor,n(Ce.nextText),B.setMentionMenuOpen(!1),M(Ce.nextCursor),(fe=C.current)==null||fe.focus(),C.current&&(C.current.style.height="auto",C.current.style.height=Math.min(C.current.scrollHeight,200)+"px")},[B]);function P(){var fe;const se=t.trim();if(!se||!O)return;const Ce=Fp();Ln(e,{type:"user_message",content:se,session_id:e,images:i.length>0?i.map(Se=>({media_type:Se.mediaType,data:Se.base64})):void 0,client_msg_id:Ce}),Y.getState().appendMessage(e,{id:Ce,role:"user",content:se,images:i.length>0?i.map(Se=>({media_type:Se.mediaType,data:Se.base64})):void 0,timestamp:Date.now()}),n(""),l([]),u(!1),B.setMentionMenuOpen(!1),C.current&&(C.current.style.height="auto"),(fe=C.current)==null||fe.focus()}function Q(se){if(c&&Z.length>0){if(se.key==="ArrowDown"){se.preventDefault(),h(Ce=>(Ce+1)%Z.length);return}if(se.key==="ArrowUp"){se.preventDefault(),h(Ce=>(Ce-1+Z.length)%Z.length);return}if(se.key==="Tab"&&!se.shiftKey){se.preventDefault(),me(Z[f]);return}if(se.key==="Enter"&&!se.shiftKey){se.preventDefault(),me(Z[f]);return}if(se.key==="Escape"){se.preventDefault(),u(!1);return}}if(B.mentionMenuOpen&&se.key==="Escape"){se.preventDefault(),B.setMentionMenuOpen(!1);return}if(B.mentionMenuOpen&&B.filteredPrompts.length>0){if(se.key==="ArrowDown"){se.preventDefault(),B.setMentionMenuIndex(Ce=>(Ce+1)%B.filteredPrompts.length);return}if(se.key==="ArrowUp"){se.preventDefault(),B.setMentionMenuIndex(Ce=>(Ce-1+B.filteredPrompts.length)%B.filteredPrompts.length);return}if(se.key==="Tab"&&!se.shiftKey||se.key==="Enter"&&!se.shiftKey){se.preventDefault(),D(B.filteredPrompts[B.mentionMenuIndex]);return}}if(B.mentionMenuOpen&&B.filteredPrompts.length===0&&(se.key==="Enter"&&!se.shiftKey||se.key==="Tab"&&!se.shiftKey)){se.preventDefault();return}if(se.key==="Tab"&&se.shiftKey){se.preventDefault(),je();return}se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),P())}function A(se){n(se.target.value),M(se.target.selectionStart??se.target.value.length);const Ce=se.target;Ce.style.height="auto",Ce.style.height=Math.min(Ce.scrollHeight,200)+"px"}function pe(){C.current&&M(C.current.selectionStart??0)}function _e(){Ln(e,{type:"interrupt"})}async function ke(se){const Ce=se.target.files;if(!Ce)return;const fe=[];for(const Se of Array.from(Ce)){if(!Se.type.startsWith("image/"))continue;const{base64:Ze,mediaType:Be}=await _d(Se);fe.push({name:Se.name,base64:Ze,mediaType:Be})}l(Se=>[...Se,...fe]),se.target.value=""}function ze(se){l(Ce=>Ce.filter((fe,Se)=>Se!==se))}async function ce(se){var Se;const Ce=(Se=se.clipboardData)==null?void 0:Se.items;if(!Ce)return;const fe=[];for(const Ze of Array.from(Ce)){if(!Ze.type.startsWith("image/"))continue;const Be=Ze.getAsFile();if(!Be)continue;const{base64:mn,mediaType:ae}=await _d(Be);fe.push({name:`pasted-${Date.now()}.${Be.type.split("/")[1]}`,base64:mn,mediaType:ae})}fe.length>0&&(se.preventDefault(),l(Ze=>[...Ze,...fe]))}function je(){if(!O)return;const se=Y.getState();if(!R)se.setPreviousPermissionMode(e,I),Ln(e,{type:"set_permission_mode",mode:"plan"}),se.updateSession(e,{permissionMode:"plan"});else{const Ce=G||(oe?"bypassPermissions":"acceptEdits");Ln(e,{type:"set_permission_mode",mode:Ce}),se.updateSession(e,{permissionMode:Ce})}}async function Fe(){const se=t.trim(),Ce=v.trim();if(!se||!Ce)return;if(b==="project"&&!(z!=null&&z.cwd)){E("No project folder available for this session");return}const fe={name:Ce,content:se,scope:b};b==="project"&&(fe.projectPaths=[z.cwd]);try{await we.createPrompt(fe),await B.refreshPrompts(),g(!1),y(""),_("global"),E(null)}catch(Se){const Ze=Se instanceof Error&&Se.message?Se.message:"Could not save prompt.";E(Ze)}}const Ke=Y(se=>se.promptSuggestions.get(e))??t8,pt=Y(se=>se.clearPromptSuggestions),qe=Y(se=>se.sessionStatus).get(e)==="running",bt=t.trim().length>0&&O;return a.jsx("div",{className:"shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent",children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[i.length>0&&a.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((se,Ce)=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:`data:${se.mediaType};base64,${se.base64}`,alt:se.name,className:"w-12 h-12 rounded-lg object-cover border border-cc-border"}),a.jsx("button",{onClick:()=>ze(Ce),"aria-label":"Remove image",className:"absolute -top-1.5 -right-1.5 w-6 h-6 rounded-full bg-cc-error text-white flex items-center justify-center text-[10px] opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]},Ce))}),a.jsx("input",{ref:$,type:"file",accept:"image/*",multiple:!0,onChange:ke,className:"hidden","aria-label":"Attach images"}),Ke.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:Ke.map((se,Ce)=>a.jsx("button",{onClick:()=>{if(!O||qe)return;const fe=Fp();Ln(e,{type:"user_message",content:se,session_id:e,client_msg_id:fe}),Y.getState().appendMessage(e,{id:fe,role:"user",content:se,timestamp:Date.now()}),pt(e)},disabled:!O||qe,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:se,children:se},Ce))}),a.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${R?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[c&&Z.length>0&&a.jsx("div",{ref:L,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:Z.map((se,Ce)=>a.jsxs("button",{"data-cmd-index":Ce,onClick:()=>me(se),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${Ce===f?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:se.type==="skill"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",se.name]}),a.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:se.type})]})]},`${se.type}-${se.name}`))}),a.jsx(Ow,{open:B.mentionMenuOpen,loading:B.promptsLoading,prompts:B.filteredPrompts,selectedIndex:B.mentionMenuIndex,onSelect:D,menuRef:B.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),p&&a.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),a.jsx("input",{value:v,onChange:se=>{y(se.target.value),k&&E(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","aria-pressed":b==="global",onClick:()=>_("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${b==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),a.jsx("button",{type:"button","aria-pressed":b==="project",onClick:()=>_("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${b==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),b==="project"&&(z==null?void 0:z.cwd)&&a.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:z.cwd,children:z.cwd}),k?a.jsx("div",{className:"text-[11px] text-cc-error",children:k}):null,a.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[a.jsx("button",{onClick:()=>{g(!1),_("global"),E(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:Fe,disabled:!v.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${v.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[a.jsxs("button",{onClick:je,disabled:!O,className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${O?R?"text-cc-primary border-cc-primary/30 bg-cc-primary/8":"text-cc-muted border-cc-border":"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[R?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),a.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),a.jsx("span",{children:X})]}),a.jsx(Vy,{sessionId:e}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{const se=t.trim().slice(0,32);y(se||""),E(null),g(Ce=>!Ce)},disabled:!O||!t.trim(),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${O&&t.trim()?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:"Save as prompt",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}),a.jsx("button",{onClick:()=>{var se;return(se=$.current)==null?void 0:se.click()},disabled:!O,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${O?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:"Upload image",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:[a.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),a.jsx("circle",{cx:"5.5",cy:"5.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M2 11l3-3 2 2 3-4 4 5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}),a.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:a.jsx("textarea",{ref:C,value:t,onChange:A,onKeyDown:Q,onClick:pe,onKeyUp:pe,onPaste:ce,"aria-label":"Message input",placeholder:O?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!O,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),a.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:qe?a.jsx("button",{onClick:_e,className:"flex items-center justify-center w-10 h-10 rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer",title:"Stop generation",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):a.jsx("button",{onClick:P,disabled:!bt,className:`flex items-center justify-center w-10 h-10 rounded-full transition-all duration-200 ${bt?"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}),a.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[a.jsx("button",{onClick:()=>{var se;return(se=$.current)==null?void 0:se.click()},disabled:!O,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${O?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:"Attach image",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx("button",{onClick:()=>{const se=t.trim().slice(0,32);y(se||""),E(null),g(Ce=>!Ce)},disabled:!O||!t.trim(),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${O&&t.trim()?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:"Save as prompt",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}),a.jsxs("button",{onClick:je,disabled:!O,className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${O?R?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[R?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),a.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),a.jsx("span",{children:X})]}),a.jsx("div",{className:"flex-1"}),a.jsx(Vy,{sessionId:e}),qe?a.jsx("button",{onClick:_e,className:"flex items-center justify-center w-9 h-9 rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer",title:"Stop generation",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):a.jsx("button",{onClick:P,disabled:!bt,className:`flex items-center justify-center w-9 h-9 rounded-full transition-all duration-200 ${bt?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]})]})})}function r8(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function i8({permission:e,sessionId:t}){const[n,i]=j.useState(!1),l=Y(p=>p.removePermission);function c(p,g){i(!0),Ln(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),l(t,e.request_id)}function u(){i(!0),Ln(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),l(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return a.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:a.jsx("div",{className:"max-w-3xl mx-auto",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:a.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:a.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&a.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&a.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?a.jsx(c8,{input:e.input,onSelect:p=>c({...e.input,answers:p}),disabled:n}):a.jsx(l8,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&a.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&a.jsx(a8,{validation:e.ai_validation}),!f&&a.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>c(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,g)=>a.jsxs("button",{onClick:()=>c(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),r8(p)]},g)),a.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function s8(e){return[/^Invalid Anthropic/i,/^Anthropic .*(rate limit|overloaded|unavailable|error|lacks permission)/i,/^AI service/i,/^AI evaluation timed out/i,/^Model not found/i,/^No Anthropic API key/i].some(n=>n.test(e))}function a8({validation:e}){const t=e.verdict==="uncertain"&&s8(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return a.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),a.jsx("span",{className:"font-medium",children:i}),a.jsx("span",{children:e.reason})]})}function l8({toolName:e,input:t,description:n}){return e==="Bash"?a.jsx(o8,{input:t}):e==="Edit"?a.jsx(u8,{input:t}):e==="Write"?a.jsx(d8,{input:t}):e==="Read"?a.jsx(f8,{input:t}):e==="Glob"?a.jsx(h8,{input:t}):e==="Grep"?a.jsx(p8,{input:t}):e==="ExitPlanMode"?a.jsx(m8,{input:t}):a.jsx(Uw,{input:t,description:n})}function o8({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsx("div",{className:"text-xs text-cc-muted",children:n}),a.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function c8({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[l,c]=j.useState({}),[u,f]=j.useState({}),[h,p]=j.useState({});function g(k,E){const S=String(k);c(M=>({...M,[S]:E})),p(M=>({...M,[S]:!1})),i.length<=1&&t({[S]:E})}function v(k){var M;const E=String(k),S=(M=u[E])==null?void 0:M.trim();S&&(c(C=>({...C,[E]:S})),i.length<=1&&t({[E]:S}))}function y(k,E){const S=String(k);f(C=>({...C,[S]:E}));const M=E.trim();c(C=>{if(!M){const $={...C};return delete $[S],$}return{...C,[S]:M}})}function b(k){const E=String(k);p(S=>{const M=!!S[E],C={...S,[E]:!M};return M&&(c($=>{const L={...$};return delete L[E],L}),f($=>{const L={...$};return delete L[E],L})),C})}function _(){t(l)}if(i.length===0){const k=typeof e.question=="string"?e.question:"";return k?a.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:k}):a.jsx(Uw,{input:e})}return a.jsxs("div",{className:"space-y-3",children:[i.map((k,E)=>{const S=typeof k.header=="string"?k.header:"",M=typeof k.question=="string"?k.question:"",C=Array.isArray(k.options)?k.options:[],$=String(E),L=l[$],T=h[$];return a.jsxs("div",{className:"space-y-2",children:[S&&a.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:S}),M&&a.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:M}),C.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[C.map((H,z)=>{const G=typeof H.label=="string"?H.label:String(H),O=typeof H.description=="string"?H.description:"",I=L===G;return a.jsx("button",{onClick:()=>g(E,G),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${I?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${I?"border-cc-primary":"border-cc-muted/40"}`,children:I&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:G}),O&&a.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:O})]})]})},z)}),a.jsx("button",{onClick:()=>b(E),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${T?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${T?"border-cc-primary":"border-cc-muted/40"}`,children:T&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),T&&a.jsxs("div",{className:"pl-6",children:[a.jsx("input",{type:"text",value:u[$]||"",onChange:H=>y(E,H.target.value),onKeyDown:H=>{H.key==="Enter"&&v(E)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&a.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},E)}),i.length>1&&Object.keys(l).length>0&&a.jsx("button",{onClick:_,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function u8({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return a.jsx(il,{oldText:n,newText:i,fileName:t,mode:"compact"})}function d8({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(il,{newText:n,fileName:t,mode:"compact"})}function f8({input:e}){const t=String(e.file_path||"");return a.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function h8({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n})]})}function p8({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n}),i&&a.jsx("div",{className:"text-cc-muted",children:i})]})}function m8({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return a.jsxs("div",{className:"space-y-2",children:[t&&a.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),a.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),a.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:a.jsx(mg,{remarkPlugins:[bg],components:{h1:({children:i})=>a.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>a.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>a.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>a.jsx("li",{children:i}),strong:({children:i})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:l})=>a.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:l}),code:i=>{const{children:l,className:c}=i;return/language-(\w+)/.exec(c||"")||typeof l=="string"&&l.includes(`
98
+ `)?a.jsx("pre",{className:"my-2 px-2.5 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto border border-cc-border",children:a.jsx("code",{children:l})}):a.jsx("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-cc-code-fg font-mono-code text-[12px]",children:l})},pre:({children:i})=>a.jsx(a.Fragment,{children:i}),blockquote:({children:i})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),a.jsx("div",{className:"space-y-1",children:n.map((i,l)=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[a.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),a.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},l))})]}),!t&&n.length===0&&a.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function Uw({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?a.jsx("div",{className:"text-xs text-cc-fg",children:t}):a.jsxs("div",{className:"space-y-1",children:[t&&a.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),a.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,l])=>{const c=typeof l=="string"?l.length>200?l.slice(0,200)+"...":l:JSON.stringify(l);return a.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[a.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),a.jsx("span",{className:"text-cc-fg break-all",children:c})]},i)})})]})}function g8({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:l}=e,c=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const f=n.input.command;u=f.length>60?f.slice(0,60)+"...":f}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return a.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${c?"text-cc-success":"text-cc-error"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),a.jsxs("span",{className:"flex-1",children:["AI auto-",c?"approved":"denied",":"," ",a.jsx("span",{className:"font-mono-code opacity-80",children:u}),l&&a.jsxs("span",{className:"text-cc-muted ml-1",children:["(",l,")"]})]}),t&&a.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const x8=[],v8=[],Gy="activity-tray-panel";function b8(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),l=n%60;return`${i}m${l>0?` ${l}s`:""}`}function y8(e,t,n=4e3){const[i,l]=j.useState(!1),c=j.useRef(void 0),u=e.length+t.length,f=u>0&&e.every(h=>h.status==="completed")&&t.every(h=>h.status!=="running");return j.useEffect(()=>(clearTimeout(c.current),f?c.current=setTimeout(()=>l(!0),n):l(!1),()=>clearTimeout(c.current)),[f,n]),j.useEffect(()=>{l(!1)},[u]),i}function _8(e){const[t,n]=j.useState(0);return j.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(l=>l+1),1e3);return()=>clearInterval(i)},[e]),t}function w8({status:e}){return e==="running"||e==="in_progress"?a.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function j8({agent:e,tick:t}){const[n,i]=j.useState(!1),l=e.status!=="running",c=!!e.summary,u=a.jsxs(a.Fragment,{children:[a.jsx(w8,{status:e.status}),a.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&a.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:b8(e.startedAt,e.completedAt)})]});return a.jsxs("div",{className:`transition-opacity duration-300 ${l?"opacity-60":""}`,children:[c?a.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):a.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&a.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function k8({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[a.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?a.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.jsx("span",{className:`text-[11px] leading-snug flex-1 truncate ${t?"text-cc-muted line-through":"text-cc-fg/80"}`,children:e.subject}),n&&e.activeForm&&a.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function S8({sessionId:e}){const[t,n]=j.useState(!1),i=j.useRef(null),l=j.useRef(null),c=Y(C=>C.sessionTasks.get(e)??x8),u=Y(C=>C.sessionBackgroundAgents.get(e)??v8),f=y8(c,u),h=u.some(C=>C.status==="running"),p=_8(h),g=u.filter(C=>C.status==="running").length,v=c.length,y=c.filter(C=>C.status==="completed").length,b=c.filter(C=>C.status==="in_progress").length,_=c.length>0||u.length>0,k=g>0||b>0,E=j.useCallback(()=>n(!1),[]);j.useEffect(()=>{if(!t)return;const C=$=>{$.key==="Escape"&&($.stopPropagation(),E())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,E]),j.useEffect(()=>{if(!t)return;const C=$=>{i.current&&!i.current.contains($.target)&&E()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,E]),j.useEffect(()=>{t&&l.current&&l.current.focus()},[t]);const[S,M]=j.useState(!1);return j.useEffect(()=>{_&&M(!1)},[_,c.length,u.length]),!_||S?null:a.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,style:f?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{f&&M(!0)},children:[t&&a.jsxs("div",{ref:l,id:Gy,role:"dialog","aria-label":"Activity panel",tabIndex:-1,className:"mb-1.5 w-72 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto rounded-xl border border-cc-border/60 bg-cc-surface/95 backdrop-blur-xl shadow-lg shadow-black/20 outline-none",style:{animation:"fadeSlideIn 0.2s ease-out"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),a.jsx("button",{type:"button",onClick:E,className:"flex items-center justify-center w-7 h-7 -mr-1 rounded-md text-cc-muted/40 hover:text-cc-muted/70 hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-label":"Close activity tray",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),u.length>0&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(C=>a.jsx(j8,{agent:C,tick:p},C.toolUseId))]}),u.length>0&&c.length>0&&a.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),c.length>0&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),c.map(C=>a.jsx(k8,{task:C},C.id))]})]}),a.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":Gy,className:`
99
+ flex items-center gap-2 px-3 min-h-[36px] rounded-full
100
+ border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
101
+ shadow-md shadow-black/15
102
+ hover:bg-cc-hover/80 hover:border-cc-border/70
103
+ transition-all duration-200 cursor-pointer
104
+ ${t?"ring-1 ring-cc-primary/30":""}
105
+ `,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[k?a.jsxs("span",{className:"relative flex h-2 w-2",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):a.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&a.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function N8({sessionId:e}){const t=Y(_=>_.pendingPermissions.get(e)),n=Y(_=>_.aiResolvedPermissions.get(e)),i=Y(_=>_.clearAiResolvedPermissions),l=Y(_=>_.connectionStatus.get(e)??"disconnected"),c=Y(_=>_.cliConnected.get(e)??!1),u=Y(_=>_.cliReconnecting.get(e)??!1),f=Y(_=>_.setCliReconnecting),[h,p]=j.useState(null),g=j.useRef(void 0);j.useEffect(()=>{p(null),clearTimeout(g.current)},[e,c]),j.useEffect(()=>()=>clearTimeout(g.current),[]);const v=j.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await we.relaunchSession(e)}catch(_){Vs(_),f(e,!1);const k=_ instanceof Error?_.message:"Reconnection failed";p(k),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=j.useMemo(()=>t?Array.from(t.values()):[],[t]),b=l==="connected"&&!c;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&a.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),a.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),l==="disconnected"&&a.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a.jsx(KM,{sessionId:e}),a.jsx(S8,{sessionId:e})]}),n&&n.length>0&&a.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:a.jsx(g8,{entry:n[n.length-1],onDismiss:()=>i(e)})}),y.length>0&&a.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>a.jsx(i8,{permission:_,sessionId:e},_.request_id))}),a.jsx(n8,{sessionId:e})]})}function C8({sessionId:e}){const[t,n]=j.useState(!1),i=j.useRef(null),l=Y(p=>p.sessions.get(e)),c=(l==null?void 0:l.aiValidationEnabled)??!1,u=(l==null?void 0:l.aiValidationAutoApprove)??!0,f=(l==null?void 0:l.aiValidationAutoDeny)??!1;j.useEffect(()=>{if(!t)return;function p(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};Y.getState().setSessionAiValidation(e,y),LS(e,y)}return a.jsxs("div",{ref:i,className:"relative",children:[a.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[a.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[a.jsx("span",{className:"text-xs",children:"Enabled"}),a.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[a.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),a.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[a.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),a.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function E8(){var H;const e=j.useSyncExternalStore(z=>(window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)),()=>window.location.hash),t=j.useMemo(()=>Zm(e),[e]),n=t.page==="session"||t.page==="home",i=Y(z=>z.currentSessionId),l=Y(z=>z.cliConnected),c=Y(z=>z.sessionStatus),u=Y(z=>z.sessionNames),f=Y(z=>z.sdkSessions),h=Y(z=>z.sidebarOpen),p=Y(z=>z.setSidebarOpen),g=Y(z=>z.taskPanelOpen),v=Y(z=>z.setTaskPanelOpen),y=Y(z=>z.activeTab),b=Y(z=>z.setActiveTab),_=Y(z=>z.markChatTabReentry),k=Y(z=>i?z.gitChangedFilesCount.get(i)??0:0),E=i?c.get(i)??null:null,S=i?l.get(i)??!1:!1,M=i?(u==null?void 0:u.get(i))||((H=f.find(z=>z.sessionId===i))==null?void 0:H.name)||`Session ${i.slice(0,8)}`:null,C=!!(i&&n),$=t.page==="session"&&!!i,L=["chat","diff"],T=z=>{z==="chat"&&y!=="chat"&&i&&_(i),b(z)};return j.useEffect(()=>{const z=G=>{if(!(G.metaKey||G.ctrlKey)||G.key.toLowerCase()!=="j"||!C)return;const O=G.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;G.preventDefault();const I=Math.max(0,L.indexOf(y)),R=G.shiftKey?-1:1,oe=(I+R+L.length)%L.length;T(L[oe])};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[C,L,y,b,_,i]),a.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:a.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[a.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&a.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[a.jsxs("button",{onClick:()=>T("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:M||"Session","aria-label":"Session tab",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S?E==="running"?"bg-cc-primary":E==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),a.jsxs("button",{onClick:()=>T("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",k>0&&a.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:k})]})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&i&&a.jsx(C8,{sessionId:i}),a.jsx(T8,{}),$&&a.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function T8(){const e=Y(n=>n.darkMode),t=j.useCallback(()=>Y.getState().toggleDarkMode(),[]);return a.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:a.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const Pw="cc-recent-dirs";function wd(){try{return JSON.parse(localStorage.getItem(Pw)||"[]")}catch{return[]}}function $w(e){const t=wd().filter(n=>n!==e);t.unshift(e),localStorage.setItem(Pw,JSON.stringify(t.slice(0,5)))}function Fw({onClose:e,embedded:t=!1}){const[n,i]=j.useState([]),[l,c]=j.useState(!0),[u,f]=j.useState(null),[h,p]=j.useState(""),[g,v]=j.useState([]),[y,b]=j.useState(""),[_,k]=j.useState(!1),[E,S]=j.useState(""),[M,C]=j.useState([{key:"",value:""}]),[$,L]=j.useState(!1),T=j.useCallback(()=>{we.listEnvs().then(i).catch(()=>{}).finally(()=>c(!1))},[]);j.useEffect(()=>{T()},[T]);function H(X){f(X.slug),p(X.name);const B=Object.entries(X.variables).map(([U,Z])=>({key:U,value:Z}));B.length===0&&B.push({key:"",value:""}),v(B),b("")}function z(){f(null),b("")}async function G(){if(!u)return;const X={};for(const B of g){const U=B.key.trim();U&&(X[U]=B.value)}try{await we.updateEnv(u,{name:h.trim()||void 0,variables:X}),f(null),b(""),T()}catch(B){b(B instanceof Error?B.message:String(B))}}async function O(X){try{await we.deleteEnv(X),u===X&&f(null),T()}catch(B){b(B instanceof Error?B.message:String(B))}}async function I(){const X=E.trim();if(!X)return;L(!0);const B={};for(const U of M){const Z=U.key.trim();Z&&(B[Z]=U.value)}try{await we.createEnv(X,B),S(""),C([{key:"",value:""}]),k(!1),b(""),T()}catch(U){b(U instanceof Error?U.message:String(U))}finally{L(!1)}}if(t)return a.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:a.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[a.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),a.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:()=>k(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?a.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):a.jsx("path",{d:"M12 5v14M5 12h14"})}),a.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&a.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:E,onChange:X=>S(X.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:X=>{X.key==="Enter"&&E.trim()&&I()}}),a.jsx(Hu,{rows:M,onChange:C}),y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),a.jsxs("div",{className:"flex items-center justify-between pt-1",children:[a.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",a.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),a.jsx("button",{onClick:I,disabled:!E.trim()||$,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${E.trim()&&!$?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:$?"Creating...":"Create"})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:a.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),l?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):a.jsx("div",{className:"space-y-1",children:n.map(X=>{const B=u===X.slug,U=Object.keys(X.variables).length;return B?a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:h,onChange:Z=>p(Z.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(Hu,{rows:g,onChange:v})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:z,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:()=>void G(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},X.slug):a.jsx(A8,{env:X,varCount:U,onStartEdit:()=>H(X),onDelete:()=>void O(X.slug)},X.slug)})}),y&&!_&&a.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const R=a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),a.jsx("input",{type:"text",value:E,onChange:X=>S(X.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:X=>{X.key==="Enter"&&E.trim()&&I()}}),a.jsx(Hu,{rows:M,onChange:C}),a.jsx("button",{onClick:I,disabled:!E.trim()||$,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${E.trim()&&!$?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:$?"Creating...":"Create"})]}),oe=l?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):a.jsx("div",{className:"space-y-3",children:n.map(X=>a.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:X.name}),a.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(X.variables).length," var",Object.keys(X.variables).length!==1?"s":""]}),u===X.slug?a.jsx("button",{onClick:z,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>H(X),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),a.jsx("button",{onClick:()=>O(X.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===X.slug&&a.jsxs("div",{className:"px-3 py-3 space-y-2",children:[a.jsx("input",{type:"text",value:h,onChange:B=>p(B.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(Hu,{rows:g,onChange:v})]})}),a.jsx("button",{onClick:G,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==X.slug&&Object.keys(X.variables).length>0&&a.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(X.variables).map(([B,U])=>a.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[a.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:B}),a.jsx("span",{className:"text-cc-muted",children:"="}),a.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:U})]},B))})]},X.slug))}),J=a.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:X=>X.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&a.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),oe,R]})]});return al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:J}),document.body)}function A8({env:e,varCount:t,onStartEdit:n,onDelete:i}){return a.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[a.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),a.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),a.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),a.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function Hu({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function i(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function l(){t([...e,{key:"",value:""}])}return a.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:c.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),a.jsx("input",{type:"text",value:c.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),a.jsx("button",{onClick:l,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const M8=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:Fw},Symbol.toStringTag,{value:"Module"}));function R8(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const l of t)i+="/"+l,n.push({label:l,path:i});return n}function L8({initialPath:e,onSelect:t,onClose:n}){const[i,l]=j.useState(""),[c,u]=j.useState([]),[f,h]=j.useState(!0),[p,g]=j.useState(""),[v,y]=j.useState(""),[b,_]=j.useState(!1),[k,E]=j.useState(""),[S,M]=j.useState(-1),[C,$]=j.useState(!1),[L,T]=j.useState(()=>wd()),H=j.useRef(null),z=j.useRef(null),G=j.useRef(null),O=j.useRef(new Map),I=j.useMemo(()=>{if(!k)return c;const U=k.toLowerCase();return c.filter(Z=>Z.name.toLowerCase().includes(U))},[c,k]),R=j.useCallback(async U=>{h(!0),g(""),E(""),M(-1);try{const Z=await we.listDirs(U);l(Z.path),u(Z.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);j.useEffect(()=>{R(e||void 0)},[]),j.useEffect(()=>{const U=H.current;if(!U)return;function Z(D){if(D.key!=="Tab")return;const P=U.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const Q=P[0],A=P[P.length-1];D.shiftKey&&document.activeElement===Q?(D.preventDefault(),A.focus()):!D.shiftKey&&document.activeElement===A&&(D.preventDefault(),Q.focus())}document.addEventListener("keydown",Z);const me=setTimeout(()=>{var D;(D=G.current)==null||D.focus()},80);return()=>{document.removeEventListener("keydown",Z),clearTimeout(me)}},[]);const oe=j.useCallback(()=>{C||($(!0),setTimeout(n,150))},[n,C]);j.useEffect(()=>{function U(Z){if(Z.key==="Escape"){if(b)return;oe()}}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[b,oe]),j.useEffect(()=>{function U(Z){var D,P;if(b)return;if(Z.key==="Backspace"&&document.activeElement!==G.current){if(i&&i!=="/"){Z.preventDefault();const Q=i.split("/").slice(0,-1).join("/")||"/";R(Q)}return}const me=I.length;if(me!==0){if(Z.key==="ArrowDown"){Z.preventDefault();const Q=S<me-1?S+1:0;M(Q),(D=O.current.get(Q))==null||D.focus()}else if(Z.key==="ArrowUp"){Z.preventDefault();const Q=S>0?S-1:me-1;M(Q),(P=O.current.get(Q))==null||P.focus()}}}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[b,I.length,S,i,R]),j.useEffect(()=>{var U;S>=0&&((U=O.current.get(S))==null||U.scrollIntoView({block:"nearest"}))},[S]);function J(U){$w(U),T(wd()),t(U),n()}const X=R8(i),B=i.split("/").pop()||"/";return al.createPortal(a.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:oe,children:a.jsxs("div",{ref:H,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:oe,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),L.length>0&&a.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[a.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),a.jsx("ul",{className:"list-none m-0 p-0",children:L.map(U=>a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>J(U),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[a.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),a.jsx("span",{className:"font-medium truncate",children:U.split("/").pop()||U}),a.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:U})]})},U))})]}),a.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?a.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:U=>y(U.target.value),onKeyDown:U=>{U.key==="Enter"&&v.trim()&&J(v.trim()),U.key==="Escape"&&(U.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):a.jsxs(a.Fragment,{children:[a.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:X.map((U,Z)=>{const me=Z===X.length-1;return a.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[Z>0&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("button",{type:"button",onClick:()=>{me||R(U.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${me?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":me?"location":void 0,tabIndex:me?-1:0,children:U.label})]},U.path)})}),a.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!b&&a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:a.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),a.jsx("input",{ref:G,type:"text","aria-label":"Filter directories",value:k,onChange:U=>{E(U.target.value),M(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),a.jsxs("button",{type:"button",onClick:()=>J(i),"aria-label":`Select ${B}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:a.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),a.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),a.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:B})]})]}),a.jsx("div",{ref:z,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?a.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((U,Z)=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),a.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+Z*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${Z*.1}s infinite`}})]},Z))}):p?a.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsx("p",{className:"text-xs text-cc-muted",children:p}),a.jsx("button",{type:"button",onClick:()=>R(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?a.jsxs("div",{className:"px-4 py-8 text-center",children:[a.jsx("p",{className:"text-xs text-cc-muted",children:k?"No matching directories":"No subdirectories"}),k&&a.jsx("button",{type:"button",onClick:()=>E(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):a.jsx("ul",{className:"list-none m-0 p-0",children:I.map((U,Z)=>a.jsxs("li",{className:`flex items-center transition-colors ${S===Z?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[a.jsxs("button",{type:"button",ref:me=>{me?O.current.set(Z,me):O.current.delete(Z)},onClick:()=>R(U.path),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),J(U.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:U.path,"aria-label":`Navigate into ${U.name}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),a.jsx("span",{className:"truncate",children:U.name}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:a.jsx("path",{d:"M6 4l4 4-4 4"})})]}),a.jsx("button",{type:"button",onClick:()=>J(U.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${U.name}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},U.path))})}),a.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),a.jsxs("span",{className:"ml-auto",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function D8(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function z8(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():D8(e.identifier,e.title)}function Fo({className:e}){return a.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[a.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),a.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),a.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),a.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function O8({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[l,c]=j.useState(""),[u,f]=j.useState(""),[h,p]=j.useState(""),[g,v]=j.useState(0),[y,b]=j.useState(!0),[_,k]=j.useState([]),[E,S]=j.useState(""),[M,C]=j.useState(""),[$,L]=j.useState(!0),[T,H]=j.useState(!1),[z,G]=j.useState("");j.useEffect(()=>{let I=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([R,oe])=>{var X;if(!I)return;k(R.teams),S(oe.viewerId);const J=((X=R.teams[0])==null?void 0:X.id)||"";p(J)}).catch(R=>{I&&G(R instanceof Error?R.message:"Failed to load teams")}).finally(()=>{I&&L(!1)}),()=>{I=!1}},[t]),j.useEffect(()=>{if(!h||_.length===0){C("");return}const I=_.find(oe=>oe.id===h),R=I==null?void 0:I.states.find(oe=>oe.type==="backlog");C((R==null?void 0:R.id)||"")},[h,_]);async function O(){if(!(!l.trim()||!h)){H(!0),G("");try{const I=await we.createLinearIssue({title:l.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&E?E:void 0,stateId:M||void 0,connectionId:t});n(I.issue)}catch(I){G(I instanceof Error?I.message:"Failed to create issue")}finally{H(!1)}}}return al.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:a.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),a.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),z&&a.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:z}),$?a.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),a.jsx("input",{id:"create-issue-title",type:"text",value:l,onChange:I=>c(I.target.value),onKeyDown:I=>{I.key==="Enter"&&l.trim()&&h&&!T&&O()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),a.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),a.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(I=>a.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),a.jsxs("select",{id:"create-issue-priority",value:g,onChange:I=>v(Number(I.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[a.jsx("option",{value:0,children:"No priority"}),a.jsx("option",{value:1,children:"Urgent"}),a.jsx("option",{value:2,children:"High"}),a.jsx("option",{value:3,children:"Medium"}),a.jsx("option",{value:4,children:"Low"})]})]}),a.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:I=>b(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),a.jsxs("div",{className:"flex gap-2.5 pt-2",children:[a.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:O,disabled:!l.trim()||!h||T,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:T?"Creating...":"Create Issue"})]})]})]})}),document.body)}function B8({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:l,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=j.useState([]),[p,g]=j.useState(null),[v,y]=j.useState(!1),[b,_]=j.useState(""),[k,E]=j.useState([]),[S,M]=j.useState(!1),[C,$]=j.useState(!1),[L,T]=j.useState(""),[H,z]=j.useState(!1),[G,O]=j.useState(null),[I,R]=j.useState([]),[oe,J]=j.useState(!1),[X,B]=j.useState(""),[U,Z]=j.useState(!1),[me,D]=j.useState([]),[P,Q]=j.useState(!1),[A,pe]=j.useState(""),[_e,ke]=j.useState(!1),[ze,ce]=j.useState([]),[je,Fe]=j.useState(!1),[At,Ke]=j.useState(!1),pt=j.useRef(null);j.useEffect(()=>{function fe(Se){pt.current&&!pt.current.contains(Se.target)&&(M(!1),Z(!1))}return document.addEventListener("pointerdown",fe),()=>document.removeEventListener("pointerdown",fe)},[]),j.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let fe=!0;return we.listLinearConnections().then(({connections:Se})=>{fe&&(h(Se),y(!0),Se.length>0?(g(Se[0].id),u(Se[0].id)):(g(null),u(null)))}).catch(()=>{fe&&y(!0)}),()=>{fe=!1}},[n]);const vt=j.useCallback(fe=>{g(fe),u(fe),l(null),E([]),_(""),T(""),ce([]),pe(""),D([]),G&&(J(!0),B(""),we.getLinearProjectIssues(G.projectId,10,fe).then(({issues:Se})=>{R(Se)}).catch(Se=>{B(Se instanceof Error?Se.message:String(Se))}).finally(()=>{J(!1)}))},[G,u,l]);j.useEffect(()=>{if(!t||!n){O(null),R([]);return}let fe=!0;return J(!0),B(""),(async()=>{try{const{mapping:Se}=await we.getLinearProjectMapping(t.repoRoot);if(!fe)return;if(O(Se),Se){const{issues:Ze}=await we.getLinearProjectIssues(Se.projectId,10,p??void 0);if(!fe)return;R(Ze)}else R([])}catch(Se){if(!fe)return;B(Se instanceof Error?Se.message:String(Se))}finally{fe&&J(!1)}})(),()=>{fe=!1}},[t,n,p]),j.useEffect(()=>{if(!n)return;const fe=b.trim();if(fe.length<2){E([]),T(""),$(!1);return}let Se=!0;$(!0),T("");const Ze=setTimeout(()=>{we.searchLinearIssues(fe,8,p??void 0).then(Be=>{Se&&E(Be.issues)}).catch(Be=>{Se&&(E([]),T(Be instanceof Error?Be.message:String(Be)))}).finally(()=>{Se&&$(!1)})},400);return()=>{Se=!1,clearTimeout(Ze)}},[n,b,p]),j.useEffect(()=>{if(!n||!_e){ce([]),Fe(!1);return}const fe=A.trim();if(fe.length<2){ce([]),Fe(!1);return}let Se=!0;Fe(!0);const Ze=setTimeout(()=>{we.searchLinearIssues(fe,10,p??void 0).then(Be=>{Se&&ce(Be.issues)}).catch(()=>{Se&&ce([])}).finally(()=>{Se&&Fe(!1)})},400);return()=>{Se=!1,clearTimeout(Ze)}},[n,_e,A,p]);function qe(fe,Se=!1){l(fe),_(`${fe.identifier} - ${fe.title}`);const Ze=z8(fe);c(Ze,!0),Se&&M(!1)}function bt(){l(null),_(""),E([]),T("")}async function pn(fe){if(t)try{const{mapping:Se}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:fe.id,projectName:fe.name});O(Se),Z(!1),J(!0),B("");const{issues:Ze}=await we.getLinearProjectIssues(fe.id,10,p??void 0);R(Ze)}catch(Se){B(Se instanceof Error?Se.message:String(Se))}finally{J(!1)}}async function dn(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),R([]),l(null),_("")}}function se(){if(!n){window.location.hash="#/integrations/linear";return}Z(!0),me.length===0&&(Q(!0),we.listLinearProjects(p??void 0).then(({projects:fe})=>D(fe)).catch(()=>{}).finally(()=>Q(!1)))}function Ce(fe){Ke(!1),qe(fe),G&&(J(!0),we.getLinearProjectIssues(G.projectId,10,p??void 0).then(({issues:Se})=>R(Se)).catch(()=>{}).finally(()=>J(!1)))}return n?a.jsxs("aside",{className:"space-y-2 mt-0.5",ref:pt,children:[a.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&a.jsx("select",{value:p??"",onChange:fe=>vt(fe.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(fe=>a.jsx("option",{value:fe.id,children:fe.workspaceName||fe.name},fe.id))}),G?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[a.jsx(Fo,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:G.projectName}),a.jsx("button",{type:"button",onClick:dn,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),a.jsxs("button",{type:"button",onClick:()=>Ke(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Create issue"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","aria-expanded":S,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}M(!S)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[a.jsx(Fo,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Linear"})]}),n&&t&&a.jsxs("button",{type:"button",onClick:se,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Attach project"})]}),n&&a.jsxs("button",{type:"button",onClick:()=>Ke(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{children:"Create issue"})]}),!n&&a.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),G&&(()=>{const fe=A.trim().toLowerCase(),Se=!_e&&fe?I.filter(Be=>Be.identifier.toLowerCase().includes(fe)||Be.title.toLowerCase().includes(fe)):_e?[]:I,Ze=_e?ze:Se;return a.jsxs("div",{className:"mt-2",children:[i&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[a.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),a.jsx("button",{type:"button",onClick:bt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),a.jsx("input",{type:"text",value:A,onChange:Be=>pe(Be.target.value),placeholder:_e?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),oe?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):X?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:X}):je?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&fe.length<2?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):Ze.length===0?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:fe?"No matching issues":"No active issues found"}):a.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:Ze.map(Be=>a.jsxs("button",{type:"button",onClick:()=>qe(Be),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Be.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:Be.identifier})," ",Be.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Be.stateName,Be.priorityLabel].filter(Boolean).join(" - ")})]},Be.id))}),a.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:_e,onChange:Be=>{ke(Be.target.checked),Be.target.checked||ce([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),U&&a.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[a.jsx("div",{className:"p-2 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),a.jsx("button",{type:"button",onClick:()=>Z(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),P?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):me.length===0?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):a.jsx("div",{className:"max-h-48 overflow-y-auto",children:me.map(fe=>a.jsx("button",{type:"button",onClick:()=>pn(fe),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("div",{className:"text-xs text-cc-fg",children:fe.name})},fe.id))})]}),S&&n&&a.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[a.jsxs("div",{className:"p-2 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:b,onChange:fe=>{_(fe.target.value)},onFocus:()=>M(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),a.jsx("button",{type:"button",onClick:()=>{M(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[a.jsx("span",{children:"Attach an issue to this draft"}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&C&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!C&&L&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:L}),b.trim().length>=2&&!C&&!L&&k.length===0&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!C&&!L&&a.jsx("div",{className:"max-h-56 overflow-y-auto",children:k.map(fe=>a.jsxs("button",{type:"button",onClick:()=>qe(fe,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:fe.identifier})," - ",fe.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[fe.stateName,fe.teamName].filter(Boolean).join(" • ")})]},fe.id))})]}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),H&&a.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),a.jsx("div",{className:"flex gap-2 mt-2.5",children:a.jsx("button",{type:"button",onClick:()=>{z(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),At&&a.jsx(O8,{defaultProjectId:G==null?void 0:G.projectId,connectionId:p??void 0,onCreated:Ce,onClose:()=>Ke(!1)})]}):null}function U8({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:l,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=j.useState([]),[g,v]=j.useState(!1),[y,b]=j.useState(""),_=j.useRef(null);return j.useEffect(()=>{function k(E){_.current&&!_.current.contains(E.target)&&v(!1)}return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[]),j.useEffect(()=>{t?we.listBranches(t.repoRoot).then(k=>{p(k),f(k)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:_,children:[a.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(k=>{p(k),f(k)}).catch(()=>{p([]),f([])})}),v(!g),b("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:a.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),a.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[a.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:a.jsx("input",{type:"text",value:y,onChange:k=>b(k.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:k=>{k.key==="Escape"&&v(!1)}})}),a.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const k=y.toLowerCase().trim(),E=h.filter($=>!$.isRemote&&(!k||$.name.toLowerCase().includes(k))),S=h.filter($=>$.isRemote&&(!k||$.name.toLowerCase().includes(k))),M=h.some($=>$.name.toLowerCase()===k),C=E.length>0||S.length>0;return a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),E.map($=>a.jsxs("button",{onClick:()=>{c($.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${$.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:$.name}),a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[$.ahead>0&&a.jsxs("span",{className:"text-[9px] text-green-500",children:[$.ahead,"↑"]}),$.behind>0&&a.jsxs("span",{className:"text-[9px] text-amber-500",children:[$.behind,"↓"]}),$.worktreePath&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),$.isCurrent&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},$.name))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),S.map($=>a.jsxs("button",{onClick:()=>{c($.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${$.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:$.name}),a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${$.name}`))]}),!C&&k&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),k&&!M&&a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),a.jsxs("span",{children:["Create ",a.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),a.jsxs("button",{onClick:()=>u(!l),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${l?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:a.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),a.jsx("span",{children:"Worktree"})]})]}):null}const P8=336*60*60*1e3,Fs=12,$8=24;function Dm(e){return e.split("/").filter(Boolean).pop()||e}function Xy(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Dm(e.cwd)}function F8(e){return e.length>8?e.slice(0,8):e}function H8(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function I8(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const l=Math.floor(i/24);if(l<14)return`${l}d ago`;const c=Math.floor(l/7);if(c<8)return`${c}w ago`;const u=Math.floor(l/30);return`${Math.max(1,u)}mo ago`}function q8(){var pc,yl;const[e,t]=j.useState(""),[n,i]=j.useState(()=>localStorage.getItem("cc-backend")||"claude"),[l,c]=j.useState([]),[u,f]=j.useState(()=>Iy(localStorage.getItem("cc-backend")||"claude")),[h,p]=j.useState(()=>qy(localStorage.getItem("cc-backend")||"claude")),[g,v]=j.useState(()=>wd()[0]||""),[y,b]=j.useState([]),[_,k]=j.useState(!1),[E,S]=j.useState(""),[M,C]=j.useState(null),[$,L]=j.useState(!1),[T,H]=j.useState(null),[z,G]=j.useState(null),[O,I]=j.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),R=M||zw(n),oe=Hy(n),[J,X]=j.useState([]),[B,U]=j.useState(()=>localStorage.getItem("cc-selected-env")||""),[Z,me]=j.useState(!1),[D,P]=j.useState(!1),[Q,A]=j.useState(()=>localStorage.getItem("cc-sandbox-enabled")==="true"),[pe,_e]=j.useState([]),[ke,ze]=j.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[ce,je]=j.useState(!1),Fe=j.useRef(null),[At,Ke]=j.useState(null),pt=j.useRef(null),vt=j.useRef(null),[qe,bt]=j.useState(!1),[pn,dn]=j.useState(!1),[se,Ce]=j.useState(!1),[fe,Se]=j.useState(!1),[Ze,Be]=j.useState(""),[mn,ae]=j.useState(!0),[ve,De]=j.useState([]),[Ge,Qe]=j.useState(!1),[ln,Nn]=j.useState(""),[jt,kt]=j.useState(!1),[$t,K]=j.useState(Fs),[he,ge]=j.useState(""),[He,mt]=j.useState(null),[Vt,Wn]=j.useState(!1),[St,Qt]=j.useState(""),[Hr,Li]=j.useState(!1),[oc,cl]=j.useState([]),[kr,Ws]=j.useState(null),[gs,xs]=j.useState(!1),[ul,Sr]=j.useState(""),[dl,Qs]=j.useState(0),vs=j.useRef(null),Kt=j.useRef(null),Gt=j.useRef(null),fn=j.useRef(null),Ir=j.useRef(null),Ks=Y(V=>V.currentSessionId),Ft=Bw({text:e,caretPos:dl,cwd:g||void 0});j.useEffect(()=>{if(vs.current===null||!Kt.current)return;const V=vs.current;Kt.current.setSelectionRange(V,V),vs.current=null},[e]),j.useEffect(()=>{var xe;window.matchMedia("(min-width: 640px)").matches&&((xe=Kt.current)==null||xe.focus())},[]),j.useEffect(()=>{we.getHome().then(({home:V,cwd:xe})=>{g||v(xe||V)}).catch(()=>{}),we.listEnvs().then(X).catch(()=>{}),we.listSandboxes().then(_e).catch(()=>{}),we.getBackends().then(c).catch(()=>{}),we.getSettings().then(V=>{L(V.linearApiKeyConfigured)}).catch(()=>{})},[]);function Ld(V){i(V),localStorage.setItem("cc-backend",V),C(null),f(Iy(V)),p(qy(V)),V!=="claude"&&(Se(!1),De([]),Nn(""),Qe(!1),kt(!1),K(Fs),ge(""))}j.useEffect(()=>{if(n!=="codex"){C(null);return}we.getBackendModels(n).then(V=>{if(V.length>0){const xe=e8(V);C(xe),xe.some(rt=>rt.value===u)||f(xe[0].value)}}).catch(()=>{})},[n]),j.useEffect(()=>{if(pt.current&&(clearInterval(pt.current),pt.current=null),Ke(null),!Q)return;const V="the-companion:latest",xe=()=>{we.getImageStatus(V).then(rt=>{Ke(rt),rt.status==="idle"&&we.pullImage(V).catch(()=>{}),(rt.status==="ready"||rt.status==="error")&&pt.current&&(clearInterval(pt.current),pt.current=null)}).catch(()=>{})};return xe(),pt.current=setInterval(xe,2e3),()=>{pt.current&&(clearInterval(pt.current),pt.current=null)}},[Q]),j.useEffect(()=>{function V(xe){Gt.current&&!Gt.current.contains(xe.target)&&bt(!1),fn.current&&!fn.current.contains(xe.target)&&dn(!1),Ir.current&&!Ir.current.contains(xe.target)&&me(!1),Fe.current&&!Fe.current.contains(xe.target)&&je(!1)}return document.addEventListener("pointerdown",V),()=>document.removeEventListener("pointerdown",V)},[]),j.useEffect(()=>{if(!g){mt(null);return}we.getRepoInfo(g).then(V=>{mt(V),Qt(V.currentBranch),Li(!1)}).catch(()=>{mt(null),Qt(""),Li(!1)})},[g]);const fl=R.find(V=>V.value===u)||R[0],bs=oe.find(V=>V.value===h)||oe[0],hl=n==="codex"?"/logo-codex.svg":"/logo.svg",Di=g?g.split("/").pop()||g:"Select folder",qr=j.useMemo(()=>Ze.trim(),[Ze]),zi=n==="claude"&&fe&&qr.length>0,zn=j.useMemo(()=>{const V=Date.now()-P8;return ve.filter(xe=>xe.createdAt>=V)},[ve]),Ht=j.useMemo(()=>jt?ve:zn.length>0?zn:ve,[jt,zn,ve]),Qn=j.useMemo(()=>he.trim().toLowerCase(),[he]),Nr=j.useMemo(()=>Qn?Ht.filter(V=>{const xe=Xy(V).toLowerCase(),rt=Dm(V.cwd).toLowerCase(),ct=(V.gitBranch||"").toLowerCase(),Nt=V.cwd.toLowerCase(),$e=V.resumeSessionId.toLowerCase();return xe.includes(Qn)||rt.includes(Qn)||ct.includes(Qn)||Nt.includes(Qn)||$e.includes(Qn)}):Ht,[Ht,Qn]),Cr=j.useMemo(()=>Nr.slice(0,$t),[Nr,$t]),Oi=$t<Nr.length,cc=Math.max(0,ve.length-zn.length),uc=!jt&&zn.length>0,Zs=j.useCallback(async()=>{if(n==="claude"){Qe(!0),Nn("");try{const[V,xe]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then($e=>$e.sessions)]),rt=new Map,ct=$e=>{const Bn=rt.get($e.resumeSessionId);(!Bn||$e.createdAt>Bn.createdAt)&&rt.set($e.resumeSessionId,$e)};for(const $e of V)$e.backendType!=="codex"&&$e.cliSessionId&&ct({resumeSessionId:$e.cliSessionId,sessionId:$e.sessionId,name:$e.name,model:$e.model,createdAt:$e.createdAt,cwd:$e.cwd,gitBranch:$e.gitBranch,source:"companion"});for(const $e of xe)ct({resumeSessionId:$e.sessionId,sessionId:$e.sessionId,slug:$e.slug,createdAt:$e.lastActivityAt,cwd:$e.cwd,gitBranch:$e.gitBranch,source:"claude_disk"});const Nt=Array.from(rt.values()).sort(($e,Bn)=>{const Vr=g&&$e.cwd===g?0:1,Tr=g&&Bn.cwd===g?0:1;return Vr!==Tr?Vr-Tr:Bn.createdAt-$e.createdAt});De(Nt),kt(!1),K(Fs)}catch(V){const xe=V instanceof Error?V.message:String(V);Nn(xe||"Failed to load existing sessions"),De([]),K(Fs)}finally{Qe(!1)}}},[n,g]);j.useEffect(()=>{n==="claude"&&fe&&Zs()},[n,fe,Zs]),j.useEffect(()=>{K(Fs)},[Qn,jt]);async function Dd(V){const xe=V.target.files;if(!xe)return;const rt=[];for(const ct of Array.from(xe)){if(!ct.type.startsWith("image/"))continue;const{base64:Nt,mediaType:$e}=await _d(ct);rt.push({name:ct.name,base64:Nt,mediaType:$e})}b(ct=>[...ct,...rt]),V.target.value=""}function Js(V){b(xe=>xe.filter((rt,ct)=>ct!==V))}async function ea(V){var ct;const xe=(ct=V.clipboardData)==null?void 0:ct.items;if(!xe)return;const rt=[];for(const Nt of Array.from(xe)){if(!Nt.type.startsWith("image/"))continue;const $e=Nt.getAsFile();if(!$e)continue;const{base64:Bn,mediaType:Vr}=await _d($e);rt.push({name:`pasted-${Date.now()}.${$e.type.split("/")[1]}`,base64:Bn,mediaType:Vr})}rt.length>0&&(V.preventDefault(),b(Nt=>[...Nt,...rt]))}function Er(V){t(V.target.value),Qs(V.target.selectionStart??V.target.value.length);const xe=V.target;xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px"}function Cn(){Kt.current&&Qs(Kt.current.selectionStart??0)}function pl(V){var rt;const xe=Ft.selectPrompt(V);vs.current=xe.nextCursor,t(xe.nextText),Ft.setMentionMenuOpen(!1),Qs(xe.nextCursor),(rt=Kt.current)==null||rt.focus(),Kt.current&&(Kt.current.style.height="auto",Kt.current.style.height=Math.min(Kt.current.scrollHeight,200)+"px")}function zd(V){if(Ft.mentionMenuOpen&&V.key==="Escape"){V.preventDefault(),Ft.setMentionMenuOpen(!1);return}if(Ft.mentionMenuOpen&&Ft.filteredPrompts.length>0){if(V.key==="ArrowDown"){V.preventDefault(),Ft.setMentionMenuIndex(xe=>(xe+1)%Ft.filteredPrompts.length);return}if(V.key==="ArrowUp"){V.preventDefault(),Ft.setMentionMenuIndex(xe=>(xe-1+Ft.filteredPrompts.length)%Ft.filteredPrompts.length);return}if(V.key==="Tab"&&!V.shiftKey||V.key==="Enter"&&!V.shiftKey){V.preventDefault(),pl(Ft.filteredPrompts[Ft.mentionMenuIndex]);return}}if(Ft.mentionMenuOpen&&Ft.filteredPrompts.length===0&&(V.key==="Enter"&&!V.shiftKey||V.key==="Tab"&&!V.shiftKey)){V.preventDefault();return}if(V.key==="Tab"&&V.shiftKey){V.preventDefault();const xe=Hy(n),ct=(xe.findIndex(Nt=>Nt.value===h)+1)%xe.length;p(xe[ct].value);return}V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),gl())}function ml(V){if(!T)return V;const xe=(T.description??"").trim();return`${["Linear issue context:",`- Identifier: ${T.identifier}`,`- Title: ${T.title}`,T.stateName?`- State: ${T.stateName}`:"",T.priorityLabel?`- Priority: ${T.priorityLabel}`:"",T.teamName?`- Team: ${T.teamName}`:"",`- URL: ${T.url}`,xe?`- Description:
106
+ ${xe}`:""].filter(Boolean).join(`
107
+ `)}
108
+
109
+ User request:
110
+ ${V}`}async function gl(){const V=e.trim();if(!(!V||_)){if(k(!0),S(""),Sr(""),He){const xe=St||He.currentBranch;if(xe&&xe===He.currentBranch){const rt=oc.find(ct=>ct.name===xe&&!ct.isRemote);if(rt&&rt.behind>0){Ws({behind:rt.behind,branchName:xe});return}}}await ii(V)}}async function ii(V,xe){const rt=Y.getState();rt.clearCreation(),rt.setSessionCreating(!0,n);try{Ks&&Vp(Ks);const ct=(xe==null?void 0:xe.resumeSessionAt)||(zi?qr:void 0),Nt=ct?(xe==null?void 0:xe.forkSession)??(zi?mn:void 0):void 0,$e=(xe==null?void 0:xe.cwd)||g,Bn=(xe==null?void 0:xe.branch)!==void 0?xe.branch.trim()||void 0:St.trim()||void 0,Vr=(xe==null?void 0:xe.useWorktree)!==void 0?xe.useWorktree:Vt,Tr=(xe==null?void 0:xe.createBranch)!==void 0?xe.createBranch:!!(Bn&&Hr),Ar=await F3({model:u,permissionMode:h,cwd:$e||void 0,envSlug:B||void 0,sandboxEnabled:Q?!0:void 0,sandboxSlug:Q&&ke?ke:void 0,branch:Bn,createBranch:Tr?!0:void 0,useWorktree:Vr?!0:void 0,backend:n,codexInternetAccess:n==="codex"?!0:void 0,resumeSessionAt:ct,forkSession:Nt,linearConnectionId:T&&z||void 0,linearIssue:T?{identifier:T.identifier,title:T.title,stateName:T.stateName,teamName:T.teamName,url:T.url}:void 0},or=>{Y.getState().addCreationProgress(or)}),En=Ar.sessionId,ta=Y.getState(),mc=ta.sdkSessions.filter(or=>or.sessionId!==En);ta.setSdkSessions([...mc,{sessionId:En,state:Ar.state,cwd:Ar.cwd,createdAt:Date.now(),backendType:Ar.backendType||n,model:u,permissionMode:h,resumeSessionAt:ct,forkSession:ct?Nt===!0:void 0}]);const ys=new Set(Y.getState().sessionNames.values()),Mr=r5(ys);Y.getState().setSessionName(En,Mr),$e&&$w($e),Y.getState().setPreviousPermissionMode(En,h),Jm(En,!0),nc(En),await TS(En);const na=V.trim();if(na.length>0){const or=ml(na),Rr=Fp();Ln(En,{type:"user_message",content:or,session_id:En,images:y.length>0?y.map(ai=>({media_type:ai.mediaType,data:ai.base64})):void 0,client_msg_id:Rr}),Y.getState().appendMessage(En,{id:Rr,role:"user",content:or,images:y.length>0?y.map(ai=>({media_type:ai.mediaType,data:ai.base64})):void 0,timestamp:Date.now()})}T&&(we.linkLinearIssue(En,T,z||void 0).then(()=>Y.getState().setLinkedLinearIssue(En,T)).catch(()=>{}),we.transitionLinearIssue(T.id,z||void 0).catch(()=>{})),Y.getState().clearCreation()}catch(ct){const Nt=ct instanceof Error?ct.message:String(ct);S(Nt),Y.getState().setCreationError(Nt),k(!1)}}async function dc(V,xe){_||(k(!0),S(""),Sr(""),v(V.cwd),Wn(!1),Li(!1),Qt(V.gitBranch||""),Be(V.resumeSessionId),ae(xe),await ii("",{resumeSessionAt:V.resumeSessionId,forkSession:xe,cwd:V.cwd,branch:V.gitBranch,useWorktree:!1,createBranch:!1}))}async function On(){if(kr){xs(!0),Sr("");try{const V=g||(He==null?void 0:He.repoRoot);if(!V)throw new Error("No working directory");const xe=await we.gitPull(V);if(!xe.success){Sr(xe.output||"Pull failed"),xs(!1),k(!1);return}Ws(null),xs(!1),await ii(e.trim())}catch(V){Sr(V instanceof Error?V.message:String(V)),xs(!1)}}}function xl(){const V=e.trim();Ws(null),Sr(""),ii(V)}function fc(){Ws(null),Sr(""),k(!1)}const vl=j.useCallback((V,xe)=>{Qt(V),Li(xe)},[]),Bi=j.useCallback((V,xe)=>{Qt(V),Li(xe)},[]),hc=j.useCallback(V=>{cl(V)},[]),bl=j.useCallback(V=>{H(V),!V&&He&&(Qt(He.currentBranch),Li(!1))},[He]),si=e.trim().length>0&&!_;return a.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[a.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),a.jsxs("div",{className:"w-full max-w-[720px]",children:[a.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[a.jsx("img",{src:hl,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),a.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",a.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),a.jsx("input",{ref:vt,type:"file",accept:"image/*",multiple:!0,onChange:Dd,className:"hidden","aria-label":"Attach images"}),a.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[a.jsx(Ow,{open:Ft.mentionMenuOpen,loading:Ft.promptsLoading,prompts:Ft.filteredPrompts,selectedIndex:Ft.mentionMenuIndex,onSelect:pl,menuRef:Ft.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(T||y.length>0)&&a.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[T&&a.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[a.jsx("span",{className:"shrink-0",children:"Linear"}),a.jsx("span",{className:"font-mono-code shrink-0",children:T.identifier}),a.jsx("span",{className:"truncate",children:T.title}),a.jsx("button",{type:"button",onClick:()=>bl(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),y.map((V,xe)=>a.jsxs("div",{className:"relative group",children:[a.jsx("img",{src:`data:${V.mediaType};base64,${V.base64}`,alt:V.name,className:"w-10 h-10 rounded-lg object-cover border border-cc-border"}),a.jsx("button",{onClick:()=>Js(xe),className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-cc-error text-white flex items-center justify-center text-[10px] opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]},xe))]}),a.jsx("textarea",{ref:Kt,value:e,onChange:Er,onKeyDown:zd,onClick:Cn,onKeyUp:Cn,onPaste:ea,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),a.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[a.jsxs("div",{className:"relative",ref:Gt,children:[a.jsxs("button",{onClick:()=>bt(!qe),"aria-expanded":qe,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("span",{children:fl.icon}),a.jsx("span",{children:fl.label}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),qe&&a.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:R.map(V=>a.jsxs("button",{onClick:()=>{f(V.value),bt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${V.value===u?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{children:V.icon}),V.label]},V.value))})]}),a.jsxs("div",{className:"relative",ref:fn,children:[a.jsxs("button",{onClick:()=>dn(!pn),"aria-expanded":pn,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),bs.label,a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),pn&&a.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:oe.map(V=>a.jsx("button",{onClick:()=>{p(V.value),dn(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${V.value===h?"text-cc-primary font-medium":"text-cc-fg"}`,children:V.label},V.value))})]}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>Ce(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Di})]}),se&&a.jsx(L8,{initialPath:g||"",onSelect:V=>{v(V)},onClose:()=>Ce(!1)})]}),a.jsx(U8,{cwd:g,gitRepoInfo:He,selectedBranch:St,isNewBranch:Hr,useWorktree:Vt,onBranchChange:vl,onWorktreeChange:Wn,onBranchesLoaded:hc}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{className:"relative",ref:Ir,children:[a.jsxs("button",{onClick:()=>{Z||we.listEnvs().then(X).catch(()=>{}),me(!Z)},"aria-expanded":Z,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:B?((pc=J.find(V=>V.slug===B))==null?void 0:pc.name)||"Env":"No env"})]}),Z&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[a.jsx("button",{onClick:()=>{U(""),localStorage.setItem("cc-selected-env",""),me(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${B?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),J.map(V=>a.jsxs("button",{onClick:()=>{U(V.slug),localStorage.setItem("cc-selected-env",V.slug),me(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${V.slug===B?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate",children:V.name}),a.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(V.variables).length," var",Object.keys(V.variables).length!==1?"s":""]})]},V.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("button",{onClick:()=>{P(!0),me(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),a.jsxs("div",{className:"relative",ref:Fe,children:[a.jsxs("button",{onClick:()=>{ce||we.listSandboxes().then(_e).catch(()=>{}),je(!ce)},"aria-expanded":ce,className:`flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs rounded-lg transition-colors cursor-pointer ${Q?"text-cc-primary bg-cc-primary/8 hover:bg-cc-primary/12":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 opacity-60",children:[a.jsx("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"}),a.jsx("path",{d:"M5 4V2.5A1.5 1.5 0 016.5 1h3A1.5 1.5 0 0111 2.5V4"})]}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Q&&ke&&((yl=pe.find(V=>V.slug===ke))==null?void 0:yl.name)||"Sandbox"}),Q&&At&&At.status!=="idle"&&a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${At.status==="ready"?"bg-green-500":At.status==="pulling"?"bg-amber-500 animate-pulse":"bg-cc-error"}`,title:At.status==="ready"?"Docker image ready":At.status==="pulling"?"Pulling Docker image...":`Image error: ${At.error||"unknown"}`})]}),ce&&a.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[a.jsx("button",{onClick:()=>{A(!1),localStorage.setItem("cc-sandbox-enabled","false"),je(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Q?"text-cc-fg":"text-cc-primary font-medium"}`,children:"Off"}),a.jsx("div",{className:"border-t border-cc-border my-0.5"}),a.jsx("button",{onClick:()=>{A(!0),localStorage.setItem("cc-sandbox-enabled","true"),ze(""),localStorage.setItem("cc-selected-sandbox",""),je(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Q&&!ke?"text-cc-primary font-medium":"text-cc-fg"}`,children:"Default (the-companion:latest)"}),pe.map(V=>a.jsx("button",{onClick:()=>{A(!0),localStorage.setItem("cc-sandbox-enabled","true"),ze(V.slug),localStorage.setItem("cc-selected-sandbox",V.slug),je(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${Q&&V.slug===ke?"text-cc-primary font-medium":"text-cc-fg"}`,children:a.jsx("span",{className:"truncate",children:V.name})},V.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("a",{href:"#/sandboxes",className:"block w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",onClick:()=>je(!1),children:"Manage sandboxes..."})})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{var V;return(V=vt.current)==null?void 0:V.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Upload image",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),a.jsx("circle",{cx:"5.5",cy:"5.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M2 11l3-3 2 2 3-4 4 5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),a.jsx("button",{onClick:gl,disabled:!si,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${si?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),a.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[l.length>1&&a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:l.map(V=>a.jsxs("button",{onClick:()=>V.available&&Ld(V.id),disabled:!V.available,title:V.available?V.name:`${V.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${V.available?n===V.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[V.name,!V.available&&a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},V.id))})}),n==="claude"&&a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>Se(V=>!V),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${fe?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":fe,"aria-controls":"branch-from-session-panel",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[a.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),a.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${fe?"rotate-180":""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),a.jsx("div",{className:"accordion-panel","data-open":fe?"true":"false",children:a.jsx("div",{className:"accordion-inner",inert:!fe||void 0,children:a.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>void Zs(),disabled:Ge,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:Ge?"Refreshing...":"Refresh detected sessions"}),ve.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",Cr.length," of ",Nr.length," ",Qn?"matching":uc?"recent":"detected"," Claude session",Nr.length!==1?"s":"","."]}),!jt&&cc>0&&zn.length>0&&a.jsxs("button",{type:"button",onClick:()=>{kt(!0),K(Fs)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",cc,")"]}),jt&&zn.length>0&&a.jsx("button",{type:"button",onClick:()=>{kt(!1),K(Fs)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"sr-only",children:"Search sessions"}),a.jsxs("div",{className:"relative",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[a.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),a.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),a.jsx("input",{type:"text",value:he,onChange:V=>ge(V.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),a.jsxs("p",{className:"text-[11px] text-cc-muted",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",a.jsx("span",{className:"mx-1",children:"•"}),a.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),ln&&a.jsx("p",{className:"text-[11px] text-cc-error",children:ln}),!Ge&&!ln&&Nr.length===0&&a.jsx("p",{className:"text-[11px] text-cc-muted",children:Qn?"No sessions match this search.":"No Claude sessions detected yet."}),Cr.length>0&&a.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[a.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[a.jsx("span",{children:"Session"}),a.jsx("span",{children:"Project"}),a.jsx("span",{children:"Branch"}),a.jsx("span",{children:"Last active"}),a.jsx("span",{className:"text-right",children:"Action"})]}),a.jsx("div",{className:"divide-y divide-cc-border/50",children:Cr.map(V=>{const xe=Xy(V),rt=Dm(V.cwd),ct=V.source==="companion"?"Companion":"Claude",Nt=qr===V.resumeSessionId;return a.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:`text-xs truncate ${Nt?"text-cc-primary font-medium":"text-cc-fg"}`,children:xe}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"font-mono-code text-cc-muted",children:F8(V.resumeSessionId)}),a.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:ct})]})]}),a.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:V.cwd,children:[a.jsx("div",{className:"truncate",children:rt}),a.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:V.cwd,children:H8(V.cwd)})]}),a.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:V.gitBranch||"—"}),a.jsx("div",{className:"text-[11px] text-cc-muted",children:I8(V.createdAt)}),a.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[a.jsx("button",{type:"button",onClick:()=>{Be(V.resumeSessionId),ae(!0),dc(V,!0)},"aria-label":`Fork and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${Nt&&mn?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
111
+ ${V.cwd}${V.gitBranch?` (${V.gitBranch})`:""}
112
+ ${V.resumeSessionId}`,children:"Fork"}),a.jsx("button",{type:"button",onClick:()=>{Be(V.resumeSessionId),ae(!1),dc(V,!1)},"aria-label":`Continue and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${Nt&&!mn?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
113
+ ${V.resumeSessionId}`,children:"Continue"})]})]},`${V.resumeSessionId}-row-${V.sessionId}`)})}),Oi&&a.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:a.jsxs("button",{type:"button",onClick:()=>K(V=>Math.min(V+$8,Nr.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",Nr.length-$t," remaining)"]})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),O&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),a.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",n==="claude"&&a.jsxs(a.Fragment,{children:[" ",a.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),a.jsx("button",{onClick:()=>{I(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx(B8,{cwd:g,gitRepoInfo:He,linearConfigured:$,selectedLinearIssue:T,onIssueSelect:bl,onBranchFromIssue:Bi,onConnectionSelect:G})]}),kr&&a.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:a.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[a.jsx("span",{className:"font-mono-code font-medium",children:kr.branchName})," is"," ",a.jsxs("span",{className:"font-semibold text-amber-500",children:[kr.behind," commit",kr.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),ul&&a.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:ul}),a.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[a.jsx("button",{onClick:fc,disabled:gs,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{onClick:xl,disabled:gs,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),a.jsx("button",{onClick:On,disabled:gs,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 transition-colors cursor-pointer flex items-center gap-1.5",children:gs?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),E&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),a.jsx("p",{className:"text-xs text-cc-error",children:E})]})]}),D&&a.jsx(Fw,{onClose:()=>{P(!1),we.listEnvs().then(X).catch(()=>{})}})]})}const V8=[],G8=[],X8={connected:{label:"Connected",badge:"text-cc-success bg-cc-success/10",dot:"bg-cc-success"},connecting:{label:"Connecting",badge:"text-cc-warning bg-cc-warning/10",dot:"bg-cc-warning animate-pulse"},failed:{label:"Failed",badge:"text-cc-error bg-cc-error/10",dot:"bg-cc-error"},disabled:{label:"Disabled",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"}},Y8={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function W8({server:e,sessionId:t}){var f,h;const[n,i]=j.useState(!1),l=X8[e.status]||Y8,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return a.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.dot}`}),a.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${l.badge}`,children:l.label}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>AS(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&a.jsx("button",{onClick:()=>MS(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&a.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[a.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),a.jsx("span",{children:e.config.type})]}),e.config.command&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),a.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),a.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),a.jsx("span",{children:e.scope})]})]}),e.error&&a.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>a.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function Q8({sessionId:e,onDone:t}){const[n,i]=j.useState(""),[l,c]=j.useState("stdio"),[u,f]=j.useState(""),[h,p]=j.useState(""),[g,v]=j.useState(""),y=n.trim()&&(l==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const k={type:l};l==="stdio"?(k.command=u.trim(),h.trim()&&(k.args=h.trim().split(/\s+/))):k.url=g.trim(),RS(e,{[n.trim()]:k}),t()}return a.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),a.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),a.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>a.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${l===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),l==="stdio"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),a.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),a.jsx("input",{type:"text",value:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(l==="sse"||l==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),a.jsx("input",{type:"text",value:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{className:"flex gap-1.5 pt-1",children:[a.jsx("button",{type:"submit",disabled:!y,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${y?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),a.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function K8({sessionId:e}){const t=Y(f=>f.mcpServers.get(e)||V8),n=Y(f=>f.cliConnected.get(e)??!1),[i,l]=j.useState(!1),c=Y(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??G8});j.useEffect(()=>{n&&T1(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[a.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>l(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx("button",{onClick:()=>T1(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&a.jsx("div",{className:"px-3 py-2",children:a.jsx(Q8,{sessionId:e,onDone:()=>l(!1)})}),u.length>0&&a.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>a.jsx(W8,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&a.jsx("div",{className:"px-3 py-3",children:a.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&a.jsx("button",{onClick:()=>l(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function Z8({cwd:e,open:t,onClose:n}){var I;const[i,l]=j.useState([]),[c,u]=j.useState(!0),[f,h]=j.useState(0),[p,g]=j.useState(""),[v,y]=j.useState(!1),[b,_]=j.useState(!1),[k,E]=j.useState(null),[S,M]=j.useState(null),C=j.useCallback(()=>{u(!0),E(null),we.getClaudeMdFiles(e).then(R=>{l(R.files),R.files.length>0&&(h(0),g(R.files[0].content)),M(null),y(!1),u(!1)}).catch(R=>{E(R.message),u(!1)})},[e]);j.useEffect(()=>{t&&C()},[t,C]);const $=R=>{v&&!confirm("Discard unsaved changes?")||(h(R),g(i[R].content),y(!1),M(null))},L=async()=>{var oe;const R=S||((oe=i[f])==null?void 0:oe.path);if(R){_(!0),E(null);try{await we.saveClaudeMd(R,p),y(!1),S?C():l(J=>J.map((X,B)=>B===f?{...X,content:p}:X))}catch(J){E(J instanceof Error?J.message:"Failed to save")}finally{_(!1)}}},T=R=>{const oe=R==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;M(oe),g(`# CLAUDE.md
114
+
115
+ `),y(!0)},H=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const z=R=>R.startsWith(e+"/")?R.slice(e.length+1):R,G=i.some(R=>R.path===`${e}/CLAUDE.md`),O=i.some(R=>R.path===`${e}/.claude/CLAUDE.md`);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:H}),a.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),a.jsx("button",{onClick:H,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 flex min-h-0",children:c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[a.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),a.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((R,oe)=>a.jsxs("button",{onClick:()=>$(oe),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!S&&f===oe?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})}),a.jsx("span",{className:"truncate font-mono-code",children:z(R.path)})]},R.path)),S&&a.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{className:"truncate font-mono-code",children:z(S)})]})]}),(!G||!O)&&!S&&a.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!G&&a.jsxs("button",{onClick:()=>T("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!O&&a.jsxs("button",{onClick:()=>T("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),a.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!S?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>T("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),a.jsx("button",{onClick:()=>T("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:z(S||(((I=i[f])==null?void 0:I.path)??""))}),a.jsxs("div",{className:"flex items-center gap-2",children:[v&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:L,disabled:!v||b,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!b?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:b?"Saving...":"Save"})]})]}),a.jsx("textarea",{value:p,onChange:R=>{g(R.target.value),y(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),k&&a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:k})]})]})})]})]})}function Yy({icon:e,title:t,expanded:n,onToggle:i}){return a.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),a.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function ji({label:e,sublabel:t,count:n,onClick:i}){return a.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&a.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function J8({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),a.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:a.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function e7({path:e,label:t,onClose:n}){const[i,l]=j.useState(""),[c,u]=j.useState(!0),[f,h]=j.useState(!1),[p,g]=j.useState(!1),[v,y]=j.useState(null);j.useEffect(()=>{we.readFile(e).then(k=>{l(k.content),u(!1)}).catch(k=>{y(k instanceof Error?k.message:"Failed to read file"),u(!1)})},[e]);const b=async()=>{g(!0),y(null);try{await we.writeFile(e,i),h(!1)}catch(k){y(k instanceof Error?k.message:"Failed to save")}finally{g(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),a.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),a.jsxs("div",{className:"flex items-center gap-2",children:[f&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:b,disabled:!f||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${f&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),a.jsx("textarea",{value:i,onChange:k=>{l(k.target.value),h(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),v&&a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:v})]})]})}function t7({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,l]=j.useState(null),[c,u]=j.useState(!0);return j.useEffect(()=>{we.readFile(e.path).then(f=>{l(f.content),u(!1)}).catch(()=>{l("Failed to read file"),u(!1)})},[e.path]),c?null:a.jsx(J8,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?a.jsx(Z8,{cwd:e.editorCwd||t,open:!0,onClose:n}):a.jsx(e7,{path:e.path,label:e.label,onClose:n})}function n7({sessionId:e}){const t=Y(S=>S.sessions.get(e)),n=Y(S=>S.sdkSessions.find(M=>M.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[l,c]=j.useState(null),[u,f]=j.useState(!0),[h,p]=j.useState(!1),[g,v]=j.useState(!1),[y,b]=j.useState(null),_=j.useCallback(async()=>{if(i)try{const S=await we.getClaudeConfig(i);c(S)}catch{}finally{f(!1)}},[i]);if(j.useEffect(()=>{_()},[_]),!i)return null;if(u)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!l)return null;const k=l.project.claudeMd.length+(l.project.settings?1:0)+(l.project.settingsLocal?1:0)+l.project.commands.length,E=(l.user.claudeMd?1:0)+l.user.skills.length+l.user.agents.length+(l.user.settings?1:0)+l.user.commands.length;return a.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[a.jsx(Yy,{icon:"project",title:`Project (${k})`,expanded:h,onToggle:()=>p(S=>!S)}),h&&a.jsxs("div",{className:"pb-1",children:[l.project.claudeMd.map(S=>a.jsx(ji,{label:S.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:S.path,kind:"claude-md"})},S.path)),l.project.settings&&a.jsx(ji,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.project.settings.path,kind:"json"})}),l.project.settingsLocal&&a.jsx(ji,{label:"settings.local.json",onClick:()=>b({label:"settings.local.json",path:l.project.settingsLocal.path,kind:"json"})}),l.project.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.project.commands.length,")"]}),l.project.commands.map(S=>a.jsx(ji,{label:`/${S.name}`,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),k===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),a.jsx(Yy,{icon:"user",title:`User (${E})`,expanded:g,onToggle:()=>v(S=>!S)}),g&&a.jsxs("div",{className:"pb-1",children:[l.user.claudeMd&&a.jsx(ji,{label:"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:l.user.claudeMd.path,kind:"claude-md",editorCwd:l.user.root})}),l.user.skills.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",l.user.skills.length,")"]}),l.user.skills.map(S=>a.jsx(ji,{label:S.name,sublabel:S.description?S.description.slice(0,40):void 0,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),l.user.agents.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",l.user.agents.length,")"]}),l.user.agents.map(S=>a.jsx(ji,{label:S.name,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),l.user.settings&&a.jsx(ji,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.user.settings.path,kind:"json"})}),l.user.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.user.commands.length,")"]}),l.user.commands.map(S=>a.jsx(ji,{label:`/${S.name}`,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),E===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),y&&al.createPortal(a.jsx(t7,{item:y,cwd:i,onClose:()=>b(null)}),document.body)]})}function r7(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class i7 extends j.Component{constructor(){super(...arguments);Jv(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Vs(n,{section:this.props.label})}render(){return this.state.hasError?a.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),a.jsx("button",{className:"text-[10px] text-cc-muted hover:text-cc-fg px-2 py-0.5 rounded bg-cc-hover cursor-pointer",onClick:()=>this.setState({hasError:!1}),children:"Retry"})]})}):this.props.children}}const Hw=[],Iw=3e4;let Wy=null,Qy=new Map;function s7(e){return e!==Wy&&(Wy=e,Qy=new Map(e.map(t=>[t.sessionId,t]))),Qy}function lc(e){return Y(j.useCallback(t=>s7(t.sdkSessions).get(e),[e]))}const qw="cc-panel-collapsed";function Ky(){try{const e=localStorage.getItem(qw);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function a7(e){try{localStorage.setItem(qw,JSON.stringify([...e]))}catch{}}function l7({id:e,label:t,badge:n,defaultOpen:i=!0,children:l}){const[c,u]=j.useState(()=>Ky().has(e)?!0:!i),f=j.useRef(!0);j.useEffect(()=>{if(f.current){f.current=!1;return}const p=Ky();c?p.add(e):p.delete(e),a7(p)},[c,e]);const h=j.useCallback(()=>{u(p=>!p)},[]);return a.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[a.jsxs("button",{onClick:h,"aria-expanded":!c,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${c?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&a.jsx("span",{className:"shrink-0",children:n})]}),a.jsx("div",{className:"accordion-panel","data-open":c?"false":"true",children:a.jsx("div",{className:"accordion-inner",children:l})})]})}function Vw(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function Gw(e){return e>80?"critical":e>50?"elevated":"normal"}function ec({label:e,pct:t,detail:n}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),a.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&a.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),a.jsx("div",{role:"meter","aria-label":`${e} usage — ${Gw(t)}`,"aria-valuenow":Math.round(t),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${Vw(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function o7({sessionId:e}){var h;const[t,n]=j.useState(null),i=j.useCallback(async()=>{try{const p=await we.getSessionUsageLimits(e);n(p)}catch{}},[e]),l=j.useRef(0);if(j.useEffect(()=>{i();const p=setInterval(()=>{l.current+=1,l.current%2===0?i():n(g=>g?{...g}:null)},Iw);return()=>clearInterval(p)},[i]),!t)return null;const c=t.five_hour!==null,u=t.seven_day!==null,f=!c&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!c&&!u&&!f?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&a.jsx(ec,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?By(t.five_hour.resets_at):void 0}),t.seven_day&&a.jsx(ec,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?By(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),a.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&a.jsx("div",{role:"meter","aria-label":`Extra usage — ${Gw(t.extra_usage.utilization)}`,"aria-valuenow":Math.round(t.extra_usage.utilization),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${Vw(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function c7({sessionId:e}){const t=Y(c=>{var u;return(u=c.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=j.useState(0);if(j.useEffect(()=>{if(!t)return;const c=setInterval(()=>n(u=>u+1),Iw);return()=>clearInterval(c)},[t]),!t)return null;const{primary:i,secondary:l}=t;return!i&&!l?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&a.jsx(ec,{label:`${Py(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?Uy(i.resetsAt):void 0}),l&&a.jsx(ec,{label:`${Py(l.windowDurationMins)} Limit`,pct:l.usedPercent,detail:l.resetsAt>0?Uy(l.resetsAt):void 0})]})}function u7({sessionId:e}){const t=Y(i=>{var l;return(l=i.sessions.get(e))==null?void 0:l.codex_token_details}),n=Y(i=>{var l;return((l=i.sessions.get(e))==null?void 0:l.context_used_percent)??0});return t?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Ao(t.inputTokens)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Ao(t.outputTokens)})]}),t.cachedInputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Ao(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Ao(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&a.jsx(ec,{label:"Context",pct:n})]}):null}function d7(e,t){if(t)return{label:"Draft",cls:"text-cc-muted bg-cc-hover"};switch(e){case"OPEN":return{label:"Open",cls:"text-cc-success bg-cc-success/10"};case"MERGED":return{label:"Merged",cls:"text-cc-merged bg-cc-merged/10"};case"CLOSED":return{label:"Closed",cls:"text-cc-error bg-cc-error/10"}}}function f7({pr:e}){const t=d7(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&a.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),a.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&a.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[a.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),a.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),a.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function h7({sessionId:e}){const t=Y(u=>u.sessions.get(e)),n=lc(e),i=Y(u=>u.prStatus.get(e)),l=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),c=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return j.useEffect(()=>{i||!l||!c||we.getPRStatus(l,c).then(u=>{Y.getState().setPRStatus(e,u)}).catch(()=>{})},[e,l,c,i]),!(i!=null&&i.available)||!i.pr?null:a.jsx(f7,{pr:i.pr})}const p7=6e4;function Dp(e,t){switch(e){case"completed":return{label:t||"Done",cls:"text-cc-success bg-cc-success/10"};case"cancelled":return{label:t||"Cancelled",cls:"text-cc-muted bg-cc-hover"};case"started":return{label:t||"In Progress",cls:"text-cc-info bg-cc-info/10"};case"unstarted":return{label:t||"Todo",cls:"text-cc-muted bg-cc-hover"};case"backlog":return{label:t||"Backlog",cls:"text-cc-muted bg-cc-hover"};default:return{label:t||e||"Unknown",cls:"text-cc-muted bg-cc-hover"}}}function m7({sessionId:e}){const t=Y(R=>R.linkedLinearIssues.get(e)),[n,i]=j.useState([]),[l,c]=j.useState(null),[u,f]=j.useState([]),[h,p]=j.useState(""),[g,v]=j.useState(!1),[y,b]=j.useState(!1),[_,k]=j.useState(!1),[E,S]=j.useState(""),[M,C]=j.useState([]),[$,L]=j.useState(!1),T=j.useRef(null);j.useEffect(()=>{we.getLinkedLinearIssue(e).then(R=>{R.issue&&Y.getState().setLinkedLinearIssue(e,R.issue)}).catch(()=>{})},[e]);const H=j.useCallback(async()=>{if(t)try{const R=await we.getLinkedLinearIssue(e,!0);R.issue&&(Y.getState().setLinkedLinearIssue(e,R.issue),R.issue.stateType==="completed"&&b(!0)),R.comments&&i(R.comments),R.assignee!==void 0&&c(R.assignee??null),R.labels&&f(R.labels)}catch{}},[e,t]);j.useEffect(()=>{if(!t)return;H();const R=setInterval(H,p7);return()=>clearInterval(R)},[H,t]),j.useEffect(()=>{if(!_)return;const R=E.trim();if(R.length<2){C([]);return}let oe=!0;L(!0);const J=setTimeout(()=>{we.searchLinearIssues(R,6).then(X=>{oe&&C(X.issues)}).catch(()=>{oe&&C([])}).finally(()=>{oe&&L(!1)})},400);return()=>{oe=!1,clearTimeout(J)}},[E,_]),j.useEffect(()=>{_&&setTimeout(()=>{var R;return(R=T.current)==null?void 0:R.focus()},50)},[_]);async function z(){if(!(!t||!h.trim()||g)){v(!0);try{const R=await we.addLinearComment(t.id,h.trim());i(oe=>[...oe,R.comment]),p("")}catch{}finally{v(!1)}}}async function G(){try{await we.unlinkLinearIssue(e),Y.getState().setLinkedLinearIssue(e,null),i([]),c(null),f([]),b(!1)}catch{}}async function O(R){try{await we.linkLinearIssue(e,R),Y.getState().setLinkedLinearIssue(e,R),k(!1),S(""),C([])}catch{}}if(!t)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Fo,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.jsx("input",{ref:T,type:"text",value:E,onChange:R=>S(R.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),a.jsx("button",{onClick:()=>{k(!1),S(""),C([])},"aria-label":"Close search",className:"w-7 h-7 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),$&&a.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),M.length>0&&a.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:M.map(R=>a.jsxs("button",{onClick:()=>O(R),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:R.identifier}),a.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${Dp(R.stateType,R.stateName).cls}`,children:Dp(R.stateType,R.stateName).label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:R.title})]},R.id))}),E.trim().length>=2&&!$&&M.length===0&&a.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):a.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[a.jsx(Fo,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const I=Dp(t.stateType,t.stateName);return a.jsxs("div",{className:"shrink-0",children:[a.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Fo,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${I.cls}`,children:I.label}),a.jsx("button",{onClick:G,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&a.jsx("span",{children:t.priorityLabel}),t.teamName&&a.jsxs(a.Fragment,{children:[t.priorityLabel&&a.jsx("span",{children:"·"}),a.jsx("span",{children:t.teamName})]}),l&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{children:["@ ",l.name]})]})]}),u.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(R=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${R.color}20`,color:R.color},children:R.name},R.id))})]}),y&&t.stateType==="completed"&&a.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),a.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("button",{onClick:()=>b(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),a.jsx("button",{onClick:async()=>{try{await we.archiveSession(e),Y.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&a.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[a.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(R=>a.jsxs("div",{className:"text-[11px]",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:R.userName}),a.jsx("span",{className:"text-[9px] text-cc-muted",children:r7(new Date(R.createdAt).getTime())})]}),a.jsx("p",{className:"text-cc-muted line-clamp-2",children:R.body})]},R.id))]}),a.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:h,onChange:R=>p(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),z())},placeholder:"Add a comment...","aria-label":"Add a comment",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),a.jsx("button",{onClick:z,disabled:!h.trim()||g,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function g7({sessionId:e}){const t=Y(l=>l.sessions.get(e)),n=lc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?a.jsxs(a.Fragment,{children:[a.jsx(c7,{sessionId:e}),a.jsx(u7,{sessionId:e})]}):a.jsx(o7,{sessionId:e})}function x7({sessionId:e}){const t=Y(p=>p.sessions.get(e)),n=lc(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),l=(t==null?void 0:t.git_ahead)||0,c=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,f=(t==null?void 0:t.total_lines_removed)||0,h=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(l>0||c>0||u>0||f>0)&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[l>0&&a.jsxs("span",{className:"text-cc-success",children:[l,"↑",a.jsx("span",{className:"sr-only",children:" commits ahead"})]}),c>0&&a.jsxs("span",{className:"text-cc-warning",children:[c,"↓",a.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&a.jsxs("span",{className:"text-cc-success",children:["+",u,a.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&a.jsxs("span",{className:"text-cc-error",children:["-",f,a.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),c>0&&h&&a.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{we.gitPull(h).then(p=>{Y.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Vs(new Error(`git pull failed: ${p.output}`))}).catch(p=>Vs(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function v7({sessionId:e}){const t=Y(c=>c.sessionTasks.get(e)||Hw),n=Y(c=>c.sessions.get(e)),i=lc(e),l=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||l?null:a.jsx("div",{className:"px-3 py-2",children:t.length===0?a.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):a.jsx("div",{className:"space-y-0.5",children:t.map(c=>a.jsx(k7,{task:c},c.id))})})}const b7={"usage-limits":g7,"git-branch":x7,"github-pr":h7,"linear-issue":m7,"mcp-servers":K8,tasks:v7};function y7(e,t){const n=Y(i=>i.sessionTasks.get(t)||Hw);if(e==="tasks"&&n.length>0){const i=n.filter(l=>l.status==="completed").length;return a.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function _7({isCodex:e}){const t=Y(p=>p.taskPanelConfig),n=Y(p=>p.toggleSectionEnabled),i=Y(p=>p.moveSectionUp),l=Y(p=>p.moveSectionDown),c=Y(p=>p.resetTaskPanelConfig),u=Y(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const g=Ti.find(v=>v.id===p);return!(!g||g.backends&&!g.backends.includes(f))});return a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((p,g)=>{const v=Ti.find(k=>k.id===p),y=t.enabled[p]??!0,b=g===0,_=g===h.length-1;return a.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${y?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[a.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>i(p),disabled:b,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),a.jsx("button",{onClick:()=>l(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:v.label}),a.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.description})]}),a.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${y?"bg-cc-primary":"bg-cc-hover"}`,title:y?"Hide section":"Show section",role:"switch","aria-checked":y,"data-testid":`toggle-${p}`,children:a.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${y?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),a.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[a.jsx("button",{onClick:()=>c(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),a.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function w7({sectionId:e,sessionId:t,children:n}){var c;const i=((c=Ti.find(u=>u.id===e))==null?void 0:c.label)??e,l=y7(e,t);return a.jsx(l7,{id:e,label:i,badge:l,children:n})}function j7({sessionId:e}){const t=Y(g=>g.sessions.get(e)),n=lc(e),i=Y(g=>g.taskPanelOpen),l=Y(g=>g.setTaskPanelOpen),c=Y(g=>g.taskPanelConfigMode),u=Y(g=>g.taskPanelConfig);if(!i)return null;const f=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",h=f?"codex":"claude",p=u.order.filter(g=>{const v=Ti.find(y=>y.id===g);return!(!v||v.backends&&!v.backends.includes(h))});return a.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:c?"Panel Settings":"Context"}),a.jsx("button",{onClick:()=>{c?Y.getState().setTaskPanelConfigMode(!1):l(!1)},"aria-label":"Close panel",className:"flex items-center justify-center w-8 h-8 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),c?a.jsx(_7,{isCodex:f}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[a.jsx(n7,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var y;const v=b7[g];return v?a.jsx(w7,{sectionId:g,sessionId:e,children:a.jsx(i7,{label:(y=Ti.find(b=>b.id===g))==null?void 0:y.label,children:a.jsx(v,{sessionId:e})})},g):null})]}),a.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:a.jsxs("button",{onClick:()=>Y.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{fillRule:"evenodd",d:"M7.429 1.525a6.593 6.593 0 011.142 0c.036.003.108.036.137.146l.289 1.105c.147.56.55.967.997 1.189.174.086.341.183.501.29.417.278.97.423 1.53.27l1.102-.303c.11-.03.175.016.195.046.219.31.41.641.573.989.014.031.022.11-.059.19l-.815.806c-.411.406-.562.957-.53 1.456a4.588 4.588 0 010 .582c-.032.499.119 1.05.53 1.456l.815.806c.08.08.073.159.059.19a6.494 6.494 0 01-.573.99c-.02.029-.086.074-.195.045l-1.103-.303c-.559-.153-1.112-.008-1.529.27-.16.107-.327.204-.5.29-.449.222-.851.628-.998 1.189l-.289 1.105c-.029.11-.101.143-.137.146a6.613 6.613 0 01-1.142 0c-.036-.003-.108-.037-.137-.146l-.289-1.105c-.147-.56-.55-.967-.997-1.189a4.502 4.502 0 01-.501-.29c-.417-.278-.97-.423-1.53-.27l-1.102.303c-.11.03-.175-.016-.195-.046a6.492 6.492 0 01-.573-.989c-.014-.031-.022-.11.059-.19l.815-.806c.411-.406.562-.957.53-1.456a4.587 4.587 0 010-.582c.032-.499-.119-1.05-.53-1.456l-.815-.806c-.08-.08-.073-.159-.059-.19a6.44 6.44 0 01.573-.99c.02-.029.086-.074.195-.045l1.103.303c.559.153 1.112.008 1.529-.27.16-.107.327-.204.5-.29.449-.222.851-.628.998-1.189l.289-1.105c.029-.11.101-.143.137-.146zM8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",clipRule:"evenodd"})}),"Customize panel"]})})]})]})}function k7({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?a.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:a.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),a.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),a.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&a.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&a.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),a.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function S7({status:e}){return e==="created"?a.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-green-500/20 text-green-400",children:"A"}):e==="deleted"?a.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-red-500/20 text-red-400",children:"D"}):a.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-cc-warning/20 text-cc-warning",children:"M"})}function N7({sessionId:e}){const t=Y(L=>L.sessions.get(e)),n=Y(L=>L.sdkSessions.find(T=>T.sessionId===e)),i=Y(L=>L.diffPanelSelectedFile.get(e)??null),l=Y(L=>L.setDiffPanelSelectedFile),c=Y(L=>L.diffBase),u=Y(L=>L.setDiffBase),f=Y(L=>L.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,g]=j.useState(""),[v,y]=j.useState(!1),[b,_]=j.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[k,E]=j.useState([]),S=Y(L=>L.setGitChangedFilesCount);j.useEffect(()=>{if(!h)return;let L=!1;return we.getChangedFiles(h,c).then(({files:T})=>{if(L)return;const H=`${h}/`,z=T.filter(G=>G.path===h||G.path.startsWith(H)).map(G=>({abs:G.path,rel:G.path.startsWith(H)?G.path.slice(H.length):G.path,status:G.status==="A"||G.status==="?"?"created":G.status==="D"?"deleted":"updated"})).sort((G,O)=>G.rel.localeCompare(O.rel));E(z),S(e,z.length)}).catch(()=>{L||(E([]),S(e,0))}),()=>{L=!0}},[h,c,f,e,S]);const M=k;j.useEffect(()=>{!i&&M.length>0&&l(e,M[0].abs)},[i,M,e,l]),j.useEffect(()=>{var L;i&&(M.some(T=>T.abs===i)||l(e,((L=M[0])==null?void 0:L.abs)??null))},[i,M,e,l]),j.useEffect(()=>{if(!i){g("");return}let L=!1;return y(!0),we.getFileDiff(i,c).then(T=>{L||(g(T.diff),y(!1))}).catch(()=>{L||(g(""),y(!1))}),()=>{L=!0}},[i,c]);const C=j.useCallback(L=>{l(e,L),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,l]),$=j.useMemo(()=>!i||!h?i:i.startsWith(h+"/")?i.slice(h.length+1):i,[i,h]);return h?M.length===0?a.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:a.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"File changes compared to the base will appear here once the agent edits files."})]})]}):a.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[b&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),a.jsxs("div",{className:`
116
+ ${b?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
117
+ fixed sm:relative z-30 sm:z-auto
118
+ ${b?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
119
+ shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
120
+ `,children:[a.jsxs("div",{className:"w-[220px] px-4 py-3 text-[11px] font-semibold text-cc-fg uppercase tracking-wider border-b border-cc-border shrink-0 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),a.jsxs("span",{children:["Changed (",M.length,")"]})]}),a.jsx("button",{onClick:()=>_(!1),className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer sm:hidden",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:M.map(({abs:L,rel:T,status:H})=>a.jsxs("button",{onClick:()=>C(L),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${L===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[a.jsx(S7,{status:H}),a.jsx("span",{className:"truncate leading-snug",children:T})]},L))})]}),a.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&a.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!b&&a.jsx("button",{onClick:()=>_(!0),className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",title:"Show file list",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:$==null?void 0:$.split("/").pop()}),a.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:$})]}),a.jsx("button",{onClick:()=>u(c==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${c==="last-commit"?"default branch":"last commit"} comparison`,children:c==="default-branch"?"vs default branch":"vs last commit"})]}),a.jsx("div",{className:"flex-1 overflow-auto",children:v?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?a.jsx("div",{className:"p-4",children:a.jsx(il,{unifiedDiff:p,fileName:$||void 0,mode:"full"})}):a.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!b&&a.jsxs("button",{onClick:()=>_(!0),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),"Show file list"]}),a.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:a.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function C7(){const e=Y(h=>h.updateInfo),t=Y(h=>h.updateDismissedVersion),n=Y(h=>h.dismissUpdate),[i,l]=j.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const c=async()=>{l(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await we.triggerUpdate(),Y.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),Vs(h),l(!1)}},u=()=>{n(e.latestVersion)},f=i||e.updateInProgress;return a.jsxs("div",{className:"px-4 py-1.5 bg-cc-primary/10 border-b border-cc-primary/20 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.2s_ease-out]",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 2a.75.75 0 0 0-.75.75v3.69L5.78 6.15a.75.75 0 0 0-.96 1.15l2.5 2.08a.75.75 0 0 0 1.08-.12l2-2.5a.75.75 0 1 0-1.17-.94L8.75 6.5V3.75A.75.75 0 0 0 8 3z"})}),a.jsxs("span",{className:"text-xs text-cc-fg",children:[a.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",a.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?a.jsx("button",{onClick:c,disabled:f,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Updating...":"Update & Restart"}):a.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",a.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," ","for auto-updates"]}),a.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function E7({steps:e,error:t,backend:n,onCancel:i}){const l=n==="codex"?"/logo-codex.svg":"/logo.svg",c=e.some(v=>v.status==="in_progress"),u=e.length>0&&e.every(v=>v.status==="done"),f=e.some(v=>v.status==="error")||!!t,h=[...e].reverse().find(v=>v.status==="in_progress"),p=[...e].reverse().find(v=>v.status==="done"),g=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.label)||(p==null?void 0:p.label)||"Preparing...";return a.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-cc-bg/95 backdrop-blur-sm animate-fade-in",children:[a.jsxs("div",{className:"relative mb-8",children:[c&&!f&&a.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),a.jsx("img",{src:l,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${c&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),c&&!f&&a.jsx("div",{className:"absolute -inset-3 z-0",children:a.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:a.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),u&&!f&&a.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),a.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:g}),a.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((v,y)=>a.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${y*60}ms`},children:[a.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[v.status==="in_progress"&&a.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),v.status==="done"&&a.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:a.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.status==="error"&&a.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),a.jsx("span",{className:`text-xs transition-colors duration-200 ${v.status==="in_progress"?"text-cc-fg font-medium":v.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:v.label}),v.detail&&v.status==="in_progress"&&a.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:v.detail})]},v.step))}),t&&a.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:a.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:a.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(f||c)&&i&&a.jsx("button",{onClick:i,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:f?"Dismiss":"Cancel"}),!f&&e.length>0&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:a.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(v=>v.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function T7(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const A7={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function M7(e){const[t,n]=j.useState("installing"),i=j.useRef(null),l=j.useRef(!0);return j.useEffect(()=>(l.current=!0,()=>{l.current=!1,i.current&&clearTimeout(i.current)}),[]),j.useEffect(()=>{if(!e)return;const c=setTimeout(()=>{l.current&&n("restarting")},3e3),u=setTimeout(()=>{l.current&&n("waiting"),f()},5e3);function f(){l.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:T7()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{l.current&&(n("ready"),setTimeout(()=>{l.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(f,1500)})}return()=>{clearTimeout(c),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function Xw({phase:e,className:t}){const n=e==="ready";return a.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[a.jsxs("div",{className:"relative mb-8",children:[!n&&a.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),a.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&a.jsx("div",{className:"absolute -inset-3 z-0",children:a.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:a.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),n&&a.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),a.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:A7[e]}),a.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&a.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>a.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${i*.2}s`}},i))}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:a.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-1000 ease-out",style:{width:n?"100%":e==="waiting"?"75%":e==="restarting"?"40%":"15%"}})})]})}function R7({active:e}){const t=M7(e);return e?a.jsx(Xw,{phase:t,className:"fixed inset-0 z-[100]"}):null}function iR({phase:e}){return a.jsx(Xw,{phase:e,className:"absolute inset-0"})}function L7(){const e=Y(k=>k.dockerUpdateDialogOpen),t=Y(k=>k.setDockerUpdateDialogOpen),[n,i]=j.useState("prompt"),[l,c]=j.useState(!1),[u,f]=j.useState(null),h=j.useRef(null);if(j.useEffect(()=>{e&&we.getSettings().then(k=>{c(k.dockerAutoUpdate),k.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),j.useEffect(()=>{if(n!=="pulling"){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{we.getImageStatus("the-companion:latest").then(k=>{f(k),k.status==="ready"?i("done"):k.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function p(){i("pulling"),we.pullImage("the-companion:latest").then(k=>{k.state&&f(k.state)}).catch(()=>{i(k=>k==="pulling"?"error":k)})}function g(){p()}function v(){b()}function y(){b()}function b(){i("prompt"),f(null),t(!1)}async function _(){const k=!l;c(k);try{await we.updateSettings({dockerAutoUpdate:k})}catch{c(!k)}}return a.jsx("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-black/50 animate-fade-in","data-testid":"docker-update-dialog",children:a.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-md mx-4 overflow-hidden",children:[n==="prompt"&&a.jsxs("div",{className:"p-6",children:[a.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),a.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),a.jsxs("button",{type:"button",onClick:_,className:"w-full flex items-center justify-between px-3 py-3 rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer mb-5",children:[a.jsx("span",{children:"Always update Docker image automatically"}),a.jsx("span",{role:"switch","aria-checked":l,"aria-label":"Always update Docker image automatically",className:`relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ${l?"bg-cc-primary":"bg-cc-border"}`,children:a.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${l?"translate-x-4":"translate-x-0"}`})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),a.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.jsx("p",{className:"text-sm text-cc-muted mb-3",children:"Pulling the-companion:latest"}),(u==null?void 0:u.progress)&&u.progress.length>0&&a.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[160px] overflow-auto whitespace-pre-wrap","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
121
+ `)})]}),n==="done"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&a.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&a.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
122
+ `)}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),a.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function sR({phase:e}){return a.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:a.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&a.jsxs("div",{className:"p-5",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),a.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[a.jsx("span",{children:"Always update automatically"}),a.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:a.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
123
+ Layer 1/5: abc123 downloading
124
+ Layer 2/5: def456 complete`})]}),e==="done"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const zp=["welcome","claude","codex","done"],Zy='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function zm(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function D7({onComplete:e}){const[t,n]=j.useState("welcome"),[i,l]=j.useState(""),[c,u]=j.useState(""),[f,h]=j.useState(!1),[p,g]=j.useState(""),[v,y]=j.useState(!1),[b,_]=j.useState(!1),[k,E]=j.useState(zm),S=j.useRef(null);j.useEffect(()=>{k||requestAnimationFrame(()=>E(!0))},[k]),j.useEffect(()=>{const I=S.current;if(!I)return;function R(J){if(J.key==="Escape"){J.preventDefault();return}if(J.key!=="Tab")return;const X=I.querySelectorAll(Zy);if(X.length===0)return;const B=X[0],U=X[X.length-1];J.shiftKey?document.activeElement===B&&(J.preventDefault(),U.focus()):document.activeElement===U&&(J.preventDefault(),B.focus())}document.addEventListener("keydown",R);const oe=I.querySelector(Zy);return oe==null||oe.focus(),()=>document.removeEventListener("keydown",R)},[t]);const M=j.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:i.trim()}),y(!0),n("codex")}catch(I){g(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[i]),C=j.useCallback(async()=>{h(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await L()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(I){g(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),$=j.useCallback(async()=>{h(!0),g("");try{await we.updateSettings({openaiApiKey:c.trim()}),_(!0),await L()}catch(I){g(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[c]),L=j.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),T=j.useCallback(()=>{e()},[e]),H=j.useCallback(async()=>{await L(),e()},[L,e]),z=j.useCallback(I=>{g(""),n(I)},[]),G=zp.indexOf(t),O=zm();return al.createPortal(a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:k?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),a.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:k?"translateY(0)":"translateY(12px)",opacity:k?1:0,transition:O?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&a.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${G+1} of ${zp.length-1}`,children:zp.slice(0,3).map((I,R)=>a.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:R===G?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:R<=G?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:R<=G?1:.5}},I))}),a.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&a.jsx(z7,{onSetupClaude:()=>z("claude"),onSetupCodex:()=>z("codex")}),t==="claude"&&a.jsx(O7,{token:i,onTokenChange:l,onSave:M,onSkip:()=>z("codex"),saving:f,error:p}),t==="codex"&&a.jsx(B7,{apiKey:c,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:$,onSkip:()=>L(),onBack:()=>z("claude"),saving:f,error:p}),t==="done"&&a.jsx(U7,{claudeConfigured:v,codexConfigured:b,onDone:T})]}),t==="welcome"&&a.jsx("button",{onClick:H,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function z7({onSetupClaude:e,onSetupCodex:t}){return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),a.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),a.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function O7({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:l,error:c}){const u=j.useRef(null);j.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(Yw,{text:"claude setup-token"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),a.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&a.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:c})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:n,disabled:l,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:l?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:l?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function B7({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:l,onBack:c,saving:u,error:f}){const[h,p]=j.useState(!1),g="codex-auth-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx(Yw,{text:"codex --login"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&a.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),a.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:a.jsx("div",{className:"accordion-inner",children:a.jsxs("div",{className:"mt-3",children:[a.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),a.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?g:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:l,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function U7({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,l=zm(),[c,u]=j.useState(l);return j.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),a.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:l?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?a.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):a.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),a.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&a.jsx("span",{className:"block",children:"Codex is ready."}),a.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),a.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function Yw({text:e}){const[t,n]=j.useState(!1),i=j.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return a.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?a.jsxs(a.Fragment,{children:[a.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const P7=j.lazy(()=>Xn(()=>import("./Playground-BV3k0RbV.js"),[]).then(e=>({default:e.Playground}))),$7=j.lazy(()=>Xn(()=>import("./SettingsPage-D1fPCL19.js"),[]).then(e=>({default:e.SettingsPage}))),F7=j.lazy(()=>Xn(()=>import("./IntegrationsPage-CTMRnbQS.js"),[]).then(e=>({default:e.IntegrationsPage}))),H7=j.lazy(()=>Xn(()=>import("./LinearSettingsPage-C9nok1qi.js"),[]).then(e=>({default:e.LinearSettingsPage}))),I7=j.lazy(()=>Xn(()=>import("./LinearOAuthSettingsPage-CgQFMIgr.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),q7=j.lazy(()=>Xn(()=>import("./TailscalePage-D06cyvyC.js"),[]).then(e=>({default:e.TailscalePage}))),V7=j.lazy(()=>Xn(()=>import("./PromptsPage-CFojqNKP.js"),[]).then(e=>({default:e.PromptsPage}))),G7=j.lazy(()=>Xn(()=>Promise.resolve().then(()=>M8),void 0).then(e=>({default:e.EnvManager}))),X7=j.lazy(()=>Xn(()=>import("./SandboxManager-CrVQ-VU_.js"),[]).then(e=>({default:e.SandboxManager}))),Y7=j.lazy(()=>Xn(()=>import("./CronManager-EGwLJONv.js"),[]).then(e=>({default:e.CronManager}))),W7=j.lazy(()=>Xn(()=>import("./AgentsPage-DCFhrJ28.js"),[]).then(e=>({default:e.AgentsPage}))),Q7=j.lazy(()=>Xn(()=>import("./RunsPage-DUJ1QUSa.js"),[]).then(e=>({default:e.RunsPage})));function yr(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function K7(){return j.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function Z7(){const e=Y(U=>U.isAuthenticated),t=Y(U=>U.darkMode),n=Y(U=>U.currentSessionId),i=Y(U=>U.sidebarOpen),l=Y(U=>U.taskPanelOpen),c=Y(U=>U.homeResetKey),u=Y(U=>U.activeTab),f=Y(U=>U.sessionCreating),h=Y(U=>U.sessionCreatingBackend),p=Y(U=>U.creationProgress),g=Y(U=>U.creationError),v=Y(U=>U.updateOverlayActive),y=K7(),b=j.useMemo(()=>Zm(y),[y]),_=b.page==="settings",k=b.page==="prompts",E=b.page==="integrations",S=b.page==="integration-linear",M=b.page==="integration-linear-oauth",C=b.page==="integration-tailscale",$=b.page==="environments",L=b.page==="sandboxes",T=b.page==="scheduled",H=b.page==="agents"||b.page==="agent-detail",z=b.page==="runs",G=b.page==="session"||b.page==="home";j.useEffect(()=>{P3(y||"#/")},[y]),j.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const O=j.useRef(Y.getState().currentSessionId);j.useEffect(()=>{if(O.current!==null&&b.page==="home"){Jm(O.current,!0),O.current=null;return}if(O.current=null,b.page==="session"){const U=Y.getState();U.currentSessionId!==b.sessionId&&U.setCurrentSession(b.sessionId),nc(b.sessionId)}else if(b.page==="home"){const U=Y.getState();U.currentSessionId!==null&&U.setCurrentSession(null)}},[b]);const I=Y(U=>n?U.changedFilesTick.get(n)??0:0),R=Y(U=>U.diffBase),oe=Y(U=>U.setGitChangedFilesCount),J=Y(U=>{var Z,me;return n&&(((Z=U.sessions.get(n))==null?void 0:Z.cwd)||((me=U.sdkSessions.find(D=>D.sessionId===n))==null?void 0:me.cwd))||null});j.useEffect(()=>{if(!n||!J)return;let U=!1;return we.getChangedFiles(J,R).then(({files:Z})=>{if(U)return;const me=`${J}/`,D=Z.filter(P=>P.path===J||P.path.startsWith(me)).length;oe(n,D)}).catch(()=>{}),()=>{U=!0}},[n,J,R,I,oe]),j.useEffect(()=>{const U=()=>{we.checkForUpdate().then(me=>{Y.getState().setUpdateInfo(me)}).catch(()=>{})};U();const Z=setInterval(U,300*1e3);return()=>clearInterval(Z)},[]);const[X,B]=j.useState(!1);return j.useEffect(()=>{e&&we.getSettings().then(U=>{U.publicUrl&&Y.getState().setPublicUrl(U.publicUrl),U.onboardingCompleted||B(!0)}).catch(()=>{})},[e]),j.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&(localStorage.removeItem("companion_docker_prompt_pending"),Y.getState().setDockerUpdateDialogOpen(!0))},[]),e?b.page==="playground"?a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(P7,{})}):a.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>Y.getState().setSidebarOpen(!1)}),a.jsx("div",{className:`
125
+ fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
126
+ h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
127
+ ${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
128
+ overflow-hidden
129
+ `,children:a.jsx(iC,{})}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[a.jsx(E8,{}),a.jsx(C7,{}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[_&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx($7,{embedded:!0})})}),k&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(V7,{embedded:!0})})}),E&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(F7,{embedded:!0})})}),S&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(H7,{embedded:!0})})}),M&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(I7,{embedded:!0})})}),C&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(q7,{embedded:!0})})}),$&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(G7,{embedded:!0})})}),L&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(X7,{embedded:!0})})}),T&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(Y7,{embedded:!0})})}),H&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(W7,{route:b})})}),z&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(j.Suspense,{fallback:a.jsx(yr,{}),children:a.jsx(Q7,{})})}),G&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?a.jsx(N7,{sessionId:n}):a.jsx(N8,{sessionId:n}):a.jsx(q8,{},c)}),f&&p&&p.length>0&&a.jsx(E7,{steps:p,error:g,backend:h??void 0,onCancel:()=>Y.getState().clearCreation()})]})]})]}),n&&G&&a.jsxs(a.Fragment,{children:[!l&&a.jsxs("button",{type:"button",onClick:()=>Y.getState().setTaskPanelOpen(!0),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 z-30 items-center gap-1 rounded-l-lg border border-r-0 border-cc-border bg-cc-card/95 backdrop-blur px-2 py-2 text-[11px] text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Open context panel",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v11a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 13.5v-11zm2 .5v10h6V3H5z"})}),a.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),l&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>Y.getState().setTaskPanelOpen(!1)}),a.jsx("div",{className:`
130
+ fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
131
+ h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
132
+ ${l?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
133
+ overflow-hidden
134
+ `,children:a.jsx(j7,{sessionId:n})})]}),a.jsx(R7,{active:v}),a.jsx(L7,{}),X&&a.jsx(D7,{onComplete:()=>B(!1)})]}):a.jsx(V3,{})}class J7 extends j.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Vs(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:a.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[a.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),a.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),a.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}U3();ck.createRoot(document.getElementById("root")).render(a.jsx(j.StrictMode,{children:a.jsx(J7,{children:a.jsx(Z7,{})})}));Xn(()=>import("./sw-register-BibwRdvC.js"),[]).catch(()=>{});export{g8 as A,rR as B,N8 as C,il as D,nR as E,L8 as F,f7 as G,Fo as L,CM as M,i8 as P,E7 as S,l5 as T,C7 as U,Xn as _,we as a,mp as b,iR as c,sR as d,OM as e,BM as f,B3 as g,C8 as h,c7 as i,a as j,u7 as k,ps as l,Ka as m,Jm as n,Ho as o,Z8 as p,Wu as q,j as r,tR as s,r7 as t,Y as u,tc as v,al as w,Iy as x,zw as y,e8 as z};