@hellcoder/companion 0.125.0 → 0.126.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 (29) hide show
  1. package/dist/assets/{AgentsPage-0Fi6tbQN.js → AgentsPage-DuPncpk1.js} +1 -1
  2. package/dist/assets/{CronManager-DNN709nr.js → CronManager-DCmtUDzd.js} +1 -1
  3. package/dist/assets/{DashboardPage-6cNRrqGQ.js → DashboardPage-CYELiWmp.js} +1 -1
  4. package/dist/assets/{IntegrationsPage-DrE-8KPE.js → IntegrationsPage-BR2Z-pCf.js} +1 -1
  5. package/dist/assets/{LinearOAuthSettingsPage-Czi_NsX1.js → LinearOAuthSettingsPage-InO6EwYe.js} +1 -1
  6. package/dist/assets/{LinearSettingsPage-C1RHlPwX.js → LinearSettingsPage-D8G4AAY3.js} +1 -1
  7. package/dist/assets/{MagicUIDashboard-BOZc4rKn.js → MagicUIDashboard-F0yTxNmY.js} +1 -1
  8. package/dist/assets/{MagicUIView-BVM8CqGg.js → MagicUIView-1wNBb6FU.js} +1 -1
  9. package/dist/assets/{Playground-DWAal5bL.js → Playground-CZoI80Za.js} +1 -1
  10. package/dist/assets/{PromptsPage-D2YI_-95.js → PromptsPage-COKY3vTB.js} +1 -1
  11. package/dist/assets/{RunsPage-dn5rSkPu.js → RunsPage-uiW4-c8p.js} +1 -1
  12. package/dist/assets/{SandboxManager-vWbQKeLT.js → SandboxManager-Doc50lAB.js} +1 -1
  13. package/dist/assets/{SettingsPage-CrV1Tb8F.js → SettingsPage-B8tXQ_Xt.js} +1 -1
  14. package/dist/assets/{TailscalePage-ba0g8QT1.js → TailscalePage-TH3Seutc.js} +1 -1
  15. package/dist/assets/index-DduNX1Gc.js +142 -0
  16. package/dist/assets/{sw-register-BBun0drK.js → sw-register-C-YDyat6.js} +1 -1
  17. package/dist/index.html +1 -1
  18. package/dist/sw.js +1 -1
  19. package/package.json +1 -1
  20. package/server/cli-launcher.ts +2 -0
  21. package/server/routes.test.ts +23 -0
  22. package/server/routes.ts +1 -0
  23. package/server/session-store.ts +2 -0
  24. package/server/ws-bridge-persist.test.ts +41 -0
  25. package/server/ws-bridge-persist.ts +17 -0
  26. package/server/ws-bridge-types.ts +6 -0
  27. package/server/ws-bridge.test.ts +122 -0
  28. package/server/ws-bridge.ts +11 -0
  29. package/dist/assets/index-e4RnFbra.js +0 -142
@@ -0,0 +1,142 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-CZoI80Za.js","assets/MagicUIDashboard-F0yTxNmY.js","assets/MagicUIView-1wNBb6FU.js"])))=>i.map(i=>d[i]);
2
+ var fM=Object.defineProperty;var pM=(e,t,n)=>t in e?fM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j_=(e,t,n)=>pM(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const mM="modulepreload",gM=function(e){return"/"+e},N_={},Wn=function(t,n,i){let a=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 h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=u(n.map(p=>{if(p=gM(p),p in N_)return;N_[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":mM,g||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),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 o(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};function kx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jm={exports:{}},Bc={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var C_;function xM(){if(C_)return Bc;C_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var h in a)h!=="key"&&(o[h]=a[h])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:o}}return Bc.Fragment=t,Bc.jsx=n,Bc.jsxs=n,Bc}var E_;function vM(){return E_||(E_=1,Jm.exports=xM()),Jm.exports}var l=vM(),eg={exports:{}},Je={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var T_;function yM(){if(T_)return Je;T_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.for("react.view_transition"),b=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function C(B,oe,ye){this.props=B,this.context=oe,this.refs=S,this.updater=ye||k}C.prototype.isReactComponent={},C.prototype.setState=function(B,oe){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,oe,"setState")},C.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function T(){}T.prototype=C.prototype;function R(B,oe,ye){this.props=B,this.context=oe,this.refs=S,this.updater=ye||k}var A=R.prototype=new T;A.constructor=R,N(A,C.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function P(){}var z={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function F(B,oe,ye){var je=ye.ref;return{$$typeof:e,type:B,key:oe,ref:je!==void 0?je:null,props:ye}}function q(B,oe){return F(B.type,oe,B.props)}function L(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function de(B){var oe={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ye){return oe[ye]})}var X=/\/+/g;function V(B,oe){return typeof B=="object"&&B!==null&&B.key!=null?de(""+B.key):oe.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(P,P):(B.status="pending",B.then(function(oe){B.status==="pending"&&(B.status="fulfilled",B.value=oe)},function(oe){B.status==="pending"&&(B.status="rejected",B.reason=oe)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function H(B,oe,ye,je,Ee){var Be=typeof B;(Be==="undefined"||Be==="boolean")&&(B=null);var Oe=!1;if(B===null)Oe=!0;else switch(Be){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(B.$$typeof){case e:case t:Oe=!0;break;case g:return Oe=B._init,H(Oe(B._payload),oe,ye,je,Ee)}}if(Oe)return Ee=Ee(B),Oe=je===""?"."+V(B,0):je,O(Ee)?(ye="",Oe!=null&&(ye=Oe.replace(X,"$&/")+"/"),H(Ee,oe,ye,"",function(It){return It})):Ee!=null&&(L(Ee)&&(Ee=q(Ee,ye+(Ee.key==null||B&&B.key===Ee.key?"":(""+Ee.key).replace(X,"$&/")+"/")+Oe)),oe.push(Ee)),1;Oe=0;var Te=je===""?".":je+":";if(O(B))for(var Re=0;Re<B.length;Re++)je=B[Re],Be=Te+V(je,Re),Oe+=H(je,oe,ye,Be,Ee);else if(Re=_(B),typeof Re=="function")for(B=Re.call(B),Re=0;!(je=B.next()).done;)je=je.value,Be=Te+V(je,Re++),Oe+=H(je,oe,ye,Be,Ee);else if(Be==="object"){if(typeof B.then=="function")return H(G(B),oe,ye,je,Ee);throw oe=String(B),Error("Objects are not valid as a React child (found: "+(oe==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":oe)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function ae(B,oe,ye){if(B==null)return B;var je=[],Ee=0;return H(B,je,"","",function(Be){return oe.call(ye,Be,Ee++)}),je}function _e(B){if(B._status===-1){var oe=B._result,ye=oe();ye.then(function(je){(B._status===0||B._status===-1)&&(B._status=1,B._result=je,ye.status===void 0&&(ye.status="fulfilled",ye.value=je))},function(je){(B._status===0||B._status===-1)&&(B._status=2,B._result=je,ye.status===void 0&&(ye.status="rejected",ye.reason=je))}),B._status===-1&&(B._status=0,B._result=ye)}if(B._status===1)return B._result.default;throw B._result}var E=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var oe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(oe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)};function Ne(B){var oe=z.T,ye={};ye.types=oe!==null?oe.types:null,z.T=ye;try{var je=B(),Ee=z.S;Ee!==null&&Ee(ye,je),typeof je=="object"&&je!==null&&typeof je.then=="function"&&je.then(P,E)}catch(Be){E(Be)}finally{oe!==null&&ye.types!==null&&(oe.types=ye.types),z.T=oe}}function Ce(B){var oe=z.T;if(oe!==null){var ye=oe.types;ye===null?oe.types=[B]:ye.indexOf(B)===-1&&ye.push(B)}else Ne(Ce.bind(null,B))}var $={map:ae,forEach:function(B,oe,ye){ae(B,function(){oe.apply(this,arguments)},ye)},count:function(B){var oe=0;return ae(B,function(){oe++}),oe},toArray:function(B){return ae(B,function(oe){return oe})||[]},only:function(B){if(!L(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Je.Activity=v,Je.Children=$,Je.Component=C,Je.Fragment=n,Je.Profiler=a,Je.PureComponent=R,Je.StrictMode=i,Je.Suspense=f,Je.ViewTransition=y,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Je.__COMPILER_RUNTIME={__proto__:null,c:function(B){return z.H.useMemoCache(B)}},Je.addTransitionType=Ce,Je.cache=function(B){return function(){return B.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(B,oe,ye){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var je=N({},B.props),Ee=B.key;if(oe!=null)for(Be in oe.key!==void 0&&(Ee=""+oe.key),oe)!K.call(oe,Be)||Be==="key"||Be==="__self"||Be==="__source"||Be==="ref"&&oe.ref===void 0||(je[Be]=oe[Be]);var Be=arguments.length-2;if(Be===1)je.children=ye;else if(1<Be){for(var Oe=Array(Be),Te=0;Te<Be;Te++)Oe[Te]=arguments[Te+2];je.children=Oe}return F(B.type,Ee,je)},Je.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},Je.createElement=function(B,oe,ye){var je,Ee={},Be=null;if(oe!=null)for(je in oe.key!==void 0&&(Be=""+oe.key),oe)K.call(oe,je)&&je!=="key"&&je!=="__self"&&je!=="__source"&&(Ee[je]=oe[je]);var Oe=arguments.length-2;if(Oe===1)Ee.children=ye;else if(1<Oe){for(var Te=Array(Oe),Re=0;Re<Oe;Re++)Te[Re]=arguments[Re+2];Ee.children=Te}if(B&&B.defaultProps)for(je in Oe=B.defaultProps,Oe)Ee[je]===void 0&&(Ee[je]=Oe[je]);return F(B,Be,Ee)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(B){return{$$typeof:h,render:B}},Je.isValidElement=L,Je.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:_e}},Je.memo=function(B,oe){return{$$typeof:p,type:B,compare:oe===void 0?null:oe}},Je.startTransition=Ne,Je.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Je.use=function(B){return z.H.use(B)},Je.useActionState=function(B,oe,ye){return z.H.useActionState(B,oe,ye)},Je.useCallback=function(B,oe){return z.H.useCallback(B,oe)},Je.useContext=function(B){return z.H.useContext(B)},Je.useDebugValue=function(){},Je.useDeferredValue=function(B,oe){return z.H.useDeferredValue(B,oe)},Je.useEffect=function(B,oe){return z.H.useEffect(B,oe)},Je.useEffectEvent=function(B){return z.H.useEffectEvent(B)},Je.useId=function(){return z.H.useId()},Je.useImperativeHandle=function(B,oe,ye){return z.H.useImperativeHandle(B,oe,ye)},Je.useInsertionEffect=function(B,oe){return z.H.useInsertionEffect(B,oe)},Je.useLayoutEffect=function(B,oe){return z.H.useLayoutEffect(B,oe)},Je.useMemo=function(B,oe){return z.H.useMemo(B,oe)},Je.useOptimistic=function(B,oe){return z.H.useOptimistic(B,oe)},Je.useReducer=function(B,oe,ye){return z.H.useReducer(B,oe,ye)},Je.useRef=function(B){return z.H.useRef(B)},Je.useState=function(B){return z.H.useState(B)},Je.useSyncExternalStore=function(B,oe,ye){return z.H.useSyncExternalStore(B,oe,ye)},Je.useTransition=function(){return z.H.useTransition()},Je.version="19.3.1",Je}var M_;function jx(){return M_||(M_=1,eg.exports=yM()),eg.exports}var j=jx();const ch=kx(j);var tg={exports:{}},Ic={},ng={exports:{}},sg={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var A_;function bM(){return A_||(A_=1,(function(e){function t(G,H){var ae=G.length;G.push(H);e:for(;0<ae;){var _e=ae-1>>>1,E=G[_e];if(0<a(E,H))G[_e]=H,G[ae]=E,ae=_e;else break e}}function n(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var H=G[0],ae=G.pop();if(ae!==H){G[0]=ae;e:for(var _e=0,E=G.length,Ne=E>>>1;_e<Ne;){var Ce=2*(_e+1)-1,$=G[Ce],B=Ce+1,oe=G[B];if(0>a($,ae))B<E&&0>a(oe,$)?(G[_e]=oe,G[B]=ae,_e=B):(G[_e]=$,G[Ce]=ae,_e=Ce);else if(B<E&&0>a(oe,ae))G[_e]=oe,G[B]=ae,_e=B;else break e}}return H}function a(G,H){var ae=G.sortIndex-H.sortIndex;return ae!==0?ae:G.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],p=[],g=1,v=null,y=3,b=!1,_=!1,k=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function R(G){for(var H=n(p);H!==null;){if(H.callback===null)i(p);else if(H.startTime<=G)i(p),H.sortIndex=H.expirationTime,t(f,H);else break;H=n(p)}}function A(G){if(k=!1,R(G),!_)if(n(f)!==null)_=!0,O||(O=!0,L());else{var H=n(p);H!==null&&V(A,H.startTime-G)}}var O=!1,P=-1,z=5,K=-1;function F(){return N?!0:!(e.unstable_now()-K<z)}function q(){if(N=!1,O){var G=e.unstable_now();K=G;var H=!0;try{e:{_=!1,k&&(k=!1,C(P),P=-1),b=!0;var ae=y;try{t:{for(R(G),v=n(f);v!==null&&!(v.expirationTime>G&&F());){var _e=v.callback;if(typeof _e=="function"){v.callback=null,y=v.priorityLevel;var E=_e(v.expirationTime<=G);if(G=e.unstable_now(),typeof E=="function"){v.callback=E,R(G),H=!0;break t}v===n(f)&&i(f),R(G)}else i(f);v=n(f)}if(v!==null)H=!0;else{var Ne=n(p);Ne!==null&&V(A,Ne.startTime-G),H=!1}}break e}finally{v=null,y=ae,b=!1}H=void 0}}finally{H?L():O=!1}}}var L;if(typeof T=="function")L=function(){T(q)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,X=de.port2;de.port1.onmessage=q,L=function(){X.postMessage(null)}}else L=function(){S(q,0)};function V(G,H){P=S(function(){G(e.unstable_now())},H)}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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(G){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var ae=y;y=H;try{return G()}finally{y=ae}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(G,H){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var ae=y;y=G;try{return H()}finally{y=ae}},e.unstable_scheduleCallback=function(G,H,ae){var _e=e.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?_e+ae:_e):ae=_e,G){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=ae+E,G={id:g++,callback:H,priorityLevel:G,startTime:ae,expirationTime:E,sortIndex:-1},ae>_e?(G.sortIndex=ae,t(p,G),n(f)===null&&G===n(p)&&(k?(C(P),P=-1):k=!0,V(A,ae-_e))):(G.sortIndex=E,t(f,G),_||b||(_=!0,O||(O=!0,L()))),G},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(G){var H=y;return function(){var ae=y;y=H;try{return G.apply(this,arguments)}finally{y=ae}}}})(sg)),sg}var R_;function _M(){return R_||(R_=1,ng.exports=bM()),ng.exports}var ig={exports:{}},Fn={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var O_;function wM(){if(O_)return Fn;O_=1;var e=jx();function t(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)v+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+v+" 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},a=Symbol.for("react.portal"),o=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function h(g,v,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:b==null?null:b===u?u:""+b,children:g,containerInfo:v,implementation:y}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(g,v){if(g==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Fn.browser=function(g){return{$$typeof:o,_reason:g}},Fn.createPortal=function(g,v){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(t(299));return h(g,v,null,y)},Fn.flushSync=function(g){var v=f.T,y=i.p;try{if(f.T=null,i.p=2,g)return g()}finally{f.T=v,i.p=y,i.d.f()}},Fn.preconnect=function(g,v){typeof g=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,i.d.C(g,v))},Fn.prefetchDNS=function(g){typeof g=="string"&&i.d.D(g)},Fn.preinit=function(g,v){if(typeof g=="string"&&v&&typeof v.as=="string"){var y=v.as,b=p(y,v.crossOrigin),_=typeof v.integrity=="string"?v.integrity:void 0,k=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;y==="style"?i.d.S(g,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:b,integrity:_,fetchPriority:k}):y==="script"&&i.d.X(g,{crossOrigin:b,integrity:_,fetchPriority:k,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Fn.preinitModule=function(g,v){if(typeof g=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var y=p(v.as,v.crossOrigin);i.d.M(g,{crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}}else v==null&&i.d.M(g)},Fn.preload=function(g,v){if(typeof g=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var y=v.as,b=p(y,v.crossOrigin);i.d.L(g,y,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Fn.preloadModule=function(g,v){if(typeof g=="string")if(v){var y=p(v.as,v.crossOrigin);i.d.m(g,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:y,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0})}else i.d.m(g)},Fn.requestFormReset=function(g){i.d.r(g)},Fn.unstable_batchedUpdates=function(g,v){return g(v)},Fn.useFormState=function(g,v,y){return f.H.useFormState(g,v,y)},Fn.useFormStatus=function(){return f.H.useHostTransitionStatus()},Fn.version="19.3.1",Fn}var L_;function oS(){if(L_)return ig.exports;L_=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(),ig.exports=wM(),ig.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var D_;function SM(){if(D_)return Ic;D_=1;var e=_M(),t=jx(),n=oS();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){for(var r=s,c=r;c&&!c.alternate;)r=c,(r.flags&4098)!==0&&(s=r.return),c=r.return;for(;r.return;)r=r.return;return r.tag===3?s:null}function u(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function h(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(i(188))}function p(s){var r=s.alternate;if(!r){if(r=o(s),r===null)throw Error(i(188));return r!==s?null:s}for(var c=s,d=r;;){var m=c.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){c=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===c)return f(m),s;if(x===d)return f(m),r;x=x.sibling}throw Error(i(188))}if(c.return!==d.return)c=m,d=x;else{for(var w=!1,M=m.child;M;){if(M===c){w=!0,c=m,d=x;break}if(M===d){w=!0,d=m,c=x;break}M=M.sibling}if(!w){for(M=x.child;M;){if(M===c){w=!0,c=x,d=m;break}if(M===d){w=!0,d=x,c=m;break}M=M.sibling}if(!w)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:r}function g(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=g(s),r!==null)return r;s=s.sibling}return null}function v(s,r,c,d,m,x){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&c(s,d,m,x)||(s.tag!==22||s.memoizedState===null)&&(r||s.tag!==5&&s.tag!==27)&&v(s.child,r,c,d,m,x))return!0;s=s.sibling}return!1}function y(s){for(s=s.return;s!==null;){if(s.tag===3||s.tag===5||s.tag===27)return s;s=s.return}return null}function b(s){var r=!1;for(s=s.return;s!==null&&(s.tag===4&&(r=!0),!(s.tag===3||s.tag===5||s.tag===27));)s=s.return;return r}function _(s){var r=[null,null],c=y(s);return c===null||k(r,s,c.child,{foundSelf:!1}),r}function k(s,r,c,d){for(;c!==null;){if(c===r)d.foundSelf=!0;else if(c.tag===5||c.tag===27||c.tag===6){if(d.foundSelf)return s[1]=c,!0;s[0]=c}else if((c.tag!==22||c.memoizedState===null)&&k(s,r,c.child,d))return!0;c=c.sibling}return!1}function N(s){switch(s.tag){case 5:case 27:case 6:return s.stateNode;case 3:return s.stateNode.containerInfo;default:throw Error(i(559))}}var S=null,C=null;function T(s,r,c){return s===c?!0:s===r?(S=s,!0):!1}function R(s,r,c){return s===c?(C=s,!1):s===r?(C!==null&&(S=s),!0):!1}function A(s){if(s===null)return null;do s=s===null?null:s.return;while(s&&s.tag!==5&&s.tag!==27&&s.tag!==3);return s||null}function O(s,r,c){for(var d=0,m=s;m;m=c(m))d++;m=0;for(var x=r;x;x=c(x))m++;for(;0<d-m;)s=c(s),d--;for(;0<m-d;)r=c(r),m--;for(;d--;){if(s===r||r!==null&&s===r.alternate)return s;s=c(s),r=c(r)}return null}var P=Object.assign,z=Symbol.for("react.element"),K=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),V=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),_e=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),Ne=Symbol.for("react.activity"),Ce=Symbol.for("react.legacy_hidden"),$=Symbol.for("react.memo_cache_sentinel"),B=Symbol.for("react.view_transition"),oe=Symbol.for("react.recoverable"),ye=Symbol.iterator;function je(s){return s===null||typeof s!="object"?null:(s=ye&&s[ye]||s["@@iterator"],typeof s=="function"?s:null)}var Ee=Symbol.for("react.client.reference");function Be(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Ee?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case q:return"Fragment";case de:return"Profiler";case L:return"StrictMode";case H:return"Suspense";case ae:return"SuspenseList";case Ne:return"Activity";case B:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case F:return"Portal";case V:return s.displayName||"Context";case X:return(s._context.displayName||"Context")+".Consumer";case G:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case _e:return r=s.displayName||null,r!==null?r:Be(s.type)||"Memo";case E:r=s._payload,s=s._init;try{return Be(s(r))}catch{}}return null}var Oe=Array.isArray,Te=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,It={pending:!1,data:null,method:null,action:null},vn=[],Gt=-1;function St(s){return{current:s}}function wt(s){0>Gt||(s.current=vn[Gt],vn[Gt]=null,Gt--)}function Ze(s,r){Gt++,vn[Gt]=s.current,s.current=r}var xt=St(null),Kt=St(null),se=St(null),ke=St(null);function We(s,r){switch(Ze(se,r),Ze(Kt,s),Ze(xt,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?Lb(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=Lb(r),s=Db(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}wt(xt),Ze(xt,s)}function nt(){wt(xt),wt(Kt),wt(se)}function Zt(s){var r=s.memoizedState;r!==null&&(Kl._currentValue=r.memoizedState,Ze(ke,s)),r=xt.current;var c=Db(r,s.type);r!==c&&(Ze(Kt,s),Ze(xt,c))}function Ft(s){Kt.current===s&&(wt(xt),wt(Kt)),ke.current===s&&(wt(ke),Kl._currentValue=It)}var ce,U;function fe(s){if(ce===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);ce=r&&r[1]||"",U=-1<c.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+ce+s+U}var Ae=!1;function tt(s,r){if(!s||Ae)return"";Ae=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(r){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(Me){var Z=Me}Reflect.construct(s,[],pe)}else{try{pe.call()}catch(Me){Z=Me}pe=!1;try{var ie=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),pe=!0,new s}finally{pe&&(ie!==void 0?Object.defineProperty(s.prototype,"props",ie):delete s.prototype.props)}}}else{try{throw Error()}catch(Me){Z=Me}(pe=s())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(Me){if(Me&&Z&&typeof Me.stack=="string")return[Me.stack,Z.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],M=x[1];if(w&&M){var I=w.split(`
45
+ `),ee=M.split(`
46
+ `);for(m=d=0;d<I.length&&!I[d].includes("DetermineComponentFrameRoot");)d++;for(;m<ee.length&&!ee[m].includes("DetermineComponentFrameRoot");)m++;if(d===I.length||m===ee.length)for(d=I.length-1,m=ee.length-1;1<=d&&0<=m&&I[d]!==ee[m];)m--;for(;1<=d&&0<=m;d--,m--)if(I[d]!==ee[m]){if(d!==1||m!==1)do if(d--,m--,0>m||I[d]!==ee[m]){var le=`
47
+ `+I[d].replace(" at new "," at ");return s.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",s.displayName)),le}while(1<=d&&0<=m);break}}}finally{Ae=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?fe(c):""}function ze(s,r){switch(s.tag){case 26:case 27:case 5:return fe(s.type);case 16:return fe("Lazy");case 13:return s.child!==r&&r!==null?fe("Suspense Fallback"):fe("Suspense");case 19:return fe("SuspenseList");case 0:case 15:return tt(s.type,!1);case 11:return tt(s.type.render,!1);case 1:return tt(s.type,!0);case 31:return fe("Activity");case 30:return fe("ViewTransition");default:return""}}function st(s){try{var r="",c=null;do r+=ze(s,c),c=s,s=s.return;while(s);return r}catch(d){return`
48
+ Error generating stack: `+d.message+`
49
+ `+d.stack}}var rn=Object.prototype.hasOwnProperty,Zn=e.unstable_scheduleCallback,on=e.unstable_cancelCallback,Is=e.unstable_shouldYield,ks=e.unstable_requestPaint,Ut=e.unstable_now,Jt=e.unstable_getCurrentPriorityLevel,fn=e.unstable_ImmediatePriority,en=e.unstable_UserBlockingPriority,bi=e.unstable_NormalPriority,_i=e.unstable_LowPriority,kr=e.unstable_IdlePriority,wi=e.log,ya=e.unstable_setDisableYieldValue,Rn=null,pn=null;function qn(s){if(typeof wi=="function"&&ya(s),pn&&typeof pn.setStrictMode=="function")try{pn.setStrictMode(Rn,s)}catch{}}var tn=Math.clz32?Math.clz32:me,te=Math.log,ve=Math.LN2;function me(s){return s>>>=0,s===0?32:31-(te(s)/ve|0)|0}var Ye=256,jt=262144,mn=4194304;function On(s){var r=s&42;if(r!==0)return r;switch(s&-s){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 s&-s;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Lt(s,r,c){var d=s.pendingLanes;if(d===0)return 0;var m=0,x=s.suspendedLanes,w=s.pingedLanes;s=s.warmLanes;var M=d&134217727;return M!==0?(d=M&~x,d!==0?m=On(d):(w&=M,w!==0?m=On(w):c||(c=M&~s,c!==0&&(m=On(c))))):(M=d&~x,M!==0?m=On(M):w!==0?m=On(w):c||(c=d&~s,c!==0&&(m=On(c)))),m===0?0:r!==0&&r!==m&&(r&x)===0&&(x=m&-m,c=r&-r,x>=c||x===32&&(c&4194048)!==0)?r:m}function Ln(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function ti(s,r){(r&8)!==0&&(r|=r&32);var c=s.entangledLanes;if(c!==0)for(s=s.entanglements,c&=r;0<c;){var d=31-tn(c),m=1<<d;r|=s[d],c&=~m}return r}function Of(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Uu(){var s=mn;return mn<<=1,(mn&62914560)===0&&(mn=4194304),s}function Yi(s){for(var r=[],c=0;31>c;c++)r.push(s);return r}function Si(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function hl(s,r,c,d,m,x){var w=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var M=s.entanglements,I=s.expirationTimes,ee=s.hiddenUpdates;for(c=w&~c;0<c;){var le=31-tn(c),pe=1<<le;M[le]=0,I[le]=-1;var Z=ee[le];if(Z!==null)for(ee[le]=null,le=0;le<Z.length;le++){var ie=Z[le];ie!==null&&(ie.lane&=-536870913)}c&=~pe}d!==0&&ba(s,d,0),x!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=x&~(w&~r))}function ba(s,r,c){s.pendingLanes|=r,s.suspendedLanes&=~r;var d=31-tn(r);s.entangledLanes|=r,s.entanglements[d]=s.entanglements[d]|1073741824|c&261930}function Io(s,r){var c=s.entangledLanes|=r;for(s=s.entanglements;c;){var d=31-tn(c),m=1<<d;m&r|s[d]&r&&(s[d]|=r),c&=~m}}function ki(s,r){var c=r&-r;return c=(c&42)!==0?1:Fo(c),(c&(s.suspendedLanes|r))!==0?0:c}function Fo(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function _a(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function wa(){var s=Re.p;return s!==0?s:(s=window.event,s===void 0?32:v_(s.type))}function us(s,r){var c=Re.p;try{return Re.p=s,r()}finally{Re.p=c}}var js=Math.random().toString(36).slice(2),gn="__reactFiber$"+js,Cn="__reactProps$"+js,ji="__reactContainer$"+js,Uo="__reactEvents$"+js,cn="__reactListeners$"+js,Lf="__reactHandles$"+js,Ho="__reactResources$"+js,Sa="__reactMarker$"+js,fl="__reactLoad$"+js;function pl(s){delete s[gn],delete s[Cn],delete s[cn],delete s[Lf]}function Qi(s){var r;if(r=s[gn])return r;for(var c=s.parentNode;c;){if(r=c[ji]||c[gn]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(s=Zb(s);s!==null;){if(c=s[gn])return c;s=Zb(s)}return r}s=c,c=s.parentNode}return null}function Ni(s){if(s=s[gn]||s[ji]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function jr(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function ds(s){var r=s[Ho];return r||(r=s[Ho]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function un(s){s[Sa]=!0}function Ns(s){s[fl]=void 0}var ni=new Set,ml={};function Xi(s,r){Wi(s,r),Wi(s+"Capture",r)}function Wi(s,r){for(ml[s]=r,s=0;s<r.length;s++)ni.add(r[s])}var Df=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]*$"),gl={},qo={};function zf(s){return rn.call(qo,s)?!0:rn.call(gl,s)?!1:Df.test(s)?qo[s]=!0:(gl[s]=!0,!1)}var vt=!1;function Hu(){var s=vt;return vt=!1,s}function xl(s,r,c){if(zf(r))if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var d=r.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,c)}}function ka(s,r,c){if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,c)}}function Fs(s,r,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(r,c,d)}}function Jn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function qu(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Vu(s,r,c){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return m.call(this)},set:function(w){c=""+w,x.call(this,w)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function Nr(s){if(!s._valueTracker){var r=qu(s)?"checked":"value";s._valueTracker=Vu(s,r,""+s[r])}}function Vo(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var c=r.getValue(),d="";return s&&(d=qu(s)?s.checked?"true":"false":s.value),s=d,s!==c?(r.setValue(s),!0):!1}var $f=/[\n"\\]/g;function hs(s){return s.replace($f,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Go(s,r,c,d,m,x,w,M){s.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?s.type=w:s.removeAttribute("type"),r!=null?w==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Jn(r)):s.value!==""+Jn(r)&&(s.value=""+Jn(r)):w!=="submit"&&w!=="reset"||s.removeAttribute("value"),r!=null?w==="number"&&s.value==r?Yo(s,Jn(s.value)):Yo(s,Jn(r)):c!=null?Yo(s,Jn(c)):d!=null&&s.removeAttribute("value"),m==null&&x!=null&&(s.defaultChecked=!!x),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?s.name=""+Jn(M):s.removeAttribute("name")}function Gu(s,r,c,d,m,x,w,M){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),r!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){Nr(s);return}c=c!=null?""+Jn(c):"",r=r!=null?""+Jn(r):c,M||r===s.value||(s.value=r),s.defaultValue=r}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=M?s.checked:!!d,s.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(s.name=w),Nr(s)}function Yo(s,r){s.defaultValue!==""+r&&(s.defaultValue=""+r)}function Cr(s,r,c,d){if(s=s.options,r){r={};for(var m=0;m<c.length;m++)r["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=r.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&d&&(s[c].defaultSelected=!0)}else{for(c=""+Jn(c),r=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,d&&(s[m].defaultSelected=!0);return}r!==null||s[m].disabled||(r=s[m])}r!==null&&(r.selected=!0)}}function Qo(s,r,c){if(r!=null&&(r=""+Jn(r),r!==s.value&&(s.value=r),c==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=c!=null?""+Jn(c):""}function Xo(s,r,c,d){if(r==null){if(d!=null){if(c!=null)throw Error(i(92));if(Oe(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),r=c}c=Jn(r),s.defaultValue=c,d=s.textContent,d===c&&d!==""&&d!==null&&(s.value=d),Nr(s)}function Ki(s,r){if(r){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=r;return}}s.textContent=r}var Q=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 xe(s,r,c){var d=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":d?s.setProperty(r,c):typeof c!="number"||c===0||Q.has(r)?r==="float"?s.cssFloat=c:s[r]=(""+c).trim():s[r]=c+"px"}function at(s,r,c){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||r!=null&&r.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",vt=!0);for(var m in r)d=r[m],r.hasOwnProperty(m)&&c[m]!==d&&(xe(s,m,d),vt=!0)}else for(var x in r)r.hasOwnProperty(x)&&xe(s,x,r[x])}function pt(s){if(s.indexOf("-")===-1)return!1;switch(s){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 mt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Qe=/^[\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 Dn(s){return Qe.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function es(){}var Er=null;function vl(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Cs=null,si=null;function Wo(s){var r=Ni(s);if(r&&(s=r.stateNode)){var c=s[Cn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Go(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+hs(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var d=c[r];if(d!==s&&d.form===s.form){var m=d[Cn]||null;if(!m)throw Error(i(90));Go(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<c.length;r++)d=c[r],d.form===s.form&&Vo(d)}break e;case"textarea":Qo(s,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&Cr(s,!!c.multiple,r,!1)}}}var Tr=!1;function Es(s,r,c){if(Tr)return s(r,c);Tr=!0;try{var d=s(r);return d}finally{if(Tr=!1,(Cs!==null||si!==null)&&(Vd(),Cs&&(r=Cs,s=si,si=Cs=null,Wo(r),s)))for(r=0;r<s.length;r++)Wo(s[r])}}function Mr(s,r){var c=s.stateNode;if(c===null)return null;var d=c[Cn]||null;if(d===null)return null;c=d[r];e:switch(r){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)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,r,typeof c));return c}var ii=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ko=!1;if(ii)try{var ja={};Object.defineProperty(ja,"passive",{get:function(){Ko=!0}}),window.addEventListener("test",ja,ja),window.removeEventListener("test",ja,ja)}catch{Ko=!1}var ri=null,Yu=null,Na=null;function Zo(){if(Na)return Na;var s,r=Yu,c=r.length,d,m="value"in ri?ri.value:ri.textContent,x=m.length;for(s=0;s<c&&r[s]===m[s];s++);var w=c-s;for(d=1;d<=w&&r[c-d]===m[x-d];d++);return Na=m.slice(s,1<d?1-d:void 0)}function Ts(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function Qu(){return!0}function Av(){return!1}function ts(s){function r(c,d,m,x,w){this._reactName=c,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var M in s)s.hasOwnProperty(M)&&(c=s[M],this[M]=c?c(x):x[M]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Qu:Av,this.isPropagationStopped=Av,this}return P(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Qu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Qu)},persist:function(){},isPersistent:Qu}),r}var Ar={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xu=ts(Ar),Jo=P({},Ar,{view:0,detail:0}),PC=ts(Jo),Pf,Bf,ec,Wu=P({},Jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ff,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ec&&(ec&&s.type==="mousemove"?(Pf=s.screenX-ec.screenX,Bf=s.screenY-ec.screenY):Bf=Pf=0,ec=s),Pf)},movementY:function(s){return"movementY"in s?s.movementY:Bf}}),Rv=ts(Wu),BC=P({},Wu,{dataTransfer:0}),IC=ts(BC),FC=P({},Jo,{relatedTarget:0}),If=ts(FC),UC=P({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),HC=ts(UC),qC=P({},Ar,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),VC=ts(qC),GC=P({},Ar,{data:0}),Ov=ts(GC),YC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QC={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"},XC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function WC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=XC[s])?!!r[s]:!1}function Ff(){return WC}var KC=P({},Jo,{key:function(s){if(s.key){var r=YC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Ts(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?QC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ff,charCode:function(s){return s.type==="keypress"?Ts(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Ts(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),ZC=ts(KC),JC=P({},Wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lv=ts(JC),eE=P({},Ar,{submitter:0}),tE=ts(eE),nE=P({},Jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ff}),sE=ts(nE),iE=P({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),rE=ts(iE),aE=P({},Wu,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),lE=ts(aE),oE=P({},Ar,{newState:0,oldState:0,source:0}),cE=ts(oE),uE=[9,13,27,32],Uf=ii&&"CompositionEvent"in window,tc=null;ii&&"documentMode"in document&&(tc=document.documentMode);var dE=ii&&"TextEvent"in window&&!tc,Dv=ii&&(!Uf||tc&&8<tc&&11>=tc),zv=" ",$v=!1;function Pv(s,r){switch(s){case"keyup":return uE.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var yl=!1;function hE(s,r){switch(s){case"compositionend":return Bv(r);case"keypress":return r.which!==32?null:($v=!0,zv);case"textInput":return s=r.data,s===zv&&$v?null:s;default:return null}}function fE(s,r){if(yl)return s==="compositionend"||!Uf&&Pv(s,r)?(s=Zo(),Na=Yu=ri=null,yl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Dv&&r.locale!=="ko"?null:r.data;default:return null}}var pE={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 Iv(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!pE[s.type]:r==="textarea"}function Fv(s,r,c,d){Cs?si?si.push(d):si=[d]:Cs=d,r=Kd(r,"onChange"),0<r.length&&(c=new Xu("onChange","change",null,c,d),s.push({event:c,listeners:r}))}var nc=null,sc=null;function mE(s){Eb(s,0)}function Ku(s){var r=jr(s);if(Vo(r))return s}function Uv(s,r){if(s==="change")return r}var Hv=!1;if(ii){var Hf;if(ii){var qf="oninput"in document;if(!qf){var qv=document.createElement("div");qv.setAttribute("oninput","return;"),qf=typeof qv.oninput=="function"}Hf=qf}else Hf=!1;Hv=Hf&&(!document.documentMode||9<document.documentMode)}function Vv(){nc&&(nc.detachEvent("onpropertychange",Gv),sc=nc=null)}function Gv(s){if(s.propertyName==="value"&&Ku(sc)){var r=[];Fv(r,sc,s,vl(s)),Es(mE,r)}}function gE(s,r,c){s==="focusin"?(Vv(),nc=r,sc=c,nc.attachEvent("onpropertychange",Gv)):s==="focusout"&&Vv()}function xE(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Ku(sc)}function vE(s,r){if(s==="click")return Ku(r)}function yE(s,r){if(s==="input"||s==="change")return Ku(r)}function bE(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Ms=typeof Object.is=="function"?Object.is:bE;function ic(s,r){if(Ms(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var c=Object.keys(s),d=Object.keys(r);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var m=c[d];if(!rn.call(r,m)||!Ms(s[m],r[m]))return!1}return!0}function Vf(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Yv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Qv(s,r){var c=Yv(s);s=0;for(var d;c;){if(c.nodeType===3){if(d=s+c.textContent.length,s<=r&&d>=r)return{node:c,offset:r-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Yv(c)}}function Xv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Xv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Wv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=Vf(s.document);r instanceof s.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)s=r.contentWindow;else break;r=Vf(s.document)}return r}function Gf(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var _E=ii&&"documentMode"in document&&11>=document.documentMode,bl=null,Yf=null,rc=null,Qf=!1;function Kv(s,r,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Qf||bl==null||bl!==Vf(d)||(d=bl,"selectionStart"in d&&Gf(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}),rc&&ic(rc,d)||(rc=d,d=Kd(Yf,"onSelect"),0<d.length&&(r=new Xu("onSelect","select",null,r,c),s.push({event:r,listeners:d}),r.target=bl)))}function Ca(s,r){var c={};return c[s.toLowerCase()]=r.toLowerCase(),c["Webkit"+s]="webkit"+r,c["Moz"+s]="moz"+r,c}var _l={animationend:Ca("Animation","AnimationEnd"),animationiteration:Ca("Animation","AnimationIteration"),animationstart:Ca("Animation","AnimationStart"),transitionrun:Ca("Transition","TransitionRun"),transitionstart:Ca("Transition","TransitionStart"),transitioncancel:Ca("Transition","TransitionCancel"),transitionend:Ca("Transition","TransitionEnd")},Xf={},Zv={};ii&&(Zv=document.createElement("div").style,"AnimationEvent"in window||(delete _l.animationend.animation,delete _l.animationiteration.animation,delete _l.animationstart.animation),"TransitionEvent"in window||delete _l.transitionend.transition);function Ea(s){if(Xf[s])return Xf[s];if(!_l[s])return s;var r=_l[s],c;for(c in r)if(r.hasOwnProperty(c)&&c in Zv)return Xf[s]=r[c];return s}var Jv=Ea("animationend"),e1=Ea("animationiteration"),t1=Ea("animationstart"),wE=Ea("transitionrun"),SE=Ea("transitionstart"),kE=Ea("transitioncancel"),n1=Ea("transitionend"),s1=new Map,Wf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Wf.push("scrollEnd");function ai(s,r){s1.set(s,r),Xi(r,[s])}var jE=0;function Zi(s,r){if(s.name!=null&&s.name!=="auto")return s.name;if(r.autoName!==null)return r.autoName;s=ui.identifierPrefix;var c=jE++;return s="_"+s+"t_"+c.toString(32)+"_",r.autoName=s}function i1(s){if(s==null||typeof s=="string")return s;var r=null,c=Fl;if(c!==null)for(var d=0;d<c.length;d++){var m=s[c[d]];if(m!=null){if(m==="none")return"none";r=r==null?m:r+(" "+m)}}return r??s.default}function Ji(s,r){return s=i1(s),r=i1(r),r==null?s==="auto"?null:s:r==="auto"?null:r}var Zu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Us=[],wl=0,Kf=0;function Ju(){for(var s=wl,r=Kf=wl=0;r<s;){var c=Us[r];Us[r++]=null;var d=Us[r];Us[r++]=null;var m=Us[r];Us[r++]=null;var x=Us[r];if(Us[r++]=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&&r1(c,m,x)}}function ed(s,r,c,d){Us[wl++]=s,Us[wl++]=r,Us[wl++]=c,Us[wl++]=d,Kf|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Zf(s,r,c,d){return ed(s,r,c,d),td(s)}function Ta(s,r){return ed(s,null,null,r),td(s)}function r1(s,r,c){s.lanes|=c;var d=s.alternate;d!==null&&(d.lanes|=c);for(var m=!1,x=s.return;x!==null;)x.childLanes|=c,d=x.alternate,d!==null&&(d.childLanes|=c),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(m=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,m&&r!==null&&(m=31-tn(c),s=x.hiddenUpdates,d=s[m],d===null?s[m]=[r]:d.push(r),r.lane=c|536870912),x):null}function td(s){if(50<Cc)throw Cc=0,qd=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var Sl={};function NE(s,r,c,d){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,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 fs(s,r,c,d){return new NE(s,r,c,d)}function Jf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function er(s,r){var c=s.alternate;return c===null?(c=fs(s.tag,r,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=r,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&1206910976,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,r=s.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function a1(s,r){s.flags&=1206910978;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,r=c.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function nd(s,r,c,d,m,x){var w=0;if(d=s,typeof d=="function")Jf(d)&&(w=1);else if(typeof d=="string")w=eM(s,c,xt.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case Ne:return s=fs(31,c,r,m),s.elementType=Ne,s.lanes=x,s;case q:return Ma(c.children,m,x,r);case L:w=8,m|=24;break;case de:return s=fs(12,c,r,m|2),s.elementType=de,s.lanes=x,s;case H:return s=fs(13,c,r,m),s.elementType=H,s.lanes=x,s;case ae:return s=fs(19,c,r,m),s.elementType=ae,s.lanes=x,s;case Ce:case B:return s=m|32,s=fs(30,c,r,s),s.elementType=B,s.lanes=x,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case V:w=10;break e;case X:w=9;break e;case G:w=11;break e;case _e:w=14;break e;case E:w=16,d=null;break e}w=29,c=Error(i(130,s===null?"null":typeof s,"")),d=null}return r=fs(w,c,r,m),r.elementType=s,r.type=d,r.lanes=x,r}function Ma(s,r,c,d){return s=fs(7,s,d,r),s.lanes=c,s}function ep(s,r,c){return s=fs(6,s,null,r),s.lanes=c,s}function l1(s){var r=fs(18,null,null,0);return r.stateNode=s,r}function tp(s,r,c){return r=fs(4,s.children!==null?s.children:[],s.key,r),r.lanes=c,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var o1=new WeakMap;function Hs(s,r){if(typeof s=="object"&&s!==null){var c=o1.get(s);return c!==void 0?c:(r={value:s,source:r,stack:st(r)},o1.set(s,r),r)}return{value:s,source:r,stack:st(r)}}var kl=[],jl=0,sd=null,ac=0,qs=[],Vs=0,Rr=null,Ci=1,Ei="";function tr(s,r){kl[jl++]=ac,kl[jl++]=sd,sd=s,ac=r}function c1(s,r,c){qs[Vs++]=Ci,qs[Vs++]=Ei,qs[Vs++]=Rr,Rr=s;var d=Ci;s=Ei;var m=32-tn(d)-1;d&=~(1<<m),c+=1;var x=32-tn(r)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Ci=1<<32-tn(r)+m|c<<m|d,Ei=x+s}else Ci=1<<x|c<<m|d,Ei=s}function id(s){s.return!==null&&(tr(s,1),c1(s,1,0))}function np(s){for(;s===sd;)sd=kl[--jl],kl[jl]=null,ac=kl[--jl],kl[jl]=null;for(;s===Rr;)Rr=qs[--Vs],qs[Vs]=null,Ei=qs[--Vs],qs[Vs]=null,Ci=qs[--Vs],qs[Vs]=null}function u1(s,r){qs[Vs++]=Ci,qs[Vs++]=Ei,qs[Vs++]=Rr,Ci=r.id,Ei=r.overflow,Rr=s}var En=null,Ht=null,lt=!1,Or=null,Gs=!1,sp=Error(i(519));function Lr(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw lc(Hs(r,s)),sp}function d1(s){var r=s.stateNode,c=s.type,d=s.memoizedProps;switch(r[gn]=s,r[Cn]=d,c){case"dialog":dt("cancel",r),dt("close",r);break;case"iframe":case"object":case"embed":dt("load",r);break;case"video":case"audio":for(c=0;c<Tc.length;c++)dt(Tc[c],r);break;case"source":dt("error",r);break;case"img":case"image":case"link":dt("error",r),dt("load",r);break;case"details":dt("toggle",r);break;case"input":dt("invalid",r),Gu(r,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":dt("invalid",r);break;case"textarea":dt("invalid",r),Xo(r,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||d.suppressHydrationWarning===!0||Rb(r.textContent,c)?(d.popover!=null&&(dt("beforetoggle",r),dt("toggle",r)),d.onScroll!=null&&dt("scroll",r),d.onScrollEnd!=null&&dt("scrollend",r),d.onClick!=null&&(r.onclick=es),r=!0):r=!1,r||Lr(s,!0)}function rd(s){for(En=s.return;En;)switch(En.tag){case 5:case 31:case 13:Gs=!1;return;case 27:case 3:Gs=!0;return;default:En=En.return}}function Nl(s){if(s!==En)return!1;if(!lt)return rd(s),lt=!0,!1;var r=s.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Om(s.type,s.memoizedProps)),c=!c),c&&Ht&&Lr(s),rd(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Kb(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Kb(s)}else r===27?(r=Ht,Wr(s.type)?(s=Um,Um=null,Ht=s):Ht=r):Ht=En?Qs(s.stateNode.nextSibling):null;return!0}function Aa(){Ht=En=null,lt=!1}function ip(){var s=Or;return s!==null&&(gs===null?gs=s:gs.push.apply(gs,s),Or=null),s}function lc(s){Or===null?Or=[s]:Or.push(s)}var rp=St(null),Ra=null,nr=null;function Dr(s,r,c){Ze(rp,r._currentValue),r._currentValue=c}function sr(s){s._currentValue=rp.current,wt(rp)}function ad(s,r,c){for(;s!==null;){var d=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,d!==null&&(d.childLanes|=r)):d!==null&&(d.childLanes&r)!==r&&(d.childLanes|=r),s===c)break;s=s.return}}function ap(s,r,c,d){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var M=x;x=m;for(var I=0;I<r.length;I++)if(M.context===r[I]){x.lanes|=c,M=x.alternate,M!==null&&(M.lanes|=c),ad(x.return,c,s),d||(w=null);break e}x=M.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=c,x=w.alternate,x!==null&&(x.lanes|=c),ad(w,c,s),w=null}else m.tag===13&&m.memoizedState!==null&&m.memoizedState.dehydrated===null?(m.lanes|=c,w=m.alternate,w!==null&&(w.lanes|=c),ad(m.return,c,s),w=m.child,w=w!==null?w.sibling:null):w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===s){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function Oa(s,r,c,d){s=null;for(var m=r,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 M=m.type;Ms(m.pendingProps.value,w.value)||(s!==null?s.push(M):s=[M])}}else if(m===ke.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Kl):s=[Kl])}m=m.return}return s!==null&&ap(r,s,c,d),r.flags|=262144,s!==null}function ld(s){for(s=s.firstContext;s!==null;){if(!Ms(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function La(s){Ra=s,nr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function zn(s){return h1(Ra,s)}function od(s,r){return Ra===null&&La(s),h1(s,r)}function h1(s,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},nr===null){if(s===null)throw Error(i(308));nr=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else nr=nr.next=r;return c}var CE=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){r.aborted=!0,s.forEach(function(c){return c()})}},EE=e.unstable_scheduleCallback,TE=e.unstable_NormalPriority,yn={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lp(){return{controller:new CE,data:new Map,refCount:0}}function oc(s){s.refCount--,s.refCount===0&&EE(TE,function(){s.controller.abort()})}function f1(s,r){if((s.pendingLanes&4194048)!==0){var c=s.transitionTypes;for(c===null&&(c=s.transitionTypes=[]),s=0;s<r.length;s++){var d=r[s];c.indexOf(d)===-1&&c.push(d)}}}var cc=null;function ME(s){var r=s.transitionTypes;return s.transitionTypes=null,r}var uc=null,op=0,Da=0,Cl=null;function AE(s,r){if(uc===null){var c=uc=[];op=0,Da=km(),Cl={status:"pending",value:void 0,then:function(d){c.push(d)}}}return op++,r.then(p1,p1),r}function p1(){if(--op===0&&(cc=null,uc!==null)){Cl!==null&&(Cl.status="fulfilled");var s=uc;uc=null,Da=0,Cl=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function RE(s,r){var c=[],d={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return s.then(function(){d.status="fulfilled",d.value=r;for(var m=0;m<c.length;m++)(0,c[m])(r)},function(m){for(d.status="rejected",d.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),d}var m1=Te.S;Te.S=function(s,r){if(lb=Ut(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&AE(s,r),cc!==null)for(var c=Vl;c!==null;)f1(c,cc),c=c.next;if(c=s.types,c!==null){for(var d=Vl;d!==null;)f1(d,c),d=d.next;if(Da!==0){d=cc,d===null&&(d=cc=[]);for(var m=0;m<c.length;m++){var x=c[m];d.indexOf(x)===-1&&d.push(x)}}}m1!==null&&m1(s,r)};var za=St(null);function cp(){var s=za.current;return s!==null?s:Dt.pooledCache}function cd(s,r){r===null?Ze(za,za.current):Ze(za,r.pool)}function g1(){var s=cp();return s===null?null:{parent:yn._currentValue,pool:s}}var El=Error(i(460)),up=Error(i(474)),ud=Error(i(542)),dd={then:function(){}};function x1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function v1(s,r,c){switch(c=s[c],c===void 0?s.push(r):c!==r&&(r.then(es,es),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,b1(s),s===void 0&&!("reason"in r)?Error(i(600)):s;default:if(typeof r.status=="string")r.then(es,es);else{if(s=Dt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(d){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=d}},function(d){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=d}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,b1(s),s}throw Pa=r,El}}function $a(s){try{var r=s._init;return r(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Pa=c,El):c}}var Pa=null;function y1(){if(Pa===null)throw Error(i(459));var s=Pa;return Pa=null,s}function b1(s){if(s===El||s===ud)throw Error(i(483))}var Tl=null,dc=0;function hd(s){var r=dc;return dc+=1,Tl===null&&(Tl=[]),v1(Tl,s,r)}function zr(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function fd(s,r){throw r.$$typeof===z?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function _1(s){function r(J,Y){if(s){var ne=J.deletions;ne===null?(J.deletions=[Y],J.flags|=16):ne.push(Y)}}function c(J,Y){if(!s)return null;for(;Y!==null;)r(J,Y),Y=Y.sibling;return null}function d(J){for(var Y=new Map;J!==null;)J.key===null?Y.set(J.index,J):Y.set(J.key,J),J=J.sibling;return Y}function m(J,Y){return J=er(J,Y),J.index=0,J.sibling=null,J}function x(J,Y,ne){return J.index=ne,s?(ne=J.alternate,ne!==null?(ne=ne.index,ne<Y?(J.flags|=2,Y):ne):(J.flags|=134217730,Y)):(J.flags|=1048576,Y)}function w(J){return s&&J.alternate===null&&(J.flags|=134217730),J}function M(J,Y,ne,he){return Y===null||Y.tag!==6?(Y=ep(ne,J.mode,he),Y.return=J,Y):(Y=m(Y,ne),Y.return=J,Y)}function I(J,Y,ne,he){var Le=ne.type;return Le===q?(J=le(J,Y,ne.props.children,he,ne.key),zr(J,ne),J):Y!==null&&(Y.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===E&&$a(Le)===Y.type)?(Y=m(Y,ne.props),zr(Y,ne),Y.return=J,Y):(Y=nd(ne.type,ne.key,ne.props,null,J.mode,he),zr(Y,ne),Y.return=J,Y)}function ee(J,Y,ne,he){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=tp(ne,J.mode,he),Y.return=J,Y):(Y=m(Y,ne.children||[]),Y.return=J,Y)}function le(J,Y,ne,he,Le){return Y===null||Y.tag!==7?(Y=Ma(ne,J.mode,he,Le),Y.return=J,Y):(Y=m(Y,ne),Y.return=J,Y)}function pe(J,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=ep(""+Y,J.mode,ne),Y.return=J,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case K:return ne=nd(Y.type,Y.key,Y.props,null,J.mode,ne),zr(ne,Y),ne.return=J,ne;case F:return Y=tp(Y,J.mode,ne),Y.return=J,Y;case E:return Y=$a(Y),pe(J,Y,ne)}if(Oe(Y)||je(Y))return Y=Ma(Y,J.mode,ne,null),Y.return=J,Y;if(typeof Y.then=="function")return pe(J,hd(Y),ne);if(Y.$$typeof===V)return pe(J,od(J,Y),ne);fd(J,Y)}return null}function Z(J,Y,ne,he){var Le=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Le!==null?null:M(J,Y,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case K:return ne.key===Le?I(J,Y,ne,he):null;case F:return ne.key===Le?ee(J,Y,ne,he):null;case E:return ne=$a(ne),Z(J,Y,ne,he)}if(Oe(ne)||je(ne))return Le!==null?null:le(J,Y,ne,he,null);if(typeof ne.then=="function")return Z(J,Y,hd(ne),he);if(ne.$$typeof===V)return Z(J,Y,od(J,ne),he);fd(J,ne)}return null}function ie(J,Y,ne,he,Le){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return J=J.get(ne)||null,M(Y,J,""+he,Le);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case K:return J=J.get(he.key===null?ne:he.key)||null,I(Y,J,he,Le);case F:return J=J.get(he.key===null?ne:he.key)||null,ee(Y,J,he,Le);case E:return he=$a(he),ie(J,Y,ne,he,Le)}if(Oe(he)||je(he))return J=J.get(ne)||null,le(Y,J,he,Le,null);if(typeof he.then=="function")return ie(J,Y,ne,hd(he),Le);if(he.$$typeof===V)return ie(J,Y,ne,od(Y,he),Le);fd(Y,he)}return null}function Me(J,Y,ne,he){for(var Le=null,ft=null,He=Y,Xe=Y=0,wn=null;He!==null&&Xe<ne.length;Xe++){He.index>Xe?(wn=He,He=null):wn=He.sibling;var yt=Z(J,He,ne[Xe],he);if(yt===null){He===null&&(He=wn);break}s&&He&&yt.alternate===null&&r(J,He),Y=x(yt,Y,Xe),ft===null?Le=yt:ft.sibling=yt,ft=yt,He=wn}if(Xe===ne.length)return c(J,He),lt&&tr(J,Xe),Le;if(He===null){for(;Xe<ne.length;Xe++)He=pe(J,ne[Xe],he),He!==null&&(Y=x(He,Y,Xe),ft===null?Le=He:ft.sibling=He,ft=He);return lt&&tr(J,Xe),Le}for(He=d(He);Xe<ne.length;Xe++)wn=ie(He,J,Xe,ne[Xe],he),wn!==null&&(s&&(yt=wn.alternate,yt!==null&&He.delete(yt.key===null?Xe:yt.key)),Y=x(wn,Y,Xe),ft===null?Le=wn:ft.sibling=wn,ft=wn);return s&&He.forEach(function(ta){return r(J,ta)}),lt&&tr(J,Xe),Le}function $e(J,Y,ne,he){if(ne==null)throw Error(i(151));for(var Le=null,ft=null,He=Y,Xe=Y=0,wn=null,yt=ne.next();He!==null&&!yt.done;Xe++,yt=ne.next()){He.index>Xe?(wn=He,He=null):wn=He.sibling;var ta=Z(J,He,yt.value,he);if(ta===null){He===null&&(He=wn);break}s&&He&&ta.alternate===null&&r(J,He),Y=x(ta,Y,Xe),ft===null?Le=ta:ft.sibling=ta,ft=ta,He=wn}if(yt.done)return c(J,He),lt&&tr(J,Xe),Le;if(He===null){for(;!yt.done;Xe++,yt=ne.next())yt=pe(J,yt.value,he),yt!==null&&(Y=x(yt,Y,Xe),ft===null?Le=yt:ft.sibling=yt,ft=yt);return lt&&tr(J,Xe),Le}for(He=d(He);!yt.done;Xe++,yt=ne.next())yt=ie(He,J,Xe,yt.value,he),yt!==null&&(s&&(wn=yt.alternate,wn!==null&&He.delete(wn.key===null?Xe:wn.key)),Y=x(yt,Y,Xe),ft===null?Le=yt:ft.sibling=yt,ft=yt);return s&&He.forEach(function(hM){return r(J,hM)}),lt&&tr(J,Xe),Le}function rt(J,Y,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===q&&ne.key===null&&ne.props.ref===void 0&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case K:e:{for(var Le=ne.key;Y!==null;){if(Y.key===Le){if(Le=ne.type,Le===q){if(Y.tag===7){c(J,Y.sibling),he=m(Y,ne.props.children),zr(he,ne),he.return=J,J=he;break e}}else if(Y.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===E&&$a(Le)===Y.type){c(J,Y.sibling),he=m(Y,ne.props),zr(he,ne),he.return=J,J=he;break e}c(J,Y);break}else r(J,Y);Y=Y.sibling}ne.type===q?(he=Ma(ne.props.children,J.mode,he,ne.key),zr(he,ne),he.return=J,J=he):(he=nd(ne.type,ne.key,ne.props,null,J.mode,he),zr(he,ne),he.return=J,J=he)}return w(J);case F:e:{for(Le=ne.key;Y!==null;){if(Y.key===Le)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){c(J,Y.sibling),he=m(Y,ne.children||[]),he.return=J,J=he;break e}else{c(J,Y);break}else r(J,Y);Y=Y.sibling}he=tp(ne,J.mode,he),he.return=J,J=he}return w(J);case E:return ne=$a(ne),rt(J,Y,ne,he)}if(Oe(ne))return Me(J,Y,ne,he);if(je(ne)){if(Le=je(ne),typeof Le!="function")throw Error(i(150));return ne=Le.call(ne),$e(J,Y,ne,he)}if(typeof ne.then=="function")return rt(J,Y,hd(ne),he);if(ne.$$typeof===V)return rt(J,Y,od(J,ne),he);fd(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Y!==null&&Y.tag===6?(c(J,Y.sibling),he=m(Y,ne),he.return=J,J=he):(c(J,Y),he=ep(ne,J.mode,he),he.return=J,J=he),w(J)):c(J,Y)}return function(J,Y,ne,he){try{dc=0;var Le=rt(J,Y,ne,he);return Tl=null,Le}catch(He){if(He===El||He===ud)throw He;var ft=fs(29,He,null,J.mode);return ft.lanes=he,ft.return=J,ft}finally{}}}var Ba=_1(!0),w1=_1(!1),$r=!1;function dp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hp(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Pr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Br(s,r,c){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Nt&2)!==0){var m=d.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),d.pending=r,r=td(s),r1(s,null,c),r}return ed(s,d,r,c),td(s)}function hc(s,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Io(s,c)}}function fp(s,r){var c=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var m=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,c=c.next}while(c!==null);x===null?m=x=r:x=x.next=r}else m=x=r;c={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=r:s.next=r,c.lastBaseUpdate=r}var pp=!1;function fc(){if(pp){var s=Cl;if(s!==null)throw s}}function pc(s,r,c,d){pp=!1;var m=s.updateQueue;$r=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,M=m.shared.pending;if(M!==null){m.shared.pending=null;var I=M,ee=I.next;I.next=null,w===null?x=ee:w.next=ee,w=I;var le=s.alternate;le!==null&&(le=le.updateQueue,M=le.lastBaseUpdate,M!==w&&(M===null?le.firstBaseUpdate=ee:M.next=ee,le.lastBaseUpdate=I))}if(x!==null){var pe=m.baseState;w=0,le=ee=I=null,M=x;do{var Z=M.lane&-536870913,ie=Z!==M.lane;if(ie?(ht&Z)===Z:(d&Z)===Z){Z!==0&&Z===Da&&(pp=!0),le!==null&&(le=le.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Me=s,$e=M;Z=r;var rt=c;switch($e.tag){case 1:if(Me=$e.payload,typeof Me=="function"){pe=Me.call(rt,pe,Z);break e}pe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=$e.payload,Z=typeof Me=="function"?Me.call(rt,pe,Z):Me,Z==null)break e;pe=P({},pe,Z);break e;case 2:$r=!0}}Z=M.callback,Z!==null&&(s.flags|=64,ie&&(s.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[Z]:ie.push(Z))}else ie={lane:Z,tag:M.tag,payload:M.payload,callback:M.callback,next:null},le===null?(ee=le=ie,I=pe):le=le.next=ie,w|=Z;if(M=M.next,M===null){if(M=m.shared.pending,M===null)break;ie=M,M=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);le===null&&(I=pe),m.baseState=I,m.firstBaseUpdate=ee,m.lastBaseUpdate=le,x===null&&(m.shared.lanes=0),Gr|=w,s.lanes=w,s.memoizedState=pe}}function S1(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function k1(s,r){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)S1(c[s],r)}var Ir=St(null),pd=St(0);function j1(s,r){s=or,Ze(pd,s),Ze(Ir,r),or=s|r.baseLanes}function mp(){Ze(pd,or),Ze(Ir,Ir.current)}function gp(){or=pd.current,wt(Ir),wt(pd)}var $n=St(null),Vn=null;function Fr(s){var r=s.alternate;Ze(Pn,Pn.current&1),Ze($n,s),Vn===null&&(r===null||Ir.current!==null||r.memoizedState!==null)&&(Vn=s)}function xp(s){Ze(Pn,Pn.current),Ze($n,s),Vn===null&&(Vn=s)}function N1(s){s.tag===22?(Ze(Pn,Pn.current),Ze($n,s),Vn===null&&(Vn=s)):Ur()}function Ur(){Ze(Pn,Pn.current),Ze($n,$n.current)}function As(s){wt($n),Vn===s&&(Vn=null),wt(Pn)}var Pn=St(0);function mc(s,r){Ze($n,$n.current),Ze(Pn,r)}function vp(s){wt(Pn),wt($n),Vn===s&&(Vn=null)}function md(s){for(var r=s;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Im(c)||Fm(c)))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!=="independent"){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var ir=0,it=null,Ot=null,bn=null,gd=!1,Ml=!1,Ia=!1,xd=0,gc=0,Al=null,OE=0;function dn(){throw Error(i(321))}function yp(s,r){if(r===null)return!1;for(var c=0;c<r.length&&c<s.length;c++)if(!Ms(s[c],r[c]))return!1;return!0}function bp(s,r,c,d,m,x){return ir=x,it=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Te.H=s===null||s.memoizedState===null?cy:uy,Ia=!1,x=c(d,m),Ia=!1,Ml&&(x=E1(r,c,d,m)),C1(s),x}function C1(s){Te.H=kd;var r=Ot!==null&&Ot.next!==null;if(ir=0,bn=Ot=it=null,gd=!1,gc=0,Al=null,r)throw Error(i(300));s===null||_n||(s=s.dependencies,s!==null&&ld(s)&&(_n=!0))}function E1(s,r,c,d){it=s;var m=0;do{if(Ml&&(Al=null),gc=0,Ml=!1,25<=m)throw Error(i(301));if(m+=1,bn=Ot=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}Te.H=FE,x=r(c,d)}while(Ml);return x}function LE(){var s=Te.H,r=s.useState()[0];return r=typeof r.then=="function"?xc(r):r,s=s.useState()[0],(Ot!==null?Ot.memoizedState:null)!==s&&(it.flags|=1024),r}function _p(){var s=xd!==0;return xd=0,s}function wp(s,r,c){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~c}function Sp(s){if(gd){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}gd=!1}ir=0,bn=Ot=it=null,Ml=!1,gc=xd=0,Al=null}function ns(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?it.memoizedState=bn=s:bn=bn.next=s,bn}function xn(){if(Ot===null){var s=it.alternate;s=s!==null?s.memoizedState:null}else s=Ot.next;var r=bn===null?it.memoizedState:bn.next;if(r!==null)bn=r,Ot=s;else{if(s===null)throw it.alternate===null?Error(i(467)):Error(i(310));Ot=s,s={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},bn===null?it.memoizedState=bn=s:bn=bn.next=s}return bn}function vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xc(s){var r=gc;return gc+=1,Al===null&&(Al=[]),s=v1(Al,s,r),r=it,(bn===null?r.memoizedState:bn.next)===null&&(r=r.alternate,Te.H=r===null||r.memoizedState===null?cy:uy),s}function yd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return xc(s);if(s.$$typeof===oe)return;if(s.$$typeof===V)return zn(s)}throw Error(i(438,String(s)))}function kp(s){var r=null,c=it.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var d=it.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(r={data:d.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=vd(),it.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(s),d=0;d<s;d++)c[d]=$;return r.index++,c}function rr(s,r){return typeof r=="function"?r(s):r}function bd(s){var r=xn();return jp(r,Ot,s)}function jp(s,r,c){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var m=s.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}r.baseQueue=m=x,d.pending=null}if(x=s.baseState,m===null)s.memoizedState=x;else{r=m.next;var M=w=null,I=null,ee=r,le=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(ht&pe)===pe:(ir&pe)===pe){var Z=ee.revertLane;if(Z===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),pe===Da&&(le=!0);else if((ir&Z)===Z){ee=ee.next,Z===Da&&(le=!0);continue}else pe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},I===null?(M=I=pe,w=x):I=I.next=pe,it.lanes|=Z,Gr|=Z;pe=ee.action,Ia&&c(x,pe),x=ee.hasEagerState?ee.eagerState:c(x,pe)}else Z={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},I===null?(M=I=Z,w=x):I=I.next=Z,it.lanes|=pe,Gr|=pe;ee=ee.next}while(ee!==null&&ee!==r);if(I===null?w=x:I.next=M,!Ms(x,s.memoizedState)&&(_n=!0,le&&(c=Cl,c!==null)))throw c;s.memoizedState=x,s.baseState=w,s.baseQueue=I,d.lastRenderedState=x}return m===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Np(s){var r=xn(),c=r.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var d=c.dispatch,m=c.pending,x=r.memoizedState;if(m!==null){c.pending=null;var w=m=m.next;do x=s(x,w.action),w=w.next;while(w!==m);Ms(x,r.memoizedState)||(_n=!0),r.memoizedState=x,r.baseQueue===null&&(r.baseState=x),c.lastRenderedState=x}return[x,d]}function T1(s,r,c){var d=it,m=xn(),x=lt;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=r();var w=!Ms((Ot||m).memoizedState,c);if(w&&(m.memoizedState=c,_n=!0),m=m.queue,Tp(R1.bind(null,d,m,s),[s]),s=m.getSnapshot!==r||w||bn!==null&&(bn.memoizedState.tag&1)!==0,Rl(s?9:8,{destroy:void 0},A1.bind(null,d,m,c,r),null),s){if(d.flags|=2048,Dt===null)throw Error(i(349));x||(ir&127)!==0||M1(d,r,c)}return c}function M1(s,r,c){s.flags|=16384,s={getSnapshot:r,value:c},r=it.updateQueue,r===null?(r=vd(),it.updateQueue=r,r.stores=[s]):(c=r.stores,c===null?r.stores=[s]:c.push(s))}function A1(s,r,c,d){r.value=c,r.getSnapshot=d,O1(r)&&L1(s)}function R1(s,r,c){return c(function(){O1(r)&&L1(s)})}function O1(s){var r=s.getSnapshot;s=s.value;try{var c=r();return!Ms(s,c)}catch{return!0}}function L1(s){var r=Ta(s,2);r!==null&&xs(r,s,2)}function Cp(s){var r=ns();if(typeof s=="function"){var c=s;if(s=c(),Ia){qn(!0);try{c()}finally{qn(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:s},r}function D1(s,r,c,d){return s.baseState=c,jp(s,Ot,typeof d=="function"?d:rr)}function DE(s,r,c,d,m){if(Sd(s))throw Error(i(485));if(s=r.action,s!==null){var x={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};Te.T!==null?c(!0):x.isTransition=!1,d(x),c=r.pending,c===null?(x.next=r.pending=x,z1(r,x)):(x.next=c.next,r.pending=c.next=x)}}function z1(s,r){var c=r.action,d=r.payload,m=s.state;if(r.isTransition){var x=Te.T,w={};w.types=x!==null?x.types:null,Te.T=w;try{var M=c(m,d),I=Te.S;I!==null&&I(w,M),$1(s,r,M)}catch(ee){Ep(s,r,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),Te.T=x}}else try{x=c(m,d),$1(s,r,x)}catch(ee){Ep(s,r,ee)}}function $1(s,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){P1(s,r,d)},function(d){return Ep(s,r,d)}):P1(s,r,c)}function P1(s,r,c){r.status="fulfilled",r.value=c,B1(r),s.state=c,r=s.pending,r!==null&&(c=r.next,c===r?s.pending=null:(c=c.next,r.next=c,z1(s,c)))}function Ep(s,r,c){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=c,B1(r),r=r.next;while(r!==d)}s.action=null}function B1(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function I1(s,r){return r}function F1(s,r){if(lt){var c=Dt.formState;if(c!==null){e:{var d=it;if(lt){if(Ht){t:{for(var m=Ht,x=Gs;m.nodeType!==8;){if(!x){m=null;break t}if(m=Qs(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Ht=Qs(m.nextSibling),d=m.data==="F!";break e}}Lr(d)}d=!1}d&&(r=c[0])}}return c=ns(),c.memoizedState=c.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:I1,lastRenderedState:r},c.queue=d,c=ay.bind(null,it,d),d.dispatch=c,d=Cp(!1),x=Lp.bind(null,it,!1,d.queue),d=ns(),m={state:r,dispatch:null,action:s,pending:null},d.queue=m,c=DE.bind(null,it,m,x,c),m.dispatch=c,d.memoizedState=s,[r,c,!1]}function U1(s){var r=xn();return H1(r,Ot,s)}function H1(s,r,c){if(r=jp(s,r,I1)[0],s=bd(rr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=xc(r)}catch(w){throw w===El?ud:w}else d=r;r=xn();var m=r.queue,x=m.dispatch;return c!==r.memoizedState&&(it.flags|=2048,Rl(9,{destroy:void 0},zE.bind(null,m,c),null)),[d,x,s]}function zE(s,r){s.action=r}function q1(s){var r=xn(),c=Ot;if(c!==null)return H1(r,c,s);xn(),r=r.memoizedState,c=xn();var d=c.queue.dispatch;return c.memoizedState=s,[r,d,!1]}function Rl(s,r,c,d){return s={tag:s,create:c,deps:d,inst:r,next:null},r=it.updateQueue,r===null&&(r=vd(),it.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=s.next=s:(d=c.next,c.next=s,s.next=d,r.lastEffect=s),s}function V1(){return xn().memoizedState}function _d(s,r,c,d){var m=ns();it.flags|=s,m.memoizedState=Rl(1|r,{destroy:void 0},c,d===void 0?null:d)}function wd(s,r,c,d){var m=xn();d=d===void 0?null:d;var x=m.memoizedState.inst;Ot!==null&&d!==null&&yp(d,Ot.memoizedState.deps)?m.memoizedState=Rl(r,x,c,d):(it.flags|=s,m.memoizedState=Rl(1|r,x,c,d))}function G1(s,r){_d(8390656,8,s,r)}function Tp(s,r){wd(2048,8,s,r)}function $E(s){it.flags|=4;var r=it.updateQueue;if(r===null)r=vd(),it.updateQueue=r,r.events=[s];else{var c=r.events;c===null?r.events=[s]:c.push(s)}}function Y1(s){var r=xn().memoizedState;return $E({ref:r,nextImpl:s}),function(){if((Nt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function Q1(s,r){return wd(4,2,s,r)}function X1(s,r){return wd(4,4,s,r)}function W1(s,r){if(typeof r=="function"){s=s();var c=r(s);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function K1(s,r,c){c=c!=null?c.concat([s]):null,wd(4,4,W1.bind(null,r,s),c)}function Mp(){}function Z1(s,r){var c=xn();r=r===void 0?null:r;var d=c.memoizedState;return r!==null&&yp(r,d[1])?d[0]:(c.memoizedState=[s,r],s)}function J1(s,r){var c=xn();r=r===void 0?null:r;var d=c.memoizedState;if(r!==null&&yp(r,d[1]))return d[0];if(d=s(),Ia){qn(!0);try{s()}finally{qn(!1)}}return c.memoizedState=[d,r],d}function Ap(s,r,c){return c===void 0||(ir&1073741824)!==0&&(ht&261930)===0?s.memoizedState=r:(s.memoizedState=c,s=cb(),it.lanes|=s,Gr|=s,c)}function ey(s,r,c,d){return Ms(c,r)?c:Ir.current!==null?(s=Ap(s,c,d),Ms(s,r)||(_n=!0),s):(ir&106)===0||(ir&1073741824)!==0&&(ht&261930)===0?(_n=!0,s.memoizedState=c):(s=cb(),it.lanes|=s,Gr|=s,r)}function ty(s,r,c,d,m){var x=Re.p;Re.p=x!==0&&8>x?x:8;var w=Te.T,M={};M.types=w!==null?w.types:null,Te.T=M,Lp(s,!1,r,c);try{var I=m(),ee=Te.S;if(ee!==null&&ee(M,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var le=RE(I,d);vc(s,r,le,Ds(s))}else vc(s,r,d,Ds(s))}catch(pe){vc(s,r,{then:function(){},status:"rejected",reason:pe},Ds())}finally{Re.p=x,w!==null&&M.types!==null&&(w.types=M.types),Te.T=w}}function PE(){}function Rp(s,r,c,d){if(s.tag!==5)throw Error(i(476));var m=ny(s).queue;ty(s,m,r,It,c===null?PE:function(){return sy(s),c(d)})}function ny(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:It,baseState:It,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:It},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rr,lastRenderedState:c},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function sy(s){var r=ny(s);r.next===null&&(r=s.alternate.memoizedState),vc(s,r.next.queue,{},Ds())}function Op(){return zn(Kl)}function iy(){return xn().memoizedState}function ry(){return xn().memoizedState}function BE(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var c=Ds();s=Pr(c);var d=Br(r,s,c);d!==null&&(xs(d,r,c),hc(d,r,c)),r={cache:lp()},s.payload=r;return}r=r.return}}function IE(s,r,c){var d=Ds();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Sd(s)?ly(r,c):(c=Zf(s,r,c,d),c!==null&&(xs(c,s,d),oy(c,r,d)))}function ay(s,r,c){var d=Ds();vc(s,r,c,d)}function vc(s,r,c,d){var m={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Sd(s))ly(r,m);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var w=r.lastRenderedState,M=x(w,c);if(m.hasEagerState=!0,m.eagerState=M,Ms(M,w))return ed(s,r,m,0),Dt===null&&Ju(),!1}catch{}finally{}if(c=Zf(s,r,m,d),c!==null)return xs(c,s,d),oy(c,r,d),!0}return!1}function Lp(s,r,c,d){if(d={lane:2,revertLane:km(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Sd(s)){if(r)throw Error(i(479))}else r=Zf(s,c,d,2),r!==null&&xs(r,s,2)}function Sd(s){var r=s.alternate;return s===it||r!==null&&r===it}function ly(s,r){Ml=gd=!0;var c=s.pending;c===null?r.next=r:(r.next=c.next,c.next=r),s.pending=r}function oy(s,r,c){if((c&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Io(s,c)}}var kd={readContext:zn,use:yd,useCallback:dn,useContext:dn,useEffect:dn,useImperativeHandle:dn,useLayoutEffect:dn,useInsertionEffect:dn,useMemo:dn,useReducer:dn,useRef:dn,useState:dn,useDebugValue:dn,useDeferredValue:dn,useTransition:dn,useSyncExternalStore:dn,useId:dn,useHostTransitionStatus:dn,useFormState:dn,useActionState:dn,useOptimistic:dn,useMemoCache:dn,useCacheRefresh:dn,useEffectEvent:dn},cy={readContext:zn,use:yd,useCallback:function(s,r){return ns().memoizedState=[s,r===void 0?null:r],s},useContext:zn,useEffect:G1,useImperativeHandle:function(s,r,c){c=c!=null?c.concat([s]):null,_d(4194308,4,W1.bind(null,r,s),c)},useLayoutEffect:function(s,r){return _d(4194308,4,s,r)},useInsertionEffect:function(s,r){_d(4,2,s,r)},useMemo:function(s,r){var c=ns();r=r===void 0?null:r;var d=s();if(Ia){qn(!0);try{s()}finally{qn(!1)}}return c.memoizedState=[d,r],d},useReducer:function(s,r,c){var d=ns();if(c!==void 0){var m=c(r);if(Ia){qn(!0);try{c(r)}finally{qn(!1)}}}else m=r;return d.memoizedState=d.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},d.queue=s,s=s.dispatch=IE.bind(null,it,s),[d.memoizedState,s]},useRef:function(s){var r=ns();return s={current:s},r.memoizedState=s},useState:function(s){s=Cp(s);var r=s.queue,c=ay.bind(null,it,r);return r.dispatch=c,[s.memoizedState,c]},useDebugValue:Mp,useDeferredValue:function(s,r){var c=ns();return Ap(c,s,r)},useTransition:function(){var s=Cp(!1);return s=ty.bind(null,it,s.queue,!0,!1),ns().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,c){var d=it,m=ns();if(lt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=r(),Dt===null)throw Error(i(349));(ht&127)!==0||M1(d,r,c)}m.memoizedState=c;var x={value:c,getSnapshot:r};return m.queue=x,G1(R1.bind(null,d,x,s),[s]),d.flags|=2048,Rl(9,{destroy:void 0},A1.bind(null,d,x,c,r),null),c},useId:function(){var s=ns(),r=Dt.identifierPrefix;if(lt){var c=Ei,d=Ci;c=(d&~(1<<32-tn(d)-1)).toString(32)+c,r="_"+r+"R_"+c,c=xd++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=OE++,r="_"+r+"r_"+c.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Op,useFormState:F1,useActionState:F1,useOptimistic:function(s){var r=ns();r.memoizedState=r.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=Lp.bind(null,it,!0,c),c.dispatch=r,[s,r]},useMemoCache:kp,useCacheRefresh:function(){return ns().memoizedState=BE.bind(null,it)},useEffectEvent:function(s){var r=ns(),c={impl:s};return r.memoizedState=c,function(){if((Nt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},uy={readContext:zn,use:yd,useCallback:Z1,useContext:zn,useEffect:Tp,useImperativeHandle:K1,useInsertionEffect:Q1,useLayoutEffect:X1,useMemo:J1,useReducer:bd,useRef:V1,useState:function(){return bd(rr)},useDebugValue:Mp,useDeferredValue:function(s,r){var c=xn();return ey(c,Ot.memoizedState,s,r)},useTransition:function(){var s=bd(rr)[0],r=xn().memoizedState;return[typeof s=="boolean"?s:xc(s),r]},useSyncExternalStore:T1,useId:iy,useHostTransitionStatus:Op,useFormState:U1,useActionState:U1,useOptimistic:function(s,r){var c=xn();return D1(c,Ot,s,r)},useMemoCache:kp,useCacheRefresh:ry,useEffectEvent:Y1},FE={readContext:zn,use:yd,useCallback:Z1,useContext:zn,useEffect:Tp,useImperativeHandle:K1,useInsertionEffect:Q1,useLayoutEffect:X1,useMemo:J1,useReducer:Np,useRef:V1,useState:function(){return Np(rr)},useDebugValue:Mp,useDeferredValue:function(s,r){var c=xn();return Ot===null?Ap(c,s,r):ey(c,Ot.memoizedState,s,r)},useTransition:function(){var s=Np(rr)[0],r=xn().memoizedState;return[typeof s=="boolean"?s:xc(s),r]},useSyncExternalStore:T1,useId:iy,useHostTransitionStatus:Op,useFormState:q1,useActionState:q1,useOptimistic:function(s,r){var c=xn();return Ot!==null?D1(c,Ot,s,r):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:kp,useCacheRefresh:ry,useEffectEvent:Y1};function Dp(s,r,c,d){r=s.memoizedState,c=c(d,r),c=c==null?r:P({},r,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var zp={enqueueSetState:function(s,r,c){s=s._reactInternals;var d=Ds(),m=Pr(d);m.payload=r,c!=null&&(m.callback=c),r=Br(s,m,d),r!==null&&(xs(r,s,d),hc(r,s,d))},enqueueReplaceState:function(s,r,c){s=s._reactInternals;var d=Ds(),m=Pr(d);m.tag=1,m.payload=r,c!=null&&(m.callback=c),r=Br(s,m,d),r!==null&&(xs(r,s,d),hc(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var c=Ds(),d=Pr(c);d.tag=2,r!=null&&(d.callback=r),r=Br(s,d,c),r!==null&&(xs(r,s,c),hc(r,s,c))}};function dy(s,r,c,d,m,x,w){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,x,w):r.prototype&&r.prototype.isPureReactComponent?!ic(c,d)||!ic(m,x):!0}function hy(s,r,c,d){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,d),r.state!==s&&zp.enqueueReplaceState(r,r.state,null)}function Fa(s,r){var c=r;if("ref"in r){c={};for(var d in r)d!=="ref"&&(c[d]=r[d])}if(s=s.defaultProps){c===r&&(c=P({},c));for(var m in s)c[m]===void 0&&(c[m]=s[m])}return c}function fy(s){Zu(s)}function py(s){console.error(s)}function my(s){Zu(s)}function jd(s,r){try{var c=s.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function gy(s,r,c){try{var d=s.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function $p(s,r,c){return c=Pr(c),c.tag=3,c.payload={element:null},c.callback=function(){jd(s,r)},c}function xy(s){return s=Pr(s),s.tag=3,s}function vy(s,r,c,d){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;s.payload=function(){return m(x)},s.callback=function(){gy(r,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(s.callback=function(){gy(r,c,d),typeof m!="function"&&(Yr===null?Yr=new Set([this]):Yr.add(this));var M=d.stack;this.componentDidCatch(d.value,{componentStack:M!==null?M:""})})}function UE(s,r,c,d,m){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(r=c.alternate,r!==null&&Oa(r,c,m,!0),c=$n.current,c!==null){switch(c.tag){case 31:case 13:case 19:return Vn===null?Gd():c.alternate===null&&hn===0&&(hn=3),c.flags&=-257,c.flags|=65536,c.lanes=m,d===dd?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([d]):r.add(d),_m(s,d,m)),!1;case 22:return c.flags|=65536,d===dd?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([d]):c.add(d)),_m(s,d,m)),!1}throw Error(i(435,c.tag))}return _m(s,d,m),Gd(),!1}if(lt)return r=$n.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,d!==sp&&(s=Error(i(422),{cause:d}),lc(Hs(s,c)))):(d!==sp&&(r=Error(i(423),{cause:d}),lc(Hs(r,c))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,d=Hs(d,c),m=$p(s.stateNode,d,m),fp(s,m),hn!==4&&(hn=2)),!1;var x=Error(i(520),{cause:d});if(x=Hs(x,c),Nc===null?Nc=[x]:Nc.push(x),hn!==4&&(hn=2),r===null)return!0;d=Hs(d,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,s=m&-m,c.lanes|=s,s=$p(c.stateNode,d,s),fp(c,s),!1;case 1:if(r=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Yr===null||!Yr.has(x))))return c.flags|=65536,m&=-m,c.lanes|=m,m=xy(m),vy(m,s,c,d),fp(c,m),!1;break;case 22:if(c.memoizedState!==null)return c.flags|=65536,!1}c=c.return}while(c!==null);return!1}var Pp=Error(i(461)),_n=!1;function Nn(s,r,c,d){r.child=s===null?w1(r,null,c,d):Ba(r,s.child,c,d)}function yy(s,r,c,d,m){c=c.render;var x=r.ref;if("ref"in d){var w={};for(var M in d)M!=="ref"&&(w[M]=d[M])}else w=d;return La(r),d=bp(s,r,c,w,x,m),M=_p(),s!==null&&!_n?(wp(s,r,m),ar(s,r,m)):(lt&&M&&id(r),r.flags|=1,Nn(s,r,d,m),r.child)}function by(s,r,c,d,m){if(s===null){var x=c.type;return typeof x=="function"&&!Jf(x)&&x.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=x,_y(s,r,x,d,m)):(s=nd(c.type,null,d,r,r.mode,m),s.ref=r.ref,s.return=r,r.child=s)}if(x=s.child,!Gp(s,m)){var w=x.memoizedProps;if(c=c.compare,c=c!==null?c:ic,c(w,d)&&s.ref===r.ref)return ar(s,r,m)}return r.flags|=1,s=er(x,d),s.ref=r.ref,s.return=r,r.child=s}function _y(s,r,c,d,m){if(s!==null){var x=s.memoizedProps;if(ic(x,d)&&s.ref===r.ref)if(_n=!1,r.pendingProps=d=x,Gp(s,m))(s.flags&131072)!==0&&(_n=!0);else return r.lanes=s.lanes,ar(s,r,m)}return Bp(s,r,c,d,m)}function wy(s,r,c,d){var m=d.children,x=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((r.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,s!==null){for(d=r.child=s.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,r.child=null;return Sy(s,r,x,c,d)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&cd(r,x!==null?x.cachePool:null),x!==null?j1(r,x):mp(),N1(r);else return d=r.lanes=536870912,Sy(s,r,x!==null?x.baseLanes|c:c,c,d)}else x!==null?(cd(r,x.cachePool),j1(r,x),Ur(),r.memoizedState=null):(s!==null&&cd(r,null),mp(),Ur());return Nn(s,r,m,c),r.child}function yc(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Sy(s,r,c,d,m){var x=cp();return x=x===null?null:{parent:yn._currentValue,pool:x},r.memoizedState={baseLanes:c,cachePool:x},s!==null&&cd(r,null),mp(),N1(r),s!==null&&Oa(s,r,d,!0),r.childLanes=m,null}function Nd(s,r){return r=Cd({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function ky(s,r,c){return Ba(r,s.child,null,c),s=Nd(r,r.pendingProps),s.flags|=2,As(r),r.memoizedState=null,s}function HE(s,r,c){var d=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(lt){if(d.mode==="hidden")return s=Nd(r,d),r.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},yc(null,s);if(xp(r),(s=Ht)?(s=Wb(s,Gs),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Rr!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},c=l1(s),c.return=r,r.child=c,En=r,Ht=null)):s=null,s===null)throw Lr(r);return r.lanes=536870912,null}return Nd(r,d)}var x=s.memoizedState;if(x!==null){var w=x.dehydrated;if(xp(r),m)if(r.flags&256)r.flags&=-257,r=ky(s,r,c);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(_n||Oa(s,r,c,!1),m=(c&s.childLanes)!==0,_n||m){if(Ir.current===null){if(d=Dt,d!==null&&(w=ki(d,c),w!==0&&w!==x.retryLane))throw x.retryLane=w,Ta(s,w),xs(d,s,w),Pp;Gd()}r=ky(s,r,c)}else s=x.treeContext,Ht=Qs(w.nextSibling),En=r,lt=!0,Or=null,Gs=!1,s!==null&&u1(r,s),r=Nd(r,d),r.flags|=134221824;return r}return s=er(s.child,{mode:d.mode,children:d.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Ol(s,r){var c=r.ref;if(c===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(r.flags|=4194816)}}function Bp(s,r,c,d,m){return La(r),c=bp(s,r,c,d,void 0,m),d=_p(),s!==null&&!_n?(wp(s,r,m),ar(s,r,m)):(lt&&d&&id(r),r.flags|=1,Nn(s,r,c,m),r.child)}function jy(s,r,c,d,m,x){return La(r),r.updateQueue=null,c=E1(r,d,c,m),C1(s),d=_p(),s!==null&&!_n?(wp(s,r,x),ar(s,r,x)):(lt&&d&&id(r),r.flags|=1,Nn(s,r,c,x),r.child)}function Ny(s,r,c,d,m){if(La(r),r.stateNode===null){var x=Sl,w=c.contextType;typeof w=="object"&&w!==null&&(x=zn(w)),x=new c(d,x),r.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=zp,r.stateNode=x,x._reactInternals=r,x=r.stateNode,x.props=d,x.state=r.memoizedState,x.refs={},dp(r),w=c.contextType,x.context=typeof w=="object"&&w!==null?zn(w):Sl,x.state=r.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(Dp(r,c,w,d),x.state=r.memoizedState),typeof c.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&&zp.enqueueReplaceState(x,x.state,null),pc(r,d,x,m),fc(),x.state=r.memoizedState),typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!0}else if(s===null){x=r.stateNode;var M=r.memoizedProps,I=Fa(c,M);x.props=I;var ee=x.context,le=c.contextType;w=Sl,typeof le=="object"&&le!==null&&(w=zn(le));var pe=c.getDerivedStateFromProps;le=typeof pe=="function"||typeof x.getSnapshotBeforeUpdate=="function",M=r.pendingProps!==M,le||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(M||ee!==w)&&hy(r,x,d,w),$r=!1;var Z=r.memoizedState;x.state=Z,pc(r,d,x,m),fc(),ee=r.memoizedState,M||Z!==ee||$r?(typeof pe=="function"&&(Dp(r,c,pe,d),ee=r.memoizedState),(I=$r||dy(r,c,I,d,Z,ee,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"&&(r.flags|=4194308)):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=I):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{x=r.stateNode,hp(s,r),w=r.memoizedProps,le=Fa(c,w),x.props=le,pe=r.pendingProps,Z=x.context,ee=c.contextType,I=Sl,typeof ee=="object"&&ee!==null&&(I=zn(ee)),M=c.getDerivedStateFromProps,(ee=typeof M=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==pe||Z!==I)&&hy(r,x,d,I),$r=!1,Z=r.memoizedState,x.state=Z,pc(r,d,x,m),fc();var ie=r.memoizedState;w!==pe||Z!==ie||$r||s!==null&&s.dependencies!==null&&ld(s.dependencies)?(typeof M=="function"&&(Dp(r,c,M,d),ie=r.memoizedState),(le=$r||dy(r,c,le,d,Z,ie,I)||s!==null&&s.dependencies!==null&&ld(s.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,ie,I),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,ie,I)),typeof x.componentDidUpdate=="function"&&(r.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=ie),x.props=d,x.state=ie,x.context=I,d=le):(typeof x.componentDidUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),d=!1)}return x=d,Ol(s,r),d=(r.flags&128)!==0,x||d?(x=r.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:x.render(),r.flags|=1,s!==null&&d?(r.child=Ba(r,s.child,null,m),r.child=Ba(r,null,c,m)):Nn(s,r,c,m),r.memoizedState=x.state,s=r.child):s=ar(s,r,m),s}function Cy(s,r,c,d){return Aa(),r.flags|=256,Nn(s,r,c,d),r.child}var Ip={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fp(s){return{baseLanes:s,cachePool:g1()}}function Up(s,r,c){return s=s!==null?s.childLanes&~c:0,r&&(s|=Ls),s}function Ey(s,r,c){var d=r.pendingProps,m=!1,x=(r.flags&128)!==0,w;if((w=x)||(w=s!==null&&s.memoizedState===null?!1:(Pn.current&2)!==0),w&&(m=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,s===null){if(lt){if(m?Fr(r):Ur(),(s=Ht)?(s=Wb(s,Gs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Rr!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},c=l1(s),c.return=r,r.child=c,En=r,Ht=null)):s=null,s===null)throw Lr(r);return Fm(s)?r.lanes=32:r.lanes=536870912,null}return x=d.children,d=d.fallback,m?(Ur(),m=r.mode,x=Cd({mode:"hidden",children:x},m),d=Ma(d,m,c,null),x.return=r,d.return=r,x.sibling=d,r.child=x,d=r.child,d.memoizedState=Fp(c),d.childLanes=Up(s,w,c),r.memoizedState=Ip,yc(null,d)):(Fr(r),Hp(r,x))}var M=s.memoizedState;if(M!==null){var I=M.dehydrated;if(I!==null)return qE(s,r,x,w,d,I,M,c)}return m?(Ur(),m=d.fallback,x=r.mode,M=s.child,I=M.sibling,d=er(M,{mode:"hidden",children:d.children}),d.subtreeFlags=M.subtreeFlags&1206910976,I!==null?m=er(I,m):(m=Ma(m,x,c,null),m.flags|=2),m.return=r,d.return=r,d.sibling=m,r.child=d,yc(null,d),d=r.child,m=s.child.memoizedState,m===null?m=Fp(c):(x=m.cachePool,x!==null?(M=yn._currentValue,x=x.parent!==M?{parent:M,pool:M}:x):x=g1(),m={baseLanes:m.baseLanes|c,cachePool:x}),d.memoizedState=m,d.childLanes=Up(s,w,c),r.memoizedState=Ip,yc(s.child,d)):(Fr(r),c=s.child,s=c.sibling,c=er(c,{mode:"visible",children:d.children}),c.return=r,c.sibling=null,s!==null&&(w=r.deletions,w===null?(r.deletions=[s],r.flags|=16):w.push(s)),r.child=c,r.memoizedState=null,c)}function Hp(s,r){return r=Cd({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Cd(s,r){return s=fs(22,s,null,r),s.lanes=0,s}function Ed(s,r,c){return Ba(r,s.child,null,c),s=Hp(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function qE(s,r,c,d,m,x,w,M){if(c)return r.flags&256?(Fr(r),r.flags&=-257,Ed(s,r,M)):r.memoizedState!==null?(Ur(),r.child=s.child,r.flags|=128,null):(Ur(),x=m.fallback,w=r.mode,m=Cd({mode:"visible",children:m.children},w),x=Ma(x,w,M,null),x.flags|=2,m.return=r,x.return=r,m.sibling=x,r.child=m,Ba(r,s.child,null,M),m=r.child,m.memoizedState=Fp(M),m.childLanes=Up(s,d,M),r.memoizedState=Ip,yc(null,m));if(Fr(r),Fm(x)){if(d=x.nextSibling&&x.nextSibling.dataset,d)var I=d.dgst;return d=I,d!==""&&(m=Error(i(419)),m.stack="",m.digest=d,lc({value:m,source:null,stack:null})),Ed(s,r,M)}if(_n||Oa(s,r,M,!1),d=(M&s.childLanes)!==0,_n||d){if(Ir.current!==null)return Ed(s,r,M);if(d=Dt,d!==null&&(m=ki(d,M),m!==0&&m!==w.retryLane))throw w.retryLane=m,Ta(s,m),xs(d,s,m),Pp;return Im(x)||Gd(),Ed(s,r,M)}return Im(x)?(r.flags|=192,r.child=s.child,null):(s=w.treeContext,Ht=Qs(x.nextSibling),En=r,lt=!0,Or=null,Gs=!1,s!==null&&u1(r,s),r=Hp(r,m.children),r.flags|=134221824,r)}function Ty(s,r,c){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),ad(s.return,r,c)}function My(s){for(var r=null;s!==null;){var c=s.alternate;c!==null&&md(c)===null&&(r=s),s=s.sibling}return r}function Td(s,r,c,d,m,x){var w=s.memoizedState;w===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:m,treeForkCount:x}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=m,w.treeForkCount=x)}function qp(s){var r=s.child;for(s.child=null;r!==null;){var c=r.sibling;r.sibling=s.child,s.child=r,r=c}}function Vp(s,r,c){var d=r.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=Pn.current;if(r.flags&128)return mc(r,w),null;var M=(w&2)!==0;if(M?(w=w&1|2,r.flags|=128):w&=1,mc(r,w),m==="backwards"&&s!==null?(qp(s),Nn(s,r,d,c),qp(s)):Nn(s,r,d,c),d=lt?ac:0,!M&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Ty(s,c,r);else if(s.tag===19)Ty(s,c,r);else if(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;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"backwards":c=My(r.child),c===null?(m=r.child,r.child=null):(m=c.sibling,c.sibling=null,qp(r)),Td(r,!0,m,null,x,d);break;case"unstable_legacy-backwards":for(c=null,m=r.child,r.child=null;m!==null;){if(s=m.alternate,s!==null&&md(s)===null){r.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}Td(r,!0,c,null,x,d);break;case"together":Td(r,!1,null,null,void 0,d);break;case"independent":r.memoizedState=null;break;default:c=My(r.child),c===null?(m=r.child,r.child=null):(m=c.sibling,c.sibling=null),Td(r,!1,m,c,x,d)}return r.child}function Ay(s,r,c){var d=r.pendingProps;return Dr(r,r.type,d.value),Nn(s,r,d.children,c),r.child}function ar(s,r,c){if(s!==null&&(r.dependencies=s.dependencies),Gr|=r.lanes,(c&r.childLanes)===0)if(s!==null){if(Oa(s,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,c=er(s,s.pendingProps),r.child=c,c.return=r;s.sibling!==null;)s=s.sibling,c=c.sibling=er(s,s.pendingProps),c.return=r;c.sibling=null}return r.child}function Gp(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&ld(s)))}function VE(s,r,c){switch(r.tag){case 3:We(r,r.stateNode.containerInfo),Dr(r,yn,s.memoizedState.cache),Aa();break;case 27:case 5:Zt(r);break;case 4:We(r,r.stateNode.containerInfo);break;case 10:Dr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,xp(r),null;break;case 13:var d=r.memoizedState;if(d!==null){if(d.dehydrated!==null)return Fr(r),r.flags|=128,null;d=Oa(s,r,c,!1);var m=r.child.childLanes;return d||(c&m)!==0?Ey(s,r,c):(Fr(r),s=ar(s,r,c),s!==null?s.sibling:null)}Fr(r);break;case 19:if(r.flags&128)return Vp(s,r,c);if(m=(s.flags&128)!==0,d=(c&r.childLanes)!==0,d||(Oa(s,r,c,!1),d=(c&r.childLanes)!==0),m){if(d)return Vp(s,r,c);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),mc(r,Pn.current),d)break;return null;case 22:return r.lanes=0,wy(s,r,c,r.pendingProps);case 24:Dr(r,yn,s.memoizedState.cache)}return ar(s,r,c)}function Ry(s,r,c){if(s!==null)if(s.memoizedProps!==r.pendingProps)_n=!0;else{if(!Gp(s,c)&&(r.flags&128)===0)return _n=!1,VE(s,r,c);_n=(s.flags&131072)!==0}else _n=!1,lt&&(r.flags&1048576)!==0&&c1(r,ac,r.index);switch(r.lanes=0,r.tag){case 16:e:{var d=r.pendingProps;if(s=$a(r.elementType),r.type=s,typeof s=="function")Jf(s)?(d=Fa(s,d),r.tag=1,r=Ny(null,r,s,d,c)):(r.tag=0,r=Bp(null,r,s,d,c));else{if(s!=null){var m=s.$$typeof;if(m===G){r.tag=11,r=yy(null,r,s,d,c);break e}else if(m===_e){r.tag=14,r=by(null,r,s,d,c);break e}else if(m===V){r.tag=10,r.type=s,r=Ay(null,r,c);break e}}throw r=Be(s)||s,Error(i(306,r,""))}}return r;case 0:return Bp(s,r,r.type,r.pendingProps,c);case 1:return d=r.type,m=Fa(d,r.pendingProps),Ny(s,r,d,m,c);case 3:e:{if(We(r,r.stateNode.containerInfo),s===null)throw Error(i(387));d=r.pendingProps;var x=r.memoizedState;m=x.element,hp(s,r),pc(r,d,null,c);var w=r.memoizedState;if(d=w.cache,Dr(r,yn,d),d!==x.cache&&ap(r,[yn],c,!0),fc(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=x,r.memoizedState=x,r.flags&256){r=Cy(s,r,d,c);break e}else if(d!==m){m=Hs(Error(i(424)),r),lc(m),r=Cy(s,r,d,c);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Ht=Qs(s.firstChild),En=r,lt=!0,Or=null,Gs=!0,c=w1(r,null,d,c),r.child=c;c;)c.flags=c.flags&-3|134221824,c=c.sibling}else{if(Aa(),d===m){r=ar(s,r,c);break e}Nn(s,r,d,c)}r=r.child}return r;case 26:return Ol(s,r),s===null?(c=s_(r.type,null,r.pendingProps,null))?r.memoizedState=c:lt||(r.stateNode=zb(r.type,r.pendingProps,se.current,r)):r.memoizedState=s_(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return Zt(r),s===null&&lt&&(d=r.stateNode=Jb(r.type,r.pendingProps,se.current),En=r,Gs=!0,m=Ht,Wr(r.type)?(Um=m,Ht=Qs(d.firstChild)):Ht=m),Nn(s,r,r.pendingProps.children,c),Ol(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&lt&&((m=d=Ht)&&(d=BT(d,r.type,r.pendingProps,Gs),d!==null?(r.stateNode=d,En=r,Ht=Qs(d.firstChild),Gs=!1,m=!0):m=!1),m||Lr(r)),Zt(r),m=r.type,x=r.pendingProps,w=s!==null?s.memoizedProps:null,d=x.children,Om(m,x)?d=null:w!==null&&Om(m,w)&&(r.flags|=32),r.memoizedState!==null&&(m=bp(s,r,LE,null,null,c),Kl._currentValue=m),Ol(s,r),Nn(s,r,d,c),r.child;case 6:return s===null&&lt&&((s=c=Ht)&&(c=IT(c,r.pendingProps,Gs),c!==null?(r.stateNode=c,En=r,Ht=null,s=!0):s=!1),s||Lr(r)),null;case 13:return Ey(s,r,c);case 4:return We(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=Ba(r,null,d,c):Nn(s,r,d,c),r.child;case 11:return yy(s,r,r.type,r.pendingProps,c);case 7:return d=r.pendingProps,Ol(s,r),Nn(s,r,d,c),r.child;case 8:return Nn(s,r,r.pendingProps.children,c),r.child;case 12:return Nn(s,r,r.pendingProps.children,c),r.child;case 10:return Ay(s,r,c);case 9:return m=r.type._context,d=r.pendingProps.children,La(r),m=zn(m),d=d(m),r.flags|=1,Nn(s,r,d,c),r.child;case 14:return by(s,r,r.type,r.pendingProps,c);case 15:return _y(s,r,r.type,r.pendingProps,c);case 19:return Vp(s,r,c);case 31:return HE(s,r,c);case 22:return wy(s,r,c,r.pendingProps);case 24:return La(r),d=zn(yn),s===null?(m=cp(),m===null&&(m=Dt,x=lp(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=c),m=x),r.memoizedState={parent:d,cache:m},dp(r),Dr(r,yn,m)):((s.lanes&c)!==0&&(hp(s,r),pc(r,null,null,c),fc()),m=s.memoizedState,x=r.memoizedState,m.parent!==d?(m={parent:d,cache:d},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),Dr(r,yn,d)):(d=x.cache,Dr(r,yn,d),d!==m.cache&&ap(r,[yn],c,!0))),Nn(s,r,r.pendingProps.children,c),r.child;case 30:return r.stateNode===null&&(r.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=r.pendingProps,d.name!=null&&d.name!=="auto"?r.flags|=s===null?18882560:18874368:lt&&id(r),s!==null&&s.memoizedProps.name!==d.name?r.flags|=4194816:Ol(s,r),Nn(s,r,d.children,c),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function lr(s){s.flags|=4}function Yp(s,r,c,d,m){var x;if((x=(s.mode&32)!==0)&&(x=c===null?l_(r,d):l_(r,d)&&(d.src!==c.src||d.srcSet!==c.srcSet)),x){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(fb())s.flags|=8192;else throw Pa=dd,up}else s.flags&=-16777217}function Oy(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!o_(r))if(fb())s.flags|=8192;else throw Pa=dd,up}function Md(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Uu():536870912,s.lanes|=r,Pl|=r)}function bc(s,r){if(!lt)switch(s.tailMode){case"visible":break;case"collapsed":for(var c=s.tail,d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(r=s.tail,c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s.tail=null:c.sibling=null}}function qt(s){var r=s.alternate!==null&&s.alternate.child===s.child,c=0,d=0;if(r)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags&1206910976,d|=m.flags&1206910976,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=d,s.childLanes=c,r}function GE(s,r,c){var d=r.pendingProps;switch(np(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(r),null;case 1:return qt(r),null;case 3:return c=r.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),sr(yn),nt(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(Nl(r)?lr(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,ip())),qt(r),null;case 26:var m=r.type,x=r.memoizedState;return s===null?(lr(r),x!==null?(qt(r),Oy(r,x)):(qt(r),Yp(r,m,null,d,c))):x?x!==s.memoizedState?(lr(r),qt(r),Oy(r,x)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&lr(r),qt(r),Yp(r,m,s,d,c)),null;case 27:if(Ft(r),c=se.current,m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&lr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}s=xt.current,Nl(r)?d1(r):(s=Jb(m,d,c),r.stateNode=s,lr(r))}return qt(r),r.subtreeFlags&=-33554433,null;case 5:if(Ft(r),m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&lr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}if(x=xt.current,Nl(r))d1(r);else{var w=Ac(se.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[gn]=r,x[Cn]=d;e:for(w=r.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===r)break e;for(;w.sibling===null;){if(w.return===null||w.return===r)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}r.stateNode=x;e:switch(In(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&&lr(r)}}return qt(r),r.subtreeFlags&=-33554433,Yp(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,c),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&lr(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(i(166));if(s=se.current,Nl(r)){if(s=r.stateNode,c=r.memoizedProps,d=null,m=En,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}s[gn]=r,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||Rb(s.nodeValue,c)),s||Lr(r,!0)}else s=Ac(s).createTextNode(d),s[gn]=r,r.stateNode=s}return qt(r),null;case 31:if(c=r.memoizedState,s===null||s.memoizedState!==null){if(d=Nl(r),c!==null){if(s===null){if(!d)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[gn]=r}else Aa(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),s=!1}else c=ip(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return r.flags&256?(As(r),r):(As(r),null);if((r.flags&128)!==0)throw Error(i(558))}return qt(r),null;case 13:if(d=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Nl(r),d!==null&&d.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[gn]=r}else Aa(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),m=!1}else m=ip(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(As(r),r):(As(r),null)}return As(r),(r.flags&128)!==0?(r.lanes=c,r):(c=d!==null,s=s!==null&&s.memoizedState!==null,c&&(d=r.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)),c!==s&&c&&(r.child.flags|=8192),Md(r,r.updateQueue),qt(r),null);case 4:return nt(),s===null&&Em(r.stateNode.containerInfo),r.flags|=67108864,qt(r),null;case 10:return sr(r.type),qt(r),null;case 19:if(vp(r),d=r.memoizedState,d===null)return qt(r),null;if(m=(r.flags&128)!==0,x=d.rendering,x===null)if(m)bc(d,!1);else{if(hn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(x=md(s),x!==null){for(r.flags|=128,bc(d,!1),s=x.updateQueue,r.updateQueue=s,Md(r,s),r.subtreeFlags=0,s=c,c=r.child;c!==null;)a1(c,s),c=c.sibling;return mc(r,Pn.current&1|2),lt&&tr(r,d.treeForkCount),r.child}s=s.sibling}d.tail!==null&&Ut()>Ud&&(r.flags|=128,m=!0,bc(d,!1),r.lanes=4194304)}else{if(!m)if(s=md(x),s!==null){if(r.flags|=128,m=!0,s=s.updateQueue,r.updateQueue=s,Md(r,s),bc(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!x.alternate&&!lt)return qt(r),null}else 2*Ut()-d.renderingStartTime>Ud&&c!==536870912&&(r.flags|=128,m=!0,bc(d,!1),r.lanes=4194304);d.isBackwards?(x.sibling=r.child,r.child=x):(s=d.last,s!==null?s.sibling=x:r.child=x,d.last=x)}if(d.tail!==null){s=d.tail;e:{for(c=s;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Ut(),s.sibling=null,x=Pn.current,x=m?x&1|2:x&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!c||lt?mc(r,x):(c=x,Ze($n,r),Ze(Pn,c),Vn===null&&(Vn=r)),lt&&tr(r,d.treeForkCount),s}return qt(r),null;case 22:case 23:return As(r),gp(),d=r.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(r.flags|=8192):d&&(r.flags|=8192),d?(c&536870912)!==0&&(r.flags&128)===0&&(qt(r),r.subtreeFlags&6&&(r.flags|=8192)):qt(r),c=r.updateQueue,c!==null&&Md(r,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==c&&(r.flags|=2048),s!==null&&wt(za),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),sr(yn),qt(r),null;case 25:return null;case 30:return r.flags|=33554432,qt(r),null}throw Error(i(156,r.tag))}function YE(s,r){switch(np(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return sr(yn),nt(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return Ft(r),null;case 31:if(r.memoizedState!==null){if(As(r),r.alternate===null)throw Error(i(340));Aa()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(As(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Aa()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return vp(r),s=r.flags,s&65536?(r.flags=s&-65537|128,s=r.memoizedState,s!==null&&(s.rendering=null,s.tail=null),r.flags|=4,r):null;case 4:return nt(),null;case 10:return sr(r.type),null;case 22:case 23:return As(r),gp(),s!==null&&wt(za),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return sr(yn),null;case 25:return null;default:return null}}function Ly(s,r){switch(np(r),r.tag){case 3:sr(yn),nt();break;case 26:case 27:case 5:Ft(r);break;case 4:nt();break;case 31:r.memoizedState!==null&&As(r);break;case 13:As(r);break;case 19:vp(r);break;case 10:sr(r.type);break;case 22:case 23:As(r),gp(),s!==null&&wt(za);break;case 24:sr(yn)}}function _c(s,r){try{var c=r.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&s)===s){d=void 0;var x=c.create,w=c.inst;d=x(),w.destroy=d}c=c.next}while(c!==m)}}catch(M){Tt(r,r.return,M)}}function Hr(s,r,c){try{var d=r.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&s)===s){var w=d.inst,M=w.destroy;if(M!==void 0){w.destroy=void 0,m=r;var I=c,ee=M;try{ee()}catch(le){Tt(m,I,le)}}}d=d.next}while(d!==x)}}catch(le){Tt(r,r.return,le)}}function Dy(s){var r=s.updateQueue;if(r!==null){var c=s.stateNode;try{k1(r,c)}catch(d){Tt(s,s.return,d)}}}function zy(s,r,c){c.props=Fa(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(d){Tt(s,r,d)}}function Ti(s,r){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var m=s.stateNode,x=Zi(s.memoizedProps,m);(m.ref===null||m.ref.name!==x)&&(m.ref=Hb(x)),d=m.ref;break;case 7:if(s.stateNode===null){var w=new zs(s);v(s.child,!1,$T,w,void 0,void 0),s.stateNode=w}d=s.stateNode;break;default:d=s.stateNode}typeof c=="function"?s.refCleanup=c(d):c.current=d}}catch(M){Tt(s,r,M)}}function Bn(s,r){var c=s.ref,d=s.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(m){Tt(s,r,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Tt(s,r,m)}else c.current=null}function Ad(s,r){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&r!==null)for(var c=0;c<r.length;c++)Xb(s.stateNode,r[c])}function $y(s){for(var r=s.return;r!==null&&(Xp(r)&&Xb(s.stateNode,r.stateNode),!Qp(r));)r=r.return}function wc(s){for(var r=s.return;r!==null&&(Xp(r)&&PT(s.stateNode,r.stateNode),!Qp(r));)r=r.return}function Qp(s){return s.tag===5||s.tag===3||s.tag===27}function Xp(s){return s&&s.tag===7&&s.stateNode!==null}function Wp(s){var r=s.type,c=s.memoizedProps,d=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(m){Tt(s,s.return,m)}}function Kp(s,r,c){try{var d=s.stateNode;yT(d,s.type,c,r),d[Cn]=r}catch(m){Tt(s,s.return,m)}}function Py(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Wr(s.type)||s.tag===4}function Zp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Py(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Wr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Jp(s,r,c,d){var m=s.tag;if(m===5||m===6)m=s.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(m,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(m),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=es)),Ad(s,d),vt=!0;else if(m!==4&&(m===27&&(Ad(s,d),d=null,Wr(s.type)&&(c=s.stateNode,r=null)),s=s.child,s!==null))for(Jp(s,r,c,d),s=s.sibling;s!==null;)Jp(s,r,c,d),s=s.sibling}function Rd(s,r,c,d){var m=s.tag;if(m===5||m===6)m=s.stateNode,r?c.insertBefore(m,r):c.appendChild(m),Ad(s,d),vt=!0;else if(m!==4&&(m===27&&(Ad(s,d),d=null,Wr(s.type)&&(c=s.stateNode)),s=s.child,s!==null))for(Rd(s,r,c,d),s=s.sibling;s!==null;)Rd(s,r,c,d),s=s.sibling}function By(s){var r=s.stateNode,c=s.memoizedProps;try{for(var d=s.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);In(r,d,c),r[gn]=s,r[Cn]=c}catch(x){Tt(s,s.return,x)}}var Od=!1,Rs=null;function Iy(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Od=!0)}var Mi=null;function Fy(){var s=Mi;return Mi=null,s}var ps=0;function Ll(s,r,c,d,m){return ps=0,Uy(s.child,r,c,d,m)}function Uy(s,r,c,d,m){for(var x=!1;s!==null;){if(s.tag===5){var w=s.stateNode;if(d!==null){var M=zm(w);d.push(M),M.view&&(x=!0)}else x||zm(w).view&&(x=!0);Od=!0,Fb(w,ps===0?r:r+"_"+ps,c),ps++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&m||Uy(s.child,r,c,d,m)&&(x=!0));s=s.sibling}return x}function Ai(s,r){for(;s!==null;)s.tag===5?Ub(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&r||Ai(s.child,r)),s=s.sibling}function Ld(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(Ld(s),s.tag===30&&(s.flags&18874368)!==0&&s.stateNode.paired)){var r=s.memoizedProps;if(r.name==null||r.name==="auto")throw Error(i(544));var c=r.name;r=Ji(r.default,r.share),r!=="none"&&(Ll(s,c,r,null,!1)||Ai(s.child,!1))}s=s.sibling}}function em(s,r){if(s.tag===30){var c=s.stateNode,d=s.memoizedProps,m=Zi(d,c),x=Ji(d.default,c.paired?d.share:d.enter);x!=="none"?Ll(s,m,x,null,!1)?(Ld(s),c.paired||r||Ul(s,d.onEnter)):Ai(s.child,!1):Ld(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)em(s,r),s=s.sibling;else Ld(s)}function tm(s){if(Rs!==null&&Rs.size!==0){var r=Rs;if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var c=s.memoizedProps,d=c.name;if(d!=null&&d!=="auto"){var m=r.get(d);if(m!==void 0){var x=Ji(c.default,c.share);if(x!=="none"&&(Ll(s,d,x,null,!1)?(x=s.stateNode,m.paired=x,x.paired=m,Ul(s,c.onShare)):Ai(s.child,!1)),r.delete(d),r.size===0)break}}}tm(s)}s=s.sibling}}}function nm(s){if(s.tag===30){var r=s.memoizedProps,c=Zi(r,s.stateNode),d=Rs!==null?Rs.get(c):void 0,m=Ji(r.default,d!==void 0?r.share:r.exit);m!=="none"&&(Ll(s,c,m,null,!1)?d!==void 0?(m=s.stateNode,d.paired=m,m.paired=d,Rs.delete(c),Ul(s,r.onShare)):Ul(s,r.onExit):Ai(s.child,!1)),Rs!==null&&tm(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)nm(s),s=s.sibling;else Rs!==null&&tm(s)}function Hy(s){for(s=s.child;s!==null;){if(s.tag===30){var r=s.memoizedProps,c=Zi(r,s.stateNode);r=Ji(r.default,r.update),s.flags&=-5,r!=="none"&&Ll(s,c,r,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&Hy(s);s=s.sibling}}function sm(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var r=s.stateNode;r.paired!==null&&(r.paired=null,Ai(s.child,!1))}sm(s)}s=s.sibling}}function Dd(s){if(s.tag===30)s.stateNode.paired=null,Ai(s.child,!1),sm(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Dd(s),s=s.sibling;else sm(s)}function qy(s){for(s=s.child;s!==null;)s.tag===30?Ai(s.child,!1):(s.subtreeFlags&33554432)!==0&&qy(s),s=s.sibling}function im(s,r,c,d,m,x,w){for(var M=!1;r!==null;){if(r.tag===5){var I=r.stateNode;if(x!==null&&ps<x.length){var ee=x[ps],le=zm(I);(ee.view||le.view)&&(M=!0);var pe;if(pe=(s.flags&4)===0)if(le.clip)pe=!0;else{pe=ee.rect;var Z=le.rect;pe=pe.y!==Z.y||pe.x!==Z.x||pe.height!==Z.height||pe.width!==Z.width}pe&&(s.flags|=4),le.abs?le=!ee.abs:(ee=ee.rect,le=le.rect,le=ee.height!==le.height||ee.width!==le.width),le&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&Fb(I,ps===0?c:c+"_"+ps,m),M&&(s.flags&4)!==0||(Mi===null&&(Mi=[]),Mi.push(I,ps===0?d:d+"_"+ps,r.memoizedProps)),ps++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&w?s.flags|=r.flags&32:im(s,r.child,c,d,m,x,w)&&(M=!0));r=r.sibling}return M}function Vy(s,r){for(s=s.child;s!==null;){if(s.tag===30){var c=s.memoizedProps,d=s.stateNode,m=Zi(c,d),x=Ji(c.default,c.update),w;w=s.memoizedState,s.memoizedState=null,d=s;var M=s.child;ps=0,m=im(d,M,m,m,x,w,!1),(s.flags&4)!==0&&m&&Ul(s,c.onUpdate)}else(s.subtreeFlags&33554432)!==0&&Vy(s);s=s.sibling}}var Tn=!1,Ct=!1,Ri=!1,rm=!1,Gy=typeof WeakSet=="function"?WeakSet:Set,Mn=null,Oi=!1,Sc=!1,zd=!1,am=!1;function QE(s,r,c){if(s=s.containerInfo,Am=Zl,s=Wv(s),Gf(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var x=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var M=0,I=-1,ee=-1,le=0,pe=0,Z=s,ie=null;t:for(;;){for(var Me;Z!==d||x!==0&&Z.nodeType!==3||(I=M+x),Z!==w||m!==0&&Z.nodeType!==3||(ee=M+m),Z.nodeType===3&&(M+=Z.nodeValue.length),(Me=Z.firstChild)!==null;)ie=Z,Z=Me;for(;;){if(Z===s)break t;if(ie===d&&++le===x&&(I=M),ie===w&&++pe===m&&(ee=M),(Me=Z.nextSibling)!==null)break;Z=ie,ie=Z.parentNode}Z=Me}d=I===-1||ee===-1?null:{start:I,end:ee}}else d=null}d=d||{start:0,end:0}}else d=null;for(Rm={focusedElem:s,selectionRange:d},Zl=!1,c=(c&335544064)===c,Mn=r,r=c?9270:1024;Mn!==null;){if(s=Mn,c&&(d=s.deletions,d!==null))for(x=0;x<d.length;x++)c&&nm(d[x]);if(s.alternate===null&&(s.flags&2)!==0)c&&Iy(s),$d(c);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&c&&nm(d),$d(c);continue}else if(d!==null&&d.memoizedState!==null){c&&Iy(s),$d(c);continue}}d=s.child,(s.subtreeFlags&r)!==0&&d!==null?(d.return=s,Mn=d):(c&&Hy(s),$d(c))}}Rs=null}function $d(s){for(;Mn!==null;){var r=Mn,c=s,d=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 15:break;case 1:if((m&1024)!==0&&d!==null){c=void 0,m=d.memoizedProps,d=d.memoizedState;var x=r.stateNode;try{var w=Fa(r.type,m);c=x.getSnapshotBeforeUpdate(w,d),x.__reactInternalSnapshotBeforeUpdate=c}catch(M){Tt(r,r.return,M)}}break;case 3:if((m&1024)!==0){if(d=r.stateNode.containerInfo,c=d.nodeType,c===9)Bm(d);else if(c===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":Bm(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:c&&d!==null&&(c=Zi(d.memoizedProps,d.stateNode),m=r.memoizedProps,m=Ji(m.default,m.update),m!=="none"&&Ll(d,c,m,d.memoizedState=[],!0));break;default:if((m&1024)!==0)throw Error(i(163))}if(d=r.sibling,d!==null){d.return=r.return,Mn=d;break}Mn=r.return}}function Yy(s,r,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Li(s,c),d&4&&_c(5,c);break;case 1:if(Li(s,c),d&4)if(s=c.stateNode,r===null)try{s.componentDidMount()}catch(w){Tt(c,c.return,w)}else{var m=Fa(c.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(m,r,s.__reactInternalSnapshotBeforeUpdate)}catch(w){Tt(c,c.return,w)}}d&64&&Dy(c),d&512&&Ti(c,c.return);break;case 3:if(Li(s,c),d&64&&(s=c.updateQueue,s!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{k1(s,r)}catch(w){Tt(c,c.return,w)}}break;case 27:r===null&&d&4&&By(c);case 26:case 5:Li(s,c),r===null&&d&4&&Wp(c),d&512&&Ti(c,c.return);break;case 12:Li(s,c);break;case 31:Li(s,c),d&4&&Ky(s,c);break;case 13:Li(s,c),d&4&&Zy(s,c),d&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=aT.bind(null,c),FT(s,c))));break;case 22:if(d=c.memoizedState!==null||Tn,!d){var x=r!==null&&r.memoizedState!==null||Ct;r=Tn,m=Ct,Tn=d,(Ct=x)&&!m?(d=2,(c.subtreeFlags&8772)!==0&&(d|=1),ci(s,c,d)):Li(s,c),Tn=r,Ct=m}break;case 30:Li(s,c),d&512&&Ti(c,c.return);break;case 7:d&512&&Ti(c,c.return);default:Li(s,c)}}function lm(s,r){for(s=s.child;s!==null;)Qy(s,r),s=s.sibling}function Qy(s,r){switch(s.tag){case 5:case 26:try{var c=s.stateNode;if(r){var d=c.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var m=s.stateNode,x=s.memoizedProps.style,w=x!=null&&x.hasOwnProperty("display")?x.display:null;m.style.display=w==null||typeof w=="boolean"?"":(""+w).trim()}}catch(I){Tt(s,s.return,I)}om(s,r);break;case 6:try{s.stateNode.nodeValue=r?"":s.memoizedProps,vt=!0}catch(I){Tt(s,s.return,I)}break;case 18:try{var M=s.stateNode;r?Ib(M,!0):Ib(s.stateNode,!1)}catch(I){Tt(s,s.return,I)}break;case 22:case 23:s.memoizedState===null&&lm(s,r);break;default:lm(s,r)}}function om(s,r){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var c=s,d=r;switch(c.tag){case 4:Qy(c,d);break e;case 22:c.memoizedState===null&&om(c,d);break e;default:om(c,d)}}s=s.sibling}}function Xy(s){var r=s.alternate;r!==null&&(s.alternate=null,Xy(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&pl(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var nn=null,ms=!1;function li(s,r,c){for(c=c.child;c!==null;)Wy(s,r,c),c=c.sibling}function Wy(s,r,c){if(pn&&typeof pn.onCommitFiberUnmount=="function")try{pn.onCommitFiberUnmount(Rn,c)}catch{}switch(c.tag){case 26:Ct||Bn(c,r),li(s,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&!Ct&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Ct||Bn(c,r),wc(c);var d=nn,m=ms;Wr(c.type)&&(nn=c.stateNode,ms=!1),li(s,r,c),e_(c.stateNode,c.type,c.memoizedProps),nn=d,ms=m;break;case 5:Ct||Bn(c,r),wc(c);case 6:if(c.tag===6&&wc(c),d=nn,m=ms,nn=null,li(s,r,c),nn=d,ms=m,nn!==null)if(ms)try{(nn.nodeType===9?nn.body:nn.nodeName==="HTML"?nn.ownerDocument.body:nn).removeChild(c.stateNode),vt=!0}catch(x){Tt(c,r,x)}else try{nn.removeChild(c.stateNode),vt=!0}catch(x){Tt(c,r,x)}break;case 18:nn!==null&&(ms?(s=nn,Bb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Jl(s)):Bb(nn,c.stateNode));break;case 4:d=nn,m=ms,nn=c.stateNode.containerInfo,ms=!0,li(s,r,c),nn=d,ms=m;break;case 0:case 11:case 14:case 15:Hr(2,c,r),Ct||Hr(4,c,r),li(s,r,c);break;case 1:Ct||(Bn(c,r),d=c.stateNode,typeof d.componentWillUnmount=="function"&&zy(c,r,d)),li(s,r,c);break;case 21:li(s,r,c);break;case 22:Ct=(d=Ct)||c.memoizedState!==null,li(s,r,c),Ct=d;break;case 30:Bn(c,r),li(s,r,c);break;case 7:Ct||Bn(c,r),li(s,r,c);break;default:li(s,r,c)}}function Ky(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Jl(s)}catch(c){Tt(r,r.return,c)}}}function Zy(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Jl(s)}catch(c){Tt(r,r.return,c)}}function XE(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new Gy),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new Gy),r;default:throw Error(i(435,s.tag))}}function Pd(s,r){var c=XE(s);r.forEach(function(d){if(!c.has(d)){c.add(d);var m=lT.bind(null,s,d);d.then(m,m)}})}function ss(s,r,c){var d=r.deletions;if(d!==null)for(var m=0;m<d.length;m++){var x=d[m],w=s,M=r,I=M;e:for(;I!==null;){switch(I.tag){case 27:if(Wr(I.type)){nn=I.stateNode,ms=!1;break e}break;case 5:nn=I.stateNode,ms=!1;break e;case 3:case 4:nn=I.stateNode.containerInfo,ms=!0;break e}I=I.return}if(nn===null)throw Error(i(160));Wy(w,M,x),nn=null,ms=!1,w=x.alternate,w!==null&&(w.return=null),x.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Jy(r,s,c),r=r.sibling}var oi=null;function Jy(s,r,c){var d=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(m&4&&(d=s.updateQueue,d=d!==null?d.events:null,d!==null))for(var x=0;x<d.length;x++){var w=d[x];w.ref.impl=w.nextImpl}ss(r,s,c),is(s),m&4&&(Hr(3,s,s.return),_c(3,s),Hr(5,s,s.return));break;case 1:ss(r,s,c),is(s),m&512&&(Ct||d===null||Bn(d,d.return)),m&64&&Tn&&(s=s.updateQueue,s!==null&&(r=s.callbacks,r!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?r:c.concat(r))));break;case 26:if(x=oi,ss(r,s,c),is(s),m&512&&(Ct||d===null||Bn(d,d.return)),m&4)if(m=d!==null?d.memoizedState:null,c=s.memoizedState,d===null)if(c===null)if(s.stateNode===null)if(Tn)s.stateNode=zb(s.type,s.memoizedProps,r.containerInfo,s);else{e:{r=s.type,c=s.memoizedProps,m=x.ownerDocument||x;t:switch(r){case"title":d=m.getElementsByTagName("title")[0],(!d||d[Sa]||d[gn]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=m.createElement(r),m.head.insertBefore(d,m.querySelector("head > title"))),In(d,r,c),d[gn]=s,un(d),r=d;break e;case"link":if(x=a_("link","href",m).get(r+(c.href||""))){for(w=0;w<x.length;w++)if(d=x[w],d.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&d.getAttribute("rel")===(c.rel==null?null:c.rel)&&d.getAttribute("title")===(c.title==null?null:c.title)&&d.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){x.splice(w,1);break t}}d=m.createElement(r),In(d,r,c),m.head.appendChild(d);break;case"meta":if(x=a_("meta","content",m).get(r+(c.content||""))){for(w=0;w<x.length;w++)if(d=x[w],d.getAttribute("content")===(c.content==null?null:""+c.content)&&d.getAttribute("name")===(c.name==null?null:c.name)&&d.getAttribute("property")===(c.property==null?null:c.property)&&d.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&d.getAttribute("charset")===(c.charSet==null?null:c.charSet)){x.splice(w,1);break t}}d=m.createElement(r),In(d,r,c),m.head.appendChild(d);break;default:throw Error(i(468,r))}d[gn]=s,un(d),r=d}s.stateNode=r}else Tn||Gm(x,s.type,s.stateNode);else s.stateNode=r_(x,c,s.memoizedProps);else m!==c?(m===null?(r=d.stateNode,r===null||Ct||r.parentNode.removeChild(r)):m.count--,c===null?Tn||Gm(x,s.type,s.stateNode):r_(x,c,s.memoizedProps)):c===null&&s.stateNode!==null&&Kp(s,s.memoizedProps,d.memoizedProps);break;case 27:ss(r,s,c),is(s),m&512&&(Ct||d===null||Bn(d,d.return)),d!==null&&m&4&&Kp(s,s.memoizedProps,d.memoizedProps);break;case 5:if(x=Ri,Ri=!1,ss(r,s,c),Ri=x,is(s),m&512&&(Ct||d===null||Bn(d,d.return)),s.flags&32){r=s.stateNode;try{Ki(r,""),vt=!0}catch(le){Tt(s,s.return,le)}}m&4&&s.stateNode!=null&&(r=s.memoizedProps,Kp(s,r,d!==null?d.memoizedProps:r)),m&1024&&(rm=!0);break;case 6:if(ss(r,s,c),is(s),m&4){if(s.stateNode===null)throw Error(i(162));r=s.memoizedProps,c=s.stateNode;try{c.nodeValue=r,vt=!0}catch(le){Tt(s,s.return,le)}}break;case 3:if(vt=!1,Jd=null,x=oi,oi=Rc(r.containerInfo),ss(r,s,c),oi=x,is(s),m&4&&d!==null&&d.memoizedState.isDehydrated)try{Jl(r.containerInfo)}catch(le){Tt(s,s.return,le)}rm&&(rm=!1,eb(s)),vt=!1;break;case 4:m=Ri,Ri=Tn,d=Hu(),x=oi,oi=Rc(s.stateNode.containerInfo),ss(r,s,c),is(s),oi=x,vt&&Sc&&(zd=!0),vt=d,Ri=m;break;case 12:ss(r,s,c),is(s);break;case 31:ss(r,s,c),is(s),m&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Pd(s,r)));break;case 13:ss(r,s,c),is(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Fd=Ut()),m&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Pd(s,r)));break;case 22:x=s.memoizedState!==null,w=d!==null&&d.memoizedState!==null;var M=Tn,I=Ct,ee=Ri;Tn=M||x,Ri=ee||x,Ct=I||w,ss(r,s,c),Ct=I,Ri=ee,Tn=M,is(s),m&8192&&(r=s.stateNode,r._visibility=x?r._visibility&-2:r._visibility|1,!x||d===null||w||Tn||Ct||(r=w||Ct,c=Tn,d=Ct,Tn=x||Tn,Ct=r,qr(s,2),Tn=c,Ct=d),!x&&Ri||lm(s,x)),m&4&&(r=s.updateQueue,r!==null&&(c=r.retryQueue,c!==null&&(r.retryQueue=null,Pd(s,c))));break;case 19:ss(r,s,c),is(s),m&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Pd(s,r)));break;case 30:m&512&&(Ct||d===null||Bn(d,d.return)),m=Hu(),x=Sc,w=(c&335544064)===c,M=s.memoizedProps,Sc=w&&Ji(M.default,M.update)!=="none",ss(r,s,c),is(s),w&&d!==null&&vt&&(s.flags|=4),Sc=x,vt=m;break;case 21:break;case 7:m&512&&(Ct||d===null||Bn(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=s);default:ss(r,s,c),is(s)}}function is(s){var r=s.flags;if(r&2){try{for(var c,d=s.return;d!==null;){if(Py(d)){c=d;break}d=d.return}d=null;for(var m=s.return;m!==null;){if(Xp(m)){var x=m.stateNode;d===null?d=[x]:d.push(x)}if(Qp(m))break;m=m.return}var w=d;if(c==null)throw Error(i(160));switch(c.tag){case 27:var M=c.stateNode,I=Zp(s);Rd(s,I,M,w);break;case 5:var ee=c.stateNode;c.flags&32&&(Ki(ee,""),c.flags&=-33);var le=Zp(s);Rd(s,le,ee,w);break;case 3:case 4:var pe=c.stateNode.containerInfo,Z=Zp(s);Jp(s,Z,pe,w);break;default:throw Error(i(161))}}catch(ie){Tt(s,s.return,ie)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function eb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;eb(r),r.tag===5&&r.flags&1024&&(r=r.stateNode,Zl=!0,r.reset(),Zl=!1),s=s.sibling}}function Dl(s,r){if(r.subtreeFlags&9270)for(r=r.child;r!==null;)tb(r,s),r=r.sibling;else Vy(r)}function tb(s,r){var c=s.alternate;if(c===null)em(s,!1);else switch(s.tag){case 3:if(am=Oi=!1,Fy(),Dl(r,s),!Oi&&!zd){if(s=Mi,s!==null)for(var d=0;d<s.length;d+=3){c=s[d];var m=s[d+1];Ub(c,s[d+2]),c=c.ownerDocument.documentElement,c!==null&&c.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+m+")"})}s=r.containerInfo,s=s.nodeType===9?s.documentElement:s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName===""&&(s.style.viewTransitionName="none",s.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),s.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),am=!0}Mi=null;break;case 5:Dl(r,s);break;case 4:d=Oi,Oi=!1,Dl(r,s),Oi&&(zd=!0),Oi=d;break;case 22:s.memoizedState===null&&(c.memoizedState!==null?em(s,!1):Dl(r,s));break;case 30:d=Oi,m=Fy(),Oi=!1,Dl(r,s),Oi&&(s.flags|=4);var x=s.memoizedProps,w=s.stateNode;r=Zi(x,w),w=Zi(c.memoizedProps,w);var M=Ji(x.default,x.update);M==="none"?r=!1:(x=c.memoizedState,c.memoizedState=null,c=s.child,ps=0,r=im(s,c,r,w,M,x,!0),ps!==(x===null?0:x.length)&&(s.flags|=32)),(s.flags&4)!==0&&r?(Ul(s,s.memoizedProps.onUpdate),Mi=m):m!==null&&(m.push.apply(m,Mi),Mi=m),Oi=(s.flags&32)!==0?!0:d;break;default:Dl(r,s)}}function Li(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Yy(s,r.alternate,r),r=r.sibling}function qr(s,r){for(s=s.child;s!==null;){var c=s,d=r;switch(c.tag){case 0:case 11:case 14:case 15:Hr(4,c,c.return),qr(c,d);break;case 1:Bn(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&zy(c,c.return,m),qr(c,d);break;case 27:(d&2)!==0&&e_(c.stateNode,c.type,c.memoizedProps);case 5:Bn(c,c.return),c.tag!==5&&c.tag!==27||wc(c),qr(c,d);break;case 6:wc(c);break;case 26:Bn(c,c.return),m=c.stateNode,c.memoizedState!==null||m===null||Ct||m.parentNode.removeChild(m),qr(c,d);break;case 22:c.memoizedState===null&&qr(c,d);break;case 30:Bn(c,c.return),qr(c,d);break;case 7:Bn(c,c.return);default:qr(c,d)}s=s.sibling}}function ci(s,r,c){for(c=(r.subtreeFlags&8772)!==0?c:c&-2,r=r.child;r!==null;){var d=r.alternate,m=s,x=r,w=x.flags,M=(c&1)!==0;switch(x.tag){case 0:case 11:case 15:ci(m,x,c),_c(4,x);break;case 1:if(ci(m,x,c),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(le){Tt(d,d.return,le)}if(d=x,m=d.updateQueue,m!==null){var I=d.stateNode;try{var ee=m.shared.hiddenCallbacks;if(ee!==null)for(m.shared.hiddenCallbacks=null,m=0;m<ee.length;m++)S1(ee[m],I)}catch(le){Tt(d,d.return,le)}}M&&w&64&&Dy(x),Ti(x,x.return);break;case 27:(c&2)!==0&&By(x);case 5:x.tag!==5&&x.tag!==27||$y(x),ci(m,x,c),M&&d===null&&w&4&&Wp(x),Ti(x,x.return);break;case 6:$y(x);break;case 26:I=x.stateNode,x.memoizedState!==null||I===null||Tn||Gm(Rc(I.ownerDocument),x.type,I),ci(m,x,c),M&&d===null&&w&4&&Wp(x),Ti(x,x.return);break;case 12:ci(m,x,c);break;case 31:ci(m,x,c),M&&w&4&&Ky(m,x);break;case 13:ci(m,x,c),M&&w&4&&Zy(m,x);break;case 22:x.memoizedState===null&&ci(m,x,c),Ti(x,x.return);break;case 30:ci(m,x,c),Ti(x,x.return);break;case 7:Ti(x,x.return);default:ci(m,x,c)}r=r.sibling}}function cm(s,r){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&oc(c))}function um(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&oc(s))}function Ys(s,r,c,d){var m=(c&335544064)===c;if(r.subtreeFlags&(m?10262:10256))for(r=r.child;r!==null;)nb(s,r,c,d),r=r.sibling;else m&&qy(r)}function nb(s,r,c,d){var m=(c&335544064)===c;m&&r.alternate===null&&r.return!==null&&r.return.alternate!==null&&Dd(r);var x=r.flags;switch(r.tag){case 0:case 11:case 15:Ys(s,r,c,d),x&2048&&_c(9,r);break;case 1:Ys(s,r,c,d);break;case 3:Ys(s,r,c,d),m&&am&&(s=s.containerInfo,s=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,s.style.viewTransitionName==="root"&&(s.style.viewTransitionName=""),s=s.ownerDocument.documentElement,s!==null&&s.style.viewTransitionName==="none"&&(s.style.viewTransitionName="")),x&2048&&(x=null,r.alternate!==null&&(x=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==x&&(r.refCount++,x!=null&&oc(x)));break;case 12:if(x&2048){Ys(s,r,c,d),x=r.stateNode;try{var w=r.memoizedProps,M=w.id,I=w.onPostCommit;typeof I=="function"&&I(M,r.alternate===null?"mount":"update",x.passiveEffectDuration,-0)}catch(ee){Tt(r,r.return,ee)}}else Ys(s,r,c,d);break;case 31:Ys(s,r,c,d);break;case 13:Ys(s,r,c,d);break;case 23:break;case 22:w=r.stateNode,M=r.alternate,r.memoizedState!==null?(m&&M!==null&&M.memoizedState===null&&Dd(M),w._visibility&2?Ys(s,r,c,d):kc(s,r)):(m&&M!==null&&M.memoizedState!==null&&Dd(r),w._visibility&2?Ys(s,r,c,d):(w._visibility|=2,zl(s,r,c,d,(r.subtreeFlags&10256)!==0||!1))),x&2048&&cm(M,r);break;case 24:Ys(s,r,c,d),x&2048&&um(r.alternate,r);break;case 30:m&&(x=r.alternate,x!==null&&(Ai(x.child,!0),Ai(r.child,!0))),Ys(s,r,c,d);break;default:Ys(s,r,c,d)}}function zl(s,r,c,d,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var x=s,w=r,M=c,I=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:zl(x,w,M,I,m),_c(8,w);break;case 23:break;case 22:var le=w.stateNode;w.memoizedState!==null?le._visibility&2?zl(x,w,M,I,m):kc(x,w):(le._visibility|=2,zl(x,w,M,I,m)),m&&ee&2048&&cm(w.alternate,w);break;case 24:zl(x,w,M,I,m),m&&ee&2048&&um(w.alternate,w);break;default:zl(x,w,M,I,m)}r=r.sibling}}function kc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=s,d=r,m=d.flags;switch(d.tag){case 22:kc(c,d),m&2048&&cm(d.alternate,d);break;case 24:kc(c,d),m&2048&&um(d.alternate,d);break;default:kc(c,d)}r=r.sibling}}var Ua=8192;function Ha(s,r,c){if(s.subtreeFlags&Ua)for(s=s.child;s!==null;)sb(s,r,c),s=s.sibling}function sb(s,r,c){switch(s.tag){case 26:Ha(s,r,c),s.flags&Ua&&(s.memoizedState!==null?tM(c,oi,s.memoizedState,s.memoizedProps):(s=s.stateNode,(r&335544128)===r&&u_(c,s)));break;case 5:Ha(s,r,c),s.flags&Ua&&(s=s.stateNode,(r&335544128)===r&&u_(c,s));break;case 3:case 4:var d=oi;oi=Rc(s.stateNode.containerInfo),Ha(s,r,c),oi=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Ua,Ua=16777216,Ha(s,r,c),Ua=d):Ha(s,r,c));break;case 30:if((s.flags&Ua)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var m=s.stateNode;m.paired=null,Rs===null&&(Rs=new Map),Rs.set(d,m)}Ha(s,r,c);break;default:Ha(s,r,c)}}function ib(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function jc(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var d=r[c];Mn=d,ab(d,s)}ib(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)rb(s),s=s.sibling}function rb(s){switch(s.tag){case 0:case 11:case 15:jc(s),s.flags&2048&&Hr(9,s,s.return);break;case 3:jc(s);break;case 12:jc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Bd(s)):jc(s);break;default:jc(s)}}function Bd(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var d=r[c];Mn=d,ab(d,s)}ib(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Hr(8,r,r.return),Bd(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,Bd(r));break;default:Bd(r)}s=s.sibling}}function ab(s,r){for(;Mn!==null;){var c=Mn;switch(c.tag){case 0:case 11:case 15:Hr(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:oc(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Mn=d;else e:for(c=s;Mn!==null;){d=Mn;var m=d.sibling,x=d.return;if(Xy(d),d===c){Mn=null;break e}if(m!==null){m.return=x,Mn=m;break e}Mn=x}}}var WE={getCacheForType:function(s){var r=zn(yn),c=r.data.get(s);return c===void 0&&(c=s(),r.data.set(s,c)),c},cacheSignal:function(){return zn(yn).controller.signal}},KE=typeof WeakMap=="function"?WeakMap:Map,Nt=0,Dt=null,ut=null,ht=0,Et=0,Os=null,Vr=!1,$l=!1,dm=!1,or=0,hn=0,Gr=0,qa=0,Id=0,Ls=0,Pl=0,Nc=null,gs=null,hm=!1,Fd=0,lb=0,Ud=1/0,Hd=null,Yr=null,an=0,ui=null,Va=null,Di=0,fm=0,pm=null,ob=null,Bl=null,Il=null,Fl=null,Cc=0,qd=null;function Ds(){return(Nt&2)!==0&&ht!==0?ht&-ht:Te.T!==null?km():wa()}function cb(){if(Ls===0)if((ht&536870912)===0||lt){var s=jt;jt<<=1,(jt&3932160)===0&&(jt=262144),Ls=s}else Ls=536870912;return s=$n.current,s!==null&&(s.flags|=32),Ls}function Ul(s,r){if(r!=null){var c=s.stateNode,d=c.ref;d===null&&(d=c.ref=Hb(Zi(s.memoizedProps,c))),Il===null&&(Il=[]),Il.push(r.bind(null,d))}}function xs(s,r,c){(s===Dt&&(Et===2||Et===9)||s.cancelPendingCommit!==null)&&(Hl(s,0),Qr(s,ht,Ls,!1)),Si(s,c),((Nt&2)===0||s!==Dt)&&(s===Dt&&((Nt&2)===0&&(qa|=c),hn===4&&Qr(s,ht,Ls,!1)),zi(s))}function ub(s,r,c){if((Nt&6)!==0)throw Error(i(327));var d=!c&&(r&127)===0&&(r&s.expiredLanes)===0||Ln(s,r),m=d?eT(s,r):gm(s,r,!0),x=d;do{if(m===0){$l&&!d&&Qr(s,r,0,!1);break}else{if(c=s.current.alternate,x&&!ZE(c)){m=gm(s,r,!1),x=!1;continue}if(m===2){if(x=r,s.errorRecoveryDisabledLanes&x)var w=0;else w=s.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var M=s;m=Nc;var I=M.current.memoizedState.isDehydrated;if(I&&(Hl(M,w).flags|=256),w=gm(M,w,!1),w!==2&&w!==6){if(dm&&!I){M.errorRecoveryDisabledLanes|=x,qa|=x,m=4;break e}x=gs,gs=m,x!==null&&(gs===null?gs=x:gs.push.apply(gs,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){Hl(s,0),Qr(s,r,0,!0);break}e:{switch(d=s,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r&&(r&62914560)!==r)break;case 6:Qr(d,r,Ls,!Vr);break e;case 2:gs=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(m=Fd+300-Ut(),10<m)){if(Qr(d,r,Ls,!Vr),Lt(d,0,!0)!==0)break e;Di=r,d.timeoutHandle=Dm(db.bind(null,d,c,gs,Hd,hm,r,Ls,qa,Pl,Vr,x,"Throttled",-0,0),m);break e}db(d,c,gs,Hd,hm,r,Ls,qa,Pl,Vr,x,null,-0,0)}}break}while(!0);zi(s)}function db(s,r,c,d,m,x,w,M,I,ee,le,pe,Z,ie){s.timeoutHandle=-1;var Me=r.subtreeFlags,$e=(x&335544064)===x;if(pe=null,($e||Me&8192||(Me&16785408)===16785408)&&(pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:es},Rs=null,sb(r,x,pe),$e&&(Me=pe,$e=s.containerInfo,$e=($e.nodeType===9?$e:$e.ownerDocument).__reactViewTransition,$e!=null&&(Me.count++,Me.waitingForViewTransition=!0,Me=Dc.bind(Me),$e.finished.then(Me,Me))),Me=(x&62914560)===x?Fd-Ut():(x&4194048)===x?lb-Ut():0,Me=nM(pe,Me),Me!==null)){Di=x,s.cancelPendingCommit=Me(yb.bind(null,s,r,x,c,d,m,w,M,I,ee,le,pe,null,Z,ie)),Qr(s,x,w,!ee);return}yb(s,r,x,c,d,m,w,M,I,ee,le,pe)}function ZE(s){for(var r=s;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var m=c[d],x=m.getSnapshot;m=m.value;try{if(!Ms(x(),m))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Qr(s,r,c,d){r=ti(s,r),r&=~Id,r&=~qa,s.suspendedLanes|=r,s.pingedLanes&=~r,d&&(s.warmLanes|=r),d=s.expirationTimes;for(var m=r;0<m;){var x=31-tn(m),w=1<<x;d[x]=-1,m&=~w}c!==0&&ba(s,c,r)}function Vd(){return(Nt&6)===0?(Ec(0),!1):!0}function mm(){if(ut!==null){if(Et===0)var s=ut.return;else s=ut,nr=Ra=null,Sp(s),Tl=null,dc=0,s=ut;for(;s!==null;)Ly(s.alternate,s),s=s.return;ut=null}}function Hl(s,r){var c=s.timeoutHandle;return c!==-1&&(s.timeoutHandle=-1,wT(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Di=0,mm(),Dt=s,ut=c=er(s.current,null),ht=r,Et=0,Os=null,Vr=!1,$l=Ln(s,r),dm=!1,Pl=Ls=Id=qa=Gr=hn=0,gs=Nc=null,hm=!1,or=ti(s,r),Ju(),c}function hb(s,r){it=null,Te.H=kd,r===El||r===ud?(r=y1(),Et=3):r===up?(r=y1(),Et=4):Et=r===Pp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Os=r,ut===null&&(hn=1,jd(s,Hs(r,s.current)))}function fb(){var s=$n.current;return s===null?!0:(ht&4194048)===ht?Vn===null:(ht&62914560)===ht||(ht&536870912)!==0?s===Vn:!1}function pb(){var s=Te.H;return Te.H=kd,s===null?kd:s}function mb(){var s=Te.A;return Te.A=WE,s}function Gd(){hn=4,Vr||(ht&4194048)!==ht&&$n.current!==null||($l=!0),(Gr&134217727)===0&&(qa&134217727)===0||Dt===null||Qr(Dt,ht,Ls,!1)}function gm(s,r,c){var d=Nt;Nt|=2;var m=pb(),x=mb();(Dt!==s||ht!==r)&&(Hd=null,Hl(s,r)),r=!1;var w=hn;e:do try{if(Et!==0&&ut!==null){var M=ut,I=Os;switch(Et){case 8:mm(),w=6;break e;case 3:case 2:case 9:case 6:$n.current===null&&(r=!0);var ee=Et;if(Et=0,Os=null,ql(s,M,I,ee),c&&$l){w=0;break e}break;default:ee=Et,Et=0,Os=null,ql(s,M,I,ee)}}JE(),w=hn;break}catch(le){hb(s,le)}while(!0);return r&&s.shellSuspendCounter++,nr=Ra=null,Nt=d,Te.H=m,Te.A=x,ut===null&&(Dt=null,ht=0,Ju()),w}function JE(){for(;ut!==null;)gb(ut)}function eT(s,r){var c=Nt;Nt|=2;var d=pb(),m=mb();Dt!==s||ht!==r?(Hd=null,Ud=Ut()+500,Hl(s,r)):$l=Ln(s,r);e:do try{if(Et!==0&&ut!==null){r=ut;var x=Os;t:switch(Et){case 1:Et=0,Os=null,ql(s,r,x,1);break;case 2:case 9:if(x1(x)){Et=0,Os=null,xb(r);break}r=function(){Et!==2&&Et!==9||Dt!==s||(Et=7),zi(s)},x.then(r,r);break e;case 3:Et=7;break e;case 4:Et=5;break e;case 7:x1(x)?(Et=0,Os=null,xb(r)):(Et=0,Os=null,ql(s,r,x,7));break;case 5:var w=null;switch(ut.tag){case 26:w=ut.memoizedState;case 5:case 27:var M=ut;if(w?o_(w):M.stateNode.complete){Et=0,Os=null;var I=M.sibling;if(I!==null)ut=I;else{var ee=M.return;ee!==null?(ut=ee,Yd(ee)):ut=null}break t}}Et=0,Os=null,ql(s,r,x,5);break;case 6:Et=0,Os=null,ql(s,r,x,6);break;case 8:mm(),hn=6;break e;default:throw Error(i(462))}}tT();break}catch(le){hb(s,le)}while(!0);return nr=Ra=null,Te.H=d,Te.A=m,Nt=c,ut!==null?0:(Dt=null,ht=0,Ju(),hn)}function tT(){for(;ut!==null&&!Is();)gb(ut)}function gb(s){var r=Ry(s.alternate,s,or);s.memoizedProps=s.pendingProps,r===null?Yd(s):ut=r}function xb(s){var r=s,c=r.alternate;switch(r.tag){case 15:case 0:r=jy(c,r,r.pendingProps,r.type,void 0,ht);break;case 11:r=jy(c,r,r.pendingProps,r.type.render,r.ref,ht);break;case 5:Sp(r);var d=r;d===En&&(lt?(rd(d),d.tag===5&&d.stateNode!=null&&(Ht=d.stateNode)):(rd(d),lt=!0));default:Ly(c,r),r=ut=a1(r,or),r=Ry(c,r,or)}s.memoizedProps=s.pendingProps,r===null?Yd(s):ut=r}function ql(s,r,c,d){nr=Ra=null,Sp(r),Tl=null,dc=0;var m=r.return;try{if(UE(s,m,r,c,ht)){hn=1,jd(s,Hs(c,s.current)),ut=null;return}}catch(x){if(m!==null)throw ut=m,x;hn=1,jd(s,Hs(c,s.current)),ut=null;return}r.flags&32768?(lt||d===1?s=!0:$l||(ht&536870912)!==0?s=!1:(Vr=s=!0,(d===2||d===9||d===3||d===6)&&(d=$n.current,d!==null&&d.tag===13&&(d.flags|=16384))),vb(r,s)):Yd(r)}function Yd(s){var r=s;do{if((r.flags&32768)!==0){vb(r,Vr);return}s=r.return;var c=GE(r.alternate,r,or);if(c!==null){ut=c;return}if(r=r.sibling,r!==null){ut=r;return}ut=r=s}while(r!==null);hn===0&&(hn=5)}function vb(s,r){do{var c=YE(s.alternate,s);if(c!==null){c.flags&=32767,ut=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(s=s.sibling,s!==null)){ut=s;return}ut=s=c}while(s!==null);hn=6,ut=null}function yb(s,r,c,d,m,x,w,M,I,ee,le,pe){s.cancelPendingCommit=null;do Qd();while(an!==0);if((Nt&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));s===Dt&&(ut=Dt=null,ht=0),Va=r,ui=s,Di=c,pm=m,ob=d,nT(s,r,c,w,M,I,pe)}}function nT(s,r,c,d,m,x,w){var M=r.lanes|r.childLanes;if(fm=M,M|=Kf,hl(s,c,M,d,m,x),Il=null,(c&335544064)===c?(Fl=ME(s),d=10262):(Fl=null,d=10256),(r.subtreeFlags&d)!==0||(r.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,oT(bi,function(){return bm(),null})):(s.callbackNode=null,s.callbackPriority=0),Od=!1,d=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||d){d=Te.T,Te.T=null,m=Re.p,Re.p=2,x=Nt,Nt|=4;try{QE(s,r,c)}finally{Nt=x,Re.p=m,Te.T=d}}an=1,Od?Bl=ET(w,s.containerInfo,Fl,xm,vm,iT,ym,bm,sT):(xm(),vm(),ym())}function sT(s){if(an!==0){var r=ui.onRecoverableError;r(s,{componentStack:null})}}function iT(){an===3&&(an=0,tb(Va,ui),an=4)}function xm(){if(an===1){an=0;var s=ui,r=Va,c=Di,d=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||d){d=Te.T,Te.T=null;var m=Re.p;Re.p=2;var x=Nt;Nt|=4;try{Sc=zd=!1,Jy(r,s,c),c=Rm;var w=Wv(s.containerInfo),M=c.focusedElem,I=c.selectionRange;if(w!==M&&M&&M.ownerDocument&&Xv(M.ownerDocument.documentElement,M)){if(I!==null&&Gf(M)){var ee=I.start,le=I.end;if(le===void 0&&(le=ee),"selectionStart"in M)M.selectionStart=ee,M.selectionEnd=Math.min(le,M.value.length);else{var pe=M.ownerDocument||document,Z=pe&&pe.defaultView||window;if(Z.getSelection){var ie=Z.getSelection(),Me=M.textContent.length,$e=Math.min(I.start,Me),rt=I.end===void 0?$e:Math.min(I.end,Me);!ie.extend&&$e>rt&&(w=rt,rt=$e,$e=w);var J=Qv(M,$e),Y=Qv(M,rt);if(J&&Y&&(ie.rangeCount!==1||ie.anchorNode!==J.node||ie.anchorOffset!==J.offset||ie.focusNode!==Y.node||ie.focusOffset!==Y.offset)){var ne=pe.createRange();ne.setStart(J.node,J.offset),ie.removeAllRanges(),$e>rt?(ie.addRange(ne),ie.extend(Y.node,Y.offset)):(ne.setEnd(Y.node,Y.offset),ie.addRange(ne))}}}}for(pe=[],ie=M;ie=ie.parentNode;)ie.nodeType===1&&pe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<pe.length;M++){var he=pe[M];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Zl=!!Am,Rm=Am=null}finally{Nt=x,Re.p=m,Te.T=d}}s.current=r,an=2}}function vm(){if(an===2){an=0;var s=ui,r=Va,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=Te.T,Te.T=null;var d=Re.p;Re.p=2;var m=Nt;Nt|=4;try{Yy(s,r.alternate,r)}finally{Nt=m,Re.p=d,Te.T=c}}an=3}}function ym(){if(an===4||an===3){an=0;var s=Bl;Bl=null,ks();var r=ui,c=Va,d=Di,m=ob,x=(d&335544064)===d?10262:10256;if((c.subtreeFlags&x)!==0||(c.flags&x)!==0?an=5:(an=0,Va=ui=null,bb(r,r.pendingLanes)),x=r.pendingLanes,x===0&&(Yr=null),_a(d),c=c.stateNode,pn&&typeof pn.onCommitFiberRoot=="function")try{pn.onCommitFiberRoot(Rn,c,void 0,(c.current.flags&128)===128)}catch{}if(m!==null){c=Te.T,x=Re.p,Re.p=2,Te.T=null;try{for(var w=r.onRecoverableError,M=0;M<m.length;M++){var I=m[M];w(I.value,{componentStack:I.stack})}}finally{Te.T=c,Re.p=x}}if(m=Il,w=Fl,Fl=null,m!==null&&(Il=null,w===null&&(w=[]),s!==null))for(I=0;I<m.length;I++)c=(0,m[I])(w),c!==void 0&&s.finished.finally(c);(Di&3)!==0&&Qd(),zi(r),x=r.pendingLanes,(d&261930)!==0&&(x&42)!==0?r===qd?Cc++:(Cc=0,qd=r):(Cc=0,qd=null),Ec(0)}}function bb(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,oc(r)))}function Qd(){return Bl!==null&&(Bl.skipTransition(),Bl=null),xm(),vm(),ym(),bm()}function bm(){if(an!==5)return!1;var s=ui,r=fm;fm=0;var c=_a(Di),d=Te.T,m=Re.p;try{Re.p=32>c?32:c,Te.T=null,c=pm,pm=null;var x=ui,w=Di;if(an=0,Va=ui=null,Di=0,(Nt&6)!==0)throw Error(i(331));var M=Nt;if(Nt|=4,rb(x.current),nb(x,x.current,w,c),Nt=M,Ec(0,!1),pn&&typeof pn.onPostCommitFiberRoot=="function")try{pn.onPostCommitFiberRoot(Rn,x)}catch{}return!0}finally{Re.p=m,Te.T=d,bb(s,r)}}function _b(s,r,c){r=Hs(c,r),r=$p(s.stateNode,r,2),s=Br(s,r,2),s!==null&&(Si(s,2),zi(s))}function Tt(s,r,c){if(s.tag===3)_b(s,s,c);else for(;r!==null;){if(r.tag===3){_b(r,s,c);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Yr===null||!Yr.has(d))){s=Hs(c,s),c=xy(2),d=Br(r,c,2),d!==null&&(vy(c,d,r,s),Si(d,2),zi(d));break}}r=r.return}}function _m(s,r,c){var d=s.pingCache;if(d===null){d=s.pingCache=new KE;var m=new Set;d.set(r,m)}else m=d.get(r),m===void 0&&(m=new Set,d.set(r,m));m.has(c)||(dm=!0,m.add(c),s=rT.bind(null,s,r,c),r.then(s,s))}function rT(s,r,c){var d=s.pingCache;d!==null&&d.delete(r),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Dt===s&&(ht&c)===c&&((hn===4||hn===3&&(ht&62914560)===ht&&300>Ut()-Fd)&&(Nt&2)===0?Hl(s,0):Id|=c,Pl===ht&&(Pl=0)),zi(s)}function wb(s,r){r===0&&(r=Uu()),s=Ta(s,r),s!==null&&(Si(s,r),zi(s))}function aT(s){var r=s.memoizedState,c=0;r!==null&&(c=r.retryLane),wb(s,c)}function lT(s,r){var c=0;switch(s.tag){case 31:case 13:var d=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(r),wb(s,c)}function oT(s,r){return Zn(s,r)}var Vl=null,Gl=null,wm=!1,Xd=!1,Sm=!1,Xr=0;function zi(s){s!==Gl&&s.next===null&&(Gl===null?Vl=Gl=s:Gl=Gl.next=s),Xd=!0,wm||(wm=!0,uT())}function Ec(s,r){if(!Sm&&Xd){Sm=!0;do for(var c=!1,d=Vl;d!==null;){if(s!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,M=d.pingedLanes;x=(1<<31-tn(42|s)+1)-1,x&=m&~(w&~M),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Nb(d,x))}else x=ht,x=Lt(d,d===Dt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||Ln(d,x)||(c=!0,Nb(d,x));d=d.next}while(c);Sm=!1}}function cT(){Sb()}function Sb(){Xd=wm=!1;var s=0;Xr!==0&&_T()&&(s=Xr);for(var r=Ut(),c=null,d=Vl;d!==null;){var m=d.next,x=kb(d,r);x===0?(d.next=null,c===null?Vl=m:c.next=m,m===null&&(Gl=c)):(c=d,(s!==0||(x&3)!==0)&&(Xd=!0)),d=m}an!==0&&an!==5||Ec(s),Xr!==0&&(Xr=0)}function kb(s,r){for(var c=s.suspendedLanes,d=s.pingedLanes,m=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var w=31-tn(x),M=1<<w,I=m[w];I===-1?((M&c)===0||(M&d)!==0)&&(m[w]=Of(M,r)):I<=r&&(s.expiredLanes|=M),x&=~M}if(r=Dt,c=ht,c=Lt(s,s===r?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,c===0||s===r&&(Et===2||Et===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&on(d),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Ln(s,c)){if(r=c&-c,r===s.callbackPriority)return r;switch(d!==null&&on(d),_a(c)){case 2:case 8:c=en;break;case 32:c=bi;break;case 268435456:c=kr;break;default:c=bi}return d=jb.bind(null,s),c=Zn(c,d),s.callbackPriority=r,s.callbackNode=c,r}return d!==null&&d!==null&&on(d),s.callbackPriority=2,s.callbackNode=null,2}function jb(s,r){if(an!==0&&an!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Qd()&&s.callbackNode!==c)return null;var d=ht;return d=Lt(s,s===Dt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(ub(s,d,r),kb(s,Ut()),s.callbackNode!=null&&s.callbackNode===c?jb.bind(null,s):null)}function Nb(s,r){if(Qd())return null;ub(s,r,!0)}function uT(){ST(function(){(Nt&6)!==0?Zn(fn,cT):Sb()})}function km(){if(Xr===0){var s=Da;s===0&&(s=Ye,Ye<<=1,(Ye&261888)===0&&(Ye=256)),Xr=s}return Xr}function Cb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Dn(s)}function dT(s,r,c,d,m){if(r==="submit"&&c&&c.stateNode===m){var x=Cb((m[Cn]||null).action),w=d.submitter;w&&(r=(r=w[Cn]||null)?Cb(r.formAction):w.getAttribute("formAction"),r!==null&&(x=r,w=null));var M=new Xu("action","action",null,d,m);s.push({event:M,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Xr!==0){var I=new FormData(m,w);Rp(c,{pending:!0,data:I,method:m.method,action:x},null,I)}}else typeof x=="function"&&(M.preventDefault(),I=new FormData(m,w),Rp(c,{pending:!0,data:I,method:m.method,action:x},x,I))},currentTarget:m}]})}}for(var jm=0;jm<Wf.length;jm++){var Nm=Wf[jm],hT=Nm.toLowerCase(),fT=Nm[0].toUpperCase()+Nm.slice(1);ai(hT,"on"+fT)}ai(Jv,"onAnimationEnd"),ai(e1,"onAnimationIteration"),ai(t1,"onAnimationStart"),ai("dblclick","onDoubleClick"),ai("focusin","onFocus"),ai("focusout","onBlur"),ai(wE,"onTransitionRun"),ai(SE,"onTransitionStart"),ai(kE,"onTransitionCancel"),ai(n1,"onTransitionEnd"),Wi("onMouseEnter",["mouseout","mouseover"]),Wi("onMouseLeave",["mouseout","mouseover"]),Wi("onPointerEnter",["pointerout","pointerover"]),Wi("onPointerLeave",["pointerout","pointerover"]),Xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tc="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(" "),pT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tc));function Eb(s,r){r=(r&4)!==0;for(var c=0;c<s.length;c++){var d=s[c],m=d.event;d=d.listeners;e:{var x=void 0;if(r)for(var w=d.length-1;0<=w;w--){var M=d[w],I=M.instance,ee=M.currentTarget;if(M=M.listener,I!==x&&m.isPropagationStopped())break e;x=M,m.currentTarget=ee;try{x(m)}catch(le){Zu(le)}m.currentTarget=null,x=I}else for(w=0;w<d.length;w++){if(M=d[w],I=M.instance,ee=M.currentTarget,M=M.listener,I!==x&&m.isPropagationStopped())break e;x=M,m.currentTarget=ee;try{x(m)}catch(le){Zu(le)}m.currentTarget=null,x=I}}}}function dt(s,r){var c=r[Uo];c===void 0&&(c=r[Uo]=new Set);var d=s+"__bubble";c.has(d)||(Tb(r,s,2,!1),c.add(d))}function Cm(s,r,c){var d=0;r&&(d|=4),Tb(c,s,d,r)}var Wd="_reactListening"+Math.random().toString(36).slice(2);function Em(s){if(!s[Wd]){s[Wd]=!0,ni.forEach(function(c){c!=="selectionchange"&&(pT.has(c)||Cm(c,!1,s),Cm(c,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Wd]||(r[Wd]=!0,Cm("selectionchange",!1,r))}}function Tb(s,r,c,d){switch(v_(r)){case 2:var m=aM;break;case 8:m=lM;break;default:m=Qm}c=m.bind(null,r,c,s),m=void 0,!Ko||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),d?m!==void 0?s.addEventListener(r,c,{capture:!0,passive:m}):s.addEventListener(r,c,!0):m!==void 0?s.addEventListener(r,c,{passive:m}):s.addEventListener(r,c,!1)}function Tm(s,r,c,d,m){var x=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var M=d.stateNode.containerInfo;if(M===m)break;if(w===4)for(w=d.return;w!==null;){var I=w.tag;if((I===3||I===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;M!==null;){if(w=Qi(M),w===null)return;if(I=w.tag,I===5||I===6||I===26||I===27){d=x=w;continue e}M=M.parentNode}}d=d.return}Es(function(){var ee=x,le=vl(c),pe=[];e:{var Z=s1.get(s);if(Z!==void 0){var ie=Xu,Me=s;switch(s){case"keypress":if(Ts(c)===0)break e;case"keydown":case"keyup":ie=ZC;break;case"focusin":Me="focus",ie=If;break;case"focusout":Me="blur",ie=If;break;case"beforeblur":case"afterblur":ie=If;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Rv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=IC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=sE;break;case Jv:case e1:case t1:ie=HC;break;case n1:ie=rE;break;case"scroll":case"scrollend":ie=PC;break;case"wheel":ie=lE;break;case"copy":case"cut":case"paste":ie=VC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Lv;break;case"submit":ie=tE;break;case"toggle":case"beforetoggle":ie=cE}var $e=(r&4)!==0,rt=!$e&&(s==="scroll"||s==="scrollend"),J=$e?Z!==null?Z+"Capture":null:Z;$e=[];for(var Y=ee,ne;Y!==null;){var he=Y;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||J===null||(he=Mr(Y,J),he!=null&&$e.push(Mc(Y,he,ne))),rt)break;Y=Y.return}0<$e.length&&(Z=new ie(Z,Me,null,c,le),pe.push({event:Z,listeners:$e}))}}if((r&7)===0){e:{if(ie=s==="mouseover"||s==="pointerover",Z=s==="mouseout"||s==="pointerout",ie&&c!==Er&&(Me=c.relatedTarget||c.fromElement)&&(Qi(Me)||Me[ji]))break e;(Z||ie)&&(Me=le.window===le?le:(ie=le.ownerDocument)?ie.defaultView||ie.parentWindow:window,Z?(ie=c.relatedTarget||c.toElement,Z=ee,ie=ie?Qi(ie):null,ie!==null&&(rt=o(ie),$e=ie.tag,ie!==rt||$e!==5&&$e!==27&&$e!==6)&&(ie=null)):(Z=null,ie=ee),Z!==ie&&($e=Rv,he="onMouseLeave",J="onMouseEnter",Y="mouse",(s==="pointerout"||s==="pointerover")&&($e=Lv,he="onPointerLeave",J="onPointerEnter",Y="pointer"),rt=Z==null?Me:jr(Z),ne=ie==null?Me:jr(ie),Me=new $e(he,Y+"leave",Z,c,le),Me.target=rt,Me.relatedTarget=ne,he=null,Qi(le)===ee&&($e=new $e(J,Y+"enter",ie,c,le),$e.target=ne,$e.relatedTarget=rt,he=$e),rt=he,$e=Z&&ie?O(Z,ie,mT):null,Z!==null&&Mb(pe,Me,Z,$e,!1),ie!==null&&rt!==null&&Mb(pe,rt,ie,$e,!0)))}e:{if(Z=ee?jr(ee):window,ie=Z.nodeName&&Z.nodeName.toLowerCase(),ie==="select"||ie==="input"&&Z.type==="file")var Le=Uv;else if(Iv(Z))if(Hv)Le=yE;else{Le=xE;var ft=gE}else ie=Z.nodeName,!ie||ie.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?ee&&pt(ee.elementType)&&(Le=Uv):Le=vE;if(Le&&(Le=Le(s,ee))){Fv(pe,Le,c,le);break e}ft&&ft(s,Z,ee)}switch(ft=ee?jr(ee):window,s){case"focusin":(Iv(ft)||ft.contentEditable==="true")&&(bl=ft,Yf=ee,rc=null);break;case"focusout":rc=Yf=bl=null;break;case"mousedown":Qf=!0;break;case"contextmenu":case"mouseup":case"dragend":Qf=!1,Kv(pe,c,le);break;case"selectionchange":if(_E)break;case"keydown":case"keyup":Kv(pe,c,le)}var He;if(Uf)e:{switch(s){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else yl?Pv(s,c)&&(Xe="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(Xe="onCompositionStart");Xe&&(Dv&&c.locale!=="ko"&&(yl||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&yl&&(He=Zo()):(ri=le,Yu="value"in ri?ri.value:ri.textContent,yl=!0)),ft=Kd(ee,Xe),0<ft.length&&(Xe=new Ov(Xe,s,null,c,le),pe.push({event:Xe,listeners:ft}),He?Xe.data=He:(He=Bv(c),He!==null&&(Xe.data=He)))),(He=dE?hE(s,c):fE(s,c))&&(Xe=Kd(ee,"onBeforeInput"),0<Xe.length&&(ft=new Ov("onBeforeInput","beforeinput",null,c,le),pe.push({event:ft,listeners:Xe}),ft.data=He)),dT(pe,s,ee,c,le)}Eb(pe,r)})}function Mc(s,r,c){return{instance:s,listener:r,currentTarget:c}}function Kd(s,r){for(var c=r+"Capture",d=[];s!==null;){var m=s,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=Mr(s,c),m!=null&&d.unshift(Mc(s,m,x)),m=Mr(s,r),m!=null&&d.push(Mc(s,m,x))),s.tag===3)return d;s=s.return}return[]}function mT(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Mb(s,r,c,d,m){for(var x=r._reactName,w=[];c!==null&&c!==d;){var M=c,I=M.alternate,ee=M.stateNode;if(M=M.tag,I!==null&&I===d)break;M!==5&&M!==26&&M!==27||ee===null||(I=ee,m?(ee=Mr(c,x),ee!=null&&w.unshift(Mc(c,ee,I))):m||(ee=Mr(c,x),ee!=null&&w.push(Mc(c,ee,I)))),c=c.return}w.length!==0&&s.push({event:r,listeners:w})}var gT=/\r\n?/g,xT=/\u0000|\uFFFD/g;function Ab(s){return(typeof s=="string"?s:""+s).replace(gT,`
50
+ `).replace(xT,"")}function Rb(s,r){return r=Ab(r),Ab(s)===r}function Mt(s,r,c,d,m,x){switch(c){case"children":if(typeof d=="string")r==="body"||r==="textarea"&&d===""||Ki(s,d);else if(typeof d=="number"||typeof d=="bigint")r!=="body"&&Ki(s,""+d);else return;break;case"className":ka(s,"class",d);break;case"tabIndex":ka(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ka(s,c,d);break;case"style":at(s,d,x);return;case"data":if(r!=="object"){ka(s,"data",d);break}case"src":case"href":if(d===""&&(r!=="a"||c!=="href")){s.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Dn(d),s.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(c,"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"&&(c==="formAction"?(r!=="input"&&Mt(s,r,"name",m.name,m,null),Mt(s,r,"formEncType",m.formEncType,m,null),Mt(s,r,"formMethod",m.formMethod,m,null),Mt(s,r,"formTarget",m.formTarget,m,null)):(Mt(s,r,"encType",m.encType,m,null),Mt(s,r,"method",m.method,m,null),Mt(s,r,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Dn(d),s.setAttribute(c,d);break;case"onClick":d!=null&&(s.onclick=es);return;case"onScroll":d!=null&&dt("scroll",s);return;case"onScrollEnd":d!=null&&dt("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));(x!=null?x.__html:void 0)!==c&&(s.innerHTML=c)}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.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"){s.removeAttribute("xlink:href");break}c=Dn(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);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"?s.setAttribute(c,d):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":d===!0?s.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(c,d):s.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(c):s.setAttribute(c,d);break;case"popover":dt("beforetoggle",s),dt("toggle",s),xl(s,"popover",d);break;case"xlinkActuate":Fs(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Fs(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Fs(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Fs(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Fs(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Fs(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Fs(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Fs(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Fs(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":xl(s,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")c=mt.get(c)||c,xl(s,c,d);else return}vt=!0}function Mm(s,r,c,d,m,x){switch(c){case"style":at(s,d,x);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));(x!=null?x.__html:void 0)!==c&&(s.innerHTML=c)}}break;case"children":if(typeof d=="string")Ki(s,d);else if(typeof d=="number"||typeof d=="bigint")Ki(s,""+d);else return;break;case"onScroll":d!=null&&dt("scroll",s);return;case"onScrollEnd":d!=null&&dt("scrollend",s);return;case"onClick":d!=null&&(s.onclick=es);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!ml.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),x=c.slice(2,m?c.length-7:void 0),r=s[Cn]||null,r=r!=null?r[c]:null,typeof r=="function"&&s.removeEventListener(x,r,m),typeof d=="function")){typeof r!="function"&&r!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(x,d,m);break e}vt=!0,c in s?s[c]=d:d===!0?s.setAttribute(c,""):xl(s,c,d)}return}vt=!0}function In(s,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dt("error",s),dt("load",s);var d=!1,m=!1,x;for(x in c)if(c.hasOwnProperty(x)){var w=c[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Mt(s,r,x,w,c,null)}}m&&Mt(s,r,"srcSet",c.srcSet,c,null),d&&Mt(s,r,"src",c.src,c,null);return;case"input":dt("invalid",s);var M=x=w=m=null,I=null,ee=null;for(d in c)if(c.hasOwnProperty(d)){var le=c[d];if(le!=null)switch(d){case"name":m=le;break;case"type":w=le;break;case"checked":I=le;break;case"defaultChecked":ee=le;break;case"value":x=le;break;case"defaultValue":M=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,r));break;default:Mt(s,r,d,le,c,null)}}Gu(s,x,M,I,ee,w,m,!1);return;case"select":dt("invalid",s),d=w=x=null;for(m in c)if(c.hasOwnProperty(m)&&(M=c[m],M!=null))switch(m){case"value":x=M;break;case"defaultValue":w=M;break;case"multiple":d=M;default:Mt(s,r,m,M,c,null)}r=x,c=w,s.multiple=!!d,r!=null?Cr(s,!!d,r,!1):c!=null&&Cr(s,!!d,c,!0);return;case"textarea":dt("invalid",s),x=m=d=null;for(w in c)if(c.hasOwnProperty(w)&&(M=c[w],M!=null))switch(w){case"value":d=M;break;case"defaultValue":m=M;break;case"children":x=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(i(91));break;default:Mt(s,r,w,M,c,null)}Xo(s,d,m,x);return;case"option":for(I in c)if(c.hasOwnProperty(I)&&(d=c[I],d!=null))switch(I){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Mt(s,r,I,d,c,null)}return;case"dialog":dt("beforetoggle",s),dt("toggle",s),dt("cancel",s),dt("close",s);break;case"iframe":case"object":dt("load",s);break;case"video":case"audio":for(d=0;d<Tc.length;d++)dt(Tc[d],s);break;case"image":dt("error",s),dt("load",s);break;case"details":dt("toggle",s);break;case"embed":case"source":case"link":dt("error",s),dt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in c)if(c.hasOwnProperty(ee)&&(d=c[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Mt(s,r,ee,d,c,null)}return;default:if(pt(r)){for(le in c)c.hasOwnProperty(le)&&(d=c[le],d!==void 0&&Mm(s,r,le,d,c,void 0));return}}for(M in c)c.hasOwnProperty(M)&&(d=c[M],d!=null&&Mt(s,r,M,d,c,null))}var vT={};function yT(s,r,c,d){switch(r){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,M=null,I=null,ee=null,le=null;for(ie in c){var pe=c[ie];if(c.hasOwnProperty(ie)&&pe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":I=pe;default:d.hasOwnProperty(ie)||Mt(s,r,ie,null,d,pe)}}for(var Z in d){var ie=d[Z];if(pe=c[Z],d.hasOwnProperty(Z)&&(ie!=null||pe!=null))switch(Z){case"type":ie!==pe&&(vt=!0),x=ie;break;case"name":ie!==pe&&(vt=!0),m=ie;break;case"checked":ie!==pe&&(vt=!0),ee=ie;break;case"defaultChecked":ie!==pe&&(vt=!0),le=ie;break;case"value":ie!==pe&&(vt=!0),w=ie;break;case"defaultValue":ie!==pe&&(vt=!0),M=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,r));break;default:ie!==pe&&Mt(s,r,Z,ie,d,pe)}}Go(s,w,M,I,ee,le,x,m);return;case"select":ie=w=M=Z=null;for(x in c)if(I=c[x],c.hasOwnProperty(x)&&I!=null)switch(x){case"value":break;case"multiple":ie=I;default:d.hasOwnProperty(x)||Mt(s,r,x,null,d,I)}for(m in d)if(x=d[m],I=c[m],d.hasOwnProperty(m)&&(x!=null||I!=null))switch(m){case"value":x!==I&&(vt=!0),Z=x;break;case"defaultValue":x!==I&&(vt=!0),M=x;break;case"multiple":x!==I&&(vt=!0),w=x;default:x!==I&&Mt(s,r,m,x,d,I)}r=M,c=w,d=ie,Z!=null?Cr(s,!!c,Z,!1):!!d!=!!c&&(r!=null?Cr(s,!!c,r,!0):Cr(s,!!c,c?[]:"",!1));return;case"textarea":ie=Z=null;for(M in c)if(m=c[M],c.hasOwnProperty(M)&&m!=null&&!d.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Mt(s,r,M,null,d,m)}for(w in d)if(m=d[w],x=c[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":m!==x&&(vt=!0),Z=m;break;case"defaultValue":m!==x&&(vt=!0),ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&Mt(s,r,w,m,d,x)}Qo(s,Z,ie);return;case"option":for(var Me in c)if(Z=c[Me],c.hasOwnProperty(Me)&&Z!=null&&!d.hasOwnProperty(Me))switch(Me){case"selected":s.selected=!1;break;default:Mt(s,r,Me,null,d,Z)}for(I in d)if(Z=d[I],ie=c[I],d.hasOwnProperty(I)&&Z!==ie&&(Z!=null||ie!=null))switch(I){case"selected":Z!==ie&&(vt=!0),s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:Mt(s,r,I,Z,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 $e in c)Z=c[$e],c.hasOwnProperty($e)&&Z!=null&&!d.hasOwnProperty($e)&&Mt(s,r,$e,null,d,Z);for(ee in d)if(Z=d[ee],ie=c[ee],d.hasOwnProperty(ee)&&Z!==ie&&(Z!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:Mt(s,r,ee,Z,d,ie)}return;default:if(pt(r)){for(var rt in c)Z=c[rt],c.hasOwnProperty(rt)&&Z!==void 0&&!d.hasOwnProperty(rt)&&Mm(s,r,rt,void 0,d,Z);for(le in d)Z=d[le],ie=c[le],!d.hasOwnProperty(le)||Z===ie||Z===void 0&&ie===void 0||Mm(s,r,le,Z,d,ie);return}}for(var J in c)Z=c[J],c.hasOwnProperty(J)&&Z!=null&&!d.hasOwnProperty(J)&&Mt(s,r,J,null,d,Z);for(pe in d)Z=d[pe],ie=c[pe],!d.hasOwnProperty(pe)||Z===ie||Z==null&&ie==null||Mt(s,r,pe,Z,d,ie)}function Ob(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bT(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var m=c[d],x=m.transferSize,w=m.initiatorType,M=m.duration;if(x&&M&&Ob(w)){for(w=0,M=m.responseEnd,d+=1;d<c.length;d++){var I=c[d],ee=I.startTime;if(ee>M)break;var le=I.transferSize,pe=I.initiatorType;le&&Ob(pe)&&(I=I.responseEnd,w+=le*(I<M?1:(M-ee)/(I-ee)))}if(--d,r+=8*(x+w)/(m.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Am=null,Rm=null;function Ac(s){return s.nodeType===9?s:s.ownerDocument}function Lb(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Db(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function zb(s,r,c,d){return c=Ac(c).createElement(s),c[gn]=d,c[Cn]=r,In(c,s,r),un(c),c}function Om(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Lm=null;function _T(){var s=window.event;return s&&s.type==="popstate"?s===Lm?!1:(Lm=s,!0):(Lm=null,!1)}var Dm=typeof setTimeout=="function"?setTimeout:void 0,wT=typeof clearTimeout=="function"?clearTimeout:void 0,$b=typeof Promise=="function"?Promise:void 0,Pb=typeof requestAnimationFrame=="function"?requestAnimationFrame:Dm,ST=typeof queueMicrotask=="function"?queueMicrotask:typeof $b<"u"?function(s){return $b.resolve(null).then(s).catch(kT)}:Dm;function kT(s){setTimeout(function(){throw s})}function Wr(s){return s==="head"}function Bb(s,r){var c=r,d=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(d===0){s.removeChild(m),Jl(r);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Hm(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Hm(c);for(var x=c.firstChild;x;){var w=x.nextSibling,M=x.nodeName;x[Sa]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=w}}else c==="body"&&Hm(s.ownerDocument.body);c=m}while(c);Jl(r)}function Ib(s,r){var c=s;s=0;do{var d=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=d}while(c)}function Fb(s,r,c){if(r=CSS.escape(r)!==r?"r-"+btoa(r).replace(/=/g,""):r,s.style.viewTransitionName=r,c!=null&&(s.style.viewTransitionClass=c),c=getComputedStyle(s),c.display==="inline"){if(r=s.getClientRects(),r.length===1)var d=1;else for(var m=d=0;m<r.length;m++){var x=r[m];0<x.width&&0<x.height&&d++}d===1&&(s=s.style,s.display=r.length===1?"inline-block":"block",s.marginTop="-"+c.paddingTop,s.marginBottom="-"+c.paddingBottom)}}function Ub(s,r){s=s.style,r=r.style;var c=r!=null?r.hasOwnProperty("viewTransitionName")?r.viewTransitionName:r.hasOwnProperty("view-transition-name")?r["view-transition-name"]:null:null;s.viewTransitionName=c==null||typeof c=="boolean"?"":(""+c).trim(),c=r!=null?r.hasOwnProperty("viewTransitionClass")?r.viewTransitionClass:r.hasOwnProperty("view-transition-class")?r["view-transition-class"]:null:null,s.viewTransitionClass=c==null||typeof c=="boolean"?"":(""+c).trim(),s.display==="inline-block"&&(r==null?s.display=s.margin="":(c=r.display,s.display=c==null||typeof c=="boolean"?"":c,c=r.margin,c!=null?s.margin=c:(c=r.hasOwnProperty("marginTop")?r.marginTop:r["margin-top"],s.marginTop=c==null||typeof c=="boolean"?"":c,r=r.hasOwnProperty("marginBottom")?r.marginBottom:r["margin-bottom"],s.marginBottom=r==null||typeof r=="boolean"?"":r)))}function jT(s,r,c){return c=c.ownerDocument.defaultView,{rect:s,abs:r.position==="absolute"||r.position==="fixed",clip:r.clipPath!=="none"||r.overflow!=="visible"||r.filter!=="none"||r.mask!=="none"||r.mask!=="none"||r.borderRadius!=="0px",view:0<=s.bottom&&0<=s.right&&s.top<=c.innerHeight&&s.left<=c.innerWidth}}function zm(s){var r=s.getBoundingClientRect(),c=getComputedStyle(s);return jT(r,c,s)}function NT(s){return s.documentElement.clientHeight}function CT(s){this.addEventListener("load",s),this.addEventListener("error",s)}function ET(s,r,c,d,m,x,w,M,I){var ee=r.nodeType===9?r:r.ownerDocument;try{var le=ee.startViewTransition({update:function(){var Z=ee.defaultView,ie=Z.navigation&&Z.navigation.transition,Me=ee.fonts.status;d();var $e=[];if(Me==="loaded"&&(NT(ee),ee.fonts.status==="loading"&&$e.push(ee.fonts.ready)),Me=$e.length,s!==null)for(var rt=s.suspenseyImages,J=0,Y=0;Y<rt.length;Y++){var ne=rt[Y];if(!ne.complete){var he=ne.getBoundingClientRect();if(0<he.bottom&&0<he.right&&he.top<Z.innerHeight&&he.left<Z.innerWidth){if(J+=c_(ne),J>eh){$e.length=Me;break}ne=new Promise(CT.bind(ne)),$e.push(ne)}}}if(0<$e.length)return Z=Promise.race([Promise.all($e),new Promise(function(Le){return setTimeout(Le,500)})]).then(m,m),(ie?Promise.allSettled([ie.finished,Z]):Z).then(x,x);if(m(),ie)return ie.finished.then(x,x);x()},types:c});ee.__reactViewTransition=le;var pe=[];return le.ready.then(function(){for(var Z=ee.documentElement.getAnimations({subtree:!0}),ie=0;ie<Z.length;ie++){var Me=Z[ie],$e=Me.effect,rt=$e.pseudoElement;if(rt!=null&&rt.startsWith("::view-transition")){pe.push(Me),Me=$e.getKeyframes();for(var J=rt=void 0,Y=!0,ne=0;ne<Me.length;ne++){var he=Me[ne],Le=he.width;if(rt===void 0)rt=Le;else if(rt!==Le){Y=!1;break}if(Le=he.height,J===void 0)J=Le;else if(J!==Le){Y=!1;break}delete he.width,delete he.height,he.transform==="none"&&delete he.transform}Y&&rt!==void 0&&J!==void 0&&($e.setKeyframes(Me),Y=getComputedStyle($e.target,$e.pseudoElement),Y.width!==rt||Y.height!==J)&&(Y=Me[0],Y.width=rt,Y.height=J,Y=Me[Me.length-1],Y.width=rt,Y.height=J,$e.setKeyframes(Me))}}w()},function(Z){ee.__reactViewTransition===le&&(ee.__reactViewTransition=null);try{if(typeof Z=="object"&&Z!==null)switch(Z.name){case"InvalidStateError":(Z.message==="View transition was skipped because document visibility state is hidden."||Z.message==="Skipping view transition because document visibility state has become hidden."||Z.message==="Skipping view transition because viewport size changed."||Z.message==="Transition was aborted because of invalid state")&&(Z=null)}Z!==null&&I(Z)}finally{d(),m(),w()}}),le.finished.finally(function(){for(var Z=0;Z<pe.length;Z++)pe[Z].cancel();ee.__reactViewTransition===le&&(ee.__reactViewTransition=null),M()}),le}catch{return d(),m(),w(),null}}function Ga(s,r){this._scope=document.documentElement,this._selector="::view-transition-"+s+"("+r+")"}Ga.prototype.animate=function(s,r){return r=typeof r=="number"?{duration:r}:P({},r),r.pseudoElement=this._selector,this._scope.animate(s,r)},Ga.prototype.getAnimations=function(){for(var s=this._scope,r=this._selector,c=s.getAnimations({subtree:!0}),d=[],m=0;m<c.length;m++){var x=c[m].effect;x!==null&&x.target===s&&x.pseudoElement===r&&d.push(c[m])}return d},Ga.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Hb(s){return{name:s,group:new Ga("group",s),imagePair:new Ga("image-pair",s),old:new Ga("old",s),new:new Ga("new",s)}}function zs(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}zs.prototype.addEventListener=function(s,r,c){var d=null,m=null;if(!(c!=null&&typeof c!="boolean"&&(d=c.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var x=this._eventListeners;if(Vb(x,s,r,c)===-1){var w=this,M=r;c!=null&&typeof c!="boolean"&&c.once===!0&&(M=function(I){w.removeEventListener(s,r,c),typeof r=="function"?r.call(this,I):r.handleEvent(I)}),d!==null&&(m=w.removeEventListener.bind(w,s,r,c),d.addEventListener("abort",m,{once:!0}),m=d.removeEventListener.bind(d,"abort",m)),d=Yl(c),x.push({type:s,listener:r,optionsOrUseCapture:c,attachedListener:M,cleanup:m}),v(this._fragmentFiber.child,!1,TT,s,M,d)}this._eventListeners=x}};function TT(s,r,c,d){return N(s).addEventListener(r,c,d),!1}zs.prototype.removeEventListener=function(s,r,c){var d=this._eventListeners;if(d!==null&&(r=Vb(d,s,r,c),r!==-1)){var m=d[r];c=m.attachedListener;var x=m.cleanup;m=Yl(m.optionsOrUseCapture),v(this._fragmentFiber.child,!1,MT,s,c,m),d.splice(r,1),x!==null&&x()}};function MT(s,r,c,d){return N(s).removeEventListener(r,c,d),!1}function Yl(s){return s!=null&&typeof s!="boolean"&&(s.once===!0||s.signal instanceof AbortSignal)?{capture:s.capture,passive:s.passive}:s}function qb(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function Vb(s,r,c,d){if(s.length===0)return-1;d=qb(d);for(var m=0;m<s.length;m++){var x=s[m];if(x.type===r&&x.listener===c&&qb(x.optionsOrUseCapture)===d)return m}return-1}zs.prototype.dispatchEvent=function(s){var r=y(this._fragmentFiber);if(r===null)return!0;r=N(r);var c=this._eventListeners;if(c!==null&&0<c.length||!s.bubbles){var d=r.nodeType===9?r.createComment(""):document.createTextNode("");if(c)for(var m=0;m<c.length;m++){var x=c[m];d.addEventListener(x.type,x.attachedListener,Yl(x.optionsOrUseCapture))}if(r.appendChild(d),s=d.dispatchEvent(s),c)for(m=0;m<c.length;m++)x=c[m],d.removeEventListener(x.type,x.attachedListener,Yl(x.optionsOrUseCapture));return r.removeChild(d),s}return r.dispatchEvent(s)},zs.prototype.focus=function(s){v(this._fragmentFiber.child,!0,Gb,s,void 0,void 0)};function Gb(s,r){return s.tag===6?!1:(s=N(s),UT(s,r))}zs.prototype.focusLast=function(s){var r=[];v(this._fragmentFiber.child,!0,$m,r,void 0,void 0);for(var c=r.length-1;0<=c&&!Gb(r[c],s);c--);};function $m(s,r){return r.push(s),!1}zs.prototype.blur=function(){var s=y(this._fragmentFiber);s!==null&&(s=N(s),s=Ac(s).activeElement,s!==null&&v(this._fragmentFiber.child,!1,AT,s,void 0,void 0))};function AT(s,r){return s.tag===6?!1:(s=N(s),s===r||s.contains(r)?(r.blur(),!0):!1)}zs.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),v(this._fragmentFiber.child,!1,RT,s,void 0,void 0)};function RT(s,r){return s.tag===6||(s=N(s),r.observe(s)),!1}zs.prototype.unobserveUsing=function(s){var r=this._observers;if(r!==null&&r.has(s)){r.delete(s),v(this._fragmentFiber.child,!1,OT,s,void 0,void 0);for(var c=r=0;c<di.length;c++){var d=di[c];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):di[r++]=d}di.length=r}};function OT(s,r){return s.tag===6||(s=N(s),r.unobserve(s)),!1}var di=[],Pm=!1;function LT(s,r,c){di.push({fragmentInstance:s,observer:r,instance:c}),Pm||(Pm=!0,HT(function(){Pm=!1;var d=di;di=[];for(var m=0;m<d.length;m++){var x=d[m];x.observer.unobserve(x.instance)}}))}zs.prototype.getClientRects=function(){var s=[];return v(this._fragmentFiber.child,!1,DT,s,void 0,void 0),s};function DT(s,r){if(s.tag===6){s=s.stateNode;var c=s.ownerDocument.createRange();c.selectNodeContents(s),r.push.apply(r,c.getClientRects())}else s=N(s),r.push.apply(r,s.getClientRects());return!1}zs.prototype.getRootNode=function(s){var r=y(this._fragmentFiber);return r===null?this:N(r).getRootNode(s)},zs.prototype.compareDocumentPosition=function(s){var r=y(this._fragmentFiber);if(r===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var c=[];v(this._fragmentFiber.child,!1,$m,c,void 0,void 0);var d=N(r);if(c.length===0){if(c=d,b(this._fragmentFiber)){e:{for(r=this._fragmentFiber.return;r!==null;){if(r.tag===4){r=r.stateNode.containerInfo;break e}if(r.tag===3||r.tag===5||r.tag===27)break;r=r.return}r=null}r!=null&&(c=r)}r=this._fragmentFiber;var m=d=c.compareDocumentPosition(s);return c===s?m=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(c=_(r)[1],c===null?m=Node.DOCUMENT_POSITION_PRECEDING:(s=N(c).compareDocumentPosition(s),m=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),m|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}r=N(c[0]),m=N(c[c.length-1]);var x=b(this._fragmentFiber)?r.parentElement:d;if(x==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=x.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY,x=x.compareDocumentPosition(m)&Node.DOCUMENT_POSITION_CONTAINED_BY;var w=r.compareDocumentPosition(s),M=m.compareDocumentPosition(s),I=w&Node.DOCUMENT_POSITION_CONTAINED_BY||M&Node.DOCUMENT_POSITION_CONTAINED_BY;return M=d&&x&&w&Node.DOCUMENT_POSITION_FOLLOWING&&M&Node.DOCUMENT_POSITION_PRECEDING,r=d&&r===s||x&&m===s||I||M?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&r===s||!x&&m===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:w,r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||zT(r,this._fragmentFiber,c[0],c[c.length-1],s)?r:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function zT(s,r,c,d,m){var x=Qi(m);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(c=!!x)e:{for(;x!==null;){if(x.tag===7&&(x===r||x.alternate===r)){c=!0;break e}x=x.return}c=!1}return c}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(x===null)return x=m.ownerDocument,m===x||m===x.documentElement||m===x.body;e:{for(x=r,r=y(r);x!==null;){if(!(x.tag!==5&&x.tag!==3&&x.tag!==27||x!==r&&x.alternate!==r)){x=!0;break e}x=x.return}x=!1}return x}return s&Node.DOCUMENT_POSITION_PRECEDING?((r=!!x)&&!(r=x===c)&&(r=O(c,x,A),r===null?r=!1:(v(r,!0,T,x,c),x=S,S=null,r=x!==null)),r):s&Node.DOCUMENT_POSITION_FOLLOWING?((r=!!x)&&!(r=x===d)&&(r=O(d,x,A),r===null?r=!1:(v(r,!0,R,x,d),x=S,C=S=null,r=x!==null)),r):!1}function Yb(s,r){var c=s.ownerDocument.createRange();c.selectNodeContents(s),s=c.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,r?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}zs.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(i(566));var r=[];v(this._fragmentFiber.child,!1,$m,r,void 0,void 0);var c=s!==!1;if(r.length===0){var d=_(this._fragmentFiber);if(d=c?d[1]||d[0]||y(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=N(d),Yb(s,c);return}if(d=N(d),d.nodeType!==9){if(d.nodeType===11){c="host"in d?d.host:null,c!==null&&c.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=c?r.length-1:0;d!==(c?-1:r.length);){var m=r[d];m.tag===6?(m=N(m),Yb(m,c)):N(m).scrollIntoView(s),d+=c?-1:1}};function $T(s,r){return s=N(s),Qb(s,r),!1}function Qb(s,r){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(r)}function Xb(s,r){var c=r._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d];s.addEventListener(m.type,m.attachedListener,Yl(m.optionsOrUseCapture))}s.nodeType!==3&&(c=r._observers,c!==null&&c.forEach(function(x){for(var w=0,M=0;M<di.length;M++){var I=di[M];(I.fragmentInstance!==r||I.observer!==x||I.instance!==s)&&(di[w++]=I)}di.length=w,x.observe(s)}),Qb(s,r))}function PT(s,r){var c=r._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d];s.removeEventListener(m.type,m.attachedListener,Yl(m.optionsOrUseCapture))}s.nodeType!==3&&(c=r._observers,c!==null&&c.forEach(function(x){typeof x.rootMargin=="string"?LT(r,x,s):x.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(r))}function Bm(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Bm(c),pl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function BT(s,r,c,d){for(;s.nodeType===1;){var m=c;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[Sa])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=Qs(s.nextSibling),s===null)break}return null}function IT(s,r,c){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Qs(s.nextSibling),s===null))return null;return s}function Wb(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Qs(s.nextSibling),s===null))return null;return s}function Im(s){return s.data==="$?"||s.data==="$~"}function Fm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function FT(s,r){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||c.readyState!=="loading")r();else{var d=function(){r(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Qs(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Um=null;function Kb(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(r===0)return Qs(s.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}s=s.nextSibling}return null}function Zb(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return s;r--}else c!=="/$"&&c!=="/&"||r++}s=s.previousSibling}return null}function UT(s,r){function c(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",c,!0),(s.focus||HTMLElement.prototype.focus).call(s,r)}finally{s.ownerDocument.removeEventListener("focus",c,!0)}return d}function HT(s){Pb(function(){Pb(function(r){return s(r)})})}function Jb(s,r,c){switch(r=Ac(c),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function e_(s,r,c){for(var d in c){var m=c[d];c.hasOwnProperty(d)&&m!=null&&Mt(s,r,d,null,vT,m)}c.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===es&&(s.onclick=null),pl(s)}function Hm(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);pl(s)}var Xs=new Map,t_=new Set;function Rc(s){if(typeof s.getRootNode=="function"){var r=s.getRootNode();if(r.nodeType===9||r.nodeType===11)return r}return s.nodeType===9?s:s.ownerDocument}var cr=Re.d;Re.d={f:qT,r:VT,D:GT,C:YT,L:QT,m:XT,X:KT,S:WT,M:ZT};function qT(){var s=cr.f(),r=Vd();return s||r}function VT(s){var r=Ni(s);r!==null&&r.tag===5&&r.type==="form"?sy(r):cr.r(s)}var Ql=typeof document>"u"?null:document;function n_(s,r,c){var d=Ql;if(d&&typeof r=="string"&&r){var m=hs(r);m='link[rel="'+s+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),t_.has(m)||(t_.add(m),s={rel:s,crossOrigin:c,href:r},d.querySelector(m)===null&&(r=d.createElement("link"),In(r,"link",s),un(r),d.head.appendChild(r)))}}function GT(s){cr.D(s),n_("dns-prefetch",s,null)}function YT(s,r){cr.C(s,r),n_("preconnect",s,r)}function QT(s,r,c){cr.L(s,r,c);var d=Ql;if(d&&s&&r){var m='link[rel="preload"][as="'+hs(r)+'"]';r==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+hs(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+hs(c.imageSizes)+'"]')):m+='[href="'+hs(s)+'"]';var x=m;switch(r){case"style":x=Xl(s);break;case"script":x=Wl(s)}if(!(Xs.has(x)||(s=P({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:s,as:r},c),Xs.set(x,s),d.querySelector(m)!==null||r==="style"&&d.querySelector(Oc(x))||r==="script"&&d.querySelector(Lc(x))))){var w=d.createElement("link");In(w,"link",s),r==="style"&&(w[fl]=!0,w.onload=w.onerror=function(){Ns(w)}),un(w),d.head.appendChild(w)}}}function XT(s,r){cr.m(s,r);var c=Ql;if(c&&s){var d=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+hs(d)+'"][href="'+hs(s)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Wl(s)}if(!Xs.has(x)&&(s=P({rel:"modulepreload",href:s},r),Xs.set(x,s),c.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Lc(x)))return}d=c.createElement("link"),In(d,"link",s),un(d),c.head.appendChild(d)}}}function WT(s,r,c){cr.S(s,r,c);var d=Ql;if(d&&s){var m=ds(d).hoistableStyles,x=Xl(s);r=r||"default";var w=m.get(x);if(!w){var M={loading:0,preload:null};if(w=d.querySelector(Oc(x)))M.loading=5;else{s=P({rel:"stylesheet",href:s,"data-precedence":r},c),(c=Xs.get(x))&&qm(s,c);var I=w=d.createElement("link");un(I),In(I,"link",s),I._p=new Promise(function(ee,le){I.onload=ee,I.onerror=le}),I.addEventListener("load",function(){M.loading|=1}),I.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Zd(w,r,d)}w={type:"stylesheet",instance:w,count:1,state:M},m.set(x,w)}}}function KT(s,r){cr.X(s,r);var c=Ql;if(c&&s){var d=ds(c).hoistableScripts,m=Wl(s),x=d.get(m);x||(x=c.querySelector(Lc(m)),x||(s=P({src:s,async:!0},r),(r=Xs.get(m))&&Vm(s,r),x=c.createElement("script"),un(x),In(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function ZT(s,r){cr.M(s,r);var c=Ql;if(c&&s){var d=ds(c).hoistableScripts,m=Wl(s),x=d.get(m);x||(x=c.querySelector(Lc(m)),x||(s=P({src:s,async:!0,type:"module"},r),(r=Xs.get(m))&&Vm(s,r),x=c.createElement("script"),un(x),In(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function s_(s,r,c,d){var m=(m=se.current)?Rc(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(c=Xl(c.href),r=ds(m).hoistableStyles,d=r.get(c),d||(d={type:"style",instance:null,count:0,state:null},r.set(c,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Xl(c.href);var x=ds(m).hoistableStyles,w=x.get(s);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,w),(x=m.querySelector(Oc(s)))?x._p||(w.instance=x,w.state.loading=5):(x=Xs.get(s),x||(x={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Xs.set(s,x)),JT(m,s,x,w.state))),r&&d===null)throw Error(i(528,""));return w}if(r&&d!==null)throw Error(i(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(c=Wl(c),r=ds(m).hoistableScripts,d=r.get(c),d||(d={type:"script",instance:null,count:0,state:null},r.set(c,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Xl(s){return'href="'+hs(s)+'"'}function Oc(s){return'link[rel="stylesheet"]['+s+"]"}function i_(s){return P({},s,{"data-precedence":s.precedence,precedence:null})}function JT(s,r,c,d){if(r=s.querySelector('link[rel="preload"][as="style"]['+r+"]")){if(r[fl]!==!0){d.loading=1;return}}else r=s.createElement("link"),r[fl]=!0,r.onload=r.onerror=Ns.bind(null,r),In(r,"link",c),un(r),s.head.appendChild(r);d.preload=r,r.addEventListener("load",function(){return d.loading|=1}),r.addEventListener("error",function(){return d.loading|=2})}function Wl(s){return'[src="'+hs(s)+'"]'}function Lc(s){return"script[async]"+s}function r_(s,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+hs(c.href)+'"]');if(d)return r.instance=d,un(d),d;var m=P({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),un(d),In(d,"style",m),Zd(d,c.precedence,s),r.instance=d;case"stylesheet":m=Xl(c.href);var x=s.querySelector(Oc(m));if(x)return r.state.loading|=4,r.instance=x,un(x),x;d=i_(c),(m=Xs.get(m))&&qm(d,m),x=(s.ownerDocument||s).createElement("link"),un(x);var w=x;return w._p=new Promise(function(M,I){w.onload=M,w.onerror=I}),In(x,"link",d),r.state.loading|=4,Zd(x,c.precedence,s),r.instance=x;case"script":return x=Wl(c.src),(m=s.querySelector(Lc(x)))?(r.instance=m,un(m),m):(d=c,(m=Xs.get(x))&&(d=P({},c),Vm(d,m)),s=s.ownerDocument||s,m=s.createElement("script"),un(m),In(m,"link",d),s.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(d=r.instance,r.state.loading|=4,Zd(d,c.precedence,s));return r.instance}function Zd(s,r,c){for(var d=c.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 M=d[w];if(M.dataset.precedence===r)x=M;else if(x!==m)break}x?x.parentNode.insertBefore(s,x.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(s,r.firstChild))}function qm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Vm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Jd=null;function a_(s,r,c){if(Jd===null){var d=new Map,m=Jd=new Map;m.set(c,d)}else m=Jd,d=m.get(c),d||(d=new Map,m.set(c,d));if(d.has(s))return d;for(d.set(s,null),c=c.getElementsByTagName(s),m=0;m<c.length;m++){var x=c[m];if(!(x[Sa]||x[gn]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(r)||"";w=s+w;var M=d.get(w);M?M.push(x):d.set(w,[x])}}return d}function Gm(s,r,c){s=s.ownerDocument||s,s.head.insertBefore(c,r==="title"?s.querySelector("head > title"):null)}function eM(s,r,c){if(c===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function l_(s,r){return s==="img"&&r.src!=null&&r.src!==""&&r.onLoad==null&&r.loading!=="lazy"}function o_(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function c_(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function u_(s,r){typeof r.decode=="function"&&(s.imgCount++,r.complete||(s.imgBytes+=c_(r),s.suspenseyImages.push(r)),s=sM.bind(s),r.decode().then(s,s))}function tM(s,r,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=Xl(d.href),x=r.querySelector(Oc(m));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Dc.bind(s),r.then(s,s)),c.state.loading|=4,c.instance=x,un(x);return}x=r.ownerDocument||r,d=i_(d),(m=Xs.get(m))&&qm(d,m),x=x.createElement("link"),un(x);var w=x;w._p=new Promise(function(M,I){w.onload=M,w.onerror=I}),In(x,"link",d),c.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=Dc.bind(s),r.addEventListener("load",c),r.addEventListener("error",c))}}var eh=0;function nM(s,r){return s.stylesheets&&s.count===0&&nh(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var d=setTimeout(function(){if(s.stylesheets&&nh(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+r);0<s.imgBytes&&eh===0&&(eh=62500*bT());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&nh(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>eh?50:800)+r);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function d_(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)nh(s,s.stylesheets);else if(s.unsuspend){var r=s.unsuspend;s.unsuspend=null,r()}}}function Dc(){this.count--,d_(this)}function sM(){this.imgCount--,d_(this)}var th=null;function nh(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,th=new Map,r.forEach(iM,s),th=null,Dc.call(s))}function iM(s,r){if(!(r.state.loading&4)){var c=th.get(s);if(c)var d=c.get(null);else{c=new Map,th.set(s,c);for(var m=s.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")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}m=r.instance,w=m.getAttribute("data-precedence"),x=c.get(w)||d,x===d&&c.set(null,m),c.set(w,m),this.count++,d=Dc.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),r.state.loading|=4}}var Kl={$$typeof:V,Provider:null,Consumer:null,_currentValue:It,_currentValue2:It,_threadCount:0};function rM(s,r,c,d,m,x,w,M,I){this.tag=1,this.containerInfo=s,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=Yi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yi(0),this.hiddenUpdates=Yi(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.transitionTypes=null,this.incompleteTransitions=new Map}function h_(s,r,c,d,m,x,w,M,I,ee,le,pe){return s=new rM(s,r,c,w,I,ee,le,pe,M),r=1,x===!0&&(r|=24),x=fs(3,null,null,r),s.current=x,x.stateNode=s,r=lp(),r.refCount++,s.pooledCache=r,r.refCount++,x.memoizedState={element:d,isDehydrated:c,cache:r},dp(x),s}function f_(s){return s?(s=Sl,s):Sl}function p_(s,r,c,d,m,x){m=f_(m),d.context===null?d.context=m:d.pendingContext=m,d=Pr(r),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=Br(s,d,r),c!==null&&(xs(c,s,r),hc(c,s,r))}function m_(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<r?c:r}}function Ym(s,r){m_(s,r),(s=s.alternate)&&m_(s,r)}function g_(s){if(s.tag===13||s.tag===31){var r=Ta(s,67108864);r!==null&&xs(r,s,67108864),Ym(s,67108864)}}function x_(s){if(s.tag===13||s.tag===31){var r=Ds();r=Fo(r);var c=Ta(s,r);c!==null&&xs(c,s,r),Ym(s,r)}}var Zl=!0;function aM(s,r,c,d){var m=Te.T;Te.T=null;var x=Re.p;try{Re.p=2,Qm(s,r,c,d)}finally{Re.p=x,Te.T=m}}function lM(s,r,c,d){var m=Te.T;Te.T=null;var x=Re.p;try{Re.p=8,Qm(s,r,c,d)}finally{Re.p=x,Te.T=m}}function Qm(s,r,c,d){if(Zl){var m=Xm(d);if(m===null)Tm(s,r,d,sh,c),y_(s,d);else if(cM(m,s,r,c,d))d.stopPropagation();else if(y_(s,d),r&4&&-1<oM.indexOf(s)){for(;m!==null;){var x=Ni(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=On(x.pendingLanes);if(w!==0){var M=x;for(M.pendingLanes|=2,M.entangledLanes|=2;w;){var I=1<<31-tn(w);M.entanglements[1]|=I,w&=~I}zi(x),(Nt&6)===0&&(Ud=Ut()+500,Ec(0))}}break;case 31:case 13:M=Ta(x,2),M!==null&&xs(M,x,2),Vd(),Ym(x,2)}if(x=Xm(d),x===null&&Tm(s,r,d,sh,c),x===m)break;m=x}m!==null&&d.stopPropagation()}else Tm(s,r,d,null,c)}}function Xm(s){return s=vl(s),Wm(s)}var sh=null;function Wm(s){if(sh=null,s=Qi(s),s!==null){var r=o(s);if(r===null)s=null;else{var c=r.tag;if(c===13){if(s=u(r),s!==null)return s;s=null}else if(c===31){if(s=h(r),s!==null)return s;s=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return sh=s,null}function v_(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Jt()){case fn:return 2;case en:return 8;case bi:case _i:return 32;case kr:return 268435456;default:return 32}default:return 32}}var Km=!1,Kr=null,Zr=null,Jr=null,zc=new Map,$c=new Map,ea=[],oM="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 y_(s,r){switch(s){case"focusin":case"focusout":Kr=null;break;case"dragenter":case"dragleave":Zr=null;break;case"mouseover":case"mouseout":Jr=null;break;case"pointerover":case"pointerout":zc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":$c.delete(r.pointerId)}}function Pc(s,r,c,d,m,x){return s===null||s.nativeEvent!==x?(s={blockedOn:r,domEventName:c,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},r!==null&&(r=Ni(r),r!==null&&g_(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),s)}function cM(s,r,c,d,m){switch(r){case"focusin":return Kr=Pc(Kr,s,r,c,d,m),!0;case"dragenter":return Zr=Pc(Zr,s,r,c,d,m),!0;case"mouseover":return Jr=Pc(Jr,s,r,c,d,m),!0;case"pointerover":var x=m.pointerId;return zc.set(x,Pc(zc.get(x)||null,s,r,c,d,m)),!0;case"gotpointercapture":return x=m.pointerId,$c.set(x,Pc($c.get(x)||null,s,r,c,d,m)),!0}return!1}function b_(s){var r=Qi(s.target);if(r!==null){var c=o(r);if(c!==null){if(r=c.tag,r===13){if(r=u(c),r!==null){s.blockedOn=r,us(s.priority,function(){x_(c)});return}}else if(r===31){if(r=h(c),r!==null){s.blockedOn=r,us(s.priority,function(){x_(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function ih(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var c=Xm(s.nativeEvent);if(c===null){c=s.nativeEvent;var d=new c.constructor(c.type,c);Er=d,c.target.dispatchEvent(d),Er=null}else return r=Ni(c),r!==null&&g_(r),s.blockedOn=c,!1;r.shift()}return!0}function __(s,r,c){ih(s)&&c.delete(r)}function uM(){Km=!1,Kr!==null&&ih(Kr)&&(Kr=null),Zr!==null&&ih(Zr)&&(Zr=null),Jr!==null&&ih(Jr)&&(Jr=null),zc.forEach(__),$c.forEach(__)}function rh(s,r){s.blockedOn===r&&(s.blockedOn=null,Km||(Km=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,uM)))}var ah=null;function w_(s){ah!==s&&(ah=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ah===s&&(ah=null);for(var r=0;r<s.length;r+=3){var c=s[r],d=s[r+1],m=s[r+2];if(typeof d!="function"){if(Wm(d||c)===null)continue;break}var x=Ni(c);x!==null&&(s.splice(r,3),r-=3,Rp(x,{pending:!0,data:m,method:c.method,action:d},d,m))}}))}function Jl(s){function r(I){return rh(I,s)}Kr!==null&&rh(Kr,s),Zr!==null&&rh(Zr,s),Jr!==null&&rh(Jr,s),zc.forEach(r),$c.forEach(r);for(var c=0;c<ea.length;c++){var d=ea[c];d.blockedOn===s&&(d.blockedOn=null)}for(;0<ea.length&&(c=ea[0],c.blockedOn===null);)b_(c),c.blockedOn===null&&ea.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var m=c[d],x=c[d+1],w=m[Cn]||null;if(typeof x=="function")w||w_(c);else if(w){var M=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[Cn]||null)M=w.formAction;else if(Wm(m)!==null)continue}else M=w.action;typeof M=="function"?c[d+1]=M:(c.splice(d,3),d-=3),w_(c)}}}function S_(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=null),d||setTimeout(c,20)}function c(){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",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function Zm(s){this._internalRoot=s}lh.prototype.render=Zm.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var c=r.current,d=Ds();p_(c,d,s,r,null,null)},lh.prototype.unmount=Zm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;p_(s.current,2,null,s,null,null),Vd(),r[ji]=null}};function lh(s){this._internalRoot=s}lh.prototype.unstable_scheduleHydration=function(s){if(s){var r=wa();s={blockedOn:null,target:s,priority:r};for(var c=0;c<ea.length&&r!==0&&r<ea[c].priority;c++);ea.splice(c,0,s),c===0&&b_(s)}};var k_=t.version;if(k_!=="19.3.1")throw Error(i(527,k_,"19.3.1"));Re.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=p(r),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var dM={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:Te,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oh.isDisabled&&oh.supportsFiber)try{Rn=oh.inject(dM),pn=oh}catch{}}return Ic.createRoot=function(s,r){if(!a(s))throw Error(i(299));var c=!1,d="",m=fy,x=py,w=my;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=h_(s,1,!1,null,null,c,d,null,m,x,w,S_),s[ji]=r.current,Em(s),new Zm(r)},Ic.hydrateRoot=function(s,r,c){if(!a(s))throw Error(i(299));var d=!1,m="",x=fy,w=py,M=my,I=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(M=c.onRecoverableError),c.formState!==void 0&&(I=c.formState)),r=h_(s,1,!0,r,c??null,d,m,I,x,w,M,S_),r.context=f_(null),c=r.current,d=Ds(),d=Fo(d),m=Pr(d),m.callback=null,Br(c,m,d),c=d,r.current.lanes=c,Si(r,c),zi(r),s[ji]=r.current,Em(s),new lh(r)},Ic.version="19.3.1",Ic}var z_;function kM(){if(z_)return tg.exports;z_=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(),tg.exports=SM(),tg.exports}var jM=kM();const $_=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))}},a=()=>t,h={setState:i,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(i,a,h);return h},NM=(e=>e?$_(e):$_),CM=e=>e;function EM(e,t=CM){const n=ch.useSyncExternalStore(e.subscribe,ch.useCallback(()=>t(e.getState()),[e,t]),ch.useCallback(()=>t(e.getInitialState()),[e,t]));return ch.useDebugValue(n),n}const P_=e=>{const t=NM(e),n=i=>EM(t,i);return Object.assign(n,t),n},TM=(e=>e?P_(e):P_),b0="companion_auth_token";function B_(){return typeof window>"u"?null:localStorage.getItem(b0)||null}const MM=e=>({authToken:B_(),isAuthenticated:B_()!==null,setAuthToken:t=>{localStorage.setItem(b0,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(b0),e({authToken:null,isAuthenticated:!1})}});function Yt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function AM(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function RM(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function OM(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function LM(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const DM=e=>({sessions:new Map,sdkSessions:[],currentSessionId:OM(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:RM(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:LM(),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 a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=Yt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Yt(n.sessions,t),connectionStatus:Yt(n.connectionStatus,t),cliConnected:Yt(n.cliConnected,t),cliReconnecting:Yt(n.cliReconnecting,t),sessionStatus:Yt(n.sessionStatus,t),previousPermissionMode:Yt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:AM(n.recentlyRenamed,t),mcpServers:Yt(n.mcpServers,t),rateLimit:Yt(n.rateLimit,t),prStatus:Yt(n.prStatus,t),linkedLinearIssues:Yt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Yt(n.messages,t),streaming:Yt(n.streaming,t),streamingStartedAt:Yt(n.streamingStartedAt,t),streamingOutputTokens:Yt(n.streamingOutputTokens,t),pendingPermissions:Yt(n.pendingPermissions,t),aiResolvedPermissions:Yt(n.aiResolvedPermissions,t),sessionTasks:Yt(n.sessionTasks,t),changedFilesTick:Yt(n.changedFilesTick,t),gitChangedFilesCount:Yt(n.gitChangedFilesCount,t),sessionProcesses:Yt(n.sessionProcesses,t),toolProgress:Yt(n.toolProgress,t),toolActivity:Yt(n.toolActivity,t),diffPanelSelectedFile:Yt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Yt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e(n=>{const i=new Map;for(const a of n.sdkSessions)a.lastUserMessageAt&&i.set(a.sessionId,a.lastUserMessageAt);return i.size===0?{sdkSessions:t}:{sdkSessions:t.map(a=>{const o=i.get(a.sessionId);return o&&o>(a.lastUserMessageAt??0)?{...a,lastUserMessageAt:o}:a})}}),noteUserMessageAt:(t,n)=>e(i=>{if(!(n>0))return i;const a=i.sdkSessions.findIndex(u=>u.sessionId===t);if(a===-1||(i.sdkSessions[a].lastUserMessageAt??0)>=n)return i;const o=[...i.sdkSessions];return o[a]={...o[a],lastUserMessageAt:n},{sdkSessions:o}}),setConnectionStatus:(t,n)=>e(i=>{const a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),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 a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),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 a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),zM=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),$M=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),PM=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 a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(h=>h.id===n?{...h,...i}:h)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.taskId===n?{...h,...i}:h)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionBackgroundAgents:o}}),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 a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(h=>h.toolUseId===n.toolUseId);if(u>=0){const h=o[u];o[u]={...h,...n,startedAt:h.startedAt,completedAt:n.completedAt??h.completedAt,elapsedSeconds:Math.max(h.elapsedSeconds,n.elapsedSeconds),isError:h.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{toolActivity:o}})}),br=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"server-disk",label:"Server Disk",description:"Free space on the Companion data volume",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"]}],BM=br.map(e=>e.id),cS="cc-task-panel-config";function _0(){return{order:[...BM],enabled:Object.fromEntries(br.map(e=>[e.id,!0]))}}function IM(){if(typeof window>"u")return _0();try{const e=localStorage.getItem(cS);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of br)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(br.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return _0()}function uh(e){try{localStorage.setItem(cS,JSON.stringify(e))}catch{}}function FM(){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 UM(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function HM(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function uS(){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"}function qM(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const VM=e=>({darkMode:FM(),notificationSound:UM(),notificationDesktop:HM(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:IM(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:uS(),density:qM(),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}),setMagicUiAvailable:t=>e({magicUiAvailable: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 uh(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const o={...n.taskPanelConfig,order:i};return uh(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return uh(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=_0();uh(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),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})},setDensity:t=>{typeof window<"u"&&localStorage.setItem("cc-density",t),e({density:t})},toggleDensity:()=>e(t=>{const n=t.density==="compact"?"standard":"compact";return typeof window<"u"&&localStorage.setItem("cc-density",n),{density:n}})});function dS(){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 GM=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:dS(),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",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,h=i?o+1:o,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,f],activeQuickTerminalTabId:f.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:h}}),closeQuickTerminalTab:t=>e(n=>{var o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,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 YM(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const QM=e=>({updateInfo:null,updateDismissedVersion:YM(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo: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||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:(t,n)=>e({creationError:t,creationDraft:n??null}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),XM=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(i=>{const a=i.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(i.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const i=new Map(n.magicUiState);return i.delete(t),{magicUiState:i}})}),W=TM((...e)=>({...MM(...e),...DM(...e),...zM(...e),...$M(...e),...PM(...e),...VM(...e),...GM(...e),...QM(...e),...XM(...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,magicUiState: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:uS(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:dS(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),WM=Object.freeze(Object.defineProperty({__proto__:null,useStore:W},Symbol.toStringTag,{value:"Module"})),KM="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",ZM=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function JM(e){return ZM.test(e)}function e6(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:JM(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const I_=["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"],F_=["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 U_(){const e=I_[Math.floor(Math.random()*I_.length)],t=F_[Math.floor(Math.random()*F_.length)];return`${e} ${t}`}function hS(e){for(let t=0;t<100;t++){const n=U_();if(!e.has(n))return n}return U_()}let rg=null;function t6(){return rg||(rg=new AudioContext),rg}function n6(){try{const e=t6();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 a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class fS{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),h=this.removeEmpty(this.tokenize(o,i)),f=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(h,f,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=C=>{if(C=this.postProcess(C,i),a){setTimeout(function(){a(C)},0);return}else return C},h=n.length,f=t.length;let p=1,g=h+f;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(o=i.timeout)!==null&&o!==void 0?o: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>=f&&_+1>=h)return u(this.buildValues(b[0].lastComponent,n,t));let k=-1/0,N=1/0;const S=()=>{for(let C=Math.max(k,-p);C<=Math.min(N,p);C+=2){let T;const R=b[C-1],A=b[C+1];R&&(b[C-1]=void 0);let O=!1;if(A){const z=A.oldPos-C;O=A&&0<=z&&z<h}const P=R&&R.oldPos+1<f;if(!O&&!P){b[C]=void 0;continue}if(!P||O&&R.oldPos<A.oldPos?T=this.addToPath(A,!0,!1,0,i):T=this.addToPath(R,!1,!0,1,i),_=this.extractCommon(T,n,t,C,i),T.oldPos+1>=f&&_+1>=h)return u(this.buildValues(T.lastComponent,n,t))||!0;b[C]=T,T.oldPos+1>=f&&(N=Math.min(N,C-1)),_+1>=h&&(k=Math.max(k,C+1))}p++};if(a)(function C(){setTimeout(function(){if(p>g||Date.now()>y)return a(void 0);S()||C()},0)})();else for(;p<=g&&Date.now()<=y;){const C=S();if(C)return C}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,h=i.length;let f=t.oldPos,p=f-a,g=0;for(;p+1<u&&f+1<h&&this.equals(i[f+1],n[p+1],o);)p++,f++,g++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!o.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=f,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 a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let h=0,f=0,p=0;for(;h<u;h++){const g=a[h];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(f,f+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(f,f+g.count));f+=g.count,g.added||(p+=g.count)}}return a}}function H_(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 q_(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 w0(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 S0(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 Fc(e,t){return w0(e,t,"")}function dh(e,t){return S0(e,t,"")}function V_(e,t){return t.slice(0,s6(e,t))}function s6(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 a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function pS(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function k0(e,t){if(t)return lu(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ho(e,t){if(t)return lu(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function lu(e,t){if(!t)return[ho(e),k0(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=pS(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const G_="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}",i6=new RegExp(`[${G_}]+|\\s+|[^${G_}]`,"ug");class r6 extends fS{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=pS(t,u)}else i=t.match(i6)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}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,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&Y_(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&Y_(i,o,a,null,n.intlSegmenter),t}}const a6=new r6;function l6(e,t,n){return a6.diff(e,t,n)}function Y_(e,t,n,i,a){if(t&&n){const[o,u]=lu(t.value,a),[h,f]=lu(n.value,a);if(e){const p=H_(o,h);e.value=S0(e.value,h,p),t.value=Fc(t.value,p),n.value=Fc(n.value,p)}if(i){const p=q_(u,f);i.value=w0(i.value,f,p),t.value=dh(t.value,p),n.value=dh(n.value,p)}}else if(n){if(e){const o=ho(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=ho(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=ho(i.value,a),[u,h]=lu(t.value,a),f=H_(o,u);t.value=Fc(t.value,f);const p=q_(Fc(o,f),h);t.value=dh(t.value,p),i.value=w0(i.value,o,p),e.value=S0(e.value,o,o.slice(0,o.length-p.length))}else if(i){const o=ho(i.value,a),u=k0(t.value,a),h=V_(u,o);t.value=dh(t.value,h)}else if(e){const o=k0(e.value,a),u=ho(t.value,a),h=V_(o,u);t.value=Fc(t.value,h)}}class o6 extends fS{constructor(){super(...arguments),this.tokenize=u6}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
51
+ `))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
52
+ `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
53
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
54
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const c6=new o6;function Q_(e,t,n){return c6.diff(e,t,n)}function u6(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
55
+ `));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let a=0;a<i.length;a++){const o=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function d6(e,t,n,i,a,o,u){let h;u?typeof u=="function"?h={callback:u}:h=u:h={},typeof h.context>"u"&&(h.context=4);const f=h.context;if(h.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(h.callback){const{callback:g}=h;Q_(n,i,Object.assign(Object.assign({},h),{callback:v=>{const y=p(v);g(y)}}))}else return p(Q_(n,i,h));function p(g){if(!g)return;g.push({value:"",lines:[]});function v(C){return C.map(function(T){return" "+T})}const y=[];let b=0,_=0,k=[],N=1,S=1;for(let C=0;C<g.length;C++){const T=g[C],R=T.lines||h6(T.value);if(T.lines=R,T.added||T.removed){if(!b){const A=g[C-1];b=N,_=S,A&&(k=f>0?v(A.lines.slice(-f)):[],b-=k.length,_-=k.length)}for(const A of R)k.push((T.added?"+":"-")+A);T.added?S+=R.length:N+=R.length}else{if(b)if(R.length<=f*2&&C<g.length-2)for(const A of v(R))k.push(A);else{const A=Math.min(R.length,f);for(const P of v(R.slice(0,A)))k.push(P);const O={oldStart:b,oldLines:N-b+A,newStart:_,newLines:S-_+A,lines:k};y.push(O),b=0,_=0,k=[]}N+=R.length,S+=R.length}}for(const C of y)for(let T=0;T<C.lines.length;T++)C.lines[T].endsWith(`
56
+ `)?C.lines[T]=C.lines[T].slice(0,-1):(C.lines.splice(T+1,0,"\"),T++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:o,hunks:y}}}function h6(e){const t=e.endsWith(`
57
+ `),n=e.split(`
58
+ `).map(i=>i+`
59
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function f6(e,t){return d6("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,o=[];let u=i.oldStart,h=i.newStart;for(const f of i.lines){const p=f[0],g=f.slice(1);p==="-"?o.push({type:"del",content:g,oldLineNo:u++}):p==="+"?o.push({type:"add",content:g,newLineNo:h++}):o.push({type:"context",content:g,oldLineNo:u++,newLineNo:h++})}return mS(o),{header:a,lines:o}})}function p6(e){const t=[],n=e.split(`
60
+ `);let i=null,a=null,o=0,u=0;for(const h of n){if(h.startsWith("diff --git")||h.startsWith("diff --cc")){a&&i&&i.hunks.push(a),i&&t.push(i),i={fileName:"",hunks:[]},a=null;continue}if(h.startsWith("--- a/")||h.startsWith("--- /dev/null"))continue;if(h.startsWith("+++ b/")){i&&(i.fileName=h.slice(6));continue}if(h.startsWith("+++ /dev/null")||h.startsWith("index ")||h.startsWith("new file")||h.startsWith("deleted file")||h.startsWith("old mode")||h.startsWith("new mode")||h.startsWith("rename from")||h.startsWith("rename to")||h.startsWith("similarity index")||h.startsWith("Binary files"))continue;const f=h.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(f){a&&i&&i.hunks.push(a),o=parseInt(f[1],10),u=parseInt(f[2],10),a={header:h,lines:[]};continue}a&&(h.startsWith("+")?a.lines.push({type:"add",content:h.slice(1),newLineNo:u++}):h.startsWith("-")?a.lines.push({type:"del",content:h.slice(1),oldLineNo:o++}):h.startsWith(" ")&&a.lines.push({type:"context",content:h.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const h of t)for(const f of h.hunks)mS(f.lines);return t}function mS(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=i-n,h=o-a;if(u>0&&h>0){const f=Math.min(u,h);for(let p=0;p<f;p++){const g=e[n+p],v=e[a+p],y=l6(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 m6({line:e}){return e.wordChanges?l.jsx(l.Fragment,{children:e.wordChanges.map((t,n)=>t.added?l.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?l.jsx("span",{className:"diff-word-del",children:t.value},n):l.jsx("span",{children:t.value},n))}):l.jsx(l.Fragment,{children:e.content})}function g6({hunk:e,showLineNumbers:t}){return l.jsxs("div",{className:"diff-hunk",children:[l.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>l.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),l.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),l.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),l.jsxs("span",{className:"diff-content",children:[l.jsx(m6,{line:n}),!n.content&&" "]})]},i))]})}function x6({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return l.jsxs("div",{className:"diff-file-header",children:[l.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:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&l.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function Oo({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const o=a==="compact",u=!o,h=j.useMemo(()=>{if(n)return p6(n);const f=e??"",p=t??"";if(!f&&!p)return[];const g=f6(f,p);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return h.length===0||h.every(f=>f.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${o?"diff-compact":"diff-full"}`,children:h.map((f,p)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||i)&&l.jsx(x6,{fileName:f.fileName||i||""}),f.hunks.map((g,v)=>l.jsx(g6,{hunk:g,showLineNumbers:u},v))]},p))})}const gS=j.createContext(null);function NI({value:e,children:t}){return l.jsx(gS.Provider,{value:e,children:t})}function v6(){const e=j.useContext(gS),t=W(n=>n.density);return e??t}function xa(){return v6()==="compact"}function _f({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:o=""}){return l.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${e?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),n&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-muted/40 select-none shrink-0",children:n}),l.jsx("span",{className:`text-[11px] text-cc-muted/60 group-hover:text-cc-muted truncate min-w-0 ${o}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const y6={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 Lo(e){return y6[e]||"tool"}function Hi(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 xS({name:e,input:t,toolUseId:n}){const[i,a]=j.useState(e==="Edit"),o=Lo(e),u=Hi(e),h=wo(e,t);return e==="Edit"?l.jsx(b6,{input:t,toolUseId:n}):e==="Bash"?l.jsx(_6,{input:t,toolUseId:n}):l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[l.jsxs("button",{onClick:()=>a(!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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ll,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),h&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:h})]}),i&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(w6,{name:e,input:t})})})]})}function b6({input:e,toolUseId:t}){const n=xa(),[i,a]=j.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",h=String(e.old_string||""),f=String(e.new_string||""),p=!!(h||f),g=!!e.replace_all,[v,y]=j.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(C=>({path:typeof C.path=="string"?C.path:"",kind:typeof C.kind=="string"?C.kind:"update"})).filter(C=>C.path),k=(h+f).split(`
61
+ `).length,N=k>15,S=l.jsx(l.Fragment,{children:p?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!v?"max-h-[240px]":""}`,children:l.jsx(Oo,{oldText:h,newText:f,mode:"compact"})}),N&&!v&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),N&&l.jsx("button",{type:"button",onClick:()=>y(!v),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:v?"Show less":`Show all ${k} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((C,T)=>{const R=C.path.split("/").pop()||C.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${C.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":C.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:C.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:R})]},`${C.path}-${T}`)})}):l.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})});return n?l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(_f,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${g?" (all)":""}`,meta:p?`${k} ${k===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),i&&l.jsx("div",{className:"mt-0.5",children:S})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),g&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),S]})}function _6({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=xa(),[o,u]=j.useState(!1);if(a){const h=n.split(`
62
+ `)[0]||"",f=i||h||"Command",p=n?n.split(`
63
+ `).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(_f,{open:o,onToggle:()=>u(!o),marker:"$",label:f,meta:!o&&p>0?`+${p}`:void 0,labelClassName:i?"italic":"font-mono-code"}),o&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function w6({name:e,input:t}){switch(e){case"Bash":return l.jsx(S6,{input:t});case"Edit":return l.jsx(k6,{input:t});case"Write":return l.jsx(j6,{input:t});case"Read":return l.jsx(N6,{input:t});case"Glob":return l.jsx(C6,{input:t});case"Grep":return l.jsx(E6,{input:t});case"WebSearch":case"web_search":return l.jsx(T6,{input:t});case"WebFetch":return l.jsx(M6,{input:t});case"Task":return l.jsx(A6,{input:t});case"TodoWrite":return l.jsx(R6,{input:t});case"NotebookEdit":return l.jsx(O6,{input:t});case"SendMessage":return l.jsx(L6,{input:t});default:return l.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 S6({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.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:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function k6({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),o=(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 l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.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?l.jsx(Oo,{oldText:n,newText:i,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,h)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.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}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${h}`))]}):l.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 j6({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Oo,{newText:n,fileName:t,mode:"compact"})}function N6({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),i!=null&&l.jsxs("span",{children:["limit: ",i]})]})]})}function C6({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function E6({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.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||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function T6({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function M6({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function A6({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.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&&l.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 R6({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.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==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):l.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 O6({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),i&&l.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.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 L6({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function wo(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("/")}`:"",a=n+i;return a.length>60?a.slice(0,60)+"...":a}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 ll({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.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"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const D6=2e3,vS=6,z6=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),gi=new Map,yr=new Map,Uh=new Map,Mh=new Map,aa=new Map,ou=new Map,ku=new Map,Hh=new Map;function yS(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function Nx(e){return!e.archived&&e.state!=="exited"}function Cx(e){const t=W.getState();if(t.currentSessionId===e)return!0;const n=t.sdkSessions.find(i=>i.sessionId===e);return n?Nx(n):!1}function $6(){const e=W.getState(),t=new Set;e.currentSessionId&&t.add(e.currentSessionId);for(const n of e.sdkSessions)Nx(n)&&t.add(n.sessionId);return Array.from(t)}const So=[];function bS(){let e=0;for(const t of gi.values())t.readyState===WebSocket.CONNECTING&&e++;return e}function _S(e){const t=So.indexOf(e);t>=0&&So.splice(t,1)}function X_(){if(!ko)for(;So.length>0&&bS()<vS;){const e=So.shift();Cx(e)&&Do(e)}}let ko=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){ko=!0;for(const[e,t]of yr)clearTimeout(t),yr.delete(e)}else{ko=!1;for(const e of $6()){if(!Cx(e))continue;const t=gi.get(e);if(!yS(t)){if(t){try{t.close()}catch{}gi.delete(e)}Do(e)}}}});function Ah(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const a of n)if(!(!a||a===".")){if(a===".."){i.length>0&&i.pop();continue}i.push(a)}return`${t?"/":""}${i.join("/")}`}function P6(e,t){return e.startsWith("/")||!t?Ah(e):Ah(`${t}/${e}`)}function B6(e,t){if(!t)return!0;const n=Ah(t);return e===n||e.startsWith(`${n}/`)}function I6(e){let t=Hh.get(e);return t||(t=new Set,Hh.set(e,t)),t}function ag(e,t){const n=W.getState(),i=I6(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:h}=a;if(h){if(i.has(h))continue;i.add(h)}if(o==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const p=f.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),Mh.set(e,p.length)}continue}if(o==="TaskCreate"){const f=(Mh.get(e)||0)+1;Mh.set(e,f);const p={id:String(f),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const f=u.taskId;if(f){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,f,p)}}}}function lg(e,t){var o,u;const n=W.getState(),i=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(h=>h.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const h of t){if(h.type!=="tool_use")continue;const{name:f,input:p}=h;if((f==="Edit"||f==="Write")&&typeof p.file_path=="string"){const g=P6(p.file_path,i);B6(g,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const nu=new Map,F6=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function og(e,t){const n=W.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const a=i.input;if(a.run_in_background===!0){let o=nu.get(e);o||(o=new Map,nu.set(e,o)),o.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,o=nu.get(e),u=o==null?void 0:o.get(a);if(o&&u){const f=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(F6);if(f){const p={taskId:f[1],toolUseId:a,command:u.command,description:u.description,outputFile:f[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&nu.delete(e)}}}}const hh=new Map,qh=new Map;function cg(e,t){const n=W.getState();let i=qh.get(e);i||(i=new Set,qh.set(e,i));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&i.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&i.add(a.id);let u=hh.get(e);u||(u=new Map,hh.set(e,u));const h={toolUseId:a.id,name:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:h.name,description:h.description,agentType:h.agentType,startedAt:h.startedAt}),n.addBackgroundAgent(e,h)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=hh.get(e),h=u==null?void 0:u.get(o);if(u&&h){const f=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(g=>"text"in g?g.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:f.length>200?f.slice(0,200)+"...":f}),u.delete(o),u.size===0&&hh.delete(e)}}}}function W_(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function K_(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function Z_(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")return`Task ${e.status}: ${e.task_id}.`;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 U6=0,H6=0;function Pi(){return`msg-${Date.now()}-${++U6}`}function J_(e){var n;const t=(n=e.errors)!=null&&n.length?e.errors.join(", "):e.result||(e.api_error_status?`API error ${e.api_error_status}`:"The turn ended with an error but no details were provided.");return e6(e)?`${KM}
64
+
65
+ Details: ${t}`:`Error: ${t}`}function q6(e,t){const n=ku.get(e)||[];n.push(t),ku.set(e,n)}function V6(e,t){const n=ku.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){ku.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const fr=new Map;function ew(e,t,n){const i=W.getState(),a=i.messages.get(e)||[],o=ou.get(e);let u=a.filter(f=>!f.isStreaming||f.id===o),h=-1;if(o&&(h=u.findIndex(f=>f.id===o),h===-1&&ou.delete(e)),h===-1){const f=`stream-${e}-${Pi()}`;ou.set(e,f),u=[...u,{id:f,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const f=u[h];u[h]={...f,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}i.setMessages(e,u)}function na(e){ou.delete(e);const t=W.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const tw=new Map,G6=8e3;function eo(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=tw.get(e);a&&a.code===t&&i-a.at<G6||(tw.set(e,{code:t,at:i}),W.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function wS(){return`cmsg-${Date.now()}-${++H6}`}function j0(){return wS()}const Y6=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","set_magic_ui"]);function Q6(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 SS(e){return`companion:last-seq:${e}`}function N0(e){const t=Uh.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(SS(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return Uh.set(e,a),a}catch{return 0}}function nw(e,t){const n=Math.max(0,Math.floor(t));Uh.set(e,n);try{localStorage.setItem(SS(e),String(n))}catch{}}function sw(e,t){Yn(e,{type:"session_ack",last_seq:t})}function Rh(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
66
+ `)}function ug(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 X6(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const h of i)a.set(ug(h),h);const o=[],u=new Set;for(const h of n){const f=ug(h);u.has(f)||(u.add(f),o.push(a.get(f)||h))}for(const h of i){const f=ug(h);u.has(f)||(u.add(f),o.push(h))}return o}function iw(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:wo(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function C0(e,t){const n=X6(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Rh(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function W6(e,t){const n=W.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...i];o[a]=C0(o[a],t),n.setMessages(e,o)}function K6(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=W.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),kS(e,n)}function kS(e,t,n={}){var u,h,f,p,g,v;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=W.getState();if(i&&typeof t.seq=="number"){const y=N0(e);if(t.seq<=y)return;nw(e,t.seq),a&&sw(e,t.seq)}switch(z6.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const y=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),y||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const b=new Set(o.sessionNames.values()),_=hS(b);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const y=t.message;if(y.model==="<synthetic>"){na(e),o.setStreaming(e,null),eo(e,"synthetic_noop",{detail:{stopReason:y.stop_reason,text:Rh(y.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const b=Rh(y.content),_={id:y.id,role:"assistant",content:b,contentBlocks:y.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:y.model,stopReason:y.stop_reason};if(na(e),W6(e,_),o.setStreaming(e,null),aa.delete(e),fr.delete(e),(u=y.content)!=null&&u.length)for(const k of y.content)k.type==="tool_result"&&o.clearToolProgress(e,k.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(h=y.content)!=null&&h.length)for(const k of y.content){if(k.type==="tool_use"){const N=k.input||{};o.addToolActivity(e,iw(k.id,k.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}k.type==="tool_result"&&o.updateToolActivity(e,k.tool_use_id,{completedAt:Date.now(),isError:!!k.is_error})}(f=y.content)!=null&&f.length&&(ag(e,y.content),lg(e,y.content),og(e,y.content),cg(e,y.content));break}case"stream_event":{const y=t.event;if(y&&typeof y=="object"){if(y.type==="message_start"&&(aa.delete(e),fr.delete(e),na(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),y.type==="content_block_delta"){const b=y.delta;if((b==null?void 0:b.type)==="text_delta"&&typeof b.text=="string"){const _=fr.get(e)||{thinking:"",text:""};aa.get(e)==="thinking"&&(_.thinking=""),_.text+=b.text,fr.set(e,_),aa.set(e,"text"),o.setStreaming(e,_.text),ew(e,_.text,"text")}if((b==null?void 0:b.type)==="thinking_delta"&&typeof b.thinking=="string"){const _=fr.get(e)||{thinking:"",text:""};_.thinking+=b.thinking,fr.set(e,_),aa.set(e,"thinking"),o.setStreaming(e,_.thinking),ew(e,_.thinking,"thinking")}}if(y.type==="message_delta"){const b=y.usage;b!=null&&b.output_tokens&&o.setStreamingStats(e,{outputTokens:b.output_tokens})}}break}case"result":{Hh.delete(e),qh.delete(e);const y=t.data,b={total_cost_usd:y.total_cost_usd,num_turns:y.num_turns};if(typeof y.total_lines_added=="number"&&(b.total_lines_added=y.total_lines_added),typeof y.total_lines_removed=="number"&&(b.total_lines_removed=y.total_lines_removed),y.modelUsage){for(const _ of Object.values(y.modelUsage))if(_.contextWindow>0){const k=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);b.context_used_percent=Math.max(0,Math.min(k,100))}}o.updateSession(e,b),na(e),o.setStreaming(e,null),aa.delete(e),fr.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&n6(),!document.hasFocus()&&o.notificationDesktop&&W_("Session completed","Claude finished the task",e),y.is_error&&o.appendMessage(e,{id:Pi(),role:"system",content:J_(y),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const b=t.request;W_("Permission needed",`${b.tool_name}: approve or deny`,b.request_id)}const y=t.request;if(y.tool_name&&y.input){const b=[{type:"tool_use",id:y.tool_use_id,name:y.tool_name,input:y.input}];ag(e,b),lg(e,b),og(e,b),cg(e,b)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(b=>b.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:Pi(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||Pi(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e),t.timestamp&&o.noteUserMessageAt(e,t.timestamp);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:b,status:_,summary:k}=t.event;b&&_&&o.updateProcess(e,b,{status:_,completedAt:Date.now(),summary:k||void 0})}const y=Z_(t.event);if(!y)break;o.appendMessage(e,{id:Pi(),role:"system",content:y,timestamp:t.timestamp||Date.now(),...K_(t.event)});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:Pi(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:Pi(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const y=t.phase;y==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),na(e)?eo(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):eo(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):y==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),na(e)&&eo(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):y==="starting"||y==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),y==="ready"?o.setSessionStatus(e,"idle"):y==="streaming"?o.setSessionStatus(e,"running"):y==="compacting"?o.setSessionStatus(e,"compacting"):y==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),na(e)?eo(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):eo(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const y=o.sessionNames.get(e),b=y&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(y);(!y||b)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const y=[],b=new Map;for(let k=0;k<t.messages.length;k++){const N=t.messages[k];if(N.type==="user_message")y.push({id:N.id||Pi(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const S=N.message,C=Rh(S.content),T={id:S.id,role:"assistant",content:C,contentBlocks:S.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:S.model,stopReason:S.stop_reason},R=y.findIndex(A=>A.role==="assistant"&&A.id===T.id);if(R===-1?y.push(T):y[R]=C0(y[R],T),(v=S.content)!=null&&v.length){ag(e,S.content),lg(e,S.content),og(e,S.content),cg(e,S.content);const A=N.timestamp||Date.now();for(const O of S.content){if(O.type==="tool_use"){const P=O.input||{},z=b.get(O.id);b.set(O.id,z??iw(O.id,O.name,P,A,N.parent_tool_use_id))}if(O.type==="tool_result"){const P=b.get(O.tool_use_id);P&&b.set(O.tool_use_id,{...P,completedAt:A,isError:P.isError||!!O.is_error,elapsedSeconds:Math.max(P.elapsedSeconds,P.completedAt?P.elapsedSeconds:Math.max(0,(A-P.startedAt)/1e3))})}}}}else if(N.type==="result"){const S=N.data;S.is_error&&y.push({id:`hist-error-${k}`,role:"system",content:J_(S),timestamp:Date.now()});const C={total_cost_usd:S.total_cost_usd,num_turns:S.num_turns};if(typeof S.total_lines_added=="number"&&(C.total_lines_added=S.total_lines_added),typeof S.total_lines_removed=="number"&&(C.total_lines_removed=S.total_lines_removed),S.modelUsage){for(const T of Object.values(S.modelUsage))if(T.contextWindow>0){const R=T,A=Math.round((R.inputTokens+R.outputTokens)/R.contextWindow*100);C.context_used_percent=Math.max(0,Math.min(A,100))}}o.updateSession(e,C)}else if(N.type==="system_event"){const S=Z_(N.event);if(!S)continue;y.push({id:`hist-system-event-${k}`,role:"system",content:S,timestamp:N.timestamp||Date.now(),...K_(N.event)})}}if(y.length>0){const k=o.messages.get(e)||[];if(k.length===0)o.setMessages(e,y);else{const N=[...k];for(const S of y){const C=N.findIndex(R=>R.id===S.id);if(C===-1){N.push(S);continue}const T=N[C];T.role==="assistant"&&S.role==="assistant"?N[C]=C0(T,S):N[C]=S}N.sort((S,C)=>(S.timestamp??0)-(C.timestamp??0)),o.setMessages(e,N)}}o.setToolActivity(e,Array.from(b.values()).sort((k,N)=>k.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(na(e),o.setStreaming(e,null),aa.delete(e),fr.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let y;for(const b of t.events){const _=N0(e);b.seq<=_||(nw(e,b.seq),y=b.seq,kS(e,b.message,{processSeq:!1,ackSeqMessage:!1}))}typeof y=="number"&&sw(e,y);break}case"prompt_suggestion":{const y=t.suggestions;o.setPromptSuggestions(e,y);break}case"streamlined_text":{o.appendMessage(e,{id:Pi(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:Pi(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{o.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Do(e){const t=gi.get(e);if(yS(t))return;if(t){try{t.close()}catch{}gi.delete(e)}const n=W.getState();if(n.setConnectionStatus(e,"connecting"),n.currentSessionId!==e&&bS()>=vS){So.includes(e)||So.push(e);return}_S(e);const i=new WebSocket(Q6(e));gi.set(e,i),i.onopen=()=>{const a=N0(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),V6(e,i);const o=yr.get(e);o&&(clearTimeout(o),yr.delete(e)),X_()},i.onmessage=a=>K6(e,a),i.onclose=()=>{gi.get(e)===i&&(gi.delete(e),W.getState().setConnectionStatus(e,"disconnected"),Z6(e),X_())},i.onerror=()=>{i.close()}}function Z6(e){if(yr.has(e)||ko)return;const t=setTimeout(()=>{yr.delete(e),!ko&&Cx(e)&&Do(e)},D6);yr.set(e,t)}function E0(e){_S(e);const t=yr.get(e);t&&(clearTimeout(t),yr.delete(e));const n=gi.get(e);n&&(n.close(),gi.delete(e)),W.getState().setConnectionStatus(e,"disconnected"),Hh.delete(e),qh.delete(e),nu.delete(e),Mh.delete(e),aa.delete(e),ou.delete(e),fr.delete(e),Uh.delete(e),ku.delete(e)}function J6(e){if(ko)return;const t=W.getState().currentSessionId,n=e.filter(Nx),i=t?[...n.filter(a=>a.sessionId===t),...n.filter(a=>a.sessionId!==t)]:n;for(const a of i)Do(a.sessionId)}function Yn(e,t){const n=gi.get(e);let i=t;const a=Y6.has(t.type);if(a)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":case"set_magic_ui":t.client_msg_id||(i={...t,client_msg_id:wS()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&q6(e,i)}function rw(e){Yn(e,{type:"mcp_get_status"})}function e4(e,t,n){Yn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function t4(e,t){Yn(e,{type:"mcp_reconnect",serverName:t})}function n4(e,t){Yn(e,{type:"mcp_set_servers",servers:t})}function aw(e,t){Yn(e,{type:"set_magic_ui",magicUiActive:t})}function CI(e){Yn(e,{type:"magic_ui_sync"})}function s4(e,t){Yn(e,{type:"set_ai_validation",...t})}var i4={};const re="u">typeof window?window:void 0,Qn="u">typeof globalThis?globalThis:re,Un=Qn==null?void 0:Qn.navigator,ge=Qn==null?void 0:Qn.document,$t=Qn==null?void 0:Qn.location,ju=Qn==null?void 0:Qn.fetch,Ex=Qn!=null&&Qn.XMLHttpRequest&&"withCredentials"in new Qn.XMLHttpRequest?Qn.XMLHttpRequest:void 0,lw=Qn==null?void 0:Qn.AbortController,r4=Qn==null?void 0:Qn.CompressionStream,as=Un==null?void 0:Un.userAgent,Uc=typeof globalThis<"u"?globalThis:re;Uc&&typeof self>"u"&&(Uc.self=Uc),Uc&&typeof File>"u"&&(Uc.File=function(){});const Fe=re??{},a4="0.9.5",vr={DEBUG:!1,LIB_VERSION:a4,LIB_NAME:"browser-common"};var Ii=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),T0=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const l4=["$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"],o4=["token"];function Ie(e,t){return e.indexOf(t)!==-1}const jo=function(e){return e.trim()},M0=function(e){return e.replace(/^\$/,"")};function jS(e){var t;const n=[];return(t=JSON.stringify(e,function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}}))!==null&&t!==void 0?t:"null"}const NS=Object.prototype,Tx=NS.hasOwnProperty,wf=NS.toString,Pe=Array.isArray||function(e){return wf.call(e)==="[object Array]"},ln=e=>typeof e=="function",Ve=e=>e===Object(e)&&!Pe(e),_s=e=>{if(Ve(e)){for(const t in e)if(Tx.call(e,t))return!1;return!0}return!1},ue=e=>e===void 0,Ke=e=>wf.call(e)=="[object String]",cu=e=>Ke(e)&&e.trim().length===0,Xt=e=>e===null,qe=e=>ue(e)||Xt(e),sn=e=>wf.call(e)=="[object Number]"&&e==e,pr=e=>sn(e)&&e>0,os=e=>wf.call(e)==="[object Boolean]",c4=e=>Ie(l4,e),u4=e=>Ie(o4,e);function CS(e){return e===null||typeof e!="object"}function Vh(e,t){return{}.toString.call(e)===`[object ${t}]`}function zo(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ES(e,Error)}}function Mx(e){return"u">typeof Event&&ES(e,Event)}function ES(e,t){try{return e instanceof t}catch{return!1}}const d4=[!0,"true",1,"1","yes"],dg=e=>Ie(d4,e),h4=[!1,"false",0,"0","no"];function ow(e,t,n,i,a,o,u){try{var h=e[o](u),f=h.value}catch(p){return void n(p)}h.done?t(f):Promise.resolve(f).then(i,a)}function Rt(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var o=e.apply(t,n);function u(f){ow(o,i,a,u,h,"next",f)}function h(f){ow(o,i,a,u,h,"throw",f)}u(void 0)})}}const f4=["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","pinterestbot","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"],fh=new Map,cw=function(e,t=[]){if(!e)return!1;const n=(function(u,h){let f="";for(let p=0;h.length>p;p++){const g=h[p];f+=g.length+":"+g}return u.length+":"+u+"|"+h.length+":"+f})(e,t),i=fh.get(n);if(i!==void 0)return i;const a=e.toLowerCase(),o=f4.concat(t).some(u=>a.indexOf(u.toLowerCase())!==-1);return 256>fh.size||fh.clear(),fh.set(n,o),o};function Ui(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),sn(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: "+a),Ui(a??n,t,n,i))}var p4=class{constructor(e){this.C={},this.I=e.I,this.R=Ui(e.bucketSize,0,100,e.A),this.$=Ui(e.refillRate,0,this.R,e.A),this.O=Ui(e.refillInterval,0,864e5,e.A)}F(e,t){const n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.$,this.R),e.lastAccess=e.lastAccess+n*this.O)}consumeRateLimit(e){var t;const n=Date.now(),i=String(e);let a=this.C[i];return a?this.F(a,n):(a={tokens:this.R,lastAccess:n},this.C[i]=a),a.tokens===0||(a.tokens--,a.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),a.tokens===0)}stop(){this.C={}}};const No="Mobile",Nu="Android",Gh="Tablet",TS="Android Tablet",MS="iPad",AS="Apple Watch",Oh="Safari",Sf="BlackBerry",RS="Samsung Internet",Lh="Chrome",OS="Chrome iOS",LS="Internet Explorer",DS="Internet Explorer Mobile",zS="Opera",$S="Microsoft Edge",Dh="Firefox",PS="Firefox iOS",Yh="Nintendo",Qh="PlayStation",kf="Xbox",BS="Android Mobile",IS="Mobile Safari",hg="Windows",FS="Windows Phone",uw="Nokia",A0="Ouya",m4="Generic "+No.toLowerCase(),US="Generic "+Gh.toLowerCase(),R0="Konqueror",HS="Oculus Browser",qS="Vivaldi",VS="Yandex",GS="Whale",YS="DuckDuckGo",QS="Pale Moon",XS="Waterfox",O0="Brave",WS="Claude",KS="Codex",ZS="ChatGPT",JS="Google Search App",fg=new RegExp("Version/(\\d+(\\.\\d+)?)"),pg=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),g4=new RegExp(kf,"i"),x4=new RegExp("PlayStation \\w+","i"),v4=new RegExp("Nintendo \\w+","i"),Ax=new RegExp("BlackBerry|PlayBook|BB10","i"),y4={"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"},ek=function(e,t,n,i){return t=t||"",(function(o){return o!=null&&o.brave?O0:null})(n)||(i!=null&&i.detectGoogleSearchApp&&Ie(e,"GSA/")?JS:Ie(e," OPR/")&&Ie(e,"Mini")?"Opera Mini":Ie(e," OPR/")?zS:Ax.test(e)?Sf:Ie(e,"IEMobile")||Ie(e,"WPDesktop")?DS:Ie(e,"OculusBrowser")?HS:Ie(e,"SamsungBrowser")?RS:Ie(e,"Edge")||Ie(e,"Edg/")?$S:Ie(e,"Vivaldi/")?qS:Ie(e,"YaBrowser/")?VS:Ie(e,"Whale/")?GS:Ie(e,"DuckDuckGo/")||Ie(e,"Ddg/")?YS:Ie(e,"Claude/")?WS:Ie(e,"Codex/")?KS:Ie(e,"ChatGPT/")?ZS:Ie(e,"FBIOS")?"Facebook Mobile":Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?OS:Ie(e,"CrMo")||Ie(e,Lh)?Lh:Ie(e,Nu)&&Ie(e,Oh)?BS:Ie(e,"FxiOS")?PS:Ie(e.toLowerCase(),R0.toLowerCase())?R0:Ie(e,"Brave/")?O0:((o,u)=>u&&Ie(u,"Apple")||(function(h){return Ie(h,Oh)&&!Ie(h,Lh)&&!Ie(h,Nu)})(o))(e,t)?Ie(e,No)?IS:Oh:Ie(e,"PaleMoon/")?QS:Ie(e,"Waterfox/")?XS:Ie(e,Dh)?Dh:Ie(e,"MSIE")||Ie(e,"Trident/")?LS:Ie(e,"Gecko")?Dh:"")},b4={[DS]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[$S]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Lh]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[OS]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Oh]:[fg],[IS]:[fg],[zS]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Dh]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[PS]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[R0]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Sf]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),fg],[BS]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[RS]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[HS]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[qS]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[VS]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[GS]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[O0]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[WS]:[pg],[KS]:[pg],[ZS]:[pg],[YS]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[QS]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[XS]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[JS]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[LS]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},_4=function(e,t,n,i){const a=ek(e,t,n,i),o=b4[a];if(ue(o))return null;for(let u=0;o.length>u;u++){const h=e.match(o[u]);if(h)return parseFloat(h[h.length-2])}return null},dw=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[kf,e&&e[1]||""]],[new RegExp(Yh,"i"),[Yh,""]],[new RegExp(Qh,"i"),[Qh,""]],[Ax,[Sf,""]],[new RegExp(hg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[FS,""];if(new RegExp(No).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let i=y4[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[hg,i]}return[hg,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=ue(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Nu,[e[2],e[3],e[4]||"0"].join(".")]:[Nu,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],tk=function(e){for(let t=0;dw.length>t;t++){const[n,i]=dw[t],a=n.exec(e),o=a&&(ln(i)?i(a,e):i);if(o)return o}return["",""]},nk=function(e){return v4.test(e)?Yh:x4.test(e)?Qh:g4.test(e)?kf:new RegExp(A0,"i").test(e)?A0:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?FS:/iPad/.test(e)?MS:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?AS:Ax.test(e)?Sf:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(uw,"i").test(e)?uw:/(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(No).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)?Nu:TS:new RegExp("(pda|Mobile)","i").test(e)?m4:new RegExp(Gh,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?US:""},w4=function(e,t){var n;const i=nk(e);return i===MS||i===TS||i==="Kobo"||i==="Kindle Fire"||i===US?Gh:i===Yh||i===kf||i===Qh||i===A0?"Console":i===AS?"Wearable":i?No:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((n=t==null?void 0:t.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((a=t==null?void 0:t.screenWidth)!==null&&a!==void 0?a:0,(o=t==null?void 0:t.screenHeight)!==null&&o!==void 0?o:0)/((u=t==null?void 0:t.devicePixelRatio)!==null&&u!==void 0?u:1)?No:Gh:"Desktop";var a,o,u},mg=/\bFBAV\/(\d+(?:\.\d+)*)/i,hw=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",mg],[/\bFBAN\/EMA\b/i,"Facebook Lite",mg],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",mg],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],L0="[Truncated]",Du="[Unserializable]";function yo(e){let t="";for(let n=0;e.length>n;n++){const i=e.charCodeAt(n);if(55296>i||i>56319)t+=56320>i||i>57343?e[n]:"�";else{const a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}function sk(e,t){if(!t)return e;let n=[];try{n=Object.keys(t)}catch{n=[]}for(const i of n){let a;try{a=t[i]}catch{a=Du}Object.defineProperty(e,i,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}const zh=3e5;var ik=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),n=Date.now(),i=Math.min(e.retryAfterMs,zh);if(!t)return this.ts=n,void(this.es=n+i);this.es=Math.max(this.es,Math.min(n+i,this.ts+zh))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(zh,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const S4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fw(e,t){return typeof(n=e)=="string"&&S4.test(n)?e:t();var n}function rk(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function pa(e){return e&&e.split("#")[0]}function pw(e){try{return e()}catch{return}}function ak(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function mw(e,t,n){return lk.apply(this,arguments)}function lk(){return(lk=Rt(function*(e,t,n){let i;try{return yield Promise.race([e,new Promise((a,o)=>{i=ak(()=>{try{n==null||n(),a()}catch(u){o(u)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}function uu(e){return uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uu(e)}function k4(e,t,n){return(t=(function(i){var a=(function(o){if(uu(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var h=u.call(o,"string");if(uu(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)})(i);return uu(a)=="symbol"?a:a+""})(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function D(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gw(Object(n),!0).forEach(function(i){k4(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gw(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}let Hc,xw,vw,to;function j4(e){var t;const n=globalThis._posthogChunkIds,i=globalThis._debugIds;if(!n&&!i)return;const a=n?Object.keys(n):[],o=i?Object.keys(i):[];if(to&&yw(n,a,xw)&&yw(i,o,vw))return to;xw=n?D({},n):void 0,vw=i?D({},i):void 0,to={},(t=Hc)!==null&&t!==void 0||(Hc={});const u=(h,f)=>{for(const g of h){const v=f[g];if(!v)continue;const y=Hc==null?void 0:Hc[g];if(y){to[y]=v;continue}const b=e(g);for(let _=b.length-1;_>=0;_--){var p;const k=(p=b[_])===null||p===void 0?void 0:p.filename;if(k){to[k]=v,Hc[g]=k;break}}}};return i&&u(o,i),n&&u(a,n),to}function yw(e,t,n){return e&&n?t.length===Object.keys(n).length&&t.every(i=>e[i]===n[i]):e===n}var N4=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){const n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),a=this.buildParsingContext(t),o=this.parseStacktrace(i,a);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return Rt(function*(){for(const n of e)n.stacktrace&&n.stacktrace.frames&&Pe(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var n;let i,a;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{a=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return D(D({},e),{},{cause:i,stack:a,errors:(n=e.errors)===null||n===void 0?void 0:n.map(o=>this.parseStacktrace(o,t))})}applyChunkIds(e,t){return e.map(n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n))}applyCoercers(e,t){for(const n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Rt(function*(){let n=e;for(const i of t.modifiers)n=yield i(n);return n})()}convertToExceptionList(e,t){const n=[],i=(a,o,u)=>{var h;const f=n.length,p=o===void 0?D(D({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:a.synthetic,exception_id:f}):{type:"chained",source:u,synthetic:a.synthetic,exception_id:f,parent_id:o},g={type:a.type,value:a.value,mechanism:p};a.stack&&(g.stacktrace={type:"raw",frames:a.stack}),n.push(g),a.cause&&i(a.cause,f,"cause");for(const v of(h=a.errors)!==null&&h!==void 0?h:[])i(v,f,"member")};return i(e),n}buildParsingContext(e){var t;return{chunkIdMap:j4(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(zo(e)){let n=Object.getPrototypeOf(e);for(let i=0;n&&100>i;i++){var t;const a=(t=Object.getOwnPropertyDescriptor(n,"constructor"))===null||t===void 0?void 0:t.value;if(typeof a=="function"&&a.name==="AggregateError"){const o=e.errors;return Pe(o)?o:void 0}n=Object.getPrototypeOf(n)}}}catch{}}buildCoercingContext(e,t,n=0){let i=0,a=0,o=!1;const u=new Set,h=[],f={},p=(y,b,_=0)=>{const k=g(b,_),N=k.apply;if(k.apply=O=>{h.push(y);try{return N(O)}finally{h.pop()}},_>4||_>0&&h.indexOf(y)!==-1)return this.coerceFallback(k);const S=typeof y=="object"&&y!==null||typeof y=="function";if(_===0&&i>=50||S&&u.has(y))return;S&&u.add(y),_===0&&i++;const C=this.getAggregateErrors(y);let T,R;o||(o=!!C);try{if(T=this.applyCoercers(y,k),!T)throw f}catch(O){if(O===f)return void(_===0&&i--);if(!o)throw O;T=this.coerceFallback(k)}if(!C||i>=50)return T;try{R=C.length}catch{return T}if(!Number.isInteger(R)||0>R||R>4294967295)return T;const A=[];for(let O=0;50>i&&1e3>a&&R>O;O++){let P;a++;try{P=k.next(C[O])}catch{i++,P=this.coerceFallback(g(b+1))}P&&A.push(P)}return D(D({},T),{},{errors:A})},g=(y,b=0)=>D(D({},t),{},{syntheticException:y==0?t.syntheticException:void 0,mechanism:y==0?e:{},apply(_){const k=p(_,y,b+1);if(!k)throw f;return k},next:_=>p(_,y+1)}),v=g(n);return D(D({},v),{},{apply:y=>{var b;return(b=p(y,n))!==null&&b!==void 0?b:this.coerceFallback(v)}})}};const C4=/^([a-z][a-z0-9.+-]+):/i,E4=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function T4(e){if(!e||e==="<anonymous>")return!1;const t=C4.exec(e);return!t||E4.includes(t[1].toLowerCase())}function D0(e,t,n,i,a){const o={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:T4(t)};return ue(i)||(o.lineno=i),ue(a)||(o.colno=a),o}const ok=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:"?",n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},M4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,A4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,R4=/\((\S*)(?::(\d+))(?::(\d+))\)/,O4=(e,t)=>{const n=M4.exec(e);if(n){const[,a,o,u]=n;return D0(t,a,"?",+o,+u)}const i=A4.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const u=R4.exec(i[2]);u&&(i[2]=u[1],i[3]=u[2],i[4]=u[3])}const[a,o]=ok(i[1]||"?",i[2]);return D0(t,o,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},L4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,D4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,z4=(e,t)=>{const n=L4.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const o=D4.exec(n[3]);o&&(n[1]=n[1]||"eval",n[3]=o[1],n[4]=o[2],n[5]="")}let i=n[3],a=n[1]||"?";return[a,i]=ok(a,i),D0(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},bw=/\(error: (.*)\)/;function Rx(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function $4(e){for(let t=1;10>=t;t++){const n=e.length-2*t;if(0>n)break;let i=!0;for(let a=0;t>a;a++)if(!Rx(e[n+a],e[n+t+a])){i=!1;break}if(i){for(let a=0;t>a;a++)e[n+a]=e[n+t+a];return e.length=n+t,{start:n,length:t}}}}function P4(e,t){const n=t.start+t.length,i=uk(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}function ck(e,t){let n=t.start;for(;n>0&&Rx(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function uk(e,t){const n=t.start+t.length;let i=n;for(;e.length>i&&Rx(e[i],e[i-t.length]);)i++;return i-n}function B4(e,t){const n=t[0];let i=e.length-(n?ck(e,n):0);for(const a of t)i-=uk(e,a);return i}function I4(e,t,n){for(let i=0;e.length>i;i++){const a=e[(t+i)%e.length],o=e[(n+i)%e.length];if(a!==o)return o>a}return!1}var F4=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const n=Ke(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Vh(e,"DOMException")}isDOMError(e){return Vh(e,"DOMError")}},U4=class{match(e){return zo(e)}coerce(e,t){var n;const i=this.getStack(e),a=i===void 0?(n=t.syntheticException)===null||n===void 0?void 0:n.stack:void 0,o=!!a;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??a,cause:e.cause?t.next(e.cause):void 0,synthetic:o}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const n=e.stack;return typeof n=="string"&&n.length>0?n:void 0}catch{return}}},H4=class{match(e){return!!Vh(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var n;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return D(D({},i),{},{stack:(n=this.lr(e))!==null&&n!==void 0?n:i.stack,synthetic:!0})}ar(e){return Ke(e.message)&&e.message.length>0}lr(e){var t,n;const i=e,a=(t=i.lineno)!==null&&t!==void 0?t:0,o=(n=i.colno)!==null&&n!==void 0?n:0;if(Ke(i.filename)&&i.filename.length!==0&&a!==0)return`Error
67
+ at ${i.filename}:${a}:${o}`}};const q4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var V4=class{match(e){return typeof e=="string"}coerce(e,t){var n;const[i,a]=this.getInfos(e);return{type:i??"Error",value:a??e,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}getInfos(e){let t="Error",n=e;const i=e.match(q4);return i&&(t=i[1],n=i[2]),[t,n]}};const G4=["fatal","error","warning","log","info","debug"];function dk(e,t=40){const n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(let i=n.length;i>0;i--){const a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?`${a.slice(0,t)}...`:a}return""}var Y4=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i;const a=this.getErrorPropertyFromObject(e);return a?t.apply(a):{type:this.getType(e),value:this.getValue(e),stack:(n=this.getStack(e))!==null&&n!==void 0?n:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Mx(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Ke(t)&&!cu(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message: '${e.message}'`),n}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${dk(e)}`}isSeverityLevel(e){return Ke(e)&&!cu(e)&&G4.indexOf(e)>=0}getStack(e){try{return Ke(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Ke(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const n=e[t];if(zo(n))return n}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Q4=class{match(e){return Mx(e)}coerce(e,t){var n;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${dk(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},X4=class{match(e){return CS(e)}coerce(e,t){var n;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},W4=class{match(t){return Vh(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Mx(t))return!1;try{const n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i;const a=this.getUnhandledRejectionReason(t);return CS(a)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(a)}`,stack:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:n.apply(a)}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}};const Xh="$message",Wh="$timestamp",K4=new Set([Xh,Wh]),gg={enabled:!0,max_bytes:32768};function Kh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:gg.enabled,max_bytes:J4(e.max_bytes,gg.max_bytes)}:D({},gg)}var Z4=class{constructor(e){this.ns=[],this.ss=0,this.Mr=Kh(e)}setConfig(e){this.Mr=Kh(e),this.rs()}add(e){const t=(function(i){let a;try{a=jS(i)}catch{return}try{const o=JSON.parse(a);if(!Ve(o))return;const u=o,h=u[Xh],f=u[Wh];return!Ke(h)||h.trim().length===0||!Ke(f)&&!sn(f)?void 0:{step:u,json:a}}catch{return}})(e);if(!t)return;const n=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const a=encodeURIComponent(i);let o=0;for(let u=0;a.length>u;u++)a[u]==="%"?(o+=1,u+=2):o+=1;return o})(t.json);n>this.Mr.max_bytes||(this.ns.push({step:t.step,bytes:n}),this.ss+=n,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function J4(e,t){if(!sn(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const _w=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function ww(e){return typeof e=="string"||e}function Sw(e){return typeof e=="string"?e:void 0}const eA=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],hk="NativeGzipValidationError",z0=e=>e.length>=2&&e[0]===31&&e[1]===139,kw=(e,t)=>e===T0.GZipJS||t===T0.GZipJS||t==="gzip",jw=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let qc;const ph=e=>{throw rk(hk,`Native gzip produced invalid output: ${e}`)},tA=(Nw=Rt(function*(e,t){18>e.size&&ph("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());z0(n)&&n[2]===8||ph("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(o=>{const u=(()=>{if(qc)return qc;qc=[];for(let f=0;256>f;f++){let p=f;for(let g=0;8>g;g++)p=1&p?3988292384^p>>>1:p>>>1;qc[f]=p>>>0}return qc})();let h=4294967295;for(let f=0;o.length>f;f++)h=u[255&(h^o[f])]^h>>>8;return(4294967295^h)>>>0})(t)&&ph("invalid-crc");const a=t.length>>>0;i.getUint32(4,!0)!==a&&ph("invalid-size")}),function(e,t){return Nw.apply(this,arguments)});var Nw;function $0(){return $0=Rt(function*(e,t=!0,n){try{const a=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),u=o.writable.getWriter(),h=u.write(a).then(()=>u.close()).catch((i=Rt(function*(g){try{yield u.abort(g)}catch{}throw g}),function(g){return i.apply(this,arguments)})),f=new Response(o.readable).blob(),[p]=yield Promise.all([f,h]);return yield tA(p,a),p}catch(a){if(n!=null&&n.rethrow)throw a;return t&&console.error("Failed to gzip compress data",a),null}var i}),$0.apply(this,arguments)}function fk(e,t){if(e==null)return{};var n,i,a=(function(u,h){if(u==null)return{};var f={};for(var p in u)if({}.hasOwnProperty.call(u,p)){if(h.includes(p))continue;f[p]=u[p]}return f})(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;o.length>i;i++)t.includes(n=o[i])||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const Gn="[redacted]",nA=/^[A-Za-z0-9+/\n\r]+=*$/,sA=/^[A-Za-z0-9_-]+={0,2}$/,iA=/[-_]/,rA=/^data:[^,\s]*;base64,/i,aA=/^[A-Za-z0-9+/_-]+={0,2}$/,lA=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,oA=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,pk=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,cA=/[\s<>"]/,mk=new RegExp(pk.source,"i"),gk=/[a-z][a-z0-9+.-]{0,63}:\/\//i,uA=new RegExp(`^${gk.source}`,"i"),dA=new RegExp(gk.source,"gi"),hA=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,fA=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,pA=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,mA=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,gA=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,xA=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,vA=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,yA=/\b\d(?:[ ./-]?\d){12,}\b/g,Cw=/\d+/g,bA=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,_A=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function P0(e){return(function(t){return oA.test(t)})(e)||hA.test(e)||fA.test(e)}function xg(e){return e.split("&",129).length>128}function wA(e,t,n){return P0(e)||t.includes(";")&&(function(i){return i.split(";").some(a=>P0(a.split("=",1)[0]))})(t)?Gn:mk.test(t)?n?Ox(t,{allowNestedUrls:!1,stripPunctuation:!0}):Gn:t}function xk(e,t){const n=new URLSearchParams;let i=!1,a=!1;for(const[o,u]of new URLSearchParams(e)){const h=Zh(o),f=Zh(u);i||(i=h!==o||f!==u);const p=wA(h,f,t);i||(i=p!==f),a=P0(h)||p!==f,n.append(h,p)}return{changed:i,lastFieldSensitive:a,serialized:n.toString()}}function Ew(e,t){if(!e.includes("="))return{value:SA(e,t),lastFieldSensitive:!1};const n=xk(e,t);return{value:n.changed?n.serialized:e,lastFieldSensitive:n.lastFieldSensitive}}function SA(e,t){return t?Ox(e,{allowNestedUrls:!1,stripPunctuation:!0}):mk.test(e)?Gn:e}function kA(e,t,n){return e==="#"?!t.fragment&&(t.fragment=!0):e==="?"&&(t.fragment?n!=="="&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function vg(e,t){var n;if(e.length>8192&&uA.test(e))return Gn;const{address:i,suffix:a}=t.stripPunctuation?(function(N){let S=N.length;for(;S>0&&".,;:!?)]}'".includes(N[S-1]);)S--;return{address:N.slice(0,S),suffix:N.slice(S)}})(e):{address:e,suffix:""};let o;try{o=new URL(i)}catch{return Gn+a}const u=o.search.slice(1),h=o.hash!=="",f=(function(N){const S=N.slice(1),C=S.indexOf("?");return 0>C?{head:S,tail:null}:{head:S.slice(0,C),tail:S.slice(C+1)}})(o.hash);if(xg(u)||xg(f.head)||xg((n=f.tail)!==null&&n!==void 0?n:""))return Gn+a;let p=!1;(o.username||o.password)&&(o.username=Gn,o.password="",p=!0);const g=xk(u,t.allowNestedUrls);g.changed&&(o.search=g.serialized,p=!0);const v=Ew(f.head,t.allowNestedUrls),y=f.tail===null?null:(b=f.tail,v.lastFieldSensitive?{value:b===""?"":Gn,lastFieldSensitive:!0}:Ew(b,t.allowNestedUrls));var b;const _=y===null?v.value:`${v.value}?${y.value}`;_!==o.hash.slice(1)&&(o.hash=_,p=!0);const k=h?y??v:g;return(p?Zh(o.toString()):i)+(k.lastFieldSensitive?"":a)}function Ox(e,t){return e.replace(pk,n=>(function(i,a){const o=(function(f){if(!f.includes("://"))return[];const p=[...f.matchAll(dA)].map(k=>k.index),g=[],v={query:!1,fragment:!1,fragmentQuery:!1};let y=0,b=!1,_="";for(let k=0;f.length>k&&p.length>y;k++){p[y]===k&&(k>0&&_!=="="&&g.push(k),y++);const N=f[k];kA(N,v,_)?(_=N,b=!0):b&&"=&".includes(N)&&(_=N)}return g})(i);if(o.length===0)return vg(i,a);let u="",h=0;for(const f of o)u+=vg(i.slice(h,f),D(D({},a),{},{stripPunctuation:!1})),h=f;return u+vg(i.slice(h),a)})(n,D(D({},t),{},{stripPunctuation:t.stripPunctuation&&n.length!==e.length})))}function Zh(e){return e.replace(lA,Gn)}function vk(e,t){return(function(n){return n.length>=10240&&(nA.test(n)||(function(i){const a=rA.exec(i);if(!a)return!1;let o;try{o=decodeURIComponent(i.slice(a[0].length))}catch{return!1}return aA.test(o.replace(/[\r\n]/g,""))})(n)||iA.test(n)&&sA.test(n))})(e)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(n,i,a){const o=4*a.maxStringLength;if(n.length>o){const u=i(n.slice(0,(function(h,f){let p=f;for(;p>0&&!cA.test(h[p-1]);)p--;return p})(n,o)));if(u.length>=2*a.maxStringLength)return u+a.truncationSuffix}return i(n)})(e,n=>(function(i){return Ox(i,{allowNestedUrls:!0,stripPunctuation:!0})})((function(i){let a=i.replace(pA," ");return a=a.replace(mA,Gn),a=a.replace(gA,Gn),a=a.replace(xA,`$1${Gn}`),a=a.replace(yA,NA),a=a.replace(vA,Gn),a=a.replace(bA,`$1${Gn}`),a=a.replace(_A,`$1${Gn}`),a})(Zh(n))),t)}function jA(e){let t=0,n=!1;for(let i=e.length-1;i>=0;i--){let a=e.charCodeAt(i)-48;if(0>a||a>9)return!1;n&&(a*=2,a>9&&(a-=9)),t+=a,n=!n}return t%10==0}function NA(e){const t=[];for(let o=Cw.exec(e);o!==null;o=Cw.exec(e))t.push({digits:o[0],start:o.index,end:o.index+o[0].length});let n="",i=0,a=0;for(;t.length>a;){let o="",u=-1;for(let h=a;t.length>h&&(o+=t[h].digits,19>=o.length);h++)o.length>=13&&jA(o)&&(u=h);0>u?a++:(n+=e.slice(i,t[a].start)+Gn,i=t[u].end,a=u+1)}return n+e.slice(i)}const CA={}.propertyIsEnumerable;function Jh(e,t){try{return yk(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Lx(e,t,n,i){if(0>=n.remainingNodes)return{stringValue:L0};if(n.remainingNodes--,os(e))return{boolValue:e};if(typeof e=="bigint")return(function(a,o){const u=a.toString(),h=BigInt("9223372036854775808");return a>=h||-h>a?(o==null||o.debug(`Attribute ${u} is outside the int64 range; encoding it as a string`),{stringValue:u}):{intValue:u}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const a=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${a} is outside the int64 range; encoding it as a string`),{stringValue:a}):{intValue:a}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:yo(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:L0};if(e instanceof Date){const a=e.getTime(),o=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof o=="string"?yo(o):String(o)}}n.ancestors.add(e);try{try{const a=e.toJSON;if(typeof a=="function")return Lx(a.call(e),t,n,i+1)}catch{}return Pe(e)?{arrayValue:{values:EA(e,t,n,i+1)}}:{kvlistValue:{values:yk(e,t,n,i+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:yo(String(e))}}function EA(e,t,n,i){const a=[],o=Math.min(e.length,1e3);let u=0;for(;o>u&&n.remainingNodes>0;u++)try{const h=u in e?e[u]:void 0;if(qe(h))continue;a.push(Lx(h,t,n,i))}catch{a.push({stringValue:Du})}return e.length>u&&a.push({stringValue:L0}),a}function yk(e,t,n,i){const a=[];for(const o in e)if(CA.call(e,o)){if(!o){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=1e3||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const u=e[o];if(Xt(u)||ue(u))continue;a.push({key:yo(o),value:Lx(u,t,n,i)})}catch{a.push({key:yo(o),value:{stringValue:Du}})}}return a}function bk(e,t,n){return D(D(D(D({},sk({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}const TA=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function _k(e,t){const n=sk({},e),i={};for(const a of TA)({}).hasOwnProperty.call(n,a)&&(i[a]=n[a],delete n[a]);return[...Jh(n,t),...Jh(i,t)]}const Tw={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},wk={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}},MA=wk.info;function AA(e){try{return yo(String(e))}catch{return Du}}function RA(e,t,n,i){const a=e.level||"info",{text:o,number:u}=wk[a]||MA,h=(function(y=Date.now()){return String(y)+"000000"})(sn(i)?i:void 0),f={};t.distinctId&&(f.posthogDistinctId=t.distinctId),t.sessionId&&(f.sessionId=t.sessionId),t.windowId&&(f["window.id"]=t.windowId),qe(t.sessionStartTimestamp)||(f.sessionStartTimestamp=String(t.sessionStartTimestamp)),qe(t.lastActivityTimestamp)||(f.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(f["url.full"]=t.currentUrl),t.screenName&&(f["screen.name"]=t.screenName),t.appState&&(f["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(f.feature_flags=t.activeFeatureFlags);const p=D({},f),g=e.attributes;if(g){let y=[];try{y=Object.keys(g)}catch{y=[]}for(const b of y){let _;try{_=g[b]}catch{_=Du}Object.defineProperty(p,b,{value:_,enumerable:!0,writable:!0,configurable:!0})}}const v={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:u,severityText:o,body:{stringValue:AA(e.body)},attributes:Jh(p,n)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),ue(e.trace_flags)||(v.flags=e.trace_flags),v}function Sk(e,t,n){return bk(e,t,n)}function kk(e,t,n,i){return{resourceLogs:[{resource:{attributes:_k(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var jk=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=ak(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function Nk(){return .75+.5*Math.random()}function Ck(e,t,n,i){const a=Math.min(Math.max(0,t-1),6),o=e*Math.pow(2,a);return Math.round(Math.min(o,Math.max(i,e))*n)}var OA=class{constructor(e,t,n,i,a,o=()=>Promise.resolve(),u){var h;this._instance=e,this.Mr=t,this.A=n,this.hs=i,this.ds=a,this.vs=o,this.fs=u,this.ps=new jk(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ik,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((h=t.maxQueueSize)!==null&&h!==void 0?h:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(Ii.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var n;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const a={record:RA(i,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.hs(),this.A,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(a))}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Pe(t)?t:[t];let i=e;for(const a of n)try{const o=a(i);if(!o)return this.A.info("Log was rejected in beforeSend function"),null;i=o}catch(o){return this.A.error("Error in beforeSend function for log:",o),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return Rt(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Rt(function*(){var t;e.ps.clear();let n=(t=e._instance.getPersistedProperty(Ii.LogsQueue))!==null&&t!==void 0?t:[];if(n.length===0)return;const i=n.length;let a=0;for(;n.length>0&&i>a;){var o,u;const h=e._s;e.bs=0;const f=Math.min(n.length,e.Es),p=n.slice(0,f),g=kk(p.map(y=>y.record),e.qs(),(o=e.fs)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),v=yield e._instance.js(g);if(e._s!==h)return;if(v.kind==="too-large"&&p.length>1)e.Es=Math.max(1,Math.floor(p.length/2)),e.A.warn(`Logs batch of size ${p.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(v),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),v.kind==="retry-later"||(v.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):v.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(p.length),n=(u=e._instance.getPersistedProperty(Ii.LogsQueue))!==null&&u!==void 0?u:[],a+=p.length,v.kind==="fatal"))throw v.error}})()}Bs(e){var t=this;return Rt(function*(){var n;const i=Math.max(0,e-t.bs),a=(n=t._instance.getPersistedProperty(Ii.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Ii.LogsQueue,a.slice(i)),yield t.vs()})()}qs(){return Sk(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(Ii.LogsQueue))!==null&&t!==void 0?t:[];this.Is>n.length||(n.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Ii.LogsQueue,n),this.Ts>n.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Ck(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Ii.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Rt(function*(){t.ps.clear();const n=t.flush().catch(()=>{});e!==void 0?yield mw(n,e):yield n})()}flushWithTimeout(e){var t=this;return Rt(function*(){const n=t.flush();yield mw(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Nk(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const LA=/^[0-9a-f]+$/;function Mw(e,t,n){return typeof e=="string"&&e.length===t&&e!==n&&LA.test(e)}const DA=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/,zA="00",yg=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function B0(e){return String(e)+"000000"}function Aw(e,t,n,i){let a="";return i&&(a=Object.keys(i).sort().map(o=>`${JSON.stringify(o)}:${JSON.stringify(i[o])}`).join(",")),`${e}\0${t}\0${n??""}\0${a}`}var $A=class{constructor(e,t,n){this._instance=e,this.Mr=t,this.A=n,this.Hs=new Map,this.ps=new jk(()=>this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ik,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Qs({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Qs({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Qs({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this;const t=this.ys,n=(function(){var i=Rt(function*(){t&&(yield t.catch(()=>{})),yield e.Zs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.Hs.size===0)return null;const e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,i;try{n=t.attributes?D({},t.attributes):void 0,i=Aw(t.type,t.name,t.unit,n)}catch(h){return void this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,h)}let a=this.Hs.get(i);if(!a){if(!this.Ks())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Hs.set(i,a)}const o=this.Ws.get(t.name);o===void 0?this.Ws.set(t.name,t.type):o===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${o}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(a,t.value);const u=this.Ys();u&&(a.exemplar=D(D({},u),{},{value:t.value,timeMs:Date.now()})),this.Fs()}Ys(){try{var e,t;const n=(function(i){const a=(function(u){if(typeof u!="string")return;const h=DA.exec(u.trim());if(!h)return;const[,f,p,g,v,y]=h;return f==="ff"||f==="00"&&y||!(function(b){return Mw(b,32,"00000000000000000000000000000000")})(p)||!(function(b){return Mw(b,16,"0000000000000000")})(g)?void 0:{version:f,traceId:p,spanId:g,flags:v}})(i);return a&&{traceId:a.traceId,spanId:a.spanId,flags:(o=a.flags,1&parseInt(o,16)?"01":zA)};var o})((e=(t=this._instance).getActiveSpan)===null||e===void 0||(e=e.call(t))===null||e===void 0?void 0:e.traceparent());if(n&&n.flags==="01")return{traceId:n.traceId,spanId:n.spanId}}catch{}}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var n;e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(yg.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,o){for(let u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,yg)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const n=Pe(t)?t:[t];let i=e;for(const a of n)try{const o=a(i);if(!o)return this.A.info("Metric was rejected in beforeSend function"),null;i=o}catch(o){return this.A.error("Error in beforeSend function for metric:",o),null}return i}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Ck(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return Rt(function*(){if(e.ps.clear(),e.Hs.size===0)return;const t=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const n=e.Gs,i=yield e._instance.co(e.Js(t));if(n===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=Nk()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),i.kind){case"ok":return;case"retry-later":return e.ho(t),void e.ps.armNoEarlierThan(e.zs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",i.error)}})()}Js(e){return t=this.do(e),n=(function(o,u,h){return bk(o,u,h)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:_k(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}do(e){const t=B0(Date.now()),n=new Map;for(const u of e.values()){var i;const h=Aw(u.type,u.name,u.unit,void 0);let f=n.get(h);f||(f=D({name:u.name},u.unit&&{unit:u.unit}),u.type==="count"?f.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:u.type==="gauge"?f.gauge={dataPoints:[]}:f.histogram={aggregationTemporality:1,dataPoints:[]},n.set(h,f));const p=Jh((i=u.attributes)!==null&&i!==void 0?i:{},this.A),g=B0(u.windowStartMs),v=PA(u.exemplar);if(u.type==="count"){var a;const y=D({attributes:p,startTimeUnixNano:g,timeUnixNano:t,asDouble:(a=u.total)!==null&&a!==void 0?a:0},v);f.sum.dataPoints.push(y)}else if(u.type==="gauge"){var o;const y=D({attributes:p,timeUnixNano:t,asDouble:(o=u.last)!==null&&o!==void 0?o:0},v);f.gauge.dataPoints.push(y)}else if(u.hist){const y=D({attributes:p,startTimeUnixNano:g,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:yg},v);f.histogram.dataPoints.push(y)}}return Array.from(n.values())}ho(e){for(const[a,o]of e){var t;const u=this.Hs.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.exemplar=(t=u.exemplar)!==null&&t!==void 0?t:o.exemplar,u.type){case"count":var n,i;u.total=((n=u.total)!==null&&n!==void 0?n:0)+((i=o.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(let h=0;u.hist.bucketCounts.length>h;h++)u.hist.bucketCounts[h]+=o.hist.bucketCounts[h]}else u.hist=o.hist}else this.Ks()&&this.Hs.set(a,o)}}};function PA(e){return e?{exemplars:[{filteredAttributes:[],timeUnixNano:B0(e.timeMs),asDouble:e.value,traceId:e.traceId,spanId:e.spanId}]}:{}}const Ek=(e,{debugEnabled:t}={})=>{const n={N(i,...a){let o;try{o=typeof window>"u"?void 0:window}catch{return}o&&(vr.DEBUG||o.POSTHOG_DEBUG||t)&&!ue(o.console)&&o.console&&("__rrweb_original__"in o.console[i]?o.console[i].__rrweb_original__:o.console[i])(e,...a)},debug(...i){n.N("debug",...i)},info(...i){n.N("log",...i)},warn(...i){n.N("warn",...i)},error(...i){n.N("error",...i)},critical(...i){console.error(e,...i)},uninitializedWarning(i){n.error(`You must initialize PostHog before calling ${i}`)},createLogger:(i,a)=>Ek(`${e} ${i}`,a)};return n},be=Ek("[PostHog.js]"),Vt=be.createLogger,BA=Vt("[ExternalScriptsLoader]"),ef=e=>{const t=ge==null?void 0:ge.querySelectorAll("script");if(t){for(let n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Ja=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return BA.warn(`${t} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const i=ef(t);if(i){if(i.__posthog_loading_callback_fired)return n();const o=i.__posthog_loading_error;return o?n(o):(i.addEventListener("load",u=>{i.__posthog_loading_callback_fired=!0,n(void 0,u)}),void i.addEventListener("error",u=>{i.__posthog_loading_error=u,n(u)}))}const a=()=>{if(!ge)return n("document not found");if(ef(t))return Ja(e,t,n);let o=ge.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=t,o.onload=h=>{o.__posthog_loading_callback_fired=!0,n(void 0,h)},o.onerror=h=>{o.__posthog_loading_error=h,n(h)},e.config.prepare_external_dependency_script&&(o=e.config.prepare_external_dependency_script(o)),!o)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")ge.head.appendChild(o);else{const h=ge.querySelectorAll("body > script");var u;h.length>0?(u=h[0].parentNode)===null||u===void 0||u.insertBefore(o,h[0]):ge.body.appendChild(o)}};ge!=null&&ge.body?a():ge==null||ge.addEventListener("DOMContentLoaded",a)},bg={},Rw=(e,t)=>{let n=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",n)};Fe.__PosthogExtensions__=Fe.__PosthogExtensions__||{},Fe.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t==="remote-config"){const a=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Ja(e,a,n)}const i=e.config.strict_script_versioning;if(i){const a=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),o=bg[a];if(i==="fallback"&&o){if(ef(o))return void Ja(e,o,n);delete bg[a]}return void Ja(e,a,i==="fallback"?(u,h)=>{if(u)if(typeof u=="string")n(u);else{var f;const p=Rw(e,t);bg[a]=p;const g=ef(a);g==null||(f=g.parentNode)===null||f===void 0||f.removeChild(g),Ja(e,p,n)}else n(void 0,h)}:n)}Ja(e,Rw(e,t),n)},Fe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{const i=e.requestRouter.endpointFor("api",t);Ja(e,i,n)},vr.DEBUG=!1,vr.LIB_VERSION="1.438.10",vr.LIB_NAME="web";var bs=vr;const I0="$early_access_features",gr="$active_feature_flags",sl="$feature_flag_details",Cu="$feature_flag_errors",ha="$feature_flag_evaluated_at",il="$feature_flag_request_id",du="$minimal_flag_called_events",pi="$enabled_feature_flags",oa="$stored_group_properties",ca="$stored_person_properties",ua="$flag_call_reported",su="$flag_call_reported_session_id",da="$feature_flag_payloads",Bi="$override_feature_flags",el="$override_feature_flag_payloads",Eu="visibilitychange",IA="$people_distinct_id",fi="distinct_id",Dx="$device_id",_g="$device_model",tf="__alias",FA="__cmpns",Ow="$fbc",bo="$fbc_persistence",Lw="$fbp",hu="$fbp_persistence",F0="__timers",Tk="$autocapture_disabled_server_side",U0="$heatmaps_enabled_server_side",H0="$exception_capture_enabled_server_side",Mk="$error_tracking_suppression_rules",q0="$error_tracking_capture_extension_exceptions",V0="$web_vitals_enabled_server_side",zx="$dead_clicks_enabled_server_side",$x="$product_tours_enabled_server_side",Ak="$logs_capture_enabled_server_side",Rk="$web_vitals_allowed_metrics",fu="$session_recording_remote_config",UA="$session_recording_enabled_server_side",HA="$replay_sample_rate",qA="$replay_override_sampling",VA="$replay_override_linked_flag",GA="$replay_override_url_trigger",YA="$replay_override_event_trigger",mo="$sesid",Ok="$session_is_sampled",QA="$session_past_minimum_duration",XA="$session_recording_url_trigger_activated_session",WA="$session_recording_event_trigger_activated_session",KA="$debug_first_full_snapshot_timestamp",ZA="$sess_rec_flush_size",Lk="$groups",iu="$surveys",nf="$surveys_loaded_at",Dk="$surveys_activated",zk="$surveys_activated_session",$k="$surveys_activated_timestamps",G0="ph_product_tours",JA="$product_tours_activated",e3="$product_tours_activated_session",t3="$conversations_widget_session_id",n3="$conversations_ticket_id",s3="$conversations_widget_state",i3="$conversations_user_traits",ls="$user_state",Y0="$client_session_props",r3="$capture_rate_limit",Pk="$initial_campaign_params",Bk="$initial_referrer_info",go="$initial_person_info",Px="$epp",wg="$posthog_cookieless",Ik="$cookieless_mode",Fk="$sdk_debug_extensions_init_method",Uk="$sdk_debug_extensions_init_time_ms",Bx="$sdk_debug_recording_script_not_loaded",Ix="$sdk_debug_replay_stale_config",Hk="$sdk_debug_replay_event_trigger_status",qk="$sdk_debug_replay_linked_flag_trigger_status",Vk="$sdk_debug_replay_matched_recording_trigger_groups",Gk="$sdk_debug_replay_pending_trigger_conditions",Yk="$sdk_debug_replay_remote_trigger_matching_config",Qk="$sdk_debug_replay_trigger_groups_count",Xk="$sdk_debug_replay_url_trigger_status",a3="$session_recording_start_reason",Fx="PostHog loadExternalDependency extension not found.",xr="anonymous",$h="identified",Wk="identified_only",sf="beforeunload",Ux="$pageview",Dw="$pageleave",Kk="$identify",zw="$groupidentify";function xo(e,t){Pe(e)&&e.forEach(t)}function _t(e,t){if(!qe(e))if(Pe(e))e.forEach(t);else if((n=>n instanceof FormData)(e))e.forEach((n,i)=>t(n,i));else for(const n in e)Tx.call(e,n)&&t(e[n],n)}const Pt=function(e,...t){for(const n of t)for(const i in n)n[i]!==void 0&&(e[i]=n[i]);return e};function Ph(e){const t=Object.keys(e);let n=t.length;const i=new Array(n);for(;n--;)i[n]=[t[n],e[t[n]]];return i}const l3=function(e){return function(...t){try{return e.apply(this,t)}catch(n){be.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),be.critical(n)}}},Hx=function(e){const t={};return _t(e,function(n,i){(Ke(n)&&n.length>0||sn(n))&&(t[i]=n)}),t};function Zk(e){const t=D({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch{}return t}const o3=["herokuapp.com","vercel.app","netlify.app"];function c3(e){const t=e==null?void 0:e.hostname;if(!Ke(t))return!1;const n=t.split(".").slice(-2).join(".");for(const i of o3)if(n===i)return!1;return!0}function gt(e,t,n,i){const{capture:a=!1,passive:o=!0}=i??{};e==null||e.addEventListener(t,n,{capture:a,passive:o})}function Q0(e){return e.name==="ph_toolbar_internal"}const pu=e=>{if(ge){try{const t=e+"=",n=ge.cookie.split(";").filter(i=>i.length);for(let i=0;n.length>i;i++){let a=n[i];for(;a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return sn(e)&&isFinite(e)&&Math.floor(e)===e});var u3=class X0{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");const o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new X0(o)}toString(){let t="";for(let 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 X0(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let n=0;16>n;n++){const i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}},d3=class{generate(){const e=this.generateOrAbort();if(!ue(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(ue(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return sn(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return u3.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new h3}};let Jk=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};re&&!ue(re.crypto)&&crypto.getRandomValues&&(Jk=e=>crypto.getRandomValues(e));var h3=class{nextUint32(){return this.Rt.length>this.Et||(Jk(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let $w;const mi=()=>f3().toString(),f3=()=>($w||($w=new d3)).generate();let Vc="";const p3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let no=null;const Qt={At(){if(!Xt(no))return no;if(no=!1,ge)try{const e=`__ph_cookie_support_${mi()}`;Qt.$t(e,"xyz"),no=pu(e)==='"xyz"',Qt.Pt(e)}catch{no=!1}return no},Lt(e){be.error("cookieStore error: "+e)},Ot:pu,Dt(e){let t;try{t=JSON.parse(Qt.Ot(e))||{}}catch{}return t},$t(e,t,n,i,a){if(!ge)return!1;try{let o="",u="";const h=(function(p,g){if(g){let v=(function(y,b=ge){if(Vc)return Vc;if(!b||["localhost","127.0.0.1"].includes(y))return"";const _=y.split(".");let k=Math.min(_.length,8);const N="dmn_chk_"+mi();for(;!Vc&&k--;){const S=_.slice(k).join("."),C=N+"=1;domain=."+S+";path=/";b.cookie=C+";max-age=3",b.cookie.includes(N)&&(b.cookie=C+";max-age=0",Vc=S)}return Vc})(p);if(!v){const y=(b=>{const _=b.match(p3);return _?_[0]:""})(p);y!==v&&be.info("Warning: cookie subdomain discovery mismatch",y,v),v=y}return v?"; domain=."+v:""}return""})(ge.location.hostname,i);if(n){const p=new Date;p.setTime(p.getTime()+864e5*n),o="; expires="+p.toUTCString()}a&&(u="; secure");const f=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+h+u;return f.length>3686.4&&be.warn("cookieStore warning: large cookie, len="+f.length),ge.cookie=f,!0}catch{return!1}},Pt(e,t){if(ge!=null&&ge.cookie&&(!t||!Xt(pu(e))))try{Qt.$t(e,"",-1,t)}catch{return}}};let Sg=null;const ct={At(){if(!Xt(Sg))return Sg;let e=!0;if(ue(re))e=!1;else try{const t="__mplssupport__";ct.$t(t,"xyz"),ct.Ot(t)!=='"xyz"'&&(e=!1),ct.Pt(t)}catch{e=!1}return e||be.error("localStorage unsupported; falling back to cookie store"),Sg=e,e},Lt(e){be.error("localStorage error: "+e)},Ot(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){ct.Lt(t)}return null},Dt(e){try{return JSON.parse(ct.Ot(e))||{}}catch{}return null},$t(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ct.Lt(n)}return!1},Pt(e){try{re==null||re.localStorage.removeItem(e)}catch(t){ct.Lt(t)}}},kg=[ca,gr,pi,sl,da,il,ha,Cu,ua],tl=[Dx,fi,mo,Ok,Px,go,bo,ls],rf=e=>e+"_cpm",m3=["__proto__","constructor","prototype"],jg=e=>{if(!Ve(e))return{};const t={};return Object.keys(e).forEach(n=>{m3.indexOf(n)===-1&&(t[n]=e[n])}),t},Ng=(e,t=[])=>{const n={};return[...tl,...t].forEach(i=>{const a=e[i];ue(a)||Xt(a)||a===""||(n[i]=a)}),n},ej=e=>{let t=5381,n=2166136261;for(let i=0;e.length>i;i++){const a=e.charCodeAt(i);t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Pw=(e,t)=>({p:t,f:ej(JSON.stringify(e))}),Bw=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Qt.Dt(rf(e)),i=(n==null?void 0:n.f)===ej(t)&&Pe(n.p);return{properties:i?n.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},Cg=(e,t)=>t+"|"+(Qt.Ot(rf(e))||""),so={},W0={At:()=>!0,Lt(e){be.error("memoryStorage error: "+e)},Ot:e=>e in so?so[e]:null,Dt:e=>e in so?so[e]:null,$t:(e,t)=>(so[e]=t,!0),Pt(e){delete so[e]}};let Ya=null;const At={At(){if(!Xt(Ya))return Ya;if(Ya=!0,ue(re))Ya=!1;else try{const e="__support__";At.$t(e,"xyz"),At.Ot(e)!=='"xyz"'&&(Ya=!1),At.Pt(e)}catch{Ya=!1}return Ya},Lt(e){be.error("sessionStorage error: ",e)},Ot(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){At.Lt(t)}return null},Dt(e){try{return JSON.parse(At.Ot(e))||null}catch{}return null},$t(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){At.Lt(n)}return!1},Pt(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){At.Lt(t)}}};var g3=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.qo.$t(this.jo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.qo.Pt(this.jo,this.Mr.cross_subdomain_cookie)}get jo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get No(){const e=this.qo.Ot(this.jo);return dg(e)?1:Ie(h4,e)?0:-1}get qo(){const e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?ct:Qt,n=t.At()?t:W0;if(!this.Bo||this.Bo!==n){this.Bo=n;const i=e==="localStorage"?Qt:ct;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(dg(i.Ot(this.jo))),i.Pt(this.jo,this.Mr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Mr.respect_dnt&&[Un==null?void 0:Un.doNotTrack,Un==null?void 0:Un.msDoNotTrack,Fe.doNotTrack,Un==null?void 0:Un.globalPrivacyControl].some(e=>dg(e))}};function tj(e,t){var n;const i=e==null||(n=e.config)===null||n===void 0?void 0:n.get_current_url;if(!ln(i))return t;try{const a=i(t);return Ke(a)&&a?a:t}catch(a){return be.error("Error in get_current_url, falling back to window.location.href",a),t}}function Iw(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function yi(e){return!!e&&e.nodeType===1}function Hn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function nj(e){return!!e&&e.nodeType===3}function qx(e){return!!e&&e.nodeType===11&&yi(e.host)}function Vx(e){return e?jo(e).split(/\s+/):[]}function Fw(e,t){const n=(function(i){var a;const o=re==null||(a=re.location)===null||a===void 0?void 0:a.href;return ue(o)?void 0:tj(i,o)})(t);return!!(n&&e&&e.some(i=>n.match(i)))}function Co(e){let 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 Vx(t)}function sj(e){return qe(e)?null:jo(e).split(/(\s+)/).filter(t=>_o(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Tu(e){let t="";return rl(e)&&!Eo(e)&&e.childNodes&&e.childNodes.length&&_t(e.childNodes,function(n){var i;nj(n)&&n.textContent&&(t+=(i=sj(n.textContent))!==null&&i!==void 0?i:"")}),jo(t)}function mu(e){var t;return ue(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Gx=["a","button","form","input","select","textarea","label"];function K0(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}function Z0(e,t){if(ue(t))return!0;for(const n of e)if(t.some(i=>K0(n,i)))return!0;return!1}function ij(e){const t=e.parentNode;return!(!t||!yi(t))&&t}const Eg=[".ph-no-autocapture","[data-ph-no-autocapture]"],rj=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Yx=[...rj,"+","-","−","–"],Uw=Yx.length+10,x3=["button","a","input","select","textarea","label"],v3=["button","link","tab","menuitem","option"],Hw=(e,t)=>/[a-z0-9]/i.test(t)?Ie(Yx,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,y3=e=>Ie(x3,e.tagName.toLowerCase())||Ie(v3,(e.getAttribute("role")||"").toLowerCase());function Tg(e){let t="",n="";const i=u=>{yi(u)&&rl(u)&&!Eo(u)&&(t+=` ${Tu(u)}`,n=n||u.getAttribute("aria-label")||"",_t(u.childNodes,i))};i(e),t=jo(t.replace(/\s+/g," "));const a=(_o(t)?t:"").toLowerCase(),o=e.getAttribute("aria-label")||(a?"":n);return{safeText:a,ariaLabel:jo(o).toLowerCase()}}const qw=[".ph-no-rageclick",".ph-no-capture"],b3=["","text","search","email","password","url","tel","number"];function aj(e,t){if(!re||Qx(e))return!1;let n,i,a;var o,u;if(os(t)?(n=!!t&&qw,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:qw,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(f){return!(!f||!yi(f))&&(!!Hn(f,"textarea")||(Hn(f,"input")?Ie(b3,(f.getAttribute("type")||"").toLowerCase()):(function(p){var g;if(p.isContentEditable)return!0;const v=(g=p.getAttribute)===null||g===void 0?void 0:g.call(p,"contenteditable");return v==="true"||v===""})(f)))})(e))return!1;const{targetElementList:h}=lj(e,!1);return!(i&&(function(f,{safeText:p,ariaLabel:g}){let v;if(f===!0)v=rj;else{if(!Pe(f))return!1;if(f.length>Uw)return be.error(`[PostHog] content_ignorelist array cannot exceed ${Uw} items. Use css_selector_ignorelist for more complex matching.`),!1;v=f.map(y=>y.toLowerCase())}return v.some(y=>Hw(p,y)||Hw(g,y))})(i,(function(f,p){for(const g of p)if(y3(g))return Tg(g);for(const g of p){try{if((re==null?void 0:re.getComputedStyle(g).getPropertyValue("cursor"))!=="pointer")break}catch{break}const v=Tg(g);if(v.safeText||v.ariaLabel)return v}return Tg(f)})(e,h))||Z0(h,n))}const Qx=e=>!e||Hn(e,"html")||!yi(e),lj=(e,t)=>{if(!re||Qx(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const i=[e];let a=e;for(;a.parentNode&&!Hn(a,"body");){if(qx(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}const o=ij(a);if(!o)break;if(t||Gx.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{const u=re.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function rl(e){const t=new Set;let n=0;for(let o=e;o.parentNode&&!Hn(o,"body");o=o.parentNode){if(n++>=1e3||t.has(o))return!1;t.add(o);const u=Co(o);if(Ie(u,"ph-sensitive")||Ie(u,"ph-no-capture"))return!1}if(Ie(Co(e),"ph-include"))return!0;const i=e.type||"";if(Ke(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const a=e.name||e.id||"";return!Ke(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function Eo(e){return!!(Hn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Hn(e,"select")||Hn(e,"textarea")||e.getAttribute("contenteditable")==="true")}const Vw=new RegExp("^(?:(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}))$"),Gw=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,_3=[16,15,14,13],w3=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Yw=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Qw=/[0-9A-Za-z_]/;function S3(e){let t=0,n=!1;for(let i=e.length-1;i>=0;i--){let a=e.charCodeAt(i)-48;n&&(a*=2,a>9&&(a-=9)),t+=a,n=!n}return t%10==0}function _o(e,t=!0){return!(qe(e)||Ke(e)&&(e=jo(e),(t?Vw.test((e||"").replace(/[- ]/g,"")):(function(n){let i;for(Gw.lastIndex=0;i=Gw.exec(n);){const a=i[2];if(!a)continue;const o=a.replace(/[- ]/g,"");for(let u=0;o.length>u;u++)for(const h of _3){const f=u+h;if(o.length>=f){const p=o.slice(u,f);if(Vw.test(p)&&S3(p))return!0}}}return!1})(e))||(t?w3.test(e):(function(n){let i;for(Yw.lastIndex=0;i=Yw.exec(n);){const a=i[1],o=i[3];if(!(a&&o&&Qw.test(a)&&Qw.test(o)))return!0}return!1})(e))))}function Xw(e){let t=Tu(e);return t=`${t} ${oj(e)}`.trim(),_o(t)?t:""}function oj(e){let t="";return e&&e.childNodes&&e.childNodes.length&&_t(e.childNodes,function(n){var i;if(n&&((i=n.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const a=Tu(n);t=`${t} ${a}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${oj(n)}`.trim())}catch(a){be.error("[AutoCapture]",a)}}),t}function Ww(e){return e.replace(/"|\\"/g,'\\"')}function k3(e){const t=e.attr__class;if(t)return Pe(t)?t:Vx(t)}const mh=Vt("[Dead Clicks]"),j3=()=>!0,N3=e=>{var t;const n=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(zx)),i=e.instance.config.capture_dead_clicks;return os(i)?i:!!Ve(i)||n};var Kw=class{get lazyLoadedDeadClicksAutocapture(){return this.zo}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[zx]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.Uo()}):this.stop()}Ho(e){var t,n,i;!((t=Fe.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(n=Fe.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this.instance,"dead-clicks-autocapture",a=>{a?mh.error("failed to load script",a):e()})}Uo(){var e;if(ge){if(!this.zo&&(!((e=Fe.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=Ve(this.instance.config.capture_dead_clicks)?D({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.zo=Fe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.zo.start(ge),mh.info("starting...")}}else mh.error("`document` not found. Cannot start.")}stop(){this.zo&&(this.zo.stop(),this.zo=void 0,mh.info("stopping..."))}};const Gc=Vt("[SegmentIntegration]");function Zw(e,t,n=!0){const i=e.config.segment;if(!i)return t();const{analytics:a,filterProperties:o}=(h=>ln(h.register))(u=i)?{analytics:u}:u;var u;(function(h,f,p,g){const v=b=>{const _=()=>b.anonymousId()||mi();h.config.get_device_id=_,g&&b.id()&&(h.register({distinct_id:b.id(),$device_id:_()}),h.persistence.set_property(ls,$h)),p(g?void 0:b.anonymousId()||void 0)},y=f.user();"then"in y&&ln(y.then)?y.then(v):v(y)})(e,a,h=>{a.register(((f,p,{filterProperties:g}={})=>{typeof Promise<"u"&&Promise.resolve||Gc.warn("This browser does not have Promise support, and can not use the segment integration");const v=(y,b)=>{if(!b)return y;const _=!!p&&y.event.anonymousId===p&&!y.event.userId;_||y.event.userId||y.event.anonymousId===f.get_distinct_id()||(Gc.info("No userId set, resetting PostHog"),f.reset()),_||(p=void 0),y.event.userId&&y.event.userId!==f.get_distinct_id()&&(Gc.info("UserId set, identifying with PostHog"),f.identify(y.event.userId));let k=f.calculateEventProperties(b,y.event.properties);if(!qe(g)){const N=y.event.properties||{},S={};for(const T of Object.keys(k))Tx.call(N,T)||(S[T]=k[T]);const C=((T,R)=>{const A=Pe(T)?T:[T];let O=D({},R);for(const P of A)try{if(O=P(O),qe(O))return null}catch(z){return Gc.error("Error in Segment filterProperties:",z),null}return O})(g,S);if(qe(C))return y;k=C}return y.event.properties=Object.assign({},k,y.event.properties),y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(y){return v(y,y.event.event)},page(y){return v(y,Ux)},identify(y){return v(y,Kk)},screen(y){return v(y,"$screen")}}})(e,h,{filterProperties:o})).then(()=>{t()},f=>{Gc.error("Failed to register the Segment integration",f),t()})},n)}const cj="posthog-js";function uj(e,{organization:t,projectId:n,prefix:i,severityAllowList:a=["error"],sendExceptionsToPostHog:o=!0}={}){return u=>{var h,f,p,g,v;if(a!=="*"&&!a.includes(u.level)||!e.__loaded)return u;u.tags||(u.tags={});const y=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);u.tags["PostHog Person URL"]=y,e.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const b=((h=u.exception)===null||h===void 0?void 0:h.values)||[],_=b.map(S=>D(D({},S),{},{stacktrace:S.stacktrace?D(D({},S.stacktrace),{},{type:"raw",frames:(S.stacktrace.frames||[]).map(C=>D(D({},C),{},{platform:"web:javascript"}))}):void 0})),k={$exception_message:((f=b[0])===null||f===void 0?void 0:f.value)||u.message,$exception_type:(p=b[0])===null||p===void 0?void 0:p.type,$exception_level:u.level,$exception_list:_,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((g=b[0])===null||g===void 0?void 0:g.value)||u.message,$sentry_exception_type:(v=b[0])===null||v===void 0?void 0:v.type,$sentry_tags:u.tags};var N;return t&&n&&(k.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+u.event_id),o&&((N=e.exceptions)===null||N===void 0||N.sendExceptionEvent(k)),u}}var C3=class{constructor(e,t,n,i,a,o){this.name=cj,this.setupOnce=function(u){u(uj(e,{organization:t,projectId:n,prefix:i,severityAllowList:a,sendExceptionsToPostHog:o==null||o}))}}},Jw=class{constructor(e){this.Wo=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(be.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Qo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Qo)===null||e===void 0||e.call(this),this.Qo=void 0}doPageView(e,t){var n;const i=this.Zo(e,t);return this.Vo={pathname:(n=re==null?void 0:re.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Zo(e,(t=this.Vo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Zo(e,t){const n=this.Vo;if(!n)return{$pageview_id:t};let i={$pageview_id:t,$prev_pageview_id:n.pageViewId};const a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:o,lastScrollY:u,maxScrollY:h,maxContentHeight:f,lastContentY:p,maxContentY:g}=a;if(!(ue(o)||ue(u)||ue(h)||ue(f)||ue(p)||ue(g))){o=Math.ceil(o),u=Math.ceil(u),h=Math.ceil(h),f=Math.ceil(f),p=Math.ceil(p),g=Math.ceil(g);const v=o>1?Ui(u/o,0,1,be):1,y=o>1?Ui(h/o,0,1,be):1,b=f>1?Ui(p/f,0,1,be):1,_=f>1?Ui(g/f,0,1,be):1;i=Pt(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:b,$prev_pageview_max_content:g,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};const Yc=["flags","surveys"],E3={[IA]:{exposure:"hidden"},[tf]:{exposure:"hidden"},[FA]:{exposure:"hidden"},[F0]:{exposure:"hidden"},[bo]:{exposure:"hidden"},[hu]:{exposure:"hidden"},[Tk]:{exposure:"event"},[U0]:{exposure:"hidden"},[Ak]:{exposure:"hidden"},[H0]:{exposure:"event"},[Mk]:{exposure:"hidden"},[q0]:{exposure:"event"},[V0]:{exposure:"event"},[zx]:{exposure:"event"},[$x]:{exposure:"hidden"},[Rk]:{exposure:"event"},[fu]:{exposure:"hidden"},[UA]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[Ok]:{exposure:"event"},[HA]:{exposure:"event",shouldSkipFromEventProperties:e=>Xt(e)},[QA]:{exposure:"event"},[XA]:{exposure:"event"},[WA]:{exposure:"event"},[KA]:{exposure:"event"},[ZA]:{exposure:"hidden"},[pi]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden",storageGroup:"flags"},[I0]:{exposure:"hidden"},[sl]:{exposure:"hidden",storageGroup:"flags"},[da]:{exposure:"hidden",storageGroup:"flags"},[il]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[du]:{exposure:"hidden",storageGroup:"flags"},[Bi]:{exposure:"hidden"},[el]:{exposure:"hidden"},[ca]:{exposure:"hidden"},[oa]:{exposure:"hidden"},[iu]:{exposure:"hidden",storageGroup:"surveys"},[nf]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Dk]:{exposure:"event"},[zk]:{exposure:"hidden"},[$k]:{exposure:"hidden"},[G0]:{exposure:"hidden"},[JA]:{exposure:"hidden"},[e3]:{exposure:"hidden"},[t3]:{exposure:"event"},[n3]:{exposure:"event"},[s3]:{exposure:"event"},[i3]:{exposure:"event"},[ua]:{exposure:"hidden"},[su]:{exposure:"hidden"},[Lk]:{exposure:"event"},[Cu]:{exposure:"hidden"},[ha]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ls]:{exposure:"hidden"},[Y0]:{exposure:"hidden"},[r3]:{exposure:"hidden"},[Pk]:{exposure:"hidden"},[Bk]:{exposure:"hidden"},[go]:{exposure:"hidden"},[Px]:{exposure:"hidden"},[qA]:{exposure:"event"},[VA]:{exposure:"event"},[GA]:{exposure:"event"},[YA]:{exposure:"event"},[Fk]:{exposure:"event"},[Uk]:{exposure:"event"},[Bx]:{exposure:"hidden"},[Ix]:{exposure:"hidden"},[Hk]:{exposure:"hidden"},[qk]:{exposure:"hidden"},[Vk]:{exposure:"hidden"},[Gk]:{exposure:"hidden"},[Yk]:{exposure:"hidden"},[Qk]:{exposure:"hidden"},[Xk]:{exposure:"hidden"},[a3]:{exposure:"event"}},T3=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{const t=E3[e];if(t)return t;for(const[n,i]of T3)if(e.indexOf(n)===0)return i};function dj(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const hj=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},fj=(e,t)=>e>=t&&hj(),pj=(e,t,n,i)=>{if(e===0){if(hj()){const a=t+1;return a===n&&i(),a}return t}return 0},vo=(e,t)=>{try{let n;return JSON.stringify(e,(i,a)=>{var o;return zo(a)?((o=n)!==null&&o!==void 0||(n=new WeakMap),n.has(a)||n.set(a,Zk(a)),n.get(a)):typeof a=="bigint"?a.toString():a},t)}catch{return jS(e)}},_r=e=>{const t=ge==null?void 0:ge.createElement("a");return ue(t)?null:(t.href=e,t)},To=function(e,t){const n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let a=0;n.length>a;a++){const o=n[a].split("=");if(o[0]===t){i=o;break}}if(!Pe(i)||2>i.length)return"";{let a=i[1];try{a=decodeURIComponent(a)}catch{be.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")}},Mu=function(e,t,n){if(!e||!t||!t.length)return e;const i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],h=o[0],f=(u||"").split("&"),p=[];for(let v=0;f.length>v;v++){const y=f[v].split("=");Pe(y)&&(t.includes(y[0])?p.push(y[0]+"="+n):p.push(f[v]))}let g=h;return u!=null&&(g+="?"+p.join("&")),a!=null&&(g+="#"+a),g},af=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Mo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],M3=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Mo],Au="<masked>",A3=["li_fat_id"];function mj(e,t,n){if(!ge)return{};const i=t?[...Mo,...n||[]]:[],a=gj(Mu(ge.URL,i,Au),e),o=(function(){const u={};return _t(A3,function(h){const f=pu(h);u[h]=f||null}),u})();return Pt(o,a)}function gj(e,t){const n=M3.concat(t||[]),i={};return _t(n,function(a){const o=To(e,a);i[a]=o||null}),i}function xj(e){const t=(function(a){return a?a.search("https?://(.*)google.([^/?]*)")===0?"google":a.search("https?://(.*)bing.com")===0?"bing":a.search("https?://(.*)yahoo.com")===0?"yahoo":a.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!Xt(t)){i.$search_engine=t;const a=ge?To(ge.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function vj(){return navigator.language||navigator.userLanguage}function R3(){const e=vj();return typeof e=="string"?e.split("-")[0]:void 0}const lf="$direct";function yj(){return(ge==null?void 0:ge.referrer)||lf}function bj(e,t,n=!1){const i=e?[...Mo,...t||[]]:[],a=n?pa($t==null?void 0:$t.href):$t==null?void 0:$t.href,o=a==null?void 0:a.substring(0,1e3);return{r:yj().substring(0,1e3),u:o?Mu(o,i,Au):void 0}}function _j(e,t=!1){var n;const{r:i,u:a}=e,o=t?pa(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==lf?lf:(n=_r(i))===null||n===void 0?void 0:n.host};if(o){u.$current_url=o;const h=_r(o);u.$host=h==null?void 0:h.host,u.$pathname=h==null?void 0:h.pathname;const f=gj(o);Pt(u,f)}if(i){const h=xj(i);Pt(u,h)}return u}function O3(){try{return new Date().getTimezoneOffset()}catch{return}}const L3={flags:ha,surveys:nf},D3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gh=e=>`${e}_cookie_identity_change_pending`,xh=e=>{let t="",n=0;for(const i of e){const a=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(n+a>1e3)break;t+=i,n+=a}return t},Sn="main",mr=[pi,gr,sl,da,il,ha,du,ca],Mg=e=>mr.indexOf(e)!==-1,wj=[bo,hu],e5=e=>wj.indexOf(e)!==-1,sa=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},io=e=>{if(!e)return{};const t=JSON.parse(e);return Ve(t)?t:{}},t5=(e,t)=>{_t(e,(n,i)=>{const a=An(i);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var Ag=class{constructor(e,t,n=!0,i=!e.cookieless_mode){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Mr=e,this.la=n,this.props={},this.ua=void 0,this.ca=(a=>{let o="";return a.token&&(o=a.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),a.persistence_name?"ph_"+a.persistence_name:"ph_"+o+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.qo=this.ha(e),this.Yo=this.da(e),this.load(i),this.va(),e.debug&&be.info("Persistence loaded",e.persistence,D({},this.props)),this.update_config(e,e,t),this.save(),re){const a=()=>this.flush();gt(re,"beforeunload",a,{capture:!1}),gt(re,"pagehide",a,{capture:!1}),this.fa=o=>{if(this.Ko&&(!o.storageArea||o.storageArea===(re==null?void 0:re.localStorage))&&o.key)if(o.key!==this.ca){if(this.Yo){const u=Yc.find(h=>o.key===this.pa(h));u&&this.ga(o.key,u)}}else this.ga(o.key,Sn)},gt(re,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const i=this.ia.get(t);if(!Mg(t)||i===!0)return;if(n===!0)return void this.ma(t,!0);const a=new Set(i||[]);n.forEach(o=>a.add(o)),a.size&&this.ma(t,a)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&re&&(re.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,t,n=!0){if(this.hi)return!1;let i,a;try{if(a=ct.Ot(e),Xt(a)){const h=this.ya(t);return h.storageValue=null,t!==Sn&&(h.persisted=!1),!1}i=io(a)}catch{return!1}const o=t===Sn?i:ct.Dt(this.ca);if(o&&this.ba(o))return!1;const u=this._a(i,t,n);return t===Sn&&this.Yo&&!sa(this.wa().main,i)||this.ka(i,t,!0,a),u}ba(e){const t=this.props[fi],n=e[fi];return!ue(t)&&!ue(n)&&t!==n}ka(e,t,n,i){const a=this.ya(t);a.storageValue=i,t!==Sn&&(a.persisted=n);try{a.fingerprint=this.Sa(e,t)}catch{a.fingerprint=void 0}}_a(e,t,n){let i=!1;return mr.forEach(a=>{var o;const u=(o=An(a))===null||o===void 0?void 0:o.storageGroup;if(t===Sn&&this.Yo&&u||t!==Sn&&u!==t)return;const h=a in e,f=this.xa(a,h?e[a]:void 0),p=this.ia.has(a)?a in this.props:h;p===a in this.props&&sa(f,this.props[a])||(p?this.$a(a,f,!1):this.Ca(a,!1),i=!0)}),i&&n&&this.aa.forEach(a=>a()),i}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=ct.Ot(this.ca),t=this.ya(Sn);let n,i=!1,a=!1;if(e!==t.storageValue)if(Xt(e))t.storageValue=null;else{if(n=io(e),this.ra=!this.sa&&this.ba(n),this.ra)return!1;a=this._a(n,Sn,!1),!this.Yo||sa(this.wa().main,n)?this.ka(n,Sn,!0,e):t.storageValue=e,i=!0}return this.Yo&&Yc.forEach(o=>{const u=ct.Ot(this.pa(o)),h=this.ya(o),f=n||{},p=i&&mr.some(v=>{var y;return((y=An(v))===null||y===void 0?void 0:y.storageGroup)===o&&v in f});if(u===h.storageValue&&!p)return;if(Xt(u))return h.storageValue=null,h.persisted=!1,void(p&&(a=this._a(f,o,!1)||a));const g=io(u);a=this._a(g,o,!1)||a,this.ka(g,o,!0,u)}),a}catch{return!1}}ma(e,t){this.ia.set(e,t);const n=An(e);n!=null&&n.volatile||(this.ya((this.Yo?n==null?void 0:n.storageGroup:void 0)||Sn).fingerprint=void 0,this.Ia(e))}Ma(){mr.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=ct.Ot(this.ca),t=io(e);this.ya(Sn).storageValue=e,mr.forEach(n=>{var i;const a=this.Yo?(i=An(n))===null||i===void 0?void 0:i.storageGroup:void 0,o=a?ct.Ot(this.pa(a)):null;if(a){const h=this.ya(a);h.storageValue=o,h.persisted=!Xt(o)}const u=a&&!Xt(o)?io(o):t;n in this.props?this.Ea(n,u[n],this.props[n]):n in u&&this.ma(n,!0)})}catch{}}xa(e,t){const n=this.ia.get(e);if(!n)return t;if(n===!0)return this.props[e];if(e==="$active_feature_flags"){const o=new Set(Pe(t)?t:[]),u=new Set(Pe(this.props[e])?this.props[e]:[]);return n.forEach(h=>u.has(h)?o.add(h):o.delete(h)),Array.from(o)}const i=Ve(t)?D({},t):{},a=Ve(this.props[e])?this.props[e]:{};return n.forEach(o=>{o in a?i[o]=a[o]:delete i[o]}),i}Ea(e,t,n){if(!Mg(e))return;const i=this.ia.get(e);if(i===!0)return;let a=t;if(this.Ko)try{var o;const h=this.Yo?(o=An(e))===null||o===void 0?void 0:o.storageGroup:void 0,f=h?this.pa(h):this.ca;a=io(ct.Ot(f))[e]}catch{}const u=new Set(i||[]);if(e==="$active_feature_flags"){if(!ue(t)&&!Pe(t)||!ue(a)&&!Pe(a)||!Pe(n))return void this.ma(e,!0);const h=new Set(t||[]),f=new Set(a||[]),p=new Set(n);new Set([...h,...p]).forEach(g=>{h.has(g)!==p.has(g)&&u.add(g)}),u.forEach(g=>{f.has(g)===p.has(g)&&u.delete(g)})}else{if(!Ve(n))return void(sa(a,n)?this.ia.delete(e):this.ma(e,!0));{if(!ue(t)&&!Ve(t)||ue(t)&&_s(n)&&ue(a))return void this.ma(e,!0);const h=Ve(t)?t:{},f=Ve(a)?a:{};new Set([...Object.keys(h),...Object.keys(n)]).forEach(p=>{p in h==p in n&&sa(h[p],n[p])||u.add(p)}),u.forEach(p=>{p in f==p in n&&sa(f[p],n[p])&&u.delete(p)})}}u.size?this.ma(e,u):this.ia.delete(e)}Pa(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return sn(t)&&t>0?t:0}Ra(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Ng(e,this.Mr.cookie_persisted_properties||[]),n=Pw(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),a=Qt.Ot(this.ca)||void 0;a&&Cg(this.ca,a)===i&&(this.Aa=i,this.Fa=a)}catch{}else try{const t=Qt.Ot(this.ca)||void 0;this.Aa=t?Cg(this.ca,t):void 0,this.Fa=t}catch{}}syncCookieProperties(){return this.Oa(this.Mr)}Oa(e,t=!1){if(this.hi&&!t||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let n;try{n=Qt.Ot(this.ca)||void 0}catch{}if(!n||n===this.Fa)return!1;const i=Cg(this.ca,n);let a;try{a=jg(JSON.parse(n))}catch{return!1}if((Qt.Ot(this.ca)||void 0)!==n)return!1;this.Aa=i,this.Fa=n;const o=Bw(this.ca,n),u=[...tl,...o.properties],h={};if(Object.keys(a).forEach(k=>{const N=a[k];(ue(N)||Xt(N)||N===""||k==="$user_state"&&N!=="anonymous"&&N!=="identified")&&(h[k]=!0,delete a[k])}),_s(a))return!1;const f="distinct_id"in a||a.$user_state==="anonymous"||a.$user_state==="identified",p=this.props,g=p[fi],v=p[ls],y=Pt({},p);[...tl,...e.cookie_persisted_properties||[]].forEach(k=>{if(u.indexOf(k)!==-1&&!(k in a)&&!h[k]&&(f||k!=="distinct_id"&&k!=="$user_state")){const N=y[k];(o.isValid||tl.indexOf(k)===-1||N!==!1&&N!==0)&&delete y[k]}}),this.props=Pt(y,a),mr.forEach(k=>{const N=k in this.props;k in p===N&&sa(p[k],this.props[k])||(N?this.Ea(k,p[k],this.props[k]):this.ma(k,!0))}),!f||"$user_state"in a||"$user_state"in this.props||this.$a(ls,xr);const b=this.props[fi],_=this.props[ls];return!f||b===g&&_===v||(this.sa=!0,this.ta=!0,At.$t(gh(this.ca),!0),this.Ca(ca),this.Ca(gr),this.Ca(pi),this.Ca(sl),this.Ca(da),this.Ca(il),this.Ca(ha),this.Ca(Cu),this.Ca(ua),_!=="anonymous"||v!=="identified"&&a.$user_state!=="anonymous"&&(ue(g)||b===g)||(t5(this.props,a),this.Ca(oa)),_==="identified"?this.props.$user_id=b:delete this.props.$user_id,this.Ca(tf)),!0}consumeCookieIdentityChange(){const e=gh(this.ca),t=this.ta||!!At.Ot(e);return this.ta=!1,t&&At.Pt(e),t}Da(e=!1){return!(this.ea||this.hi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(ue(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[Sn],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():ue(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.hi}ha(e){D3.indexOf(e.persistence.toLowerCase())===-1&&(be.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((u=[],h=!1,f=()=>!1)=>{const p=[...tl,...u];return D(D({},ct),{},{Dt(g){try{let y,b={};try{y=Qt.Ot(g)||void 0,b=y?jg(JSON.parse(y)):{}}catch{}const _=JSON.parse(ct.Ot(g)||"{}");let k;if(h){const N=Bw(g,y),S=[...tl,...N.properties],C={};Object.keys(b).forEach(R=>{const A=b[R];Xt(A)||A===""||R==="$user_state"&&A!=="anonymous"&&A!=="identified"||(C[R]=A)});const T="distinct_id"in C||C.$user_state==="anonymous"||C.$user_state==="identified";if(Object.keys(C).length>0){var v;const R=_[fi],A=(v=_.$user_state)!==null&&v!==void 0?v:xr;p.forEach(O=>{if(S.indexOf(O)!==-1&&!(O in b)&&(T||O!=="distinct_id"&&O!=="$user_state")){const P=_[O];(N.isValid||tl.indexOf(O)===-1||P!==!1&&P!==0)&&delete _[O]}}),!T||"$user_state"in b||"$user_state"in _||(_[ls]=xr),!T||("distinct_id"in C?C[fi]:_[fi])===R&&("$user_state"in C?C[ls]:_[ls])===A||(kg.forEach(O=>delete _[O]),C.$user_state==="identified"&&"distinct_id"in C?_.$user_id=C[fi]:delete _.$user_id,C.$user_state!=="identified"&&(delete _[Lk],delete _[oa]),delete _.__alias)}k=Pt(_,C)}else k=Pt(b,_);return f()||ct.$t(g,k),k}catch{}return null},$t(g,v,y,b,_,k){const N=ct.$t(g,v,void 0,void 0,k);try{const S=Ng(v,u);if(Object.keys(S).length){if(h){const C=rf(g),T=Pw(S,u);if(Qt.$t(C,T,y,b,_,k),Qt.Ot(C)!==JSON.stringify(T)){Qt.Pt(C,b);const R=Ng(v);return Qt.$t(g,R,y,b,_,k),N}}Qt.$t(g,S,y,b,_,k)}}catch(S){ct.Lt(S)}return N},Pt(g,v){try{re==null||re.localStorage.removeItem(g),Qt.Pt(g,v),Qt.Pt(rf(g),v)}catch(y){ct.Lt(y)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let n,i=!1,a=!1;const o=e.persistence.toLowerCase();return o==="localstorage"&&ct.At()?(n=ct,a=!0):o==="localstorage+cookie"&&t.At()?(n=t,a=!0,i=!0):o==="sessionstorage"&&At.At()?n=At:o==="memory"?n=W0:o==="cookie"&&Qt.At()?(n=Qt,i=!0):t.At()?(n=t,a=!0,i=!0):Qt.At()?(n=Qt,i=!0):n=W0,this.Ko=a,this.Xo=i,n}pa(e){return`${this.ca}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return _t(this.props,(t,n)=>{const i=An(n);if(!i||i.exposure==="event"){var a;if(!(i==null||(a=i.shouldSkipFromEventProperties)===null||a===void 0)&&a.call(i,t))return;e[n]=t}}),e}load(e=!1){if(this.hi&&!e)return;const t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",n=t?ct.Dt(this.ca):null;let i={};if(t)try{i=jg(Qt.Dt(this.ca)),_t(i,(h,f)=>{(ue(h)||Xt(h)||h==="")&&delete i[f]})}catch{}const a=this.qo.Dt(this.ca);if(a&&(this.props=Pt({},a)),this.Yo&&this.Ba(),t&&a){var o,u;const h=n==null?void 0:n[fi],f=(o=n==null?void 0:n.$user_state)!==null&&o!==void 0?o:xr,p=a[fi],g=(u=a.$user_state)!==null&&u!==void 0?u:xr;if(p!==h||g!==f){this.ta=!0,this.hi||At.$t(gh(this.ca),!0);const v=Pt({},this.props);kg.forEach(b=>delete v[b]),g!=="anonymous"||f!=="identified"&&i.$user_state!=="anonymous"&&(ue(h)||p===h)||(t5(v,i),delete v[oa]),this.props=v;const y=new Set;kg.forEach(b=>{var _;const k=(_=An(b))===null||_===void 0?void 0:_.storageGroup;k&&y.add(k)}),y.forEach(b=>{if(this.hi)return;const _={};_t(this.props,(k,N)=>{var S;((S=An(N))===null||S===void 0?void 0:S.storageGroup)===b&&(_[N]=k)}),_s(_)?(ct.Pt(this.pa(b)),this.Jo[b]={}):ct.$t(this.pa(b),_)&&(this.Jo[b]={persisted:!0,fingerprint:this.Sa(_,b)})})}}At.Ot(gh(this.ca))&&(this.ta=!0)}Ba(){for(const e of Yc){const t=ct.Dt(this.pa(e));if(t&&!_s(t)){const n=this.ya(e);n.persisted=!0,this.za(e)||(n.fingerprint=this.Sa(t,e)),this.Ha(e,t)||Pt(this.props,t)}}}za(e){return Object.keys(this.props).some(t=>{var n;return((n=An(t))===null||n===void 0?void 0:n.storageGroup)===e})}Ha(e,t){const n=L3[e];if(!n)return!1;const i=t[n],a=this.props[n];return sn(i)&&sn(a)&&a>i}refreshKey(e){var t;if(this.hi||this.oa.has(e))return;const n=this.Yo?(t=An(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=n?ct.Dt(this.pa(n)):this.qo.Dt(this.ca);if(i&&e in i)this.$a(e,i[e],!1);else{if(n){const a=this.qo.Dt(this.ca);if(a&&e in a)return void this.$a(e,a[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;const e=this.Pa();e>0?ue(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){ue(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.hi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||wj.forEach(a=>this.refreshKey(a)));const t=!e&&!this.na;t||(this.ra=!1);const n=!!t&&this.Ta();if(this.ra)return void(this.Mr.debug&&be.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(n&&this.aa.forEach(a=>a()));const i=this.Wa(this.qo,this.ca,this.props,Sn);i==="written"&&this.Ra(this.props),i!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),n&&this.aa.forEach(a=>a())}Ua(){const{main:e,groups:t}=this.wa(),n=this.Wa(this.qo,this.ca,e,Sn);n==="written"&&this.Ra(e),n!=="failed"&&(this.sa=!1,this.oa.clear(),mr.forEach(a=>{var o;!((o=An(a))===null||o===void 0)&&o.storageGroup||this.ia.delete(a)}));for(const a of Yc){var i;const o=t[a];if(_s(o)&&!(!((i=this.Jo[a])===null||i===void 0)&&i.persisted)){mr.forEach(h=>{var f;((f=An(h))===null||f===void 0?void 0:f.storageGroup)===a&&this.ia.delete(h)});continue}const u=this.Wa(ct,this.pa(a),o,a);u!=="failed"&&mr.forEach(h=>{const f=An(h);(f==null?void 0:f.storageGroup)!==a||u!=="written"&&f.volatile||this.ia.delete(h)})}}wa(){const e={},t={flags:{},surveys:{}};return _t(this.props,(n,i)=>{var a;const o=(a=An(i))===null||a===void 0?void 0:a.storageGroup;o?t[o][i]=n:e[i]=n}),{main:e,groups:t}}Sa(e,t){if(t===Sn)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Qa;const n={};return _t(e,(i,a)=>{var o;n[a]=!((o=An(a))===null||o===void 0)&&o.volatile?"__volatile__":i}),JSON.stringify(n)}Wa(e,t,n,i){const a=this.ya(i);if(i!==Sn&&!a.dirty&&!ue(a.fingerprint))return"skipped";let o;try{if(o=this.Sa(n,i),o===a.fingerprint)return a.dirty=!1,"skipped"}catch{o=void 0}return e.$t(t,n,this.Va,this.Ga,this.Qa,this.Mr.debug)?(a.dirty=!1,i!==Sn&&(a.persisted=!0),ue(o)||(a.fingerprint=o),this.Ko&&(a.storageValue=ct.Ot(t)),"written"):(this.Mr.debug&&be.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),ue(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Pt(this.ca,!1),this.qo.Pt(this.ca,!0),!e&&this.la)for(const t of Yc)ct.Pt(this.pa(t));e?delete this.Jo[Sn]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(Ve(e)){this.syncCookieProperties(),ue(t)&&(t="None"),this.Va=ue(n)?this.Za:n;let i=!1;if(_t(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.$a(o,a),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(Ve(e)){this.syncCookieProperties(),this.Va=ue(t)?this.Za:t;let n=!1;if(_t(e,(i,a)=>{e.hasOwnProperty(a)&&(this.props[a]!==i||Ve(i)||Pe(i))&&(this.$a(a,i),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let n=!1;for(const i of t)i in this.props&&(this.Ca(i),n=!0);n&&this.save()}update_campaign_params(){const e=ge==null?void 0:ge.URL;if(e===this.ua)return;const t=mj(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),n=!_s(Hx(t));return n&&this.register(t),this.ua=e,n?t:void 0}update_search_keyword(){this.register((function(){const e=ge==null?void 0:ge.referrer;return e?xj(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:yj(),$referring_domain:(ge==null?void 0:ge.referrer)&&((e=_r(ge.referrer))===null||e===void 0?void 0:e.host)||lf},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=bj(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[go]:this.Xo?{r:xh(e.r),u:e.u?xh(e.u):void 0}:e},void 0)}get_initial_props(){const e={};_t([Bk,Pk],n=>{const i=this.props[n];i&&_t(i,function(a,o){e["$initial_"+M0(o)]=a})});const t=this.props[go];if(t){const n=(function(i,a=!1){const o=_j(i,a),u={};return _t(o,function(h,f){u[`$initial_${M0(f)}`]=h}),u})(t,this.Mr.disable_capture_url_hashes);Pt(e,n)}return e}safe_merge(e){return _t(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){const i=e.persistence!==t.persistence,a=!((b,_)=>{if(b.length!==_.length)return!1;const k=[...b].sort(),N=[..._].sort();return k.every((S,C)=>S===N[C])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=i||a,u=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,h=e.disable_persistence||!!n,f=!!this.hi&&!h;h||this.Oa(t,f),this.Mr=e,!h&&(i||a||u)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(D(D({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),f));const p=o||u?this.ha(e):this.qo;this.Ja();const g=this.da(e),v=o||g!==this.Yo,y=!h&&(v||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Qa)&&this.Da(f);this.na=v;try{if(this.Za=this.Va=e.cookie_expiration,this.set_disabled(h),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),v){const b=this.props;this.clear(),this.qo=p,this.Yo=g,this.props=b,this.save()}else u&&(this.qo=p,h||(delete this.Jo[Sn],this.qa()))}finally{this.na=!1,y&&this.ja()}}Ja(){const e=this.props[go];if(!this.Xo||!Ve(e)||typeof e.r!="string")return;const t=xh(e.r),n=typeof e.u=="string"?xh(e.u):e.u;t===e.r&&n===e.u||this.$a(go,D(D({},e),{},{r:t,u:n}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Qa&&(this.Qa=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const n=this.props.__timers||{};n[e]=t,this.$a(F0,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return ue(n)||(delete t[e],this.$a(F0,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.$a(e,t),this.save()}$a(e,t,n=!0){var i;const a=this.props[e];this.props[e]=t,n&&(e!=="distinct_id"&&e!=="$user_state"||a===t||(this.sa=!0),e5(e)&&!sa(a,t)&&this.oa.add(e),this.Ea(e,a,t),!((i=An(e))===null||i===void 0)&&i.volatile||this.Ia(e))}Ca(e,t=!0){delete this.props[e],t&&(Mg(e)&&this.ma(e,!0),e5(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var t;const n=(t=An(e))===null||t===void 0?void 0:t.storageGroup;n&&(this.ya(n).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}};const Bs={GZipJS:"gzip-js",Base64:"base64"},Qc={Activation:"events",Cancellation:"cancelEvents"},Rg={Popover:"popover",API:"api",Widget:"widget"},Ps={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Og={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},J0={Popover:"popover",Inline:"inline"};function Lg(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&ln(n.then)&&n.then(void 0,()=>{})}}}}const z3={SHOWN:"product tour shown"},n5={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},s5=Vt("[RateLimiter]");var $3=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(i=>{s5.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void s5.warn(`could not rate limit - continuing. Error: "${i==null?void 0:i.message}"`,{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,n,i;const{captureEventsBurstLimit:a,captureEventsPerSecond:o}=this,u=new Date().getTime(),h=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:a,last:u};h.tokens+=(u-h.last)/1e3*o,h.last=u,h.tokens>a&&(h.tokens=a);const f=1>h.tokens;if(f||e||(h.tokens=Math.max(0,h.tokens-1)),f&&!e){const p=(sn(h.dropped)?h.dropped:0)+1;h.dropped=p,!this.lastEventRateLimited&&this.Ka(p)&&(h.dropped=0)}return this.lastEventRateLimited=f,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",h),{isRateLimited:f,remainingTokens:h.tokens}}Xa(e){const t=this.instance.config.property_denylist;return!Pe(t)||!t.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&($t!=null&&$t.pathname))return`${(e=$t.origin)!==null&&e!==void 0?e:""}${$t.pathname}`}Ka(e){var t,n;const{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,o=this.Ya(),u=this.Xa("$session_id")?(t=(n=this.instance).get_session_id)===null||t===void 0?void 0:t.call(n):void 0,h=[`${e} event(s) dropped since the last warning`,o?`triggered on ${o}`:void 0,u?`session ${u}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${h}. Config is set to ${a} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const ia=Vt("[RemoteConfig]");var Sj=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Fe._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var t,n,i;!((t=Fe.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(n=Fe.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return ia.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void ia.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return ia.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(t=>{this.il(t.json,t)});this.il(e)})}catch(e){ia.error("Error loading remote config",e),this.il()}}il(e,t){!e&&t&&(t.statusCode===0?t.error||ia.warn("Failed to fetch remote config from PostHog."):ia.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){ia.error("Error applying remote config",i)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)===null||n===void 0||n.ensureFlagsLoaded()}catch(i){ia.error("Error loading feature flags",i)}}},ei=Uint8Array,ws=Uint16Array,Ao=Uint32Array,Xx=new ei([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]),Wx=new ei([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]),i5=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kj=function(e,t){for(var n=new ws(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new Ao(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},jj=kj(Xx,2),ex=jj[1];jj[0][28]=258,ex[258]=28;for(var r5=kj(Wx,0)[1],Nj=new ws(32768),Wt=0;32768>Wt;++Wt){var ro=(43690&Wt)>>>1|(21845&Wt)<<1;Nj[Wt]=((65280&(ro=(61680&(ro=(52428&ro)>>>2|(13107&ro)<<2))>>>4|(3855&ro)<<4))>>>8|(255&ro)<<8)>>>1}var gu=function(e,t,n){for(var i=e.length,a=0,o=new ws(t);i>a;++a)++o[e[a]-1];var u,h=new ws(t);for(a=0;t>a;++a)h[a]=h[a-1]+o[a-1]<<1;for(u=new ws(i),a=0;i>a;++a)u[a]=Nj[h[e[a]-1]++]>>>15-e[a];return u},ol=new ei(288);for(Wt=0;144>Wt;++Wt)ol[Wt]=8;for(Wt=144;256>Wt;++Wt)ol[Wt]=9;for(Wt=256;280>Wt;++Wt)ol[Wt]=7;for(Wt=280;288>Wt;++Wt)ol[Wt]=8;var of=new ei(32);for(Wt=0;32>Wt;++Wt)of[Wt]=5;var P3=gu(ol,9),B3=gu(of,5),Cj=function(e){return(e/8|0)+(7&e&&1)},Ej=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof ws?ws:e instanceof Ao?Ao:ei)(n-t);return i.set(e.subarray(t,n)),i},ur=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Xc=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Dg=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,o=n.slice();if(!a)return[new ei(0),0];if(a==1){var u=new ei(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort(function(A,O){return A.f-O.f}),n.push({s:-1,f:25001});var h=n[0],f=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:h.f+f.f,l:h,r:f};g!=a-1;)h=n[n[v].f>n[p].f?p++:v++],f=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:h.f+f.f,l:h,r:f};var y=o[0].s;for(i=1;a>i;++i)o[i].s>y&&(y=o[i].s);var b=new ws(y+1),_=tx(n[g-1],b,0);if(_>t){i=0;var k=0,N=_-t,S=1<<N;for(o.sort(function(A,O){return b[O.s]-b[A.s]||A.f-O.f});a>i;++i){var C=o[i].s;if(t>=b[C])break;k+=S-(1<<_-b[C]),b[C]=t}for(k>>>=N;k>0;){var T=o[i].s;t>b[T]?k-=1<<t-b[T]++-1:++i}for(;i>=0&&k;--i){var R=o[i].s;b[R]==t&&(--b[R],++k)}_=t}return[new ei(b),_]},tx=function(e,t,n){return e.s==-1?Math.max(tx(e.l,t,n+1),tx(e.r,t,n+1)):t[e.s]=n},a5=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ws(++t),i=0,a=e[0],o=1,u=function(f){n[i++]=f},h=1;t>=h;++h)if(e[h]==a&&h!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[h]}return[n.subarray(0,i),t]},Wc=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},nx=function(e,t,n){var i=n.length,a=Cj(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},l5=function(e,t,n,i,a,o,u,h,f,p,g){ur(t,g++,n),++a[256];for(var v=Dg(a,15),y=v[0],b=v[1],_=Dg(o,15),k=_[0],N=_[1],S=a5(y),C=S[0],T=S[1],R=a5(k),A=R[0],O=R[1],P=new ws(19),z=0;C.length>z;++z)P[31&C[z]]++;for(z=0;A.length>z;++z)P[31&A[z]]++;for(var K=Dg(P,7),F=K[0],q=K[1],L=19;L>4&&!F[i5[L-1]];--L);var de,X,V,G,H=p+5<<3,ae=Wc(a,ol)+Wc(o,of)+u,_e=Wc(a,y)+Wc(o,k)+u+14+3*L+Wc(P,F)+(2*P[16]+3*P[17]+7*P[18]);if(ae>=H&&_e>=H)return nx(t,g,e.subarray(f,f+p));if(ur(t,g,1+(ae>_e)),g+=2,ae>_e){de=gu(y,b),X=y,V=gu(k,N),G=k;var E=gu(F,q);for(ur(t,g,T-257),ur(t,g+5,O-1),ur(t,g+10,L-4),g+=14,z=0;L>z;++z)ur(t,g+3*z,F[i5[z]]);g+=3*L;for(var Ne=[C,A],Ce=0;2>Ce;++Ce){var $=Ne[Ce];for(z=0;$.length>z;++z)ur(t,g,E[B=31&$[z]]),g+=F[B],B>15&&(ur(t,g,$[z]>>>5&127),g+=$[z]>>>12)}}else de=P3,X=ol,V=B3,G=of;for(z=0;h>z;++z)if(i[z]>255){var B;Xc(t,g,de[257+(B=i[z]>>>18&31)]),g+=X[B+257],B>7&&(ur(t,g,i[z]>>>23&31),g+=Xx[B]);var oe=31&i[z];Xc(t,g,V[oe]),g+=G[oe],oe>3&&(Xc(t,g,i[z]>>>5&8191),g+=Wx[oe])}else Xc(t,g,de[i[z]]),g+=X[i[z]];return Xc(t,g,de[256]),g+X[256]},I3=new Ao([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F3=(function(){for(var e=new Ao(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),zg=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function U3(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=F3[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var a,o,u,h,f,p=(h=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(v,y,b,_,k,N){var S=v.length,C=new ei(_+S+5*(1+Math.floor(S/7e3))+k),T=C.subarray(_,C.length-k),R=0;if(!y||8>S)for(var A=0;S>=A;A+=65535){var O=A+65535;S>O?R=nx(T,R,v.subarray(A,O)):(T[A]=N,R=nx(T,R,v.subarray(A,S)))}else{for(var P=I3[y-1],z=P>>>13,K=8191&P,F=(1<<b)-1,q=new ws(32768),L=new ws(F+1),de=Math.ceil(b/3),X=2*de,V=function(We){return(v[We]^v[We+1]<<de^v[We+2]<<X)&F},G=new Ao(25e3),H=new ws(288),ae=new ws(32),_e=0,E=0,Ne=(A=0,0),Ce=0,$=0;S>A;++A){var B=V(A),oe=32767&A,ye=L[B];if(q[oe]=ye,L[B]=oe,A>=Ce){var je=S-A;if((_e>7e3||Ne>24576)&&je>423){R=l5(v,T,0,G,H,ae,E,Ne,$,A-$,R),Ne=_e=E=0,$=A;for(var Ee=0;286>Ee;++Ee)H[Ee]=0;for(Ee=0;30>Ee;++Ee)ae[Ee]=0}var Be=2,Oe=0,Te=K,Re=oe-ye&32767;if(je>2&&B==V(A-Re))for(var It=Math.min(z,je)-1,vn=Math.min(32767,A),Gt=Math.min(258,je);vn>=Re&&--Te&&oe!=ye;){if(v[A+Be]==v[A+Be-Re]){for(var St=0;Gt>St&&v[A+St]==v[A+St-Re];++St);if(St>Be){if(Be=St,Oe=Re,St>It)break;var wt=Math.min(Re,St-2),Ze=0;for(Ee=0;wt>Ee;++Ee){var xt=A-Re+Ee+32768&32767,Kt=xt-q[xt]+32768&32767;Kt>Ze&&(Ze=Kt,ye=xt)}}}Re+=(oe=ye)-(ye=q[oe])+32768&32767}if(Oe){G[Ne++]=268435456|ex[Be]<<18|r5[Oe];var se=31&ex[Be],ke=31&r5[Oe];E+=Xx[se]+Wx[ke],++H[257+se],++ae[ke],Ce=A+Be,++_e}else G[Ne++]=v[A],++H[v[A]]}}R=l5(v,T,N,G,H,ae,E,Ne,$,A-$,R)}return Ej(C,0,_+Cj(R)+k)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,h,f,!0)),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&&zg(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),zg(p,g-8,n.d()),zg(p,g-4,i),p}const H3=!!Ex||!!ju,Tj=new WeakMap,Mj="text/plain";let $g=0,Bh=!1;const Aj=(e,t)=>{const[n,i]=e.split("#"),[a,o]=n.split("?");if(!o)return e;const u=o.split("&").filter(h=>h.split("=")[0]!==t).join("&");return`${a}${u?`?${u}`:""}${i?`#${i}`:""}`},zu=(e,t,n=!0)=>{var i;const[a,o]=e.split("?"),u=D({},t),h=(i=o==null?void 0:o.split("&").map(p=>{var g;const[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:[],f=(function(p,g="&"){let v,y;const b=[];return _t(p,function(_,k){ue(_)||ue(k)||k==="undefined"||(v=encodeURIComponent((N=>N instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(k),b[b.length]=y+"="+v)}),b.join(g)})(u);return f&&h.push(f),h.length>0?`${a}?${h.join("&")}`:a},Pg=e=>{if(e.sl)return e.sl;const{data:t,compression:n}=e;if(!t)return;if(n===Bs.GZipJS){const a=U3((function(o){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var h=new ei(o.length+(o.length>>>1)),f=0,p=function(b){h[f++]=b},g=0;u>g;++g){if(f+5>h.length){var v=new ei(f+8+(u-g<<1));v.set(h),h=v}var y=o.charCodeAt(g);128>y?p(y):2048>y?(p(192|y>>>6),p(128|63&y)):y>55295&&57344>y?(p(240|(y=65536+(1047552&y)|1023&o.charCodeAt(++g))>>>18),p(128|y>>>12&63),p(128|y>>>6&63),p(128|63&y)):(p(224|y>>>12),p(128|y>>>6&63),p(128|63&y))}return Ej(h,0,f)})(vo(t)),{mtime:0});return{contentType:Mj,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Bs.Base64){const a=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(h,f)=>String.fromCharCode(parseInt(f,16))))})(vo(t)),o=(u=>"data="+encodeURIComponent(typeof u=="string"?u:vo(u)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}const i=vo(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},Rj=e=>{const t=()=>e.transport==="sendBeacon"?{url:zu(e.url,{compression:Bs.Base64}),encodedBody:Pg(D(D({},e),{},{compression:Bs.Base64,sl:void 0}))}:{url:Aj(e.url,"compression"),encodedBody:Pg(D(D({},e),{},{compression:void 0,sl:void 0}))};let n;try{n=Pg(e)}catch(a){if(kw(e.compression,To(e.url,"compression")))return be.error("Failed to gzip request body, sending uncompressed payload",a),t();throw a}return n&&kw(e.compression,To(e.url,"compression"))&&!((i=n.body)instanceof ArrayBuffer?z0(new Uint8Array(i)):ArrayBuffer.isView(i)&&z0(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Bh=!0,t()):{url:e.url,encodedBody:n};var i},Oj=e=>{try{return Rj(e)}catch(n){var t;return be.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},q3=(function(){var e=Rt(function*(t){const n=yield(function(a){return $0.apply(this,arguments)})(vo(t.data),bs.DEBUG,{rethrow:!0});if(!n)return t;const i=yield n.arrayBuffer();return D(D({},t),{},{sl:{contentType:Mj,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),V3=/Failed to fetch|NetworkError|Load failed/i,Lj=e=>(e==null?void 0:e.name)==="TypeError"&&V3.test((e==null?void 0:e.message)||""),Dj=e=>{try{const t=(function(n,i=Date.now()){if(typeof n!="string"||!n)return;const a=n.trim(),o=/^\d+\s*,/.test(a)?a.slice(0,a.indexOf(",")).trim():a;if(/^\d+$/.test(o)){const f=1e3*Math.min(Number(o),300);return f>0?f:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(o))return;const u=/^\w{3} \w{3} /.test(o)?o+" GMT":o,h=Date.parse(u)-i;return Number.isFinite(h)&&h>0?Math.min(h,zh):void 0})(e());return ue(t)?void 0:Math.min(t,3e4)}catch{return}},zj=e=>{const t=Oj(e);if(!t)return;const n=new Ex;Tj.set(n,!0);const{url:i,encodedBody:a}=t;n.open(e.method||"GET",i,!0);const{contentType:o,body:u}=a??{};_t(e.headers,function(h,f){n.setRequestHeader(f,h)}),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var h;const f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}(h=e.callback)===null||h===void 0||h.call(e,f,Dj(()=>n.getResponseHeader("Retry-After")))}},n.send(u)},$j=e=>{const t=Oj(e);if(!t)return;const{url:n,encodedBody:i}=t,{contentType:a,body:o,estimatedSize:u}=i??{},h=new Headers;_t(e.headers,function(_,k){h.append(k,_)}),a&&h.append("Content-Type",a);let f=null,p=!1;if(lw){const _=new lw;f={signal:_.signal,timeout:setTimeout(()=>{p=!0;try{_.abort(rk("AbortError","PostHog request timed out"+((k=e.timeout)?` after ${k}ms`:"")))}catch(N){v(N)}var k},e.timeout)}}let g=!1;const v=_=>{var k;g||(g=!0,p&&(_==null?void 0:_.name)==="AbortError"||Lj(_)?be.warn(_):be.error(_),(k=e.callback)===null||k===void 0||k.call(e,{statusCode:0,error:_}))};let y=0;const b=()=>{$g-=y,y=0,f&&clearTimeout(f.timeout)};try{const _=D({method:(e==null?void 0:e.method)||"GET",headers:h,referrerPolicy:"strict-origin",body:o,signal:f==null?void 0:f.signal},e.fetchOptions),k=u??(ue(o)?0:void 0);_.keepalive=_.method==="POST"&&!e.rl&&_.keepalive!==!1&&_.body===o&&!ue(k)&&k>=0&&52428.8>$g+k,_.keepalive&&(y=k,$g+=y),ju(n,_).then(N=>N.text().then(S=>{var C;if(g)return;const T={statusCode:N.status,text:S};if(N.status===200)try{T.json=JSON.parse(S)}catch(R){be.error(R)}g=!0,b(),(C=e.callback)===null||C===void 0||C.call(e,T,Dj(()=>N.headers.get("Retry-After")))})).catch(N=>{b(),v(N)}).finally(b)}catch(_){b(),v(_)}},sx=e=>{try{var t;const{url:n,encodedBody:i}=Rj(e),{contentType:a,body:o,estimatedSize:u}=i??{};if(!o)return;const h=o instanceof Blob?o:new Blob([o],{type:a});if(Un.sendBeacon(n,h))return;const f=Pe(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Pe(f)&&f.length>1&&(u??0)>16384){const p=Math.ceil(f.length/2),g=v=>Pe(e.data)?v:D(D({},e.data),{},{batch:v});return sx(D(D({},e),{},{data:g(f.slice(0,p))})),void sx(D(D({},e),{},{data:g(f.slice(p))}))}be.warn(`Beacon of ~${u??0} bytes was rejected by the browser, falling back to ${ju?"fetch":"XHR"}`),ju?$j(D(D({},e),{},{rl:!0})):zj(e)}catch(n){be.warn("Beacon send failed",n)}},o5=(e,t,n,i)=>{const a=i==="query"?t==="POST"?"sent_at":"_":void 0;return zu(n===Bs.GZipJS?Aj(e,"compression"):e,D(D({},a?{[a]:Date.now().toString()}:{}),n===Bs.GZipJS?{}:{compression:n}))},G3=(()=>{const e=[];return ju&&e.push({transport:"fetch",method:$j}),Ex&&e.push({transport:"XHR",method:zj}),Un!=null&&Un.sendBeacon&&e.push({transport:"sendBeacon",method:sx}),e})();let Pj=!H3&&(as==null?void 0:as.indexOf("MSIE"))===-1&&(as==null?void 0:as.indexOf("Mozilla"))===-1;function Bj(e,t,n){var i,a,o;n&&(t=D(D({},t),{},{callback:u=>n(u)})),e.__loaded?Pj?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((a=t.callback)===null||a===void 0||a.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=D(D({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(i=e.compression)!==null&&i!==void 0?i:t.compressionFallback:t.compression,(ue(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((u,h)=>{var f,p,g;const v=D(D({},u),{},{callback:h??(N=>{var S;return(S=u.callback)===null||S===void 0?void 0:S.call(u,N)})});v.timeout=v.timeout||6e4;const y=(f=v.transport)!==null&&f!==void 0?f:"fetch";y==="sendBeacon"&&ue(v.compression)&&v.data&&(v.compression=Bs.Base64),v.method==="POST"&&v.data&&(v.timestampMode==="capture-body"?v.data=(N=>{var S,C;const T=(Pe(N)?N:[N]).map(A=>D(D({},A),A.timestamp instanceof Date&&!isNaN(A.timestamp.getTime())?{timestamp:A.timestamp.toISOString()}:{})),R=T[0];return{api_key:(S=R==null||(C=R.properties)===null||C===void 0?void 0:C.token)!==null&&S!==void 0?S:R==null?void 0:R.token,batch:T,sent_at:new Date().toISOString()}})(v.data):v.timestampMode==="body"&&(v.data=((N,S=new Date().toISOString())=>Pe(N)?N.map(C=>D(D({},C),{},{sent_at:S})):D(D({},N),{},{sent_at:S}))(v.data))),v.url=o5(v.url,v.method,v.compression,v.timestampMode);const b=G3.filter(N=>!v.disableTransport||!N.transport||!v.disableTransport.includes(N.transport)),_=(p=(g=(function(N,S){for(let C=0;N.length>C;C++)if(S(N[C]))return N[C]})(b,N=>N.transport===y))===null||g===void 0?void 0:g.method)!==null&&p!==void 0?p:b[0].method;if(!_)throw new Error("No available transport method");const k=N=>{try{_(N)}catch(C){var S;Lj(C)?be.warn(C):be.error(C),(S=v.callback)===null||S===void 0||S.call(v,{statusCode:0,error:C})}};y!=="sendBeacon"&&!v.preferSyncCompression&&v.data&&v.compression===Bs.GZipJS&&r4&&typeof Promise<"u"&&!Bh?q3(v).then(N=>{k(N)}).catch(N=>{if(jw(N))return Bh=!0,void k(D(D({},v),{},{compression:void 0,url:o5(u.url,u.method,void 0,u.timestampMode)}));(S=>{if(!S||typeof S!="object")return!1;const C="name"in S?String(S.name):"";return jw(S)||C===hk})(N)&&(Bh=!0),k(v)}):k(v)})(t,(u,h)=>{var f,p,g;e.rateLimiter.checkForLimiting(u),400>u.statusCode||(f=(p=e.config).on_request_error)===null||f===void 0||f.call(p,u),n?n(u,h):(g=t.callback)===null||g===void 0||g.call(t,u)})):t.fireCallbackOnDrop&&((o=t.callback)===null||o===void 0||o.call(t,{statusCode:0}))}var Y3=class{constructor(e,t){this.ol=!0,this.al=[],this.ll=Ui((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,be.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.cl||this.hl()}unload(){this.dl();const e=this.al.length>0?this.vl():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.fl(D(D({},n),{},{callback:void 0}),"sendBeacon")})}enable(){this.ol=!1,this.hl()}hl(){this.ol||(this.cl=setTimeout(()=>{this.dl(),this.pl()},this.ll))}pl(){if(this.al.length>0){const e=this.vl();for(const t in e)this.fl(e[t])}}fl(e,t){try{this.ul(e,t)}catch(n){be.error(n)}}dl(){clearTimeout(this.cl),this.cl=void 0}vl(){const e={},t={};_t(this.al,n=>{var i;const a=n,o=((a?a.batchKey:null)||a.url)+(a.batchGroup?`:${a.batchGroup}`:"");ue(e[o])&&(e[o]=D(D({},a),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[o]=[]),(i=e[o].data)===null||i===void 0||i.push(a.data),a.callback&&t[o].push(a.callback)});for(const n in t){const i=t[n];i.length&&(e[n].callback=a=>{for(const o of i)o(a)})}return this.al=[],e}};const Q3=["retriesPerformedSoFar"];var X3=class{constructor(e){this._instance=e,this.gl=!1,this.ml=3e3,this.al=[],this.al=[],this.yl=!0,this.resume()}resume(){if(!ue(re)&&"onLine"in re.navigator){if(this.yl=re.navigator.onLine,this.bl)return;this.bl=()=>{this.yl=!0,this.pl()},this._l=()=>{this.yl=!1},gt(re,"online",this.bl),gt(re,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,i=fk(e,Q3);pr(n)&&(i.url=zu(i.url,{retry_count:n})),Bj(this._instance,t?D(D({},i),{},{transport:t}):i,(a,o)=>{var u;if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.Ls(D({retriesPerformedSoFar:n},i),o);a.statusCode===0&&be.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${n??0} retries.`)}(u=i.callback)===null||u===void 0||u.call(i,a)})}Ls(e,t){const n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;const i=Math.max((function(u){const h=3e3*Math.pow(2,u),f=h/2,p=Math.min(18e5,h),g=(Math.random()-.5)*(p-f);return Math.ceil(p+g)})(n),t??0),a=Date.now()+i;this.al.push({retryAt:a,requestOptions:e});let o=`Enqueued failed request for retry in ${i}`;navigator.onLine||(o+=" (Browser is offline)"),be.warn(o),this.gl||(this.gl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.gl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.yl&&this.al.length>0&&this.pl(),this.wl()},this.ml)}pl(){const e=Date.now(),t=[],n=this.al.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.al=t,n.length>0)for(const{requestOptions:i}of n)this.retriableRequest(i)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.gl=!1,ue(re)||(this.bl&&(re.removeEventListener("online",this.bl),this.bl=void 0),this._l&&(re.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(D(D({},e),{},{callback:Pe(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(t){be.error(t)}this.al=[]}},W3=class{constructor(e){this._instance=e,this.Sl=()=>{var t,n,i,a;this.xl||(this.xl={});const o=this.scrollElement(),u=this.scrollY(),h=o?Math.max(0,o.scrollHeight-o.clientHeight):0,f=u+((o==null?void 0:o.clientHeight)||0),p=(o==null?void 0:o.scrollHeight)||0;this.xl.lastScrollY=Math.ceil(u),this.xl.maxScrollY=Math.max(u,(t=this.xl.maxScrollY)!==null&&t!==void 0?t:0),this.xl.maxScrollHeight=Math.max(h,(n=this.xl.maxScrollHeight)!==null&&n!==void 0?n:0),this.xl.lastContentY=f,this.xl.maxContentY=Math.max(f,(i=this.xl.maxContentY)!==null&&i!==void 0?i:0),this.xl.maxContentHeight=Math.max(p,(a=this.xl.maxContentHeight)!==null&&a!==void 0?a:0)}}get $l(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){gt(re,"scroll",this.Sl,{capture:!0}),gt(re,"scrollend",this.Sl,{capture:!0}),gt(re,"resize",this.Sl)}scrollElement(){if(this.$l){const n=Pe(this.$l)?this.$l:[this.$l];for(const i of n){var e;const a=re==null||(e=re.document)===null||e===void 0?void 0:e.querySelector(i);if(a)return a}return}var t;return re==null||(t=re.document)===null||t===void 0?void 0:t.documentElement}Cl(e){var t,n;const i=e==="y"?"scrollTop":"scrollLeft";if(this.$l){const a=this.scrollElement();return a&&a[i]||0}return re?e==="y"?re.scrollY||re.pageYOffset||((t=re.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:re.scrollX||re.pageXOffset||((n=re.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}};const K3=e=>bj(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);var c5=class{constructor(e,t,n,i){this.qe=a=>{const o=this.Tl();if(o&&o.sessionId===a)return;const u={sessionId:a,props:this.Il(this._instance)};this.Ml.register({[Y0]:u})},this._instance=e,this.El=t,this.Ml=n,this.Il=i||K3,this.El.onSessionId(this.qe)}Tl(){return this.Ml.props[Y0]}getSetOnceProps(){var e;const t=(e=this.Tl())===null||e===void 0?void 0:e.props;return t?"r"in t?_j(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return _t(Hx(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${M0(n)}`]=t}),e}},cf=class{on(e,t){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(t),()=>{this.Pl[e]=this.Pl[e].filter(n=>n!==t)}}emit(e,t){for(const n of this.Pl[e]||[])n(t);for(const n of this.Pl["*"]||[])n(e,t)}constructor(){this.Pl={}}};const ao=Vt("[SessionId]"),u5=864e5;var d5=class{on(e,t){return this.Rl.on(e,t)}constructor(e,t,n){var i;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new cf,this.Nl=(o,u)=>!(!pr(o)||!pr(u))&&Math.abs(o-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.Ml=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=t||mi,this.Bl=n||mi;const a=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ui(this.Mr.session_idle_timeout_seconds||1800,60,36e3,ao.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.zl(),this.Hl="ph_"+a+"_window_id",this.Ul="ph_"+a+"_primary_window_exists",this.Wl()){const o=At.Dt(this.Hl),u=At.Dt(this.Ul);o&&!u?this.je=o:At.Pt(this.Hl),At.$t(this.Ul,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ue(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Ol=this.Ol.filter(t=>t!==e)}}Wl(){return this.Mr.persistence!=="memory"&&!this.Ml.hi&&At.At()}Gl(e){e!==this.je&&(this.je=e,this.Wl()&&At.$t(this.Hl,e))}Ql(){return this.je?this.je:this.Wl()?At.Dt(this.Hl):null}Zl(e){const t=this.Al;return!Xt(t)&&!Xt(e)&&5e3>Math.abs(e-t)}Jl(e,t,n){const i=t!==this._sessionActivityTimestamp,a=!(e!==this.Xt||n!==this._sessionStartTimestamp);this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,a&&!i||a&&this.Zl(t)||(this.Al=t,this.Ml.register({[mo]:[t,e,n]}))}Kl(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return pr(t)&&t>0}Xl(){this.Kl()?this.Ml.refreshKey(mo):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(Xt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,t,n]=this.tu();t===this.Xt&&n===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[mo]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),t=pr(e)?e:0,n=pr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){const e=this.Ml.props[mo];return Pe(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,t=!1){const n=((i,a=new Date().getTime())=>{try{const o=(u=>{const h=u.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(i);return o>a+6e4?void ao.error("Bootstrap sessionID cannot be in the future"):o}catch(o){return void ao.error("Invalid sessionID in bootstrap",o)}})(e);return!ue(n)&&(t?this.ql={sessionId:e,sessionStartTimestamp:n}:this.Jl(e,new Date().getTime(),n),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&re&&(re.removeEventListener(sf,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&At.Pt(this.Ul)},gt(re,sf,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=t||new Date().getTime(),a=this.Xt;if(n)this.Fl=i;else if(Xt(this.Fl)||this.Fl>i||i-this.Fl>=1e3){var o,u;(o=(u=this.Ml).syncCookieProperties)===null||o===void 0||o.call(u),this.Fl=i}let[,h,f]=this.tu();const p=!ue(a)&&h!==a,g=this.eu();let v=this.Ql();const y=this.ql,b=!!y&&(y.sessionStartTimestamp>i+6e4||i-y.sessionStartTimestamp>u5),_=y?b:pr(f)&&Math.abs(i-f)>u5;let k=!1,N=p,S=!h||!!y;const C=h;let T=!S&&!e&&this.Nl(i,g);if(T&&(T=this.iu(i),T||ao.info("cross-tab refresh kept the session alive",{sessionId:h}),[,h,f]=this.tu(),T||(S=!h||!!y)),S||T||_){N=!1;const P=y&&!b;h=P?y.sessionId:this.jl(),v=this.Bl(),ao.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!P,changeReason:{noSessionId:S,activityTimeout:T,sessionPastMaximumLength:_}}),f=P?y.sessionStartTimestamp:i,this.ql=void 0,k=!0}else v||(v=this.Bl(),k=!0),N=N||h!==C,N&&(ao.info("adopted cross-tab session id",{sessionId:h,windowId:v}),k=!0);const R=pr(g)&&e&&!_?g:i,A=pr(f)?f:new Date().getTime();this.Gl(v),this.Jl(h,R,A),e||this.zl();const O={noSessionId:S,activityTimeout:T,sessionPastMaximumLength:_,crossTabAdoption:N};return k&&this.Ol.forEach(P=>P(h,v,O)),{sessionId:h,windowId:v,sessionStartTimestamp:A,changeReason:k?O:void 0,lastActivityTimestamp:g}}zl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.zl()},1.1*this.sessionTimeoutMs))}};const Ij=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&cw(n,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(a=>cw(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver};function Fj(){return(Fj=Rt(function*(){const e=Un==null?void 0:Un.userAgentData;if(e!=null&&e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Ke(n)&&n.length>0?n:void 0}catch(t){return void be.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Z3(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function Uj(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}const uf=(e,t)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},vh=e=>e.toLowerCase(),Hj={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=>uf(n,i))),not_regex:(e,t)=>t.every(n=>e.every(i=>!uf(n,i))),icontains:(e,t)=>t.map(vh).some(n=>e.map(vh).some(i=>n.includes(i))),not_icontains:(e,t)=>t.map(vh).every(n=>e.map(vh).every(i=>!n.includes(i))),gt:(e,t)=>t.some(n=>{const i=parseFloat(n);return!isNaN(i)&&e.some(a=>i>parseFloat(a))}),lt:(e,t)=>t.some(n=>{const i=parseFloat(n);return!isNaN(i)&&e.some(a=>i<parseFloat(a))})};function qj(e,t){return!e||Object.entries(e).every(([n,i])=>{const a=t==null?void 0:t[n];if(a==null)return!1;const o=Hj[i.operator];return!!o&&o(i.values.map(String),[String(a)])})}function Bg(e,t,n){return vo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const ix="custom",h5="i.posthog.com",J3=/^\/static\//,e8=["/s/","/e/","/i/"];var t8=class{constructor(e){this.su={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${h5}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.su[this.apiHost]||(this.su[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":ix),this.su[this.apiHost]}ru(e){if(!J3.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ou(e){const t=_r(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}au(e,t,n){if(e==="ui")return n;let i=n;const a=this.instance.config.rewriteRequestPath;if(a){var o;const u=((o=_r(n))===null||o===void 0?void 0:o.href)||n;i=a(new URL(u)).toString()}if(a&&e==="api"&&e8.some(u=>t.indexOf(u)===0)){const u=this.ou(i);if(u){const h=this.apiHost;let f=this.lu;(f==null?void 0:f.apiHost)===h&&f.rewriteRequestPath===a||(f={apiHost:h,rewriteRequestPath:a,urls:new Set},this.lu=f),f.urls.add(u)}}return i}isIngestionEndpoint(e){const t=this.lu,n=this.ou(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.au(e,t,this.uiHost+t);if(e==="flags")return this.au(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.ru(t);if(i)return this.au(e,t,`${i}${t}`)}if(this.region===ix)return this.au(e,t,this.apiHost+t);const n=h5+t;switch(e){case"assets":return this.au(e,t,`https://${this.region}-assets.${n}`);case"api":return this.au(e,t,`https://${this.region}.${n}`)}}};const bt=Vt("[Surveys]"),Vj=e=>{try{const t=(n=>((i,a)=>`seenSurvey_${(function(o){return o.current_iteration&&o.current_iteration>0?`${o.id}_${o.current_iteration}`:o.id})(a)}`)(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){bt.error("Failed to persist survey seen state",t)}},n8=[Rg.Popover,Rg.Widget,Rg.API],s8={ignoreConditions:!1,ignoreDelay:!1,displayType:J0.Popover},i8=Vt("[PostHog ExternalIntegrations]"),r8={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var a8=class{constructor(e){this._instance=e}Ho(e,t){var n,i;(n=Fe.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,e,a=>{if(a)return i8.error("failed to load script",a);t()})}startIfEnabledOrStop(){var e;for(const[a,o]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,n,i;o&&!(!((t=Fe.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[a])&&this.Ho(r8[a],()=>{var u;(u=Fe.__PosthogExtensions__)===null||u===void 0||(u=u.integrations)===null||u===void 0||(u=u[a])===null||u===void 0||u.start(this._instance)}),!o&&(!((n=Fe.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[a])&&((i=Fe.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[a])===null||i===void 0||i.stop())}}};const Gj="autocapture",Yj="featureFlags",Qj="logs",Xj="surveys";var l8=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);const n={};for(const i of e){const a=t==null?void 0:t.get_property(i);ue(a)||(n[i]=a)}return n}set(e,t){var n;(n=this._instance.persistence)===null||n===void 0||n.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},o8=class{constructor(e){this.instance=e,this.A=be,this.kv=new l8(e),this.onEvent=t=>Lg(this.instance._addCaptureHook((n,i)=>{if(i)try{t({event:n,properties:i.properties})}catch(a){this.A.error("Browser extension event listener failed",a)}})),this.onRemoteConfig=t=>{const n=a=>{try{t(a)}catch(o){this.A.error("Browser extension remote config listener failed",o)}},i=this.instance.uu.on("extensionsRemoteConfig",n);return this.instance.cu&&n(this.instance.cu),Lg(i)}}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(Dx);return typeof e=="string"?e:void 0}get library(){return{name:bs.LIB_NAME,version:bs.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,i,a;const o=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=o==null?void 0:o.sessionId)!==null&&t!==void 0?t:"",windowId:(n=o==null?void 0:o.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(i=o==null?void 0:o.sessionStartTimestamp)!==null&&i!==void 0?i:0,lastActivityTimestamp:(a=o==null?void 0:o.lastActivityTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return ln(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(e){let t;switch(e){case Yj:case"featureFlagsCommon":t=this.instance.featureFlags;break;case Qj:t=this.instance.logs;break;case Xj:t=this.instance.surveys;break;case Gj:t=this.instance.autocapture}return t}capture(e,t,n){n?this.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Lg(this.instance.hu(e))}sendRequest(e){var t=this;return Rt(function*(n,i={}){var a;const o=(a=i.target)!==null&&a!==void 0?a:"api",u=t.instance.requestRouter.endpointFor(o,n),h=o==="api"&&n==="/i/v1/logs",f={method:i.method,url:i.query?zu(u,i.query):u,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?T0.Base64:void 0,timestampMode:i.sentAt};return h&&(f.batchKey="logs"),i.transport==="sendBeacon"?(t.instance._send_request(f),{statusCode:202}):new Promise(p=>{f.callback=p,t.instance._send_request(f)})}).apply(this,arguments)}};const xu={};let Ig=0;const vu=()=>{},f5='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',lo="Surveys module not available",p5="sanitize_properties is deprecated. Use before_send instead",Wj="Invalid value for property_denylist config: ",c8=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],u8=["$feature_flag_called","$$heatmap","$snapshot"],m5=e=>e.charAt(0)==="$"&&!Ie(u8,e),d8=/^[A-Za-z0-9_-]{1,400}$/,g5=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,x5=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,h8=["token","distinct_id",Ik],ru="posthog",f8=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Fg=e=>{var t;return D({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:c3(ge==null?void 0:ge.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:vu,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_replay_sync_fetch:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:$t&&Ke($t==null?void 0:$t.search)&&$t.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,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.location)===null||t===void 0?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,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){be.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:Wk,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:vu},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Yx,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:f8(n),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,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},p8=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],v5=e=>{const t={};for(const[a,o]of p8)ue(e[a])||(t[o]=e[a]);const n=Pt({},t,e),i=e.__preview_external_dependency_versioned_paths;return ue(i)||(ue(e.strict_script_versioning)&&(n.strict_script_versioning=!!i),Ke(i)&&ue(e.asset_host)&&(n.asset_host=i)),Pe(e.property_blacklist)&&(ue(e.property_denylist)?n.property_denylist=e.property_blacklist:Pe(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:be.error(Wj+e.property_denylist)),n};var m8=class{constructor(){this.__forceAllowLocalhost=!1}get du(){return this.__forceAllowLocalhost}set du(e){be.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},yu=class la{vu(t){if(!t)return;const n=this.fu.indexOf(t);n!==-1&&this.fu.splice(n,1)}pu(t,n){var i;return this.vu(t),this.fu.push(n),(i=n.initialize)===null||i===void 0||i.call(n),n}gu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}mu(){if(this.yu||this.config.reuseAnonymousId||this.config.segment||this.gu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.bu)return;let n,i,a;t?(n=`persistence is set to '${this.config.persistence}'`,i=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",a="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",i="on every page load",a="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.yu=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${a}`)}_u(){const t=this.persistence;if(!t||this.wu)return;if(this.gu())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.ku(),this.Su()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.xu()||t.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const i=this.config.get_device_id(mi());this.register({distinct_id:i,$device_id:i}),t.set_property(ls,xr)}this.ku()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.$u=!1,this.Cu=!1,this.webPerformance=new m8,this.Tu=!1,this.version=bs.LIB_VERSION,this.Iu=new Set,this.Mu="",this.uu=new cf,this.fu=[],this.Eu=[],this.Pu=!1,this.bu=!1,this.yu=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Fg(),this.SentryIntegration=C3,this.sentryIntegration=i=>(function(a,o){const u=uj(a,o);return{name:cj,processEvent:h=>u(h)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new W3(this),this.pageViewManager=new Jw(this),this.rateLimiter=new $3(this),this.requestRouter=new t8(this),this.consent=new g3(this),this.externalIntegrations=new a8(this);const n=(t=la.__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.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,a,o)=>{const u=Ke(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{const u=Ke(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",i=>be.info(`send "${i==null?void 0:i.event}"`,i))}init(t,n,i){if(i&&i!==ru){var a;const o=(a=xu[i])!==null&&a!==void 0?a:new la;return o._init(t,n,i),xu[i]=o,xu[ru][i]=o,o}return this._init(t,n,i)}_init(t,n={},i){var a,o,u;const h=Ke(t)?t.trim():"";if(!h)return be.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var f;if(this.__loaded)return h!==((f=this.config)===null||f===void 0?void 0:f.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${h}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Fg(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);const p=Fg(n.defaults),g=v5(n),v=Pt({},p,g,{name:i,token:h});Ve(p.rageclick)&&Ve(g.rageclick)&&(v.rageclick=Pt({},p.rageclick,g.rageclick)),Ve(p.session_recording)&&Ve(g.session_recording)&&(v.session_recording=Pt({},p.session_recording,g.session_recording)),this.set_config(v),this.config.on_xhr_error&&be.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Bs.GZipJS;const y=this.xu(),b=!this.gu();if(this.persistence=new Ag(this.config,y,!0,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ag(D(D({},this.config),{},{persistence:"sessionStorage"}),y,!1,b),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!y&&At.At()){const C=At.Dt(this.Mu);Pe(C)&&C.forEach(T=>{Ke(T)&&this.Iu.add(T)})}else At.Pt(this.Mu);const _=D({},this.persistence.props),k=D({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new Y3((C,T)=>this.ju(C,T),this.config.request_queue_config),this.Bu=new X3(this),this.__request_queue=[];const N=this.gu();N||(this.sessionManager=new d5(this),this.sessionPropsManager=new c5(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((C,T,R)=>{(R!=null&&R.activityTimeout||R!=null&&R.sessionPastMaximumLength||R!=null&&R.crossTabAdoption)&&this.zu()})),this.Hu(),this.config.__preview_deferred_init_extensions?(be.info("Deferring extension initialization to improve startup performance"),this.Uu=setTimeout(()=>{this.Uu=void 0,this.Wu(N)},0)):(be.info("Initializing extensions synchronously"),this.Wu(N)),bs.DEBUG=bs.DEBUG||this.config.debug,bs.DEBUG&&be.info("Starting in debug mode",{this:this,config:n,thisC:D({},this.config),p:_,s:k}),this.config.identity_distinct_id&&!(!((a=n.bootstrap)===null||a===void 0)&&a.distinctID)&&(n.bootstrap=D(D({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const S=(o=n.bootstrap)===null||o===void 0?void 0:o.distinctID;if(this.bu=!!S&&!cu(S),(u=n.bootstrap)===null||u===void 0?void 0:u.distinctID){const C=n.bootstrap.distinctID,T=this.get_distinct_id(),R=this.persistence.get_property(ls);if(n.bootstrap.isIdentifiedID&&T!=null&&T!==C&&R==="anonymous")this.identify(C);else if(n.bootstrap.isIdentifiedID&&T!=null&&T!==C&&R==="identified")be.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{const A=this.config.get_device_id(mi()),O=n.bootstrap.isIdentifiedID?A:C;this.persistence.set_property(ls,n.bootstrap.isIdentifiedID?$h:xr),this.register({distinct_id:C,$device_id:O})}}if(N)this.register_once({distinct_id:wg,$device_id:null},"");else if(!this.get_distinct_id()){const C=this.config.get_device_id(mi());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(ls,xr)}return gt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),gt(re,"pageshow",()=>{var C;this.$u=!1,this.Cu||(C=this.Bu)===null||C===void 0||C.resume()}),n.segment?Zw(this,()=>this.Vu()):this.Vu(),ln(this.config._onCapture)&&this.config._onCapture!==vu&&(be.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",C=>this.config._onCapture(C.event,C))),this.config.ip&&be.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.config.disableDeviceModel||(function(){return Fj.apply(this,arguments)})().then(C=>{C&&this.register({[_g]:C})}).catch(vu),this}Gu(t){const n=t;return Ke(n.name)&&ln(n.setup)}Qu(t,n){var i=this;this.Gu(t)?n.push(Rt(function*(){try{yield t.setup(i.Zu())}catch(o){be.error(`Failed to set up extension "${t.name}"`,o);try{var a;yield(a=t.dispose)===null||a===void 0?void 0:a.call(t)}catch(u){be.error(`Failed to dispose extension "${t.name}"`,u)}}})):this.fu.push(t)}Hu(){var t,n,i,a=this;const o=(t=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&t!==void 0?t:(i=la.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var u,h,f;if(o)if(this.featureFlags&&this.featureFlags instanceof o||((u=this.Ju)===null||u===void 0||u.call(this),this.Ju=void 0,this.featureFlags=new o(this)),ln(this.featureFlags.onReloading)&&ln(this.featureFlags.setup)){if(!this.Ju){this.Ju=this.featureFlags.onReloading(()=>{this.uu.emit("featureFlagsReloading",!0)});const p=this.featureFlags;Rt(function*(){try{yield p.setup(a.Zu())}catch(g){be.error("Failed to set up feature flags",g);const v=a.Ju;a.Ju=void 0;try{v==null||v()}catch(y){be.error("Failed to unsubscribe feature flag reloading",y)}try{yield p.dispose()}catch(y){be.error("Failed to dispose feature flags",y)}}})()}}else(h=(f=this.featureFlags).initialize)===null||h===void 0||h.call(f)}Wu(t){const n=performance.now(),i=D(D({},la.__defaultExtensionClasses),this.config.__extensionClasses),a=[];var o,u,h,f,p,g,v,y;i.exceptions&&this.fu.push(this.exceptions=(o=this.exceptions)!==null&&o!==void 0?o:new i.exceptions(this)),i.historyAutocapture&&this.fu.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.fu.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.fu.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.fu.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||a.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Qu(this.autocapture=new i.autocapture(this),a),i.surveys&&this.Qu(this.surveys=(u=this.surveys)!==null&&u!==void 0?u:new i.surveys(this),a),i.logs&&this.Qu(this.logs=(h=this.logs)!==null&&h!==void 0?h:new i.logs(this),a),i.metrics&&this.fu.push(this.metrics=(f=this.metrics)!==null&&f!==void 0?f:new i.metrics(this)),i.conversations&&this.fu.push(this.conversations=(p=this.conversations)!==null&&p!==void 0?p:new i.conversations(this)),i.productTours&&this.fu.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.fu.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.fu.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.fu.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.fu.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,N3)),i.toolbar&&this.fu.push(this.toolbar=(g=this.toolbar)!==null&&g!==void 0?g:new i.toolbar(this)),i.experiments&&this.fu.push(this.experiments=(v=this.experiments)!==null&&v!==void 0?v:new i.experiments(this)),i.webMCP&&this.fu.push(this.webMCP=(y=this.webMCP)!==null&&y!==void 0?y:new i.webMCP(this)),this.fu.forEach(b=>{b.initialize&&a.push(()=>{var _;(_=b.initialize)===null||_===void 0||_.call(b)})}),a.push(()=>{if(this.Ku){const b=this.Ku;this.Ku=void 0,this.fu.forEach(_=>{var k;return(k=_.onRemoteConfig)===null||k===void 0?void 0:k.call(_,b)})}}),this.Xu(a,n)}Xu(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void(this.Uu=setTimeout(()=>{this.Uu=void 0,this.Xu(t,n)},0));const a=t.shift();if(a)try{a()}catch(o){be.error("Error initializing extension:",o)}}const i=Math.round(performance.now()-n);this.register_for_session({[Fk]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Uk]:i}),this.config.__preview_deferred_init_extensions&&be.info(`PostHog extensions initialized (${i}ms)`)}il(t){if(!ge||!ge.body)return be.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ku=t),this.cu=t,this.compression=void 0,t.ok){var n;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(i.supportedCompression,Bs.GZipJS)?Bs.GZipJS:Ie(i.supportedCompression,Bs.Base64)?Bs.Base64:void 0),!((n=i.analytics)===null||n===void 0)&&n.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Wk}),this.uu.emit("extensionsRemoteConfig",t),this.fu.forEach(i=>{var a;return(a=i.onRemoteConfig)===null||a===void 0?void 0:a.call(i,t)})}Vu(){try{this.config.loaded(this)}catch(t){be.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&($t==null?void 0:$t.hostname)){const t=$t.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.gu())&&this.tc()},1),this.ec=new Sj(this),this.ec.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.qu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&xo(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,n,i,a,o,u;this.$u=!0,(t=this.surveys)===null||t===void 0||(n=t.handlePageUnload)===null||n===void 0||n.call(t),(i=this.metrics)===null||i===void 0||i.flush("sendBeacon"),this.config.request_batching?(this.nc()&&this.capture(Dw),(a=this.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(o=this.qu)===null||o===void 0||o.unload(),(u=this.Bu)===null||u===void 0||u.unload()):this.nc()&&this.capture(Dw,null,{transport:"sendBeacon"})}_send_request(t){Bj(this,t)}ju(t,n){this.Bu?this.Bu.retriableRequest(t,n):this._send_request(n?D(D({},t),{},{transport:n}):t)}_execute_array(t){Ig++;try{let n;const i=[],a=[],o=[];xo(t,h=>{if(h)if(n=h[0],Pe(n))o.push(h);else if(ln(h))try{h.call(this)}catch(f){be.error("Error executing queued PostHog call",h,f)}else Pe(h)&&n==="alias"?i.push(h):Pe(h)&&n.indexOf("capture")!==-1&&ln(this[n])?o.push(h):a.push(h)});const u=function(h,f){xo(h,function(p){try{if(Pe(p[0])){let g=f;_t(p,function(v){g=g[v[0]].apply(g,v.slice(1))})}else f[p[0]].apply(f,p.slice(1))}catch(g){be.error("Error executing queued PostHog call",p,g)}})};u(i,this),u(a,this),u(o,this)}finally{Ig--}}push(t){if(Ig>0&&Pe(t)&&Ke(t[0])){const n=la.prototype[t[0]];return void(ln(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}get sc(){return{property:Ow,persistenceKey:bo,cookieName:"_fbc",pattern:g5,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[bo]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(bo)}}}get rc(){return{property:Lw,persistenceKey:hu,cookieName:"_fbp",pattern:x5,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[hu]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(hu)}}}oc(t){var n;const i=(n=this.persistence)===null||n===void 0?void 0:n.get_property(t.persistenceKey);return Ke(i)&&t.pattern.test(i)?{value:i,delivered:!1}:Ve(i)&&Ke(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:i.delivered===!0}:void 0}ac(t,n,i){return n===(i==null?void 0:i.value)?{value:n,pending:!i.delivered}:(t.register(n,!1),{value:n,pending:!0})}lc(t){if(!this.config.save_campaign_params||this.gu())return;const n=pu(t.cookieName);return Ke(n)&&t.pattern.test(n)?n:void 0}uc(t,n,i,a){if(!this.persistence)return;const o=this.sc;this.persistence.refreshKey(o.persistenceKey);const u=this.oc(o);if(a)return void o.unregister();if(i)return Ke(n)&&g5.test(n)?this.ac(o,n,u):void o.unregister();const h=Ke(t)&&d8.test(t)?t:void 0,f=this.lc(o);return f&&((p,g,v)=>{const y=p.split(".");if(g)return y[3]===g;if(!v)return!0;const b=v.value.split(".");return y[3]===b[3]||Number(y[2])>Number(b[2])})(f,h,u)?this.ac(o,f,u):h?(u==null?void 0:u.value.split(".")[3])===h?{value:u.value,pending:!u.delivered}:this.ac(o,`fb.1.${Date.now()}.${h}`,u):u?{value:u.value,pending:!u.delivered}:void 0}cc(t,n,i){if(!this.persistence)return;const a=this.rc;this.persistence.refreshKey(a.persistenceKey);const o=this.oc(a);if(i)return void a.unregister();if(n)return Ke(t)&&x5.test(t)?this.ac(a,t,o):void a.unregister();const u=this.lc(a);return u?this.ac(a,u,o):o?{value:o.value,pending:!o.delivered}:void 0}hc(t,n){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.oc(t);(i==null?void 0:i.value)!==n||i.delivered||t.register(n,!0)}capture(t,n,i){var a,o;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void be.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(ue(t)||!Ke(t))return void be.error("No event name provided to posthog.capture");if(this._u(),t==="$snapshot"&&this.gu())return;const u=!this.config.opt_out_useragent_filter&&this._is_bot();if(u&&!this.config.__preview_capture_bot_pageviews)return;const h=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h!=null&&h.isRateLimited)return void be.critical("This capture call is ignored due to client rate limiting.");let f;n!=null&&n.$current_url&&!Ke(n==null?void 0:n.$current_url)&&(be.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.dc||be.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&&(f=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();const p=new Date,g=(i==null?void 0:i.timestamp)||p,v=fw(i==null?void 0:i.uuid,mi);let y={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},g,v)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&u&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),h&&(y.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const b=t==="$feature_flag_called"&&y.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i!=null&&i.$set&&!b&&(y.$set=i==null?void 0:i.$set);const _=Ve(n==null?void 0:n.$set)?n.$set:void 0,k=Pe(n==null?void 0:n.$unset)?n.$unset:[],N=(i==null?void 0:i.$unset)||[],S=X=>{var V;const G=!!(i!=null&&i.$set)&&X in i.$set;return{hasProvided:G||!!_&&X in _,provided:G?i==null||(V=i.$set)===null||V===void 0?void 0:V[X]:_==null?void 0:_[X],unset:k.indexOf(X)!==-1||N.indexOf(X)!==-1}},C=S(Ow),T=S(Lw),R=[{channel:this.sc,hasProvided:C.hasProvided,update:this.uc(f==null?void 0:f.fbclid,C.provided,C.hasProvided,C.unset)},{channel:this.rc,hasProvided:T.hasProvided,update:this.cc(T.provided,T.hasProvided,T.unset)}];for(const{channel:X,hasProvided:V,update:G}of R)G&&y.properties.$process_person_profile===!0&&G.pending&&!V&&!b&&(y.$set=D({[X.property]:G.value},y.$set));const A=i==null?void 0:i.$unset;A&&(y.$unset=A);const O=b?void 0:this.vc(i==null?void 0:i.$set_once,t!==zw,t===Kk);if(O&&(y.$set_once=O),i!=null&&i._noTruncate||(P=this.config.properties_string_max_length,y=(function(X,V){const G=new Set;return(function H(ae,_e){if(ae!==Object(ae))return V?V(ae):ae;if(G.has(ae))return;let E;if(G.add(ae),Pe(ae))E=[],xo(ae,Ne=>{E.push(H(Ne))});else{const Ne={};_t(zo(ae)?Zk(ae):ae,(Ce,$)=>{G.has(Ce)||(Ne[$]=H(Ce))}),E=Ne}return E})(X)})(y,X=>Ke(X)?X.slice(0,P):X)),y.timestamp=g,ue(i==null?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=p),b&&(y.properties=((X,V=[])=>{const G={},H=ae=>{X[ae]!==void 0&&(G[ae]=X[ae])};return eA.forEach(H),V.forEach(H),G})(y.properties,h8)),t===Ps.DISMISSED||t===Ps.SENT){const X=n==null?void 0:n[Og.SURVEY_ID],V=n==null?void 0:n[Og.SURVEY_ITERATION];Vj({id:X,current_iteration:V}),y.$set=D(D({},y.$set),{},{[Z3({id:X,current_iteration:V},t===Ps.SENT?"responded":"dismissed")]:!0})}else t===Ps.SHOWN&&(y.$set=D(D({},y.$set),{},{[Og.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var P;if(t===z3.SHOWN){const X=n==null?void 0:n[n5.TOUR_TYPE];X&&(y.$set=D(D({},y.$set),{},{[`${n5.TOUR_LAST_SEEN_DATE}/${X}`]:new Date().toISOString()}))}const z=D(D({},y.properties.$set),y.$set);if(_s(z)||this.setPersonPropertiesForFlags(z),!qe(this.config.before_send)){const X=this.Os(y);if(!X)return;y=X,y.uuid=fw(y.uuid,mi)}this.sessionRecording&&!this.Pu&&m5(t)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const K=R.filter(({channel:X,update:V})=>{var G,H,ae;const _e=(G=(H=y.$set)===null||H===void 0?void 0:H[X.property])!==null&&G!==void 0?G:Ve((ae=y.properties)===null||ae===void 0?void 0:ae.$set)?y.properties.$set[X.property]:void 0;return(V==null?void 0:V.pending)&&_e===V.value});this.uu.emit("eventCaptured",y);const F=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),q=(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(F),L=D(D(D({method:"POST",url:F,data:y,compression:"best-available",preferSyncCompression:i==null?void 0:i.send_instantly,timestampMode:q?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},q&&(!((o=y.properties)===null||o===void 0)&&o.$session_id)?{batchGroup:y.properties.$session_id+(y.properties.$window_id?`-${y.properties.$window_id}`:"")}:{}),i!=null&&i.transport?{transport:i.transport}:{}),K.length?{fireCallbackOnDrop:!0,callback:X=>{if(X.statusCode>=200&&300>X.statusCode)for(const{channel:V,update:G}of K)this.hc(V,G.value)}}:{});if(!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly){var de;let X;!L.transport&&!L.callback&&_s((de=this.config.request_headers)!==null&&de!==void 0?de:{})&&this.$u&&(X="sendBeacon"),this.ju(L,X)}else this.qu.enqueue(L);return y}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}getExtension(t){var n;return(n=this.fc)===null||n===void 0?void 0:n.getExtension(t)}Zu(){var t;return(t=this.fc)!==null&&t!==void 0?t:this.fc=new o8(this)}hu(t){this.Eu.push(t);let n=!0;return()=>{if(!n)return;n=!1;const i=this.Eu.indexOf(t);i!==-1&&this.Eu.splice(i,1)}}gc(t=!0){var n,i,a;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((a=this.sessionPersistence)===null||a===void 0||a.clear(),this.Iu.clear(),this.mc()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;this._u(),this.persistence.syncCookieProperties(),this.gc();const u=o?void 0:this.persistence.remove_event_timer(t);let h=D({},n);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.gu()&&(h[Ik]=!0),t==="$snapshot"){const C=D(D({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=C.distinct_id,(!Ke(h.distinct_id)&&!sn(h.distinct_id)||cu(h.distinct_id))&&be.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const f=(function(C,T,R,A=!1){var O,P,z,K;if(!as)return{};const F=C?[...Mo,...T||[]]:[],[q,L]=tk(as),[de,X]=(function(B){for(let oe=0;hw.length>oe;oe++){const[ye,je,Ee]=hw[oe],Be=B.match(ye);if(Be){const Oe=Ee&&B.match(Ee)||Be;return[je,(Oe==null?void 0:Oe[1])||""]}}return["",""]})(as),V=(function(){const B="u">typeof navigator?navigator:void 0;return B!=null&&B.brave?{brave:!0}:{}})(),G={};ue(R)||(G.detectGoogleSearchApp=R);const H={},ae=(O=navigator)===null||O===void 0||(O=O.userAgentData)===null||O===void 0?void 0:O.platform,_e=(P=navigator)===null||P===void 0?void 0:P.maxTouchPoints,E=re==null||(z=re.screen)===null||z===void 0?void 0:z.width,Ne=re==null||(K=re.screen)===null||K===void 0?void 0:K.height,Ce=re==null?void 0:re.devicePixelRatio;ue(ae)||(H.userAgentDataPlatform=ae),ue(_e)||(H.maxTouchPoints=_e),ue(E)||(H.screenWidth=E),ue(Ne)||(H.screenHeight=Ne),ue(Ce)||(H.devicePixelRatio=Ce);const $=Pt(Hx({$os:q,$os_version:L,$browser:ek(as,navigator.vendor,V,G),$webview_app:de,$webview_app_version:X,$device:nk(as),$device_type:w4(as,H),$timezone:dj(),$timezone_offset:O3()}),{$current_url:Mu(A?pa($t==null?void 0:$t.href):$t==null?void 0:$t.href,F,Au),$host:$t==null?void 0:$t.host,$pathname:$t==null?void 0:$t.pathname,$raw_user_agent:as.length>1e3?as.substring(0,997)+"...":as,$browser_version:_4(as,navigator.vendor,V,G),$browser_language:vj(),$browser_language_prefix:R3(),$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:vr.LIB_NAME,$lib_version:vr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return vr.SDK_DIST_CHANNEL&&($.$sdk_dist_channel=vr.SDK_DIST_CHANNEL),$})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:C,windowId:T}=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime(),!0);h.$session_id=C,h.$window_id=T}this.sessionPropsManager&&Pt(h,this.sessionPropsManager.getSessionProps());try{var p;if(this.sessionRecording){const C=this.sessionRecording.sdkDebugProperties,T=!this.Pu&&m5(t);for(const R in C)(T||Ie(c8,R))&&(h[R]=C[R])}h.$sdk_debug_retry_queue_size=(p=this.Bu)===null||p===void 0?void 0:p.length}catch(C){h.$sdk_debug_error_capturing_properties=String(C)}let g;if(this.requestRouter.region===ix&&(h.$lib_custom_api_host=this.config.api_host),g=t!=="$pageview"||o?t!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),h=Pt(h,g),t==="$pageview"&&ge&&(h.title=ge.title),!ue(u)){const C=i.getTime()-u;h.$duration=parseFloat((C/1e3).toFixed(3))}as&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const v=this.persistence.properties(),y=this.sessionPersistence.properties(),b=h.$groups,_=v.$groups;Ve(b)&&!_s(b)&&(h.$groups=D(D({},Ve(_)?_:{}),b)),_t(["$referrer","$referring_domain"],C=>{C in v&&delete y[C]});const k={};if(this.Eu.length>0)for(const C of this.Eu.slice())try{Pt(k,C())}catch(T){be.error("Failed to produce browser extension event properties",T)}h=Pt({},f,v,y,D(D({},k),h)),h.$is_identified=this._isIdentified(),Pe(this.config.property_denylist)?_t(this.config.property_denylist,function(C){delete h[C]}):be.error(Wj+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const N=this.config.sanitize_properties;N&&(be.error(p5),h=N(h,t));const S=this.yc();return h.$process_person_profile=S,S&&!o&&this.bc("_calculate_event_properties"),h}vc(t,n=!0,i=!1){var a;if(!this.persistence||!this.yc()||this.Tu&&!i)return t;const o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)===null||a===void 0?void 0:a.getSetOnceProps();let h=Pt({},o,u||{},t||{});const f=this.config.sanitize_properties;return f&&(be.error(p5),h=f(h,"$set_once")),n&&(this.Tu=!0),_s(h)?void 0:h}register(t,n){var i;(i=this.persistence)===null||i===void 0||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)===null||a===void 0||a.register_once(t,n,i)}register_for_session(t){var n,i;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gc(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(a=>this.Iu.add(a)),this.mc()}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t),this.Iu.delete(t),this.mc()}_c(t,n){this.register({[t]:n})}zu(){this.Iu.forEach(t=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}),this.Iu.clear(),this.mc()}mc(){var t;if(!this.Mu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!At.At())return void At.Pt(this.Mu);const n=[];this.Iu.forEach(i=>n.push(i)),n.length>0?At.$t(this.Mu,n):At.Pt(this.Mu)}getFeatureFlag(t,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var i,a;return(i=(a=this.featureFlags)===null||a===void 0?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)===null||a===void 0||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)===null||a===void 0||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n=!1,i){var a;return(a=this.featureFlags)===null||a===void 0?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.uu.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:lo}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n=!1){this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:lo})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:lo})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:lo}),()=>{})}renderSurvey(t,n){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,n)}displaySurvey(t,n=s8){var i;(i=this.surveys)===null||i===void 0||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:lo}}canRenderSurveyAsync(t,n=!1){var i,a;return(i=(a=this.surveys)===null||a===void 0?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:lo})}wc(t){return!t||cu(t)?(be.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(be.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())||(be.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 be.uninitializedWarning("posthog.identify");if(sn(t)&&(t=t.toString(),be.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wc(t)||!this.bc("posthog.identify"))return;this._u();const a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.gc(!1),h=this.persistence.Da();let f=!1;try{const g=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:g},""),t!==g&&t!==this.get_property("__alias")&&(this.unregister(tf),this.register({distinct_id:t}));const v=(this.persistence.get_property("$user_state")||"anonymous")===xr,y=t!==g,b=!y&&v;if(y&&v){var p;const _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:g};this.persistence.set_property(ls,$h),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",_,{$set:n||{},$set_once:i||{}})&&(this.Ou=Bg(t,n,i)),(p=this.featureFlags)===null||p===void 0||p.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:g)}else if(b){this.persistence.set_property(ls,$h);const _=n||{},k=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:k},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:_,$set_once:k})&&(this.Ou=Bg(t,n,i))}else(n||i)&&this.setPersonProperties(n,i);y||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ua)):b&&(n||i)&&this.reloadFeatureFlags(),f=!0}finally{h&&this.persistence.ja(f)}}setPersonProperties(t,n){if(!t&&!n||!this.bc("posthog.setPersonProperties"))return;const i=Bg(this.get_distinct_id(),t,n);this.Ou!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}})&&(this.Ou=i)):be.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const i=(Pe(t)?t:[t]).filter(a=>Ke(a)&&a.length>0);i.length!==0&&this.bc("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ou=null)}group(t,n,i){var a;if(!t||!n)return void be.error("posthog.group requires a group type and group key");(a=this.persistence)===null||a===void 0||a.syncCookieProperties(),this.gc();const o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:D(D({},o),{},{[t]:n})}),(u||i)&&this.yc()){const h={$group_type:t,$group_key:n};i&&(h.$group_set=i),this.capture(zw,h)}i&&this.setGroupPropertiesForFlags({[t]:i}),u&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n=!0){var i;(i=this.featureFlags)===null||i===void 0||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n=!0){var i;this.bc("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)===null||i===void 0||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(t)}reset(t){const n=os(t)?t:t==null?void 0:t.resetDeviceID,i=os(t)||t==null?void 0:t.bootstrap;this.kc(n,!1,i)}kc(t,n=!1,i){var a,o,u,h,f,p;if(be.info("reset"),!this.__loaded)return be.uninitializedWarning("posthog.reset");const g=i==null?void 0:i.sessionID;this.config.bootstrap=i||((a=this.Lu)===null||a===void 0?void 0:a.bootstrap)||{},(o=this.featureFlags)===null||o===void 0||(u=o.updateConfig)===null||u===void 0||u.call(o,this.config,this.nl());const v=this.get_property(Dx),y=this.get_property(_g),b=this.get_property(fu);(h=this.sessionRecording)===null||h===void 0||h.flushBeforeIdentityReset();const _=this.is_capturing();n||this.consent.reset(),n||!_||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const k=(f=this.persistence)===null||f===void 0||(p=f.Da)===null||p===void 0?void 0:p.call(f),N=this.wu;this.wu=N||n;let S=!1;try{var C,T,R,A,O,P,z,K,F,q,L,de,X;if((C=this.persistence)===null||C===void 0||C.clear(),(T=this.sessionPersistence)===null||T===void 0||T.clear(),this.Iu.clear(),this.mc(),ue(b)||(q=this.persistence)===null||q===void 0||q.register({$session_recording_remote_config:b}),(R=this.surveys)===null||R===void 0||R.reset(),(A=this.featureFlags)===null||A===void 0||A.reset(),(O=this.conversations)===null||O===void 0||O.reset(),(P=this.logs)===null||P===void 0||P.reset(),(z=this.metrics)===null||z===void 0||z.reset(),(K=this.persistence)===null||K===void 0||K.set_property("$user_state","anonymous"),(F=this.sessionManager)===null||F===void 0||F.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:wg,$device_id:null},"");else{const H=this.config.get_device_id(mi());this.register_once({distinct_id:H,$device_id:t?H:v},""),t||ue(y)||this.register({[_g]:y})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.gu()&&((X=this.persistence)===null||X===void 0||X.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(L=this.featureFlags)===null||L===void 0||L.initialize(),!qe(g)&&!(!((de=this.sessionManager)===null||de===void 0)&&de.setBootstrapSessionId(g,!0)))){const H=D({},i);delete H.sessionID,this.config.bootstrap=H}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,S=!0}finally{var V,G;this.wu=N,k&&((V=this.persistence)===null||V===void 0||(G=V.ja)===null||G===void 0||G.call(V,S))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Rt(function*(){if(!n.__loaded)return void be.uninitializedWarning("posthog.shutdown");n.Cu=!0,clearTimeout(n.Uu),n.Uu=void 0;const i=n.Ju;n.Ju=void 0;for(const a of[()=>{var o;return(o=n.sessionRecording)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=n.logs)===null||o===void 0?void 0:o.flushLogs("sendBeacon")},()=>{var o;return(o=n.metrics)===null||o===void 0?void 0:o.flush("sendBeacon")},()=>{var o;return(o=n.metrics)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=n.logs)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=n.surveys)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=n.autocapture)===null||o===void 0?void 0:o.dispose()},()=>i==null?void 0:i(),()=>{var o;return(o=n.qu)===null||o===void 0?void 0:o.unload()},()=>{var o;return(o=n.Bu)===null||o===void 0?void 0:o.unload()},()=>{var o;return(o=n.featureFlags)===null||o===void 0?void 0:o.destroy()},()=>{var o;return(o=n.persistence)===null||o===void 0?void 0:o.destroy()},()=>{var o;return(o=n.sessionPersistence)===null||o===void 0?void 0:o.destroy()}])try{const o=a();o&&ln(o.then)&&o.then(void 0,u=>{be.error("Error during shutdown",u)})}catch(o){be.error("Error during shutdown",o)}})()}setIdentity(t,n){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)===null||i===void 0||i.Sc()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.xc()}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||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let a=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(t!=null&&t.withTimestamp&&i){var o;const u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+=`?t=${Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}`}return a}alias(t,n){return t===this.get_property("$people_distinct_id")?(be.critical("Attempting to create alias for existing People user - aborting."),-2):this.bc("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this._c(tf,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(be.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const n=D({},this.config);if(Ve(t)){var i,a,o,u,h,f,p,g,v,y,b,_,k,N;Pt(this.config,v5(t));const A=this.xu();if(this.persistence){const P=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var S,C;if(P&&this.sessionPersistence!==this.persistence&&((S=this.sessionPersistence)===null||S===void 0||S.remove(),(C=this.sessionPersistence)===null||C===void 0||C.destroy()),this.persistence.update_config(this.config,n,A),P)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Ag(D(D({},this.config),{},{persistence:"sessionStorage"}),A,!1);else{var T;(T=this.sessionPersistence)===null||T===void 0||T.update_config(D(D({},this.config),{},{persistence:"sessionStorage"}),D(D({},n),{},{persistence:"sessionStorage"}),A)}}const O=this.Du(this.config.debug);var R;os(O)&&(this.config.debug=O),os(this.config.debug)&&(this.config.debug?(bs.DEBUG=!0,ct.At()&&ct.$t("ph_debug",!0),be.info("set_config",{config:t,oldConfig:n,newConfig:D({},this.config)})):(bs.DEBUG=!1,ct.At()&&ct.Pt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(a=i.updateConfig)===null||a===void 0||a.call(i,this.config,this.nl()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(u=this.exceptions)===null||u===void 0||u.onConfigChange(),(h=this.metrics)===null||h===void 0||h.onConfigChange(),(f=this.webMCP)===null||f===void 0||f.startIfEnabled(),(p=this.sessionRecording)===null||p===void 0||p.startIfEnabledOrStop(),(g=this.tracingHeaders)===null||g===void 0||g.startIfEnabledOrStop(),(v=this.autocapture)===null||v===void 0||v.startIfEnabled(),(y=this.heatmaps)===null||y===void 0||y.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((R=this.historyAutocapture)===null||R===void 0||R.startIfEnabledOrStop()),(b=this.exceptionObserver)===null||b===void 0||b.startIfEnabledOrStop(),(_=this.deadClicksAutocapture)===null||_===void 0||_.startIfEnabledOrStop(),(k=this.surveys)===null||k===void 0||k.loadIfEnabled(),this.ku(),(N=this.externalIntegrations)===null||N===void 0||N.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Zw(this,vu,!1)}}_overrideSDKInfo(t,n){bs.LIB_NAME=t,bs.LIB_VERSION=n}startSessionRecording(t){const n=t===!0,i={sampling:n||!!(t!=null&&t.sampling),linked_flag:n||!!(t!=null&&t.linked_flag),url_trigger:n||!!(t!=null&&t.url_trigger),event_trigger:n||!!(t!=null&&t.event_trigger)};var a,o,u,h,f;Object.values(i).some(Boolean)&&((a=this.sessionManager)===null||a===void 0||a.checkAndGetSessionAndWindowId(),i.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),i.linked_flag&&((u=this.sessionRecording)===null||u===void 0||u.overrideLinkedFlag()),i.url_trigger&&((h=this.sessionRecording)===null||h===void 0||h.overrideTrigger("url")),i.event_trigger&&((f=this.sessionRecording)===null||f===void 0||f.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===void 0)&&t.started)}captureException(t,n){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(D(D({},i),n))}catch{return}}addExceptionStep(t,n){var i;(i=this.exceptions)===null||i===void 0||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)===null||n===void 0||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&t!==void 0?t:la.$c}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||i===void 0?void 0:i.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t;let n=(t=this.config.name)!==null&&t!==void 0?t:ru;return n!==ru&&(n="posthog."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}yc(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_s(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}nc(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yc()||this.bc("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bc("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bc(t){return this.config.person_profiles==="never"?(be.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.mu(),this._c(Px,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}ku(){var t,n;const i=this.xu();var a,o,u;return this.is_capturing()||(a=this.logs)===null||a===void 0||a.Cc(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==i&&((o=this.persistence)===null||o===void 0||o.set_disabled(i)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==i&&((u=this.sessionPersistence)===null||u===void 0||u.set_disabled(i)),this.mc(),i}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this.gu()){var i,a,o,u,h,f;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.kc(!0,!0),(a=this.sessionManager)===null||a===void 0||a.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=new d5(this),this.pageViewManager=new Jw(this),this.persistence&&(this.sessionPropsManager=new c5(this,this.sessionManager,this.persistence));const b=(u=(h=this.config.__extensionClasses)===null||h===void 0?void 0:h.sessionRecording)!==null&&u!==void 0?u:(f=la.__defaultExtensionClasses)===null||f===void 0?void 0:f.sessionRecording;var p,g;b&&(this.sessionRecording=this.pu(this.sessionRecording,new b(this)),this.cu&&((p=this.sessionRecording)===null||p===void 0||(g=p.onRemoteConfig)===null||g===void 0||g.call(p,this.cu)))}var v,y;this.consent.optInOut(!0),this.ku(),this.Yu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((v=this.surveys)===null||v===void 0||v.loadIfEnabled()),(ue(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((y=t==null?void 0:t.captureEventName)!==null&&y!==void 0?y:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.tc()}else be.warn(f5)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.ku(),this.config.cookieless_mode==="on_reject"&&this.Su()):be.warn(f5)}Su(){var t,n;const i=this.sessionRecording;i==null||i.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.kc(!0,!0),this.register({distinct_id:wg,$device_id:null}),this.vu(i),this.sessionRecording=void 0,(t=this.sessionManager)===null||t===void 0||t.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.tc(),this.Yu()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return!this.wu&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.ku()}_is_bot(){return Un?Ij(Un,this.config.custom_blocked_useragents):void 0}tc(){ge&&(ge.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(Ux,{title:ge.title},{send_instantly:!0}),this.Au&&(ge.removeEventListener(Eu,this.Au),this.Au=null)):this.Au||(this.Au=this.tc.bind(this),gt(ge,Eu,this.Au)))}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}))}nl(){const t=this.Lu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(be.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):(function(n,i,a,o,u){const h=i in n&&!qe(n[i]),f=a in n&&!qe(n[a]);return h?n[i]:!!f&&(u&&u.warn(`Config field '${a}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,be)}Os(t){var n;if(qe(this.config.before_send))return t;const i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(u4),a=Pe(this.config.before_send)?this.config.before_send:[this.config.before_send];let o=t;for(const u of a)try{if(o=u(o),qe(o)){const h=`Event '${t.event}' was rejected in beforeSend function`;return c4(t.event)?be.warn(`${h}. This can cause unexpected behavior.`):be.info(h),null}o.properties&&!_s(o.properties)||be.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(h){return be.error(`Error in beforeSend function for event '${t.event}':`,h),null}for(const u of i)if(o.properties&&qe(o.properties[u]))return be.warn(`Event '${t.event}' had its '${u}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return o}getPageViewId(){var t;return(t=this.pageViewManager.Vo)===null||t===void 0?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)})}Du(t){const n=os(t)&&!t,i=ct.At()&&ct.Ot("ph_debug")==="true";return!n&&(!!i||t)}};yu.__defaultExtensionClasses={},yu.$c=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let n=0;t.length>n;n++)e.prototype[t[n]]=l3(e.prototype[t[n]])})(yu,["identify"]);var Kj=class{constructor(e){this.disabled=e===!1;const t=Ve(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}};const Ug="$copy_autocapture",Hg=Vt("[AutoCapture]");function qg(e,t){return t.length>e?t.slice(0,e)+"...":t}function g8(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!yi(t));return t}function x8(e,{e:t,maskAllElementAttributes:n,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:o,disableCaptureUrlHashes:u}){var h,f;if(!yi(e))return{props:{}};const p=[e],g=new Set([e]);let v=e;for(;v.parentNode&&!Hn(v,"body")&&1e3>p.length;){if(qx(v.parentNode)){const O=v.parentNode.host;if(g.has(O))break;g.add(O),p.push(O),v=O;continue}if(!yi(v.parentNode)||g.has(v.parentNode))break;g.add(v.parentNode),p.push(v.parentNode),v=v.parentNode}const y=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?p.findIndex(O=>Hn(O,"button")||Hn(O,"a")):-1;y>0&&(i=i||p.slice(0,y+1).some(O=>!rl(O)||Eo(O)));const b=[],_={};let k,N=!1,S=!1;if(_t(p,O=>{const P=rl(O);if(Hn(O,"a")&&!n&&!(a!=null&&a.includes("href"))){const z=O.getAttribute("href");N=!!(P&&z&&_o(z))&&(u?pa(z):z)}Ie(Co(O),"ph-no-capture")&&(S=!0),b.push((function(z,K,F,q,L=!1){const de=z.tagName.toLowerCase(),X={tag_name:de};Gx.indexOf(de)>-1&&!F&&(X.$el_text=de.toLowerCase()==="a"||de.toLowerCase()==="button"?qg(1024,Xw(z)):qg(1024,Tu(z)));const V=Co(z);K||q!=null&&q.includes("class")||0>=V.length||(X.classes=V.filter(function(_e){return _e!==""})),_t(z.attributes,function(_e){var E;if((!Eo(z)||["name","id","class","aria-label"].indexOf(_e.name)!==-1)&&!(q!=null&&q.includes(_e.name))&&!K&&_o(_e.value)&&(!Ke(E=_e.name)||E.substring(0,10)!=="_ngcontent"&&E.substring(0,7)!=="_nghost")){let Ne=_e.value;_e.name==="class"&&(Ne=Vx(Ne).join(" ")),X["attr__"+_e.name]=qg(1024,_e.name==="href"&&L?pa(Ne):Ne)}});let G=1,H=1,ae=z;for(;ae=g8(ae);)G++,ae.tagName===z.tagName&&H++;return X.nth_child=G,X.nth_of_type=H,X})(O,n,i,a,u)),_t((function(z){if(!rl(z))return{};const K={};return _t(z.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){const q=F.name.replace("data-ph-capture-attribute-",""),L=F.value;q&&L&&_o(L)&&(K[q]=L)}}),K})(O),(z,K)=>{({}).hasOwnProperty.call(_,K)||(_[K]=z)})}),S)return{props:{},explicitNoCapture:S};if(y>0&&(e=p[y],b.splice(0,y)),i||(b[0].$el_text=Hn(e,"a")||Hn(e,"button")?Xw(e):Tu(e)),N){var C,T;b[0].attr__href=N;const O=(C=_r(N))===null||C===void 0?void 0:C.host,P=re==null||(T=re.location)===null||T===void 0?void 0:T.host;O&&P&&O!==P&&(k=N)}return{props:Pt((A=t.type,{$event_type:A,$ce_version:1}),o?{}:{$elements:b},{$elements_chain:(R=b,Pe(R)?(function(O){return O.map(P=>{var z,K;let F="";if(P.tag_name&&(F+=P.tag_name),P.attr_class){P.attr_class.sort();for(const de of P.attr_class)F+=`.${de.replace(/"/g,"")}`}const q=D(D(D(D({},P.text?{text:P.text}:{}),{},{"nth-child":(z=P.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(K=P.nth_of_type)!==null&&K!==void 0?K:0},P.href?{href:P.href}:{}),P.attr_id?{attr_id:P.attr_id}:{}),P.attributes),L={};return Ph(q).sort(([de],[X])=>(function(V,G){return G>V?-1:V>G?1:0})(de,X)).forEach(([de,X])=>L[Ww(de.toString())]=Ww(X.toString())),F+=":",F+=Ph(L).map(([de,X])=>`${de}="${X}"`).join(""),F}).join(";")})((function(O){return O.map(P=>{var z,K;const F={text:(z=P.$el_text)===null||z===void 0?void 0:z.slice(0,400),tag_name:P.tag_name,href:(K=P.attr__href)===null||K===void 0?void 0:K.slice(0,2048),attr_class:k3(P),attr_id:P.attr__id,nth_child:P.nth_child,nth_of_type:P.nth_of_type,attributes:{}};return Ph(P).filter(([q])=>q.indexOf("attr__")===0).forEach(([q,L])=>F.attributes[q]=L),F})})(R)):"")},!((h=b[0])===null||h===void 0)&&h.$el_text?{$el_text:(f=b[0])===null||f===void 0?void 0:f.$el_text}:{},k&&t.type==="click"?{$external_click_url:k}:{},_),target:e};var R,A}var v8=class{vo(){this.fo=void 0,clearTimeout(this.po),this.po=void 0}mo(e){var t;if(!rl(e))return!0;const n=(t=this.yo().css_selector_ignorelist)!==null&&t!==void 0?t:Eg,i=new Set;let a=e;for(;a;){if(i.size>=1e3||i.has(a))return!0;i.add(a);const o=a,u=Co(o);if(Ie(u,"ph-no-capture")||Ie(u,"ph-sensitive")||Eo(o)||n.some(f=>K0(o,f)))return!0;const h=a.parentNode;a=qx(h)?h.host:h&&yi(h)?h:null}return!1}bo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.vo();if(e.type==="pointerdown"){this.vo();const i=mu(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&yi(i)&&(this.fo={target:i,excluded:this.mo(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this._o)===null||t===void 0?void 0:t.distinctId}))}const n=this.fo;n&&(e.pointerId!==n.id||Math.abs(e.clientX-n.x)>5||Math.abs(e.clientY-n.y)>5?this.vo():e.type==="pointerup"&&(n.released=!0,this.po=setTimeout(()=>this.vo(),0)))}wo(e){var t;const n=this.fo;this.vo();const i=mu(e);if(n!=null&&n.released&&n.target.isConnected&&n.distinctId===((t=this._o)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===n.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-n.x)&&5>=Math.abs(e.clientY-n.y)&&i&&(Hn(i,"html")||Hn(i,"body"))){var a;if(n.excluded)return null;const o=(a=this.yo().css_selector_ignorelist)!==null&&a!==void 0?a:Eg;return[i,ge==null?void 0:ge.documentElement,ge==null?void 0:ge.body].some(u=>{if(!u)return!1;const h=Co(u);return Ie(h,"ph-no-capture")||Ie(h,"ph-sensitive")||!rl(u)||Eo(u)||o.some(f=>K0(u,f))})?null:n.target}}constructor(e){this.ko=e,this.name=Gj,this.So=!1,this.xo=null,this.$o=!1,this.Co=new Map,this.To=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.ko.refresh(this.Mr),this.rageclicks=new Kj(this.Mr.rageclick),this.Mo=null}setup(e){this.Eo(),this._o=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?t.dispose():(this.Po=t,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this._o=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.Co.clear(),this.Mo=null,this.Ro())}yo(){return this.ko.refresh(this.Mr),this.Mr}Eo(){var e,t;return this.yo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Mr}Ao(){if(!this.isBrowserSupported())return void Hg.info("Disabling Automatic Event Collection because this browser is not supported");if(!re||!ge)return;const e=this.Fo=t=>{t=t||(re==null?void 0:re.event);try{if(t.type==="blur")return void this.vo();if(t.type.indexOf("pointer")===0)return void this.bo(t);const n=t.type==="click"?this.wo(t):void 0;if(Xt(n))return;this.Oo(t,"$autocapture",n)}catch(n){Hg.error("Failed to capture event",n)}};if(gt(re,"blur",e),gt(ge,"submit",e,{capture:!0}),gt(ge,"change",e,{capture:!0}),gt(ge,"click",e,{capture:!0}),_t(["pointerdown","pointermove","pointerup","pointercancel"],t=>{gt(ge,t,e,{capture:!0})}),this.yo().capture_copied_text){const t=this.Do=n=>{n=n||(re==null?void 0:re.event);try{this.Oo(n,Ug)}catch(i){Hg.error("Failed to capture clipboard event",i)}};gt(ge,"copy",t,{capture:!0}),gt(ge,"cut",t,{capture:!0}),gt(ge,"paste",t,{capture:!0})}}Ro(){this.vo(),this.Fo&&(re==null||re.removeEventListener("blur",this.Fo),_t(["pointerdown","pointermove","pointerup","pointercancel"],e=>{ge==null||ge.removeEventListener(e,this.Fo,!0)}),ge==null||ge.removeEventListener("submit",this.Fo,!0),ge==null||ge.removeEventListener("change",this.Fo,!0),ge==null||ge.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(ge==null||ge.removeEventListener("copy",this.Do,!0),ge==null||ge.removeEventListener("cut",this.Do,!0),ge==null||ge.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.So=!1}startIfEnabled(){this.isEnabled||this.vo(),!this.Io&&this._o&&this.isEnabled&&!this.So&&(this.Ao(),this.So=!0)}onRemoteConfig(e){if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);const n=t.autocapture_opt_out;var i;os(n)&&((i=this._o)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",n),this.xo=n),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.Io)return;e.size?this.Co.set(t,new Set(e)):this.Co.delete(t);const n=new Set;this.Co.forEach(i=>{i.forEach(a=>n.add(a))}),this.Mo=n}getElementSelectors(e,t){var n;const i=[];return(n=this.Mo)===null||n===void 0||n.forEach(a=>{const o=ge==null?void 0:ge.querySelectorAll(a);o==null||o.forEach(u=>{e!==u&&t!==u||Ie(i,a)||i.push(a)})}),i}get isEnabled(){var e,t;if(this.Io)return!1;const n=(e=this._o)===null||e===void 0?void 0:e.kv.get(Tk),i=this.xo,a=this.yo();if(!a.remoteRequestsDisabled&&!this.$o)return!1;const o=a.remoteRequestsDisabled&&!this.$o;if(Xt(i)&&!os(n)&&!o)return!1;const u=(t=this.xo)!==null&&t!==void 0?t:!!n;return!!a.enabled&&!u}Oo(e,t="$autocapture",n){if(!this.isEnabled)return void this.vo();let i=n||mu(e);nj(i)&&(i=i.parentNode||null);const a=this.Eo();var o;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&a.rageclick&&(!((o=this.rageclicks)===null||o===void 0)&&o.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&aj(i,a.rageclick)&&this.Oo(e,"$rageclick",n);const u=t===Ug,h=u?D(D({},a),{},{dom_event_allowlist:void 0}):a;if(i&&(function(v,y,b,_,k,N){var S;if(!re||Qx(v)||b!=null&&b.url_allowlist&&!Fw(b.url_allowlist,N)||b!=null&&b.url_ignorelist&&Fw(b.url_ignorelist,N))return!1;if(b!=null&&b.dom_event_allowlist){const A=b.dom_event_allowlist;if(A&&!A.some(O=>y.type===O))return!1}const{parentIsUsefulElement:C,targetElementList:T}=lj(v,_);if(!(function(A,O){const P=O==null?void 0:O.element_allowlist;if(ue(P))return!0;for(const z of A)if(P.some(K=>z.tagName.toLowerCase()===K))return!0;return!1})(T,b)||!Z0(T,b==null?void 0:b.css_selector_allowlist)||Z0(T,(S=b==null?void 0:b.css_selector_ignorelist)!==null&&S!==void 0?S:Eg))return!1;try{const A=re.getComputedStyle(v);if(A&&A.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0}catch{}const R=v.tagName.toLowerCase();switch(R){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 C?(k||["click"]).indexOf(y.type)>=0:(k||["click"]).indexOf(y.type)>=0&&(Gx.indexOf(R)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,h,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:a.getCurrentUrl}})){var f;const{props:v,explicitNoCapture:y,target:b}=x8(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(y)return!1;const _=this.getElementSelectors(i,b);if(_&&_.length>0&&(v.$element_selectors=_),t===Ug){const k=e.type||"clipboard";if(k!=="paste"){var p,g;const N=re==null||(p=re.getSelection())===null||p===void 0?void 0:p.toString(),S=sj(N);if(!S)return!1;v.$selected_content=S,v.$clipboard_text_length=(g=N==null?void 0:N.length)!==null&&g!==void 0?g:0}v.$copy_type=k}return(f=this._o)===null||f===void 0||f.capture(t,v),!0}}isBrowserSupported(){return ln(ge==null?void 0:ge.querySelectorAll)}},y8=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,n=Ve(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=n==null?void 0:n.url_allowlist,e.url_ignorelist=n==null?void 0:n.url_ignorelist,e.dom_event_allowlist=n==null?void 0:n.dom_event_allowlist,e.element_allowlist=n==null?void 0:n.element_allowlist,e.css_selector_allowlist=n==null?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=n==null?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=n==null?void 0:n.element_attribute_ignorelist,e.capture_copied_text=n==null?void 0:n.capture_copied_text}};const Kc=Vt("[ExceptionAutocapture]"),y5=()=>{},b5=e=>{var t;if(ln(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function Ro(e,t,n){try{if(!(t in e))return y5;const i={next:e[t]},a=n(function(...o){return i.next.apply(this,o)});return ln(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=a,()=>{if(e[t]===a)return void(e[t]=i.next);let o=e[t],u=b5(o);for(;u;){if(u.next===a)return void(u.next=i.next);o=u.next,u=b5(o)}}}catch{return y5}}const b8=Vt("[TracingHeaders]"),Qa=Vt("[Web Vitals]"),_5=9e5,w5=["CLS","FCP","INP","LCP"],_8=["INP","LCP"],w8=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Vg="disabled",S5="lazy_loading",dr=Vt("[SessionRecording]"),S8=[Bx,Ix,Hk,qk,Vk,Gk,Yk,Qk,Xk],k8=Vt("[Heatmaps]");function Gg(e){return Ve(e)&&"clientX"in e&&"clientY"in e&&sn(e.clientX)&&sn(e.clientY)}const yh=Vt("[Product Tours]"),Yg=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property($x))},j8=["$set_once","$set"],$i=Vt("[SiteApps]"),k5="Error while initializing PostHog app with config id ",Kx=(e,t)=>e!=null&&e.then?e.then(t):t(e),oo="SDK is not enabled or survey functionality is not yet loaded",j5="Disabled. Not loading surveys.";var N8=class{constructor(e,t){this.ko=e,this.Tc=t,this.name=Xj,this._surveyEventReceiver=null,this._surveyManager=null,this.Ic=!1,this.Mc=!1,this.Ec=[],this.Pc=[],this.Rc=null,this.Ac=null,this.Io=!1,this.Fc=new Set,this.onRemoteConfig=n=>{if(this.Io||this.Mr.disableSurveys)return;if(!n.ok)return this.Mc=!0,this.Oc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),bt.warn("Remote config unavailable. Not loading surveys.");const i=n.config.surveys;if(qe(i))return bt.warn("Flags not loaded yet. Not loading surveys.");this.Dc=os(i)?i:i.length>0,bt.info(`flags response received, isSurveysEnabled: ${this.Dc}`),this.loadIfEnabled()},this.Oc=n=>{this.Pc.slice().forEach(i=>this.Lc(i,n))}}setup(e){if(!this.Io)return this.Nc=e,Kx(e.kv.initialize(),()=>{if(this.Nc!==e||this.Io)return;this.Nc=void 0,this._o=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.Io?t.dispose():(this.Po=t,this.loadIfEnabled())})}dispose(){var e,t,n,i,a;this.Io||(this.Io=!0,this.Nc=void 0,this._o=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)===null||n===void 0||(i=n.dispose)===null||i===void 0||i.call(n),this._surveyManager=null,this.Ec=[],this.Pc.forEach(o=>{o.active=!1}),this.Pc=[],(a=this.qc)===null||a===void 0||a.call(this),this.qc=void 0,this.Rc=null,this.Fc.forEach(o=>clearTimeout(o)),this.Fc.clear())}get Mr(){return this.ko.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var n;(n=this._surveyEventReceiver)===null||n===void 0||n.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let a=0;a<localStorage.length;a++){const o=localStorage.key(a);(o!=null&&o.startsWith("seenSurvey_")||o!=null&&o.startsWith("inProgressSurvey_"))&&i.push(o)}i.forEach(a=>localStorage.removeItem(a))}catch{}this.Oc()}loadIfEnabled(){if(this.Io||!this._o)return;const e=this.Mr;if(this._surveyManager)return;if(this.Ic)return void bt.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void bt.info(j5);if(e.cookielessMode&&this.ko.isOptedOut())return void bt.info("Not loading surveys in cookieless mode without consent.");const t=this.ko.getExtensions();if(!t)return void this.jc("PostHog Extensions not found.");if(ue(this.Dc)&&!e.advancedEnableSurveys)return;const n=this.Dc||e.advancedEnableSurveys;this.Ic=!0,this.Mc=!1;try{const i=t.generateSurveys;if(i)return this.Bc(i,n),void(this.Ic=!1);const a=t.loadExternalDependency;if(!a)return this.jc(Fx),void(this.Ic=!1);a(o=>{try{if(this.Io)return;const u=this.ko.getExtensions();o||!(u!=null&&u.generateSurveys)?this.jc("Could not load surveys script",o):this.Bc(u.generateSurveys,n)}finally{this.Ic=!1}})}catch(i){throw this.Ic=!1,this.jc("Error initializing surveys",i),i}}Bc(e,t){var n,i;if(this.Io)return;this._surveyManager=e(t),this._surveyEventReceiver=this.ko.createEventReceiver(this.Oc);const a=(n=(i=this._o)!==null&&i!==void 0?i:this.Tc)===null||n===void 0?void 0:n.kv.get(iu);a&&this.zc(a),bt.info("Surveys loaded successfully"),this.Hc(),this.Oc(),this.Uc({isLoaded:!0})}jc(e,t){this.Mc=!0,bt.error(e,t),this.Oc({isLoaded:!1,error:e}),this.Uc({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ec.push(e),this._surveyManager&&this.Uc({isLoaded:!0}),()=>{this.Ec=this.Ec.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const i=(n=this._o)!==null&&n!==void 0?n:this.Tc;if(!i||this.Io)return;if(this.Mr.disableSurveys)return bt.info(j5),e([]);const a=i.kv.get(iu);if(a&&!t)return e(a,{isLoaded:!0}),void(this.Wc()&&this.getSurveys(()=>{},!0));if(this.Rc)return void this.Rc.then(({surveys:h,context:f})=>{this.Io||e(h,f)}).catch(h=>bt.error("Error in survey callback",h));const o=this.Vc("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(h=>{try{return this.Gc(i,h)}catch(f){return bt.error("Error processing surveys response",f),this.Gc(i,{statusCode:0,error:f})}},h=>this.Gc(i,{statusCode:0,error:h}));this.Rc=o;const u=()=>{this.Rc===o&&(this.Rc=null)};o.then(h=>{u(),this.Io||(this.Oc(h.context),e(h.surveys,h.context))},u).catch(h=>bt.error("Error in survey callback",h))}Vc(e,t){const n=this._o;return n?n.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(oo)}))}Gc(e,t){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:oo}};const n=t.statusCode;if(n!==200||!t.json){const a=`Surveys API could not be loaded, status: ${n}`;return n!==0?bt.error(a):t.error||bt.warn(a),this.Ac=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Ac=null;const i=t.json.surveys||[];return e.kv.set({[iu]:i,[nf]:Date.now()}),this.zc(i),{surveys:i,context:{isLoaded:!0}}}zc(e){var t;const n=e.filter(i=>(function(a){return!(!a.start_date||a.end_date)})(i)&&(Uj(i)||(function(a){var o;return!!(!((o=a.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0)&&o.length)})(i)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(n)}Wc(){return this.Qc()&&!this.Rc&&!this.Zc()}Qc(){var e,t;const n=(e=(t=this._o)!==null&&t!==void 0?t:this.Tc)===null||e===void 0?void 0:e.kv.get(nf);return sn(n)&&Date.now()-n>3e5}Zc(){return sn(this.Ac)&&3e5>Date.now()-this.Ac}markSurveyAsSeen(e,t){var n;const i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};Vj(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oc()}Uc(e){for(const t of this.Ec)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){bt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t=!1){if(!qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);bt.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,n;if(this.Io)return()=>{};const i={callback:e,active:!0,revision:0};this.Pc.push(i),this.Hc();const a=(t=(n=this._o)!==null&&n!==void 0?n:this.Tc)===null||t===void 0?void 0:t.kv.get(iu);return this.Mr.disableSurveys||!this._surveyManager&&this.Mc&&!this.Ic||!a&&!qe(this.Ac)&&!this.Rc?this.Lc(i,{isLoaded:!1}):this._surveyManager&&this.Lc(i),()=>{var o;i.active=!1,this.Pc=this.Pc.filter(u=>u!==i),this.Pc.length===0&&((o=this.qc)===null||o===void 0||o.call(this),this.qc=void 0)}}Hc(){var e,t,n;this._surveyManager&&this.Pc.length>0&&((e=this.qc)!==null&&e!==void 0||(this.qc=(t=(n=this.ko).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(n,this.Oc)))}Lc(e,t){if(this.Io||!e.active)return;const n=++e.revision,i=a=>{if(!this.Io&&e.active&&n===e.revision)try{const o=t??{isLoaded:!0},u=JSON.stringify([a,o]);if(u===e.lastResult)return;e.lastResult=u,e.callback(a,o)}catch(o){bt.error("Error in active matching surveys callback",o)}};try{t&&!t.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(a){bt.error("Error in active matching surveys callback",a)}}Jc(e){let t=null;return this.getSurveys(n=>{var i;t=(i=n.find(a=>a.id===e))!==null&&i!==void 0?i:null}),t}Kc(e){if(qe(this._surveyManager))return{eligible:!1,reason:oo};const t=typeof e=="string"?this.Jc(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Xc(e){if(!this.ko.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(qe(this._surveyManager))return{eligible:!1,reason:oo};const t=typeof e=="string"?this.Jc(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(qe(this._surveyManager))return bt.warn("init was not called"),{visible:!1,disabledReason:oo};const t=this.Xc(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return qe(this._surveyManager)?(bt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:oo})):new Promise(n=>{this.getSurveys(i=>{var a;const o=(a=i.find(u=>u.id===e))!==null&&a!==void 0?a:null;if(o){const u=this.Xc(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var i;if(!this.ko.isCapturing())return;if(qe(this._surveyManager))return void bt.warn("init was not called");const a=typeof e=="string"?this.Jc(e):e;if(!(a!=null&&a.id))return void bt.warn("Survey not found");if(!n8.includes(a.type))return void bt.warn(`Surveys of type ${a.type} cannot be rendered in the app`);const o=ge==null?void 0:ge.querySelector(t);if(o){if(!((i=a.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){bt.info(`Rendering survey ${a.id} with delay of ${a.appearance.surveyPopupDelaySeconds} seconds`);const u=setTimeout(()=>{var h,f;this.Fc.delete(u),!this.Io&&this.ko.isCapturing()&&(bt.info(`Rendering survey ${a.id} with delay of ${(h=a.appearance)===null||h===void 0?void 0:h.surveyPopupDelaySeconds} seconds`),(f=this._surveyManager)===null||f===void 0||f.renderSurvey(a,o,n),bt.info(`Survey ${a.id} rendered`))},1e3*a.appearance.surveyPopupDelaySeconds);return void this.Fc.add(u)}this._surveyManager.renderSurvey(a,o,n)}else bt.warn("Survey element not found")}displaySurvey(e,t){var n;if(!this.ko.isCapturing())return;if(qe(this._surveyManager))return void bt.warn("init was not called");const i=this.Jc(e);if(!i)return void bt.warn("Survey not found");let a=i;if(!((n=i.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=D(D({},i),{},{appearance:D(D({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==J0.Popover&&t.initialResponses&&bt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const o=this.Kc(i);if(!o.eligible)return void bt.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==J0.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}cancelPendingSurvey(e){qe(this._surveyManager)?bt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function co(e,t,n){if(qe(e))return!1;switch(n){case"exact":return e===t;case"contains":{const 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}}var C8=class{constructor(e){this._instance=e,this.Yc=new Set,this.th=new Set,this.eh=new cf,this.ih=(t,n)=>this.nh(t,n)&&this.sh(t,n)&&this.rh(t,n)&&this.oh(t,n),this.nh=(t,n)=>!(n!=null&&n.event)||(t==null?void 0:t.event)===(n==null?void 0:n.event)}init(){var e,t;ue((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.ah=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,i)=>{this.on(n,i)}))}dispose(){var e,t;(e=this.ah)===null||e===void 0||e.call(this),this.ah=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.eh=new cf}register(e){var t,n;if(!ue((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var a;this.Yc.add(i),(a=i.steps)===null||a===void 0||a.forEach(o=>{this.th.add((o==null?void 0:o.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const i=new Set;this.Yc.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(u=>{u!=null&&u.selector&&i.add(u.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.Yc.clear(),this.th.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.th.has(e)||this.th.has(t.event))&&this.Yc.forEach(n=>{this.uh(t,n)&&this.eh.emit("actionCaptured",n.name)})}hh(e){this.onAction("actionCaptured",t=>e(t))}uh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.ih(e,n))return!0;return!1}onAction(e,t){return this.eh.on(e,t)}sh(e,t){if(t!=null&&t.url){var n;const i=e==null||(n=e.properties)===null||n===void 0?void 0:n.$current_url;if(!i||typeof i!="string"||!co(i,t.url,t.url_matching||"contains"))return!1}return!0}rh(e,t){return!!this.dh(e,t)&&!!this.fh(e,t)&&!!this.ph(e,t)}dh(e,t){var n;if(!(t!=null&&t.href))return!0;const i=this.gh(e);if(i.length>0)return i.some(o=>co(o.href,t.href,t.href_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&co((function(o){const u=o.match(/(?::|")href="(.*?)"/);return u?u[1]:""})(a),t.href,t.href_matching||"exact")}fh(e,t){var n;if(!(t!=null&&t.text))return!0;const i=this.gh(e);if(i.length>0)return i.some(f=>co(f.text,t.text,t.text_matching||"exact")||co(f.$el_text,t.text,t.text_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&(o=(function(f){const p=[],g=/(?::|")text="(.*?)"/g;let v;for(;!qe(v=g.exec(f));)p.includes(v[1])||p.push(v[1]);return p})(a),u=t.text,h=t.text_matching||"exact",o.some(f=>co(f,u,h)));var o,u,h}ph(e,t){var n,i;if(!(t!=null&&t.selector))return!0;const a=e==null||(n=e.properties)===null||n===void 0?void 0:n.$element_selectors;if(a!=null&&a.includes(t.selector))return!0;const o=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}gh(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}oh(e,t){return!(t!=null&&t.properties)||t.properties.length===0||qj(t.properties.reduce((n,i)=>{const a=Pe(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:a,operator:i.operator||"exact"},n},{}),e==null?void 0:e.properties)}},E8=class{constructor(e,t){var n,i;this.mh=[],this._instance=e,this.yh=t,this.bh=new Map,this._h=new Map,this.wh=new Map,this.kh=(n=this._instance)===null||n===void 0||(i=n.onSessionId)===null||i===void 0?void 0:i.call(n,a=>this.Sh(a))}xh(e){return!1}$h(){return null}Ch(e){}Th(){}Ih(e,t){return!!e&&qj(e.propertyFilters,t==null?void 0:t.properties)}Mh(e,t){const n=new Map;return e.forEach(i=>{var a;(a=i.conditions)===null||a===void 0||(a=a[t])===null||a===void 0||(a=a.values)===null||a===void 0||a.forEach(o=>{if(o!=null&&o.name){const u=n.get(o.name)||[];u.push(i.id),n.set(o.name,u)}})}),n}Eh(e,t,n){const i=(n===Qc.Activation?this.bh:this._h).get(e);let a=[];return this.Ph(o=>{a=o.filter(u=>i==null?void 0:i.includes(u.id))}),a.filter(o=>{var u;const h=(u=o.conditions)===null||u===void 0||(u=u[n])===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.find(f=>f.name===e);return this.Ih(h,t)})}register(e){this.Rh(e,!1)}replace(e){this.Rh(e,!0)}Rh(e,t){var n;ue((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.Ah(e,t),this.Fh(e,t))}Fh(e,t){const n=e.filter(o=>{var u;return(u=o.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length});var i;if(t&&this.wh.clear(),n.length===0)return void(t&&((i=this.Oh)===null||i===void 0||i.replace([])));this.Oh||(this.Oh=new C8(this._instance),this.Oh.init(),this.Oh.hh(o=>this.onAction(o)));const a=[];n.forEach(o=>{var u;(u=o.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||u.values.forEach(h=>{if(a.push(h),h.name){var f;const p=(f=this.wh.get(h.name))!==null&&f!==void 0?f:[];p.includes(o.id)||p.push(o.id),this.wh.set(h.name,p)}})}),t?this.Oh.replace(a):this.Oh.register(a)}Dh(e,t){t.forEach((n,i)=>{var a;const o=(a=e.get(i))!==null&&a!==void 0?a:[];n.forEach(u=>{o.includes(u)||o.push(u)}),e.set(i,o)})}Ah(e,t){var n,i;const a=e.filter(f=>{var p,g;return((p=f.conditions)===null||p===void 0?void 0:p.events)&&((g=f.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),o=e.filter(f=>{var p,g;return((p=f.conditions)===null||p===void 0?void 0:p.cancelEvents)&&((g=f.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),u=this.Mh(e,Qc.Activation),h=this.Mh(e,Qc.Cancellation);t?(this.bh=u,this._h=h):(this.Dh(this.bh,u),this.Dh(this._h,h)),(a.length!==0||o.length!==0||e.some(f=>{var p;return(p=f.conditions)===null||p===void 0||(p=p.actions)===null||p===void 0||(p=p.values)===null||p===void 0?void 0:p.length}))&&((n=this.ah)!==null&&n!==void 0||(this.ah=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((f,p)=>{this.onEvent(f,p)})))}onEvent(e,t){var n,i;const a=this.Lh(),o=(t==null||(n=t.properties)===null||n===void 0?void 0:n.$survey_id)||(t==null||(i=t.properties)===null||i===void 0?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){const h=this.Nh(e,o,t);if(h==="consume")return a.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.qh([o]);if(h==="persist")return a.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.jh(o),void this.Bh([o])}if(this._h.has(e)){const h=this.Eh(e,t,Qc.Cancellation);h.length>0&&(a.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(f=>f.id)}),this.qh(h.map(f=>f.id)),h.forEach(f=>this.zh(f.id)))}if(!this.bh.has(e))return;a.info("event name matched",{event:e,eventPayload:t,items:this.bh.get(e)});const u=this.Eh(e,t,Qc.Activation);this.Hh(u.map(h=>h.id))}onAction(e){this.wh.has(e)&&this.Hh(this.wh.get(e)||[])}Hh(e){var t,n;if(e.length===0)return;const i=!!(!((t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0)&&n.call(t)),a=[];for(const o of e)i&&this.xh(o)?this.jh(o)&&this.Uh(o):a.push(o);a.length>0&&(this.mh=[...new Set([...this.mh,...a])]),this.Lh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Wh()}jh(e){this.mh=this.mh.filter(n=>n!==e);const t=this.Vh();return!t.includes(e)&&(this.Gh([...t,e]),this.Qh(),!0)}qh(e){const t=new Set(e);this.mh=this.mh.filter(a=>!t.has(a));const n=this.Zh(),i=n.filter(a=>!t.has(a));i.length!==n.length&&(this.Gh(i),i.length===0&&this.Jh()),this.Bh(e),this.Wh()}Wh(){try{var e;(e=this.yh)===null||e===void 0||e.call(this)}catch(t){this.Lh().error("Error while handling activated items change",t)}}Kh(){var e;const t=this.$h();if(!t)return{};const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return n&&typeof n=="object"?n:{}}Uh(e){if(!this.$h())return;const t=this.Kh();this.Ch(D(D({},t),{},{[e]:Date.now()}))}Bh(e){if(!this.$h())return;const t=this.Kh(),n={};let i=!1;for(const[a,o]of Object.entries(t))e.includes(a)?i=!0:n[a]=o;i&&(_s(n)?this.Th():this.Ch(n))}Xh(){this.$h()&&this.Th()}getActivationTimestamp(e){if(!this.Vh().includes(e))return;const t=this.Kh()[e];return sn(t)?t:void 0}Zh(){var e;const t=this.Yh();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Vh(){var e,t,n;const i=this.Zh();if(i.length===0)return[];const a=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.td()],o=(t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0?void 0:n.call(t);return o&&a===o?i:[]}Qh(){var e,t;const n=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);n&&this.ed(n)}Jh(){this.nd()}Sh(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.td()];if(n&&n!==e){const i=this.Zh(),a=this.Kh();i.length>0&&(this.Gh([]),i.filter(o=>sn(a[o])).forEach(o=>this.zh(o))),this.Jh(),this.Xh(),i.length>0&&this.Wh()}}getActivatedIds(){return[...new Set([...this.Vh(),...this.mh])].filter(e=>!this.sd(e))}dispose(){var e,t,n;(e=this.kh)===null||e===void 0||e.call(this),this.kh=void 0,(t=this.ah)===null||t===void 0||t.call(this),this.ah=void 0,(n=this.Oh)===null||n===void 0||n.dispose(),this.Oh=void 0}reset(){this.mh=[],this.Zh().length>0&&this.Gh([]),this.Jh(),this.Xh(),this.Wh()}getEventToItemsMap(){return this.bh}rd(){return this.Oh}},T8=class extends E8{constructor(e,t){super(e,t)}Yh(){return Dk}td(){return zk}$h(){return $k}Ch(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}Th(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}xh(e){var t;let n;this.Ph(a=>{n=a.find(o=>o.id===e)});const i=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return sn(i)&&i>0}od(){return Ps.SHOWN}Ph(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}zh(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Lh(){return bt}Gh(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}ed(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}nd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}sd(){return!1}Nh(e,t,n){var i;if(e===Ps.SENT&&(n==null||(i=n.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let a;return this.Ph(o=>{a=o.find(u=>u.id===t)}),!a||(function(o){var u;return Uj(o)&&!!(!((u=o.conditions)===null||u===void 0||(u=u.events)===null||u===void 0)&&u.repeatedActivation)||o.schedule==="always"})(a)?e===Ps.SHOWN?"consume":"ignore":e===Ps.SHOWN?"persist":e===Ps.DISMISSED||e===Ps.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},M8=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const n of e){const i=this._instance.get_property(n);ue(i)||(t[n]=i)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},A8=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Fe==null?void 0:Fe.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:n}=e;return{generateSurveys:t?i=>t(this._instance,i):void 0,loadExternalDependency:n?i=>n(this._instance,"surveys",i):void 0}}createEventReceiver(e){return new T8(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(o=>{o!=="$pageview"&&o!==Ps.SHOWN&&o!==Ps.DISMISSED&&o!==Ps.SENT||e()}),n=()=>e();gt(re,"PHSurveyShown",n);let i=!1;const a=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,t(),a(),re==null||re.removeEventListener("PHSurveyShown",n)}}};const R8=re!=null&&re.location?af(re.location.hash,"__posthog")||af(location.hash,"state"):null,N5="_postHogToolbarParams",C5=Vt("[Toolbar]"),E5=Vt("[FeatureFlags]"),Xa=Vt("[FeatureFlags]",{debugEnabled:!0}),Qg=`" failed. Feature flags didn't load in time.`,O8=[502,504],T5=["click","keydown","wheel","touchstart","pointerdown"],M5="connection_error",A5=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},R5=e=>{const t={};for(const[n,i]of Ph(e||{}))i&&(t[n]=i);return t};var L8=class{constructor(e){this.name="featureFlags",this.ad=!1,this.featureFlagEventHandlers=[],this.A=E5,this.ld={},this.ud={},this.hd=[],this.dd=new Set,this.vd=new Set,this.fd=!1,this.pd=!1,this.gd=0,this.md=!1,this.yd=!1,this.bd=!1,this._d=!1,this.wd=0,this.kd=!1,this.rn=()=>{const t=this.Sd();this.wd=0,t&&this.reloadFeatureFlags()},this.xd=()=>{var t,n;const i=this.$d,a=(t=this.Cd)!==null&&t!==void 0?t:i;ue(i)||ue(a)||this.Mr.remoteRequestsDisabled||!this.Td||this.Td.visibilityState==="hidden"||Date.now()-((n=this.Id)!==null&&n!==void 0?n:0)<a||(this.Cd=this.kd||!this.Mr.idleRefreshBackoff?i:Math.min(2*a,36e5),this.kd=!1,this.reloadFeatureFlags(),this.Md())},this.Ed=()=>{this.kd&&this.Cd===this.$d||this.Pd()},this.sn=()=>{var t;((t=this.Td)===null||t===void 0?void 0:t.visibilityState)==="visible"&&this.Pd()},this.ko=e}get Rd(){}Ad(){this._o&&this.Fd()}setup(e){try{this.Od=typeof window>"u"?void 0:window,this.Td=typeof document>"u"?void 0:document}catch{this.Od=void 0,this.Td=void 0}return this.Nc=e,this.A=e.logger.createLogger("[FeatureFlags]"),Kx(e.kv.initialize(),()=>{this.Nc===e&&(this.Nc=void 0,this._o=e,this.Dd(e))})}Dd(e){var t;if(this._o===e)return this.Od&&gt(this.Od,"online",this.rn),this.Fd(),this.Ld=e.registerDynamicEventProperties(()=>this.Nd()?this.ld:this.ud),this.qd=(t=this.Rd)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.jd(),this.Bd(),this.zd()}),this.Bd(),this.initialize()}Pd(){this.kd=!0,this.Cd=this.$d,this.xd()}Fd(){var e;const t=this.Mr.refreshIntervalMs,n=!this.Mr.remoteRequestsDisabled&&this.Td&&!ue(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.Cd=n),n!==this.$d&&(this.Hd(),ue(n)||(this.$d=n,this.Cd=n,this.Md(),!((e=this.Td)===null||e===void 0)&&e.addEventListener&&(gt(this.Td,Eu,this.sn),xo(T5,i=>{gt(this.Td,i,this.Ed,{capture:!0})}))))}Md(){ue(this.$d)||(ue(this.Ud)||clearInterval(this.Ud),this.Id=Date.now(),this.Ud=setInterval(this.xd,this.$d))}Hd(){var e,t;ue(this.Ud)||(clearInterval(this.Ud),this.Ud=void 0,(e=this.Td)===null||e===void 0||(t=e.removeEventListener)===null||t===void 0||t.call(e,"visibilitychange",this.sn),xo(T5,n=>{var i,a;(i=this.Td)===null||i===void 0||(a=i.removeEventListener)===null||a===void 0||a.call(i,n,this.Ed,{capture:!0})})),this.$d=void 0,this.Cd=void 0,this.kd=!1,this.Id=void 0}destroy(){this.Wd()}dispose(){this.Wd()}Wd(){var e,t,n;this.Hd(),this.gd++,this.yd=!1,this.Nc=void 0,this.Vd(this.dd,"cancelled"),this.Vd(this.vd,"cancelled"),this._o&&(this.Gd(),(e=this.Ld)===null||e===void 0||e.dispose(),this.Ld=void 0,(t=this.qd)===null||t===void 0||t.call(this),this.qd=void 0,this.hd=[],(n=this.Od)===null||n===void 0||n.removeEventListener("online",this.rn),this._o=void 0)}get Mr(){return this.ko.get()}Qd(e){var t;return this.Zd&&e in this.Zd?this.Zd[e]:(t=this._o)===null||t===void 0?void 0:t.kv.get(e)}jd(){return!!this.Zd&&(this.Zd=void 0,!0)}Jd(){var e;return!ue((e=this._o)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.jd()}$t(e){this.Kd(()=>{var t;return(t=this._o)===null||t===void 0?void 0:t.kv.set(e)})}Xd(e,t,n){if(!this.Rd||!e.$enabled_feature_flags)return;const i=this.Qd("$enabled_feature_flags")||{},a=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,u=t.flags?Object.entries(t.flags).filter(([,N])=>!(N!=null&&N.failed)).map(([N])=>N):[],h=!!t.errorsWhileComputingFlags&&!!t.flags,f=h?u:n&&!Pe(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(i),...Object.keys(a)])),p=this.Qd("$feature_flag_payloads")||{},g=e.$feature_flag_payloads||{},v=h||n?f:Array.from(new Set([...Object.keys(p),...Object.keys(g)])),y=!h&&!n,b=!!y||f,_=!!y||v,k={[gr]:b,[pi]:b,[da]:_};e.$feature_flag_details&&(k[sl]=b);for(const N of[il,ha,du])ue(e[N])||(k[N]=!0);this.Rd.markCrossTabFeatureFlagChanges(k)}Pt(e){this.Kd(()=>{var t;return(t=this._o)===null||t===void 0?void 0:t.kv.remove(e)})}Kd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Bd(){const e={};for(const i of[gr,da,il,Bi]){const a=this.Qd(i);ue(a)||(e[i]=a)}this.ld=e;const t=D({},e),n=this.Qd(pi);if(n)for(const[i,a]of Object.entries(n))t[`$feature/${i}`]=a;this.ud=t}Nd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Qd(ha);return typeof t!="number"||Date.now()-t>e}Yd(){return!!this.Nd()&&(this._d||this.pd||(this._d=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}tv(){const e=this.Mr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}ev(){const e=this.Mr.flagKeys;if(!ue(e))return e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n})}initialize(){var e,t;const n=this.Mr,i=(e=(t=n.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,o;const u=(a=(o=n.bootstrap)===null||o===void 0?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},h=Object.keys(i).filter(p=>!ue(i[p])).reduce((p,g)=>(p[g]=i[g],p),{}),f=Object.keys(u).filter(p=>h[p]).reduce((p,g)=>(p[g]=u[g],p),{});return this.iv({featureFlags:h,featureFlagPayloads:f},void 0,{persist:!1})}}updateFlags(e,t,n){var i,a;const o=n!=null&&n.merge&&(i=this.Qd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.Qd("$feature_flag_payloads"))!==null&&a!==void 0?a:{},h=D(D({},o),e),f=D(D({},u),t),p={};for(const[g,v]of Object.entries(h))p[g]={key:g,enabled:ww(v),variant:Sw(v),reason:void 0,metadata:ue(f==null?void 0:f[g])?void 0:{id:0,version:void 0,description:void 0,payload:f[g]}};this.iv({flags:p})}get hasLoadedFlags(){return this.fd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Qd(sl),t=this.Qd(Bi),n=this.Qd(el);if(!n&&!t)return e||{};const i=Pt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(const h of a){var o,u;const f=i[h],p=t==null?void 0:t[h],g=ue(p)?(o=f==null?void 0:f.enabled)!==null&&o!==void 0&&o:!!p,v=ue(p)?f==null?void 0:f.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[h],b=D(D({},f),{},{enabled:g,variant:g?v??(f==null?void 0:f.variant):void 0});g!==(f==null?void 0:f.enabled)&&(b.original_enabled=f==null?void 0:f.enabled),v!==(f==null?void 0:f.variant)&&(b.original_variant=f==null?void 0:f.variant),y&&(b.metadata=D(D({},f==null?void 0:f.metadata),{},{payload:y,original_payload:f==null||(u=f.metadata)===null||u===void 0?void 0:u.payload})),i[h]=b}return this.ad||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ad=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const i=e[n];return{key:n,enabled:ww(i),variant:Sw(i),payload:_w(t[n])}})}getFlagVariants(){const e=this.Qd(pi),t=this.Qd(Bi);if(!t)return e||{};const n=Pt({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ad||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ad=!0),n}getFlagPayloads(){const e=this.Qd(da),t=this.Qd(el);if(!t)return e||{};const n=Pt({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.ad||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ad=!0),n}reloadFeatureFlags(){this.md||this.Mr.featureFlagsDisabled||this.Sd()||(this.pd&&(this.yd=!0),this.nv||(this.hd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.nv=setTimeout(()=>{this.sv()},5)))}reloadFeatureFlagsAsync(){return!this._o||this.md||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.Sd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.dd.add(e),this.reloadFeatureFlags()})}Vd(e,t){e.forEach(n=>n({status:t})),e.clear()}Gd(){clearTimeout(this.nv),this.nv=void 0}onReloading(e){return this.hd.push(e),()=>{this.hd=this.hd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.fd||this.pd||this.nv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.md=e}resetFlagCallReported(){this.Pt(ua)}sv(e){var t;this.Gd();const n=this._o;if(!n||this.Mr.remoteRequestsDisabled||this.Sd())return void this.Vd(this.dd,"skipped");if(this.pd)return void(this.yd=!0);const i={token:n.projectToken,distinct_id:n.distinctId,groups:n.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:D(D(D({},n.initialPersonProperties),this.Qd("$stored_person_properties")||{}),{},{$lib:n.library.name,$lib_version:n.library.version}),group_properties:this.Qd(oa),timezone:dj()};ue(n.deviceId)||(i.$device_id=n.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const a=this.tv();a.length&&(i.evaluation_contexts=a);const o=this.ev();ue(o)||(i.flag_keys=o);const u=this.Mr.onlyEvaluateSurveyFeatureFlags,h="/flags/?v=2"+(u?"&only_evaluate_survey_feature_flags=true":""),f=this.gd,p=this.dd;this.dd=new Set,this.vd=p,this.pd=!0;const g=()=>{this.yd&&(this.yd=!1,this.sv())},v=N=>{var S,C;const T=(S=N.json)!==null&&S!==void 0?S:{},R=N.statusCode!==200;if(this.pd=!1,f!==this.gd)return void g();if(this.rv(N.statusCode),R||this.yd||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.yd)return void this.Vd(p,"skipped");this.bd=!R;const A=[];N.error?A.push(N.error instanceof Error&&N.error.name==="AbortError"?"timeout":N.error instanceof Error?M5:"unknown_error"):N.statusCode!==200&&A.push(`api_error_${N.statusCode}`),T.errorsWhileComputingFlags&&A.push("errors_while_computing_flags");const O=!!(!((C=T.quotaLimited)===null||C===void 0)&&C.includes("feature_flags"));O&&A.push("quota_limited"),this.$t({[Cu]:A}),O?this.A.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."):i.disable_flags||this.iv(T,R,{partialResponse:u}),this.Vd(p,i.disable_flags?"skipped":A.length||!T.flags&&!T.featureFlags?"error":"loaded"),g()},y=N=>{this.pd=!1,f===this.gd&&(this.$t({[Cu]:[M5]}),this.A.error("Feature flag request failed",N),this.Jd()&&this.zd(!0),this.Vd(p,"error")),g()};let b=(t=this.Mr.requestMaxRetries)!==null&&t!==void 0?t:1;const _=()=>b>0&&f===this.gd,k=()=>{if(f!==this.gd||!this._o||this.Mr.remoteRequestsDisabled)return this.pd=!1,this.Vd(p,"skipped"),void g();try{n.sendRequest(h,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(N=>{if((S=>O8.includes(S.statusCode)||(C=>C.statusCode===0&&C.error instanceof Error&&C.error.name==="AbortError")(S))(N)&&_())return b--,void setTimeout(k,500);v(N)}).catch(y)}catch(N){y(N)}};k()}Sd(){return fj(this.wd,3)}rv(e){this.wd=pj(e,this.wd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var n;if(t.fresh&&!this.bd)return;if(!(this.fd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+Qg);if(this.Yd())return;const i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.bd)return;if(!(this.fd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+Qg);if(this.Yd())return;const n=this.getFlagVariants(),i=e in n,a=n[e],o=this.getFlagPayloads()[e],u=String(a),h=this.Qd("$feature_flag_request_id")||void 0,f=this.Qd("$feature_flag_evaluated_at")||void 0;let p,g=this.Qd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var v;const K=(v=this._o)===null||v===void 0||(v=v.session)===null||v===void 0?void 0:v.sessionId,F=this.Qd(su);K&&K!==F&&(g={},p=K)}if(!t.send_event&&"send_event"in t)p&&this.$t({[ua]:g,[su]:p});else if(e in g&&g[e].includes(u))p&&this.$t({[ua]:g,[su]:p});else{var y,b,_,k,N,S,C,T,R,A,O,P,z;Pe(g[e])?g[e].push(u):g[e]=[u],this.$t(D({[ua]:g},p?{[su]:p}:{}));const K=this.getFeatureFlagDetails(e),F=[...(y=this.Qd("$feature_flag_errors"))!==null&&y!==void 0?y:[]];ue(a)&&F.push("flag_missing");const q={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o??null,$feature_flag_request_id:h,$feature_flag_evaluated_at:f,$feature_flag_bootstrapped_response:(b=(_=this.Mr.bootstrap)===null||_===void 0||(_=_.featureFlags)===null||_===void 0?void 0:_[e])!==null&&b!==void 0?b:null,$feature_flag_bootstrapped_payload:(k=(N=this.Mr.bootstrap)===null||N===void 0||(N=N.featureFlagPayloads)===null||N===void 0?void 0:N[e])!==null&&k!==void 0?k:null,$used_bootstrap_value:!this.bd};ue(K==null||(S=K.metadata)===null||S===void 0?void 0:S.has_experiment)||(q.$feature_flag_has_experiment=K.metadata.has_experiment),ue(K==null||(C=K.metadata)===null||C===void 0?void 0:C.version)||(q.$feature_flag_version=K.metadata.version);const L=(T=K==null||(R=K.reason)===null||R===void 0?void 0:R.description)!==null&&T!==void 0?T:K==null||(A=K.reason)===null||A===void 0?void 0:A.code;L&&(q.$feature_flag_reason=L),!(K==null||(O=K.metadata)===null||O===void 0)&&O.id&&(q.$feature_flag_id=K.metadata.id),ue(K==null?void 0:K.original_variant)&&ue(K==null?void 0:K.original_enabled)||(q.$feature_flag_original_response=ue(K.original_variant)?K.original_enabled:K.original_variant),!(K==null||(P=K.metadata)===null||P===void 0)&&P.original_payload&&(q.$feature_flag_original_payload=K==null||(z=K.metadata)===null||z===void 0?void 0:z.original_payload),F.length&&(q.$feature_flag_error=F.join(",")),this.ov(q)}return i?{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:_w(o)}:void 0}ov(e){try{var t;(t=this._o)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.av(e,t)}av(e,t){var n=this;return Rt(function*(){const i=n._o;if(!i)return;const a={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},o=n.tv();o.length&&(a.evaluation_contexts=o);const u=n.ev();let h;ue(u)||(a.flag_keys=u);try{var f;const p=(f=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.Mr.compression,sentAt:"body",timeoutMs:n.Mr.requestTimeoutMs})).json)===null||f===void 0?void 0:f.featureFlagPayloads;h=(p==null?void 0:p[e])||void 0}catch(p){return void n.A.error("Remote config feature flag request failed",p)}try{t(h)}catch(p){n.A.error("Remote config feature flag callback failed",p)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.bd)return t.defaultValue;if(!(this.fd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+Qg),t.defaultValue;const n=this.getFeatureFlag(e,t);return ue(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.iv(e,t,n)}iv(e,t,n){if(!this._o)return;this.fd=!0;const i=((a,o={},u={},h={},f,p=E5)=>{const g=((T,R)=>{const A=T.flags;if(A){const O=Object.fromEntries(Object.keys(A).map(z=>{var K;return[z,(K=A[z].variant)!==null&&K!==void 0?K:A[z].enabled]})),P=Object.fromEntries(Object.keys(A).filter(z=>A[z].enabled).filter(z=>{var K;return!ue((K=A[z].metadata)===null||K===void 0?void 0:K.payload)}).map(z=>{var K;return[z,(K=A[z].metadata)===null||K===void 0?void 0:K.payload]}));return D(D({},T),{},{featureFlags:O,featureFlagPayloads:P})}return T.featureFlags&&R.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),T})(a,p),v=g.flags,y=g.featureFlags,b=g.featureFlagPayloads;if(!y)return;const _=a.requestId,k=a.evaluatedAt;if(Pe(y)){p.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const T={};if(y)for(let R=0;y.length>R;R++)T[y[R]]=!0;return{[gr]:y,[pi]:T,[du]:!1}}let N=y,S=b,C=v;if(f!=null&&f.partialResponse){const T=Object.keys(N),R=S||{};N=D(D({},o),N),S=D(D({},u),R),T.forEach(A=>{A in R||S==null||delete S[A]}),C=D(D({},h),C)}else if(a.errorsWhileComputingFlags)if(v){const T=new Set(Object.keys(v).filter(A=>{var O;return!(!((O=v[A])===null||O===void 0)&&O.failed)}));N=D(D({},o),Object.fromEntries(Object.entries(N).filter(([A])=>T.has(A))));const R=Object.fromEntries(Object.entries(S||{}).filter(([A])=>T.has(A)));S=D(D({},u),R),T.forEach(A=>{A in R||S==null||delete S[A]}),C=D(D({},h),Object.fromEntries(Object.entries(C||{}).filter(([A])=>T.has(A))))}else N=D(D({},o),N),S=D(D({},u),S),C=D(D({},h),C);return D(D({[gr]:Object.keys(R5(N)),[pi]:N||{},[da]:S||{},[sl]:C||{},[du]:a.minimalFlagCalledEvents===!0},_?{[il]:_}:{}),k?{[ha]:k}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(i)if((n==null?void 0:n.persist)===!1){const a=!ue(this._o.kv.get(pi));this.Zd=i,a||this.$t(i)}else this.jd(),this.Xd(i,e,!!(n!=null&&n.partialResponse)),this.$t(i);else t&&this.Jd();t||(this._d=!1),this.zd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.lv(e)}lv(e){if(this._o){if(e===!1)return this.Pt([Bi,el]),this.zd(),void Xa.info("All overrides cleared");if(Pe(e))return this.$t({[Bi]:A5(e)}),this.zd(),void Xa.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const n=e;this.ad=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const i={},a=n.flags,o=n.payloads;return a&&(i[Bi]=Pe(a)?A5(a):a),o&&(i[el]=o),Object.keys(i).length&&this.$t(i),a===!1&&o===!1?this.Pt([Bi,el]):a===!1?this.Pt(Bi):o===!1&&this.Pt(el),this.zd(),a===!1?Xa.info("Flag overrides cleared"):a&&Xa.info("Flag overrides set",{flags:a}),void(o===!1?Xa.info("Payload overrides cleared"):o&&Xa.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.$t({[Bi]:e}),this.zd(),void Xa.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.fd){const{flags:t,flagVariants:n}=this.uv();try{e(t,n)}catch(i){this.A.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i;const a=(this.Qd("$early_access_features")||[]).find(p=>p.flagKey===e),o={[`$feature_enrollment/${e}`]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);const h=D(D({},this.getFlagVariants()),{},{[e]:t});(i=this.Rd)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(o)}),this.$t({[gr]:Object.keys(R5(h)),[pi]:h,[ca]:D(D({},this.Qd("$stored_person_properties")||{}),o)}),this.zd();try{var f;(f=this._o)===null||f===void 0||f.capture("$feature_enrollment_update",u)}catch(p){this.A.error("Failed to capture early access feature enrollment",p)}}getEarlyAccessFeatures(e,t=!1,n){const i=this.Qd(I0);!i||t?this.hv(e,n):e(i)}hv(e,t){var n=this;return Rt(function*(){const i=n._o;if(!i)return;const a=t?`&${t.map(u=>`stage=${u}`).join("&")}`:"";let o;try{const u=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${a}`,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;o=u.json.earlyAccessFeatures,n.$t({[I0]:o})}catch(u){return void n.A.error("Early access feature request failed",u)}try{e(o)}catch(u){n.A.error("Early access feature callback failed",u)}})()}uv(){const 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),{})}}zd(e){this.Bd();const{flags:t,flagVariants:n}=this.uv();this.featureFlagEventHandlers.forEach(i=>{try{i(t,n,{errorsLoading:e})}catch(a){this.A.error("Error while running feature flags callback",a)}})}setPersonPropertiesForFlags(e,t=!0){this.dv(e,t)}dv(e,t=!0){const n=this.Qd("$stored_person_properties")||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(const u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this.$t({[ca]:D(D(D({},n),o),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=D({},this.Qd("$stored_person_properties")||{});e.forEach(i=>{delete n[i]}),this.$t({[ca]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(ca),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this.Qd("$stored_group_properties")||{},i=D({},n);for(const a of Object.keys(e))i[a]=D(D({},n[a]),e[a]);this.$t({[oa]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Qd("$stored_group_properties")||{};this.$t({[oa]:D(D({},t),{},{[e]:{}})})}else this.Pt(oa)}reset(){this.gd++,this.Vd(this.dd,"cancelled"),this.Vd(this.vd,"cancelled"),this.yd=!1,this.ld={},this.ud={},this.Zd=void 0,this.fd=!1,this.md=!1,this.bd=!1,this.$anon_distinct_id=void 0,this.Gd(),this.ad=!1,this.wd=0}};const O5=Vt("[FeatureFlags]");var D8=class{constructor(e,t=!1){this.vv=!1,this.update(e,t)}update(e,t){this.fv=((n,i)=>{var a,o,u,h,f,p,g,v;return{bootstrap:{featureFlags:(a=(o=n.bootstrap)===null||o===void 0?void 0:o.featureFlags)!==null&&a!==void 0?a:void 0,featureFlagPayloads:(u=(h=n.bootstrap)===null||h===void 0?void 0:h.featureFlagPayloads)!==null&&u!==void 0?u:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!n.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!n.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!n.advanced_feature_flags_dedup_per_session,cacheTtlMs:n.feature_flag_cache_ttl_ms,refreshIntervalMs:(f=n.remote_config_refresh_interval_ms)!==null&&f!==void 0?f:3e5,idleRefreshBackoff:ue(n.remote_config_refresh_interval_ms),requestTimeoutMs:n.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(p=n.feature_flag_request_max_retries)!==null&&p!==void 0?p:1),compression:n.disable_compression?void 0:"best-available",evaluationContexts:(g=(v=n.evaluation_contexts)!==null&&v!==void 0?v:n.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:Pe(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.vv||(O5.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.vv=!0),ue(e.flag_keys)||Pe(e.flag_keys)||O5.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.fv}};const L5=e=>zo(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),hi=Vt("[Error tracking]"),rx="webkit-masked-url:",z8=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],$8=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",rx],P8=["__firefox__","__gCrWeb"],D5="Refusing to render web experiment since the viewer is a likely bot",B8={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>uf(t,e),not_regex:(e,t)=>!uf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Ws=Vt("[Conversations]"),Wa="Conversations not available yet.";function z5(e,t){var n,i,a,o,u,h,f;const p=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,g=(i=e==null?void 0:e.maxBufferSize)!==null&&i!==void 0?i:100,v=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,y=ue(v)?Math.max(g,2048):Math.max(g,v),b=D(D({},(function(){let _="",k="";try{var N;const S="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,C=S==null||(N=S.navigator)===null||N===void 0?void 0:N.userAgent;C&&([_,k]=tk(C))}catch{}return(function(S,C){const T=(function(R){if(R)return{}.hasOwnProperty.call(Tw,R)?Tw[R]:R})(S);return D(D({},T?{"os.name":T}:{}),C?{"os.version":C}:{})})(_,k)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(o=(u=b==null?void 0:b["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&o!==void 0?o:t==null?void 0:t.serviceNameDefault,serviceVersion:(h=b==null?void 0:b["service.version"])!==null&&h!==void 0?h:e==null?void 0:e.serviceVersion,environment:(f=b==null?void 0:b["deployment.environment"])!==null&&f!==void 0?f:e==null?void 0:e.environment,resourceAttributes:b,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:p,maxBufferSize:g,maxQueueSize:y,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const I8=["debug","log","warn","error","info"],F8=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},$5="console",Zj="__posthogHandledLogsRequestError",Xg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[Zj]=!0,n},P5=e=>!!e&&typeof e=="object"&&e[Zj]===!0;var U8=class{get pv(){return D(D({},this.A),{},{error:(...e)=>{e.some(P5)||this.A.error(...e)}})}constructor(e,t){var n;this.ko=e,this.gv=t,this.name="logs",this.mv=!1,this.yv=!1,this.bv=!1,this.A=Vt("[logs]"),this.al=[],this._v=[],this.wd=0,this.wv=!1,this.Io=!1,this.Sv=[],this.xv=[],this.$v=!1,this.Cv=!1,this.Tv=!1,this.Iv=()=>{var i,a;this.Io||(this.wd=0,(i=this.Mv)===null||i===void 0||i.onReconnect(),(a=this.Ev)===null||a===void 0||a.onReconnect())},this.mv=!!(!((n=e.get())===null||n===void 0)&&n.captureConsoleLogs)}get Pv(){return!0}Rv(){}Av(){if(!this.Tv){try{this.Od=typeof window>"u"?void 0:window}catch{this.Od=void 0}this.Od&&(gt(this.Od,"online",this.Iv),this.Tv=!0)}}Fv(e,t,n,i){this.Av();const a=z5(this.ko.get(),n);return[new OA(this.Ov(e,t),a,this.pv,()=>this.gv(),o=>o(),void 0,i),a]}Dv(){const e=this.ko.get();var t;return this.Mv&&this.Lv===e||((t=this.Mv)===null||t===void 0||t.reset(),this.Lv=e,[this.Mv,this.Nv]=this.Fv(()=>this.al,n=>{this.al=n})),this.Mv}qv(){const e=this.ko.get();var t;return this.Ev&&this.jv===e||((t=this.Ev)===null||t===void 0||t.reset(),this.jv=e,[this.Ev,this.Bv]=this.Fv(()=>this._v,n=>{this._v=n},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},$5)),this.Ev}setup(e){if(!this.Io&&!this.wv)return this.wv=!0,this._o=e,this.A=e.logger.createLogger("[logs]"),Kx(e.kv.initialize(),()=>{this.Io||this.Dd(e)})}Dd(e){var t;this.Av(),!((t=this.ko.get())===null||t===void 0)&&t.captureConsoleLogs&&(this.mv=!0),(this.mv||this.ko.remoteConfigWillArrive&&e.kv.get(this.ko.captureHintKey))&&this.zv();let n=!1;const i=e.onRemoteConfig(a=>{var o;n=a.ok&&((o=a.config.logs)===null||o===void 0?void 0:o.captureConsoleLogs)===!0,this.onRemoteConfig(a)});this.Io?i.dispose():(this.Po=i,n||this.loadIfEnabled())}dispose(){var e,t,n,i,a,o,u;this.Io||(this.Io=!0,this.Hv(),(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this._o=void 0,this.bv=!1,(t=this.Od)===null||t===void 0||t.removeEventListener("online",this.Iv),(n=this.Uv)===null||n===void 0||n.call(this),this.Uv=void 0,(i=this.Mv)===null||i===void 0||i.clearQueue(),(a=this.Ev)===null||a===void 0||a.clearQueue(),(o=this.Mv)===null||o===void 0||o.reset(),(u=this.Ev)===null||u===void 0||u.reset())}onRemoteConfig(e){var t,n;if(this.Io)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;qe(i)?this.Wv():((n=this._o)===null||n===void 0||n.kv.set(this.ko.captureHintKey,!!i),i?(this.mv=!0,this.yv||this.zv(),this.loadIfEnabled()):this.Wv())}reset(){var e,t,n,i;this.Hv(),(e=this.Mv)===null||e===void 0||e.clearQueue(),this.al=[],(t=this.Mv)===null||t===void 0||t.reset(),(n=this.Ev)===null||n===void 0||n.clearQueue(),this._v=[],(i=this.Ev)===null||i===void 0||i.reset(),this.wd=0}captureLog(e){!this.Io&&this._o&&this.Dv().captureLog(e)}captureConsoleLog(e){!this.Io&&this._o&&this.qv().captureLog(e)}captureBufferedConsoleLog(e,t,n){!this.Io&&this._o&&this.qv().captureLog(e,{context:t,occurredAtMs:n})}Cc(){var e;this.Hv(),(e=this.Ev)===null||e===void 0||e.clearQueue(),this._v=[]}Wv(){this.mv||this.Hv()}zv(){var e;if(this.$v||!(!((e=this.Od)===null||e===void 0)&&e.console))return;const t=z5(this.ko.get()).maxBufferSize;let n=!0;this.xv.push(()=>{n=!1});for(const i of I8){let a;try{a=F8(this.Od.console[i])}catch{continue}a&&this.xv.push(Ro(this.Od.console,i,o=>{const u=(...h)=>{try{n&&this.Vv(i,h,t)}catch{}return o.apply(this.Od.console,h)};return u.__rrweb_original__=a,u}))}this.$v=!0,this.Gv=setTimeout(()=>{this.Hv()},3e4)}Vv(e,t,n){var i;if(this.$v&&!this.Cv&&t.length!==0)if(!((i=this._o)===null||i===void 0)&&i.canCapture){if(n>this.Sv.length){this.Cv=!0;try{this.Sv.push({level:e,args:t,occurredAtMs:Date.now(),context:this.gv()})}finally{this.Cv=!1}}}else this.Hv()}Hv(){if(this.Sv=[],this.$v){this.$v=!1,this.Gv&&(clearTimeout(this.Gv),this.Gv=void 0);for(const e of this.xv)e();this.xv=[]}}Qv(){const e=this.Sv;return this.Hv(),e}get logger(){return this.Zv||(this.Zv={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.Zv}flushLogs(e){this._o&&(e?this.Jv(e):(this.Mv&&this.Mv.flush().catch(t=>this.Kv(t)),this.Ev&&this.Ev.flush().catch(t=>this.Kv(t))))}flush(){var e=this;return Rt(function*(){var t,n;const i=(t=e.Mv)===null||t===void 0?void 0:t.flush().catch(o=>e.Kv(o)),a=(n=e.Ev)===null||n===void 0?void 0:n.flush().catch(o=>e.Kv(o));yield i,yield a})()}Kv(e){P5(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Io||!this.mv||this.yv||this.bv)return;const e=this.Rv();if(e){this.bv=!0;try{e((t,n)=>{if(this.bv=!1,!this.Io&&this.mv)if(t||!n)this.A.error("Could not load logs script",t),this.Hv();else{const i=this.Qv();this.Uv=n.initialize(this._o),this.yv=!0,i.length>0&&n.replay(this._o,i)}})}catch(t){throw this.bv=!1,t}}else this.Hv()}Ov(e,t){const n=this._o;return{get isDisabled(){return!1},get optedOut(){return!n.canCapture},getPersistedProperty:i=>i===Ii.LogsQueue?e():void 0,setPersistedProperty(i,a){i===Ii.LogsQueue&&t(a??[])},js:i=>this.js(i),getLibraryId:()=>n.library.name,getLibraryVersion:()=>n.library.version}}js(e){return new Promise(t=>{if(fj(this.wd,3))return void t({kind:"fatal",error:Xg(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const i=u=>{n||(n=!0,clearTimeout(a),t(u))},a=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Xg(void 0,"logs request timed out")})},9e4),o=this.Pv;this._o.sendRequest("/i/v1/logs",{method:"POST",query:{token:this._o.projectToken},body:e,compression:"best-available",timeoutMs:6e4}).then(u=>{var h;const f=u.statusCode;this.Xv(f,o),f>=200&&300>f?i({kind:"ok"}):f===413?i({kind:"too-large"}):f!==0&&f!==408&&f!==429&&500>f?i({kind:"fatal",error:new Error(`logs request failed with status ${f}`)}):f===0?(u.error||this.A.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Xg(u.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error(`logs request failed with status ${f}`)})},u=>{i({kind:"retry-later",error:u})})})}Xv(e,t){(e!==0||t)&&(this.wd=pj(e,this.wd,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Jv(e){this.al.length>0&&this.Yv(e,this.al,this.Nv,this._o.library.name,t=>{this.al=t}),this._v.length>0&&this.Yv(e,this._v,this.Bv,$5,t=>{this._v=t})}Yv(e,t,n,i,a){if(t.length===0)return;const o=t.map(h=>h.record);a([]);const u=kk(o,Sk(n,this._o.library.name,this._o.library.version),i,this._o.library.version);this._o.sendRequest("/i/v1/logs",{method:"POST",query:{token:this._o.projectToken},body:u,compression:"best-available",transport:e,timeoutMs:6e4}).catch(h=>this.Kv(h))}};const df=Vt("[NetworkMetrics]"),Zx=()=>{var e;return!(re==null||(e=re.performance)===null||e===void 0)&&e.now?re.performance.now():Date.now()},H8={"http:":80,"https:":443},q8=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Jj=(e,t)=>{var n;const i=String(t);return{method:String(e).toUpperCase(),url:((n=_r(i))===null||n===void 0?void 0:n.href)||i}},ax=(e,t,n,i,a,o,u=!1)=>{try{var h,f;const p=a();if(!p)return;const g=n||void 0,v=Zx()-i,y=_r(t.url);if(y&&y.protocol!=="http:"&&y.protocol!=="https:")return;const b={url:(y==null?void 0:y.href)||t.url,method:t.method},_=ln(p.name)?p.name(b):Ke(p.name)?p.name:"http.client.request.duration";if(!_)return;const k=u&&!g?void 0:((S,C)=>S?400>S?void 0:String(S):(C==null?void 0:C.name)||"_OTHER")(g,o),N=D(D(D(D(D({},(S=>{const C=q8.has(S)?S:"_OTHER";return D({"http.request.method":C},C==="_OTHER"&&S!==C?{"http.request.method_original":S}:{})})(b.method)),y?(S=>{return{"server.address":S.hostname.startsWith("[")&&S.hostname.endsWith("]")?S.hostname.slice(1,-1):S.hostname,"server.port":Number(S.port)||H8[S.protocol],"url.scheme":S.protocol.slice(0,-1),"url.template":(C=S.pathname,C.split("/").map(T=>(R=>/^\d+$/.test(R)||R.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(R))(T)?":id":T).join("/"))};var C})(y):{}),g?{"http.response.status_code":g}:{}),k?{"error.type":k}:{}),(h=p.attributes)===null||h===void 0?void 0:h.call(p,b,{status:g,durationMs:v}));(f=e.metrics)===null||f===void 0||f.histogram(_,v,{unit:"ms",attributes:N})}catch(p){df.error("Failed to record network metric",p)}},eN=()=>{},V8=(e,t)=>ln(re==null?void 0:re.fetch)?Ro(re,"fetch",n=>function(...i){const a=Zx(),o=n.apply(this,i);if(!t())return o;try{var u,h,f;const[p,g]=i,v=Jj((u=(h=g==null?void 0:g.method)!==null&&h!==void 0?h:p==null?void 0:p.method)!==null&&u!==void 0?u:"GET",(f=p==null?void 0:p.url)!==null&&f!==void 0?f:p);return o.then(y=>(ax(e,v,y==null?void 0:y.status,a,t,void 0,!0),y),y=>{throw ax(e,v,void 0,a,t,y),y})}catch(p){return df.error("Failed to observe fetch",p),o}}):eN,G8=(e,t)=>{var n;const i=re==null||(n=re.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!i)return eN;const a=new WeakMap,o=Ro(i,"open",h=>function(...f){try{Tj.has(this)||a.set(this,Jj(f[0],f[1]))}catch(p){df.error("Failed to observe XHR open",p)}return h.apply(this,f)}),u=Ro(i,"send",h=>function(...f){let p;try{const g=a.get(this);if(g&&t()){const v=Zx();p=()=>{this.removeEventListener("loadend",p),ax(e,g,this.status,v,t)},gt(this,"loadend",p)}}catch(g){df.error("Failed to observe XHR send",g)}try{return h.apply(this,f)}catch(g){throw p&&this.removeEventListener("loadend",p),g}});return()=>{o(),u()}},B5=new WeakMap,Y8=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),Q8={maxStringLength:2048,truncationSuffix:"..."},X8={maxStringLength:2048,truncationSuffix:"..."};function I5(e){if(e)return e===!0?{intent:!0,model:!0}:{intent:e.intent!==!1,model:e.model!==!1}}function Wg(e,t){return{}.hasOwnProperty.call(e,t)}function Kg(e,t){const n=Object.create(e);return t&&Object.defineProperty(n,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),n}function F5(e,t,n=!1){if(!Ke(e))return;const i=e.trim();return i?(n?vk(i,Q8):i).slice(0,t):void 0}function U5(e){try{return Ve(e)&&e.isError===!0}catch{return!1}}function W8(e,t){try{return vk((t?(function(n){try{return!Ve(n)||!Pe(n.content)?void 0:n.content.filter(i=>Ve(i)&&i.type==="text"&&Ke(i.text)).map(i=>i.text).join(" ").trim()||void 0}catch{return}})(e):Ve(e)&&Ke(e.message)?e.message:Ke(e)?e:String(e))||"Unknown error",X8).slice(0,2048)}catch{return"Unknown error"}}function K8(e,t){if(t)return"Error";try{if(!Ve(e))return"Error";let n=Ke(e.name)?e.name.trim():"";const i=e.constructor;return n&&n!=="Error"||!ln(i)||i.name==="Error"||(n=i.name),(n||"Error").slice(0,256)}catch{return"Error"}}function Z8(e,t){return{message:W8(e,t),type:K8(e,t)}}const jf={featureFlags:class extends L8{constructor(e){const t=new D8(e.config,e.nl());super(t),this.name=Yj,this._instance=e,this.tf=t}get Rd(){return this._instance.persistence}updateConfig(e,t){this.tf.update(e,t),this.Ad()}}},J8={sessionRecording:class{get Mr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var e;return!!(!((e=this.ef)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.if==="awaiting_config"||this.if==="missing_config"?this.if:(e=(t=this.ef)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.if}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.if=Vg,this.nf=void 0,this.sf=!1,this.Je=(()=>{var t,n;if(!(ge!=null&&ge.visibilityState)||ge.visibilityState==="visible")return!0;const i=re==null||(t=re.performance)===null||t===void 0||(n=t.getEntriesByType)===null||n===void 0?void 0:n.call(t,"visibility-state");return!(i!=null&&i.length)||i.some(a=>a.name==="visible")})(),this.sn=()=>{var t,n;(ge==null?void 0:ge.visibilityState)==="visible"&&(this.Je=!0,(t=this.ef)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw dr.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');ge!=null&&ge.addEventListener&&gt(ge,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.sf=!0,ge==null||(t=ge.removeEventListener)===null||t===void 0||t.call(ge,"visibilitychange",this.sn),e?this.rf(!0):this.stopRecording()}get af(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),n=!this.Mr.disable_session_recording,i=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(this.sf||this.af&&(!((t=this.ef)===null||t===void 0)&&t.isStarted))return;const n=!ue(Object.assign)&&!ue(Array.from);this.af&&n?(this.lf(e),dr.info("starting")):(this.if=Vg,this.stopRecording())}lf(e){var t,n;if(this.af)if(this.if!=="awaiting_config"&&this.if!=="missing_config"&&(this.if=S5),(Fe==null||(t=Fe.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((n=Fe.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.uf(e);else{var i,a;const o=this._instance.sessionManager;(i=Fe.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this._instance,this.cf,u=>{if(!this.sf&&this.af&&this._instance.sessionManager===o)return u?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),dr.error("could not load recorder",u)):void this.uf(e);this.if="disabled"})}}stopRecording(){var e,t;(e=this.nf)===null||e===void 0||e.call(this),this.nf=void 0,(t=this.ef)===null||t===void 0||t.stop()}rf(e=!1){var t,n;(t=this.nf)===null||t===void 0||t.call(this),this.nf=void 0,(n=this.ef)===null||n===void 0||n.discard({discardProducerEvents:e})}hf(){var e,t;(e=this.Ml)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Ml)===null||t===void 0||t.unregister("$replay_sample_rate")}df(e,t){if(qe(e))return null;const n=sn(e)?e:parseFloat(e);return typeof(i=n)!="number"||!Number.isFinite(i)||0>i||i>1?(dr.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var i}vf(e){if(this.Ml){var t,n;const i=this.Ml,a=()=>{var o;const u=e.sessionRecording===!1?void 0:e.sessionRecording,h=this.df((o=this.Mr.session_recording)===null||o===void 0?void 0:o.sampleRate,"session_recording.sampleRate"),f=this.df(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=h??f;qe(p)&&this.hf();const g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[fu]:D(D({cache_timestamp:Date.now(),enabled:!!u},u),{},{networkPayloadCapture:D({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:ue(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})})};a(),(t=this.nf)===null||t===void 0||t.call(this),this.nf=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(a)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.vf(t),void this.rf()):(this.vf(t),void this.startIfEnabledOrStop()):(this.if==="awaiting_config"&&(this.if="missing_config",this._instance.register_for_session({[Ix]:!0}),dr.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.ef)===null||n===void 0)&&n.log?this.ef.log(e,t):dr.warn("log called before recorder was ready")}get cf(){var e,t;const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(fu);return(n==null||(t=n.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}ff(){const e=this._instance.get_property(fu);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return dr.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!qe(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}uf(e){var t,n,i;if(!this.sf&&this.af&&this._instance.sessionManager){if(!(!((t=Fe.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return dr.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Bx]:!0});var a;if(this.ef||(this.ef=(a=Fe.__PosthogExtensions__)===null||a===void 0?void 0:a.initSessionRecording(this._instance,this.Je),this.ef._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ff())return this.if==="missing_config"||this.if==="awaiting_config"?void 0:(this.if="awaiting_config",dr.info("persisted remote config is stale, requesting fresh config before starting"),void new Sj(this._instance).load());this.if=S5,(n=(i=this.ef).setDocumentWasEverVisible)===null||n===void 0||n.call(i,this.Je),this.ef.start(e)}else this.if=Vg}onRRwebEmit(e){var t,n;(t=this.ef)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.ef||(t=this.Ml)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.ef)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ef||(t=this.Ml)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.ef)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.ef||(n=this.Ml)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.ef)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const i of S8){var n;const a=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(i);ue(a)||(t[i]=a)}return D(D({},t),((e=this.ef)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var n;return!!(!((n=this.ef)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.ef)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},e7={autocapture:class extends v8{constructor(e){super(new y8(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.pf=!1,this._instance=e,this.gf=this.mf()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.yf();return!!(e.path||e.search||this.bf(e))}startIfEnabled(){this.isEnabled&&(be.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.gf=this.mf(),this.startIfEnabled()}stop(){this._f&&this._f(),this._f=void 0,this.wf&&this.wf(),this.wf=void 0,be.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.kf("pushState"),this.kf("replaceState"),this.Sf(),this.bf()&&this.xf())}kf(e){var t;if(!re||!((t=re.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;Ro(re.history,e,i=>function(a,o,u){var h;n.$f(u)&&n.Cf(),i.call(this,a,o,u),n.Tf(e,!n.pf&&(re==null||(h=re.event)===null||h===void 0?void 0:h.type)!=="popstate")})}mf(){const e=re==null?void 0:re.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}yf(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:Ve(e)?e:{}}bf(e=this.yf()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}If(e){const t=this.yf(),n=this.gf;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.bf(t)&&e.hash!==n.hash))}Tf(e,t=!1){try{t||this.Cf();const n=this.mf();if(!n)return;if(this.If(n)){const i=()=>this._instance.capture(Ux,{navigation_type:e});t?(this.Mf=i,Promise.resolve().then(()=>this.Cf())):i()}this.gf=n}catch(n){be.error(`Error capturing ${e} pageview`,n)}}$f(e){var t,n;return!(qe(e)||!re)&&((t=_r(String(e)))===null||t===void 0?void 0:t.href)!==((n=re.location)===null||n===void 0?void 0:n.href)}Cf(){const e=this.Mf;if(e){this.Mf=void 0,this.pf=!0;try{e()}catch(t){be.error("Error capturing deferred pageview",t)}finally{this.pf=!1}this.gf=this.mf()}}Sf(){if(this._f)return;const e=()=>{this.Tf("popstate")};gt(re,"popstate",e),this._f=()=>{re&&re.removeEventListener("popstate",e)}}xf(){if(this.wf)return;const e=()=>{this.Tf("hashchange")};gt(re,"hashchange",e),this.wf=()=>{re&&re.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.Ef=!1,this.So=!1,this.Pf=null,this.instance=e,this.Ef=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[U0]),this.rageclicks=new Kj(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return Ve(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return qe(this.Mr.capture_heatmaps)?qe(this.Mr.enable_heatmaps)?this.Ef:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.So)return;k8.info("starting..."),this.Rf(),this.sn()}else{var e;clearInterval((e=this.Pf)!==null&&e!==void 0?e:void 0),this.Af(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[U0]:n}),this.Ef=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Ff(e){Gg(e.originalEvent)&&this.Ir(e.originalEvent,"deadclick")}sn(){this.Pf&&clearInterval(this.Pf),this.Pf=(ge==null?void 0:ge.visibilityState)==="visible"?setInterval(this.pl.bind(this),this.flushIntervalMilliseconds):null}Rf(){re&&ge&&(this.Of=this.pl.bind(this),gt(re,sf,this.Of),this.Df=e=>this.Ir(e||(re==null?void 0:re.event)),gt(ge,"click",this.Df,{capture:!0}),this.Lf=e=>this.Nf(e||(re==null?void 0:re.event)),gt(ge,"mousemove",this.Lf,{capture:!0}),this.qf=new Kw(this.instance,j3,this.Ff.bind(this)),this.qf.startIfEnabledOrStop(),this.jf=this.sn.bind(this),gt(ge,Eu,this.jf),this.So=!0)}Af(){var e;re&&ge&&(this.Of&&re.removeEventListener(sf,this.Of),this.Df&&ge.removeEventListener("click",this.Df,{capture:!0}),this.Lf&&ge.removeEventListener("mousemove",this.Lf,{capture:!0}),this.jf&&ge.removeEventListener(Eu,this.jf),clearTimeout(this.Bf),(e=this.qf)===null||e===void 0||e.stop(),this.So=!1)}zf(e,t){const n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,h,f){let p=u;for(;p&&yi(p)&&!Hn(p,"body");){if(p===f)return!1;let b;try{var g,v,y;b=(g=(v=(y=p.ownerDocument)===null||y===void 0?void 0:y.defaultView)!==null&&v!==void 0?v:re)===null||g===void 0?void 0:g.getComputedStyle(p).position}catch{return!1}if(Ie(h,b))return!0;p=ij(p)}return!1})(mu(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Ir(e,t="click"){var n;if(Iw(e.target)||!Gg(e))return;const i=this.zf(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&aj(mu(e),this.instance.config.rageclick)&&this.Qs(D(D({},i),{},{type:"rageclick"})),this.Qs(i)}Nf(e){!Iw(e.target)&&Gg(e)&&(clearTimeout(this.Bf),this.Bf=setTimeout(()=>{this.Qs(this.zf(e,"mousemove"))},500))}Qs(e){if(!re)return;const t=this.Mr.disable_capture_url_hashes?pa(re.location.href):re.location.href,n=this.Mr.custom_personal_data_properties,i=this.Mr.mask_personal_data_properties?[...Mo,...n||[]]:[],a=Mu(t,i,Au);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}pl(){this.Rt&&!_s(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Kw,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Ef=!1,this.So=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hf=()=>{clearTimeout(this.Uf),this.Uf=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",D({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,i)=>D(D({},n),{},{[`$web_vitals_${i.name}_event`]:D({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Wf=n=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},qe(n==null?void 0:n.name)||qe(n==null?void 0:n.value))return void Qa.error("Invalid metric received",n);const a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.Vf(a);if(ue(o))return;const u=sn(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${o}`;if(this.Gf&&n.value>=this.Gf)return void Qa.error("Ignoring metric with value >= "+this.Gf,n);this.Rt.navigationKey!==u&&(this.Hf(),this.Uf=setTimeout(this.Hf,this.flushToCaptureTimeoutMs)),ue(this.Rt.navigationKey)&&(this.Rt.navigationKey=u,this.Rt.url=o),this.Rt.firstMetricTimestamp=ue(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const h=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),f=D(D(D({},n),a?{navigationURL:o}:{}),{},{$current_url:o,timestamp:Date.now()});if(delete f.entries,Ve(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const p={};for(const g of w8){const v=g==="url"&&typeof n.attribution[g]=="string"?this.Vf(n.attribution[g]):n.attribution[g];ue(v)||(p[g]=v)}f.attribution=p}else delete f.attribution;ue(h)||(f.$session_id=h.sessionId,f.$window_id=h.windowId),this.Rt.metrics.push(f),this.Rt.metrics.length===this.allowedMetrics.length&&this.Hf()},this.Qf=()=>{if(this.So)return;let n,i,a,o,u=!1;const h=Fe.__PosthogExtensions__,f=h==null?void 0:h.postHogWebVitalsCallbacksByFlavor,p=(f==null?void 0:f[this.Zf])||(this.Zf==="web-vitals"&&ue(f)?h==null?void 0:h.postHogWebVitalsCallbacks:void 0);if(!ue(p)){const y=p.withoutAttribution,b=this.attributionMetrics;u=!ue(y),n=b.indexOf("LCP")>-1?p.onLCP:(y==null?void 0:y.onLCP)||p.onLCP,i=b.indexOf("CLS")>-1?p.onCLS:(y==null?void 0:y.onCLS)||p.onCLS,a=b.indexOf("FCP")>-1?p.onFCP:(y==null?void 0:y.onFCP)||p.onFCP,o=b.indexOf("INP")>-1?p.onINP:(y==null?void 0:y.onINP)||p.onINP}if(!(n&&i&&a&&o))return void Qa.error("web vitals callbacks not loaded - not starting");const g={reportSoftNavs:this.useSoftNavs},v=u&&this.attributionMetrics.indexOf("INP")>-1?D(D({},g),{},{includeProcessedEventEntries:!1}):g;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Wf.bind(this),g),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Wf.bind(this),g),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Wf.bind(this),g),this.allowedMetrics.indexOf("INP")>-1&&o(this.Wf.bind(this),v),this.So=!0},this.Ef=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[V0]),this.startIfEnabled()}get Jf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=Ve(this.Jf)?(e=this.Jf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return qe(n)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||w5:n}get flushToCaptureTimeoutMs(){return(Ve(this.Jf)?this.Jf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=Ve(this.Jf)?this.Jf.web_vitals_attribution:void 0;return os(e)?e?w5:[]:Pe(e)?e:_8}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=Ve(this.Jf)?this.Jf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Gf(){const e=Ve(this.Jf)&&sn(this.Jf.__web_vitals_max_value)?this.Jf.__web_vitals_max_value:_5;return e>0&&6e4>=e?_5:e}get isEnabled(){const e=$t==null?void 0:$t.protocol;if(e!=="http:"&&e!=="https:")return Qa.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=Ve(this.Jf)?this.Jf.web_vitals:os(this.Jf)?this.Jf:void 0;return os(t)?t:this.Ef}startIfEnabled(){this.isEnabled&&!this.So&&(Qa.info("enabled, starting..."),this.Ho(this.Qf))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const n=Ve(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Ve(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[V0]:n}),this._instance.persistence.register({[Rk]:i})),this.Ef=n,this.startIfEnabled()}get Zf(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(e){var t;const n=Fe.__PosthogExtensions__,i=this.Zf,a=n==null?void 0:n.postHogWebVitalsCallbacksByFlavor;a!=null&&a[i]||i==="web-vitals"&&ue(a)&&(n!=null&&n.postHogWebVitalsCallbacks)?e():n==null||(t=n.loadExternalDependency)===null||t===void 0||t.call(n,this._instance,i,o=>{o?Qa.error("failed to load script",o):e()})}Vf(e){const t=e||(re==null?void 0:re.location.href);if(!t)return void Qa.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?pa(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...Mo,...i||[]]:[];return Mu(n,a,Au)}}},t7={exceptionObserver:class{constructor(e){var t;this.Qf=()=>{var n;if(!re||!this.isEnabled||!(!((n=Fe.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const i=Fe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Fe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Fe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Kf&&this.Mr.capture_unhandled_errors&&(this.Kf=i(this.captureException.bind(this))),!this.Xf&&this.Mr.capture_unhandled_rejections&&(this.Xf=a(this.captureException.bind(this))),!this.Yf&&this.Mr.capture_console_errors&&(this.Yf=o(this.captureException.bind(this)))}catch(u){Kc.error("failed to start",u),this.tp()}},this._instance=e,this.ep=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[H0]),this.wt=new p4(D(D({},(function(n={}){var i,a,o,u;return{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Kc})),this.Mr=this.np(),this.startIfEnabledOrStop()}np(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ve(e)?t=D(D({},t),e):(ue(e)?this.ep:e)&&(t=D(D({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Kc.info("enabled"),this.tp(),this.Ho(this.Qf)):this.tp()}Ho(e){var t,n,i;!((t=Fe.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(n=Fe.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"exception-autocapture",a=>{if(a)return Kc.error("failed to load script",a);e()})}tp(){var e,t,n;(e=this.Kf)===null||e===void 0||e.call(this),this.Kf=void 0,(t=this.Xf)===null||t===void 0||t.call(this),this.Xf=void 0,(n=this.Yf)===null||n===void 0||n.call(this),this.Yf=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.ep=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[H0]:this.ep}),this.Mr=this.np(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.np()}captureException(e){try{var t,n,i;const a=(t=e==null||(n=e.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(a))return void Kc.info("Skipping exception capture because of client rate limiting.",{exception:a});(i=this._instance.exceptions)===null||i===void 0||i.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,n;this.sp=[],this.rp=new N4([new F4,new W4,new H4,new U4,new Q4,new Y4,new V4,new X4],(function(i,...a){return(o,u=0)=>{const h=[],f=o.split(`
68
+ `),p=Math.min(f.length,u+1e3),g=[];for(let b=u;p>b;b++){const _=f[b];if(_.length>1024)continue;const k=bw.test(_)?_.replace(bw,"$1"):_;if(!k.match(/\S*Error: /)){for(const N of a){const S=N(k,i);if(S){h.push(S);const C=$4(h);if(C){for(let T=g.length-1;T>=0;T--){const R=g[T];if(C.start>=R.start+R.length)break;g.pop()}g.push(C)}break}}if(B4(h,g)>=50)break}}const v=[...g].sort((b,_)=>_.start-b.start),y=v[v.length-1];if(y){const b=ck(h,y);h.splice(y.start-b,b);for(const _ of v)_.start-=b}for(const b of v)P4(h,b);return g.some(b=>b.start===0&&h.length===b.length)&&(function(b){const _=b.map(N=>`${N.function}|${N.filename}|${N.lineno}|${N.colno}|${N.module}`);let k=0;for(let N=1;_.length>N;N++)I4(_,N,k)&&(k=N);b.push(...b.splice(0,k))})(h),(function(b){if(!b.length)return[];const _=Array.from(b);return _.reverse(),_.slice(0,50).map(k=>{return D(D({},k),{},{filename:k.filename||(N=_,N[N.length-1]||{}).filename,function:k.function||"?"});var N})})(h)}})("web:javascript",O4,z4)),this._instance=e,this.sp=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.op=Kh(this.ap()),this.lp=new Z4(this.op)}onConfigChange(){this.op=Kh(this.ap()),this.lp.setConfig(this.op)}onRemoteConfig(e){var t,n,i;if(!e.ok)return;const a=e.config;if(!("errorTracking"in a))return;const o=(t=(n=a.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)===null||i===void 0?void 0:i.captureExtensionExceptions;this.sp=o,this._instance.persistence&&this._instance.persistence.register({[Mk]:this.sp,[q0]:u})}get up(){var e;const t=!!this._instance.get_property(q0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.rp.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.op.enabled)try{if(!Ke(e)||e.trim().length===0)return void hi.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:i}=(function(a){if(!a)return{sanitizedProperties:{},droppedKeys:[]};const o=[];return{sanitizedProperties:Object.keys(a).reduce((u,h)=>K4.has(h)?(o.push(h),u):(u[h]=a[h],u),{}),droppedKeys:o}})(this.cp(t));i.length>0&&hi.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.lp.add(D({[Xh]:e,[Wh]:new Date().toISOString()},n))}catch(n){hi.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.hp(t)){if(this.dp(t))return this.vp("Exception dropped: matched a suppression rule"),void hi.info("Skipping exception capture because a suppression rule matched");if(!this.up&&this.fp(t))return this.vp("Exception dropped: thrown by a browser extension"),void hi.info("Skipping exception capture because it was thrown by an extension");if(!this.up&&this.pp(t))return this.vp("Exception dropped: thrown by an injected browser script"),void hi.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.gp(t))return this.vp("Exception dropped: thrown by the PostHog SDK"),void hi.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.op.enabled&&qe(e.$exception_steps)?this.mp(e):e,i=(function(){if("u">typeof process){var a;const u=(a=i4.POSTHOG_RELEASE_ID)===null||a===void 0?void 0:a.trim();if(u)return u}const o=globalThis._posthogReleaseId;return typeof o=="string"&&o.length>0?o:void 0})();i&&(n.$release_id=i);try{const a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",dc:!0});return a&&this.lp.clear(),a}catch(a){return L5(a)||hi.error("Failed to capture exception event. Dropping this exception.",a),void this.lp.clear()}}catch(t){return void(L5(t)||hi.error("Failed to process exception event. Ignoring this exception.",t))}}mp(e){try{const t=this.lp.getAttachable();return t.length===0?e:D(D({},e),{},{$exception_steps:t})}catch(t){return hi.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}vp(e){this.op.enabled&&this.lp.add({[Xh]:e,[Wh]:new Date().toISOString()})}cp(e){return Ve(e)?D({},e):{}}ap(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}dp(e){if(e.length===0)return!1;try{const t=e.reduce((n,{type:i,value:a})=>(Ke(i)&&i.length>0&&n.$exception_types.push(i),Ke(a)&&a.length>0&&n.$exception_values.push(a),n),{$exception_types:[],$exception_values:[]});return this.sp.some(n=>{const i=n.values.map(a=>{const o=Hj[a.operator],u=t[a.key];if(!o||!u)return!1;const h=Pe(a.value)?a.value:[a.value];return h.length>0&&o(h,u)});return n.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return hi.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}fp(e){const t=e.flatMap(i=>{var a,o;return(a=(o=i.stacktrace)===null||o===void 0?void 0:o.frames)!==null&&a!==void 0?a:[]}),n=t.filter(({filename:i})=>!!i&&$8.some(a=>i.startsWith(a)));return n.length!==0&&(!n.every(({filename:i})=>!!i&&i.startsWith(rx))||e.some(({type:i,value:a})=>i==="NoResponse"||Ke(a)&&z8.some(({value:o,exact:u})=>u?a===o:a.includes(o)))&&!t.some(({in_app:i,filename:a})=>i&&!(a!=null&&a.startsWith(rx))))}pp(e){return e.some(({value:t})=>Ke(t)&&P8.some(n=>t.includes(n)))}gp(e){if(e.length>0){var t,n,i,a;const o=(t=(n=e[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)===null||a===void 0?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}hp(e){return!qe(e)&&Pe(e)}}},n7=D({productTours:class{get Ml(){return this._instance.persistence}constructor(e){this.yp=null,this.bp=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var n,i;if(this.Ml&&this.Ml.register({[$x]:!!t.productTours}),!Yg(this._instance))return!this.yp&&qe((n=this.Ml)===null||n===void 0?void 0:n.props.ph_product_tours)||yh.info("product tours disabled; stopping and clearing cached tours"),(i=this.yp)===null||i===void 0||i.stop(),this.yp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.yp&&Yg(this._instance)&&this.Ho(()=>this._p())}Ho(e){var t,n,i;!((t=Fe.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(n=Fe.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"product-tours",a=>{a?yh.error("Could not load product tours script",a):e()})}_p(){var e;!this.yp&&(!((e=Fe.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.yp=Fe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Pe(this.bp)&&!t)return void e(this.bp,{isLoaded:!0});const n=this.Ml;if(n){const i=n.props[G0];if(Pe(i)&&!t)return this.bp=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",timestampMode:"query",callback:i=>{if(!Yg(this._instance))return void e([],{isLoaded:!0});const a=i.statusCode;if(a!==200||!i.json){const u=`Product Tours API could not be loaded, status: ${a}`;return a===0?i.error||yh.warn(u):yh.error(u),void e([],{isLoaded:!1,error:u})}const o=Pe(i.json.product_tours)?i.json.product_tours:[];this.bp=o,n&&n.register({[G0]:o}),e(o,{isLoaded:!0})}})}getActiveProductTours(e){qe(this.yp)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.yp.getActiveProductTours(e)}showProductTour(e){var t;(t=this.yp)===null||t===void 0||t.showTourById(e)}previewTour(e){this.yp?this.yp.previewTour(e):this.Ho(()=>{var t;this._p(),(t=this.yp)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.yp)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.yp)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.yp)===null||e===void 0||e.previousStep()}clearCache(){var e;this.bp=null,(e=this.Ml)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.yp)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.yp)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.yp)===null||t===void 0||t.cancelPendingTour(e)}}},jf),s7={siteApps:class{constructor(e){this._instance=e,this.wp=0,this.kp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Sp(e,t){if(!t)return;const n=this.globalsForEvent(t);this.kp.push(n),this.kp.length>1e3&&(this.kp=this.kp.slice(10))}get siteAppLoaders(){var e;return(e=Fe._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.Sp.bind(this));this.xp=()=>{e(),this.kp=[],this.xp=void 0}}}globalsForEvent(e){var t,n,i,a,o,u,h;if(!e)throw new Error("Event payload is required");const f={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(const[b,_]of Object.entries(g))f[b]={id:p[b],type:b,properties:_};const{$set_once:v,$set:y}=e;return{event:D(D({},fk(e,j8)),{},{properties:D(D(D({},e.properties),y?{$set:D(D({},(t=(n=e.properties)===null||n===void 0?void 0:n.$set)!==null&&t!==void 0?t:{}),y)}:{}),v?{$set_once:D(D({},(i=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&i!==void 0?i:{}),v)}:{}),elements_chain:(o=(u=e.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(h=e.properties)===null||h===void 0?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:f}}$p(e){var t;const n=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||($i.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||($i.error("prepare_external_dependency_script returned null"),null):e}Cp(){var e,t,n,i,a,o,u,h;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const f=ge==null?void 0:ge.defaultView,p=f==null||(e=f.Node)===null||e===void 0?void 0:e.prototype;if(!f||!p)return()=>{};if(this.wp++,this.Tp)return this.Ip();const g=[],v=this,y=new WeakSet,b=(N,S,C)=>{if(!(N!=null&&N[S]))return;const T=N[S];N[S]=C(T),g.push(()=>{N[S]=T})},_=N=>{if(y.has(N))return N;const S=v.$p(N);return S&&y.add(S),S},k=N=>N.map(S=>typeof S=="string"?S:_(S)).filter(S=>!Xt(S));return b(p,"appendChild",N=>function(S){const C=_(S);return C?N.call(this,C):S}),b(p,"insertBefore",N=>function(S,C){const T=_(S);return T?N.call(this,T,C):S}),b(p,"replaceChild",N=>function(S,C){const T=_(S);return T?N.call(this,T,C):C}),[(t=f.Element)===null||t===void 0?void 0:t.prototype,(n=f.Document)===null||n===void 0?void 0:n.prototype,(i=f.DocumentFragment)===null||i===void 0?void 0:i.prototype].forEach(N=>{b(N,"append",S=>function(...C){return S.apply(this,k(C))}),b(N,"prepend",S=>function(...C){return S.apply(this,k(C))})}),[(a=f.Element)===null||a===void 0?void 0:a.prototype,(o=f.CharacterData)===null||o===void 0?void 0:o.prototype,(u=f.DocumentType)===null||u===void 0?void 0:u.prototype].forEach(N=>{b(N,"before",S=>function(...C){return S.apply(this,k(C))}),b(N,"after",S=>function(...C){return S.apply(this,k(C))}),b(N,"replaceWith",S=>function(...C){const T=k(C);return C.length&&!T.length?void 0:S.apply(this,T)})}),b((h=f.Element)===null||h===void 0?void 0:h.prototype,"insertAdjacentElement",N=>function(S,C){const T=_(C);return T?N.call(this,S,T):null}),this.Tp=()=>{g.forEach(N=>N()),this.Tp=void 0},this.Ip()}Ip(){let e=!1;return()=>{var t;e||(e=!0,this.wp--,this.wp===0&&((t=this.Tp)===null||t===void 0||t.call(this)))}}Mp(e,t=!0){const n=this.Cp();try{const i=e(n);return t&&n(),i}catch(i){throw n(),i}}setupSiteApp(e){const t=this.apps[e.id],n=()=>{var o;!t.errored&&this.kp.length&&($i.info(`Processing ${this.kp.length} events for site app with id ${e.id}`),this.kp.forEach(u=>this.Mp(()=>{var h;return(h=t.processEvent)===null||h===void 0?void 0:h.call(t,u)})),t.processedBuffer=!0),Object.values(this.apps).every(u=>u.processedBuffer||u.errored)&&((o=this.xp)===null||o===void 0||o.call(this))};let i=!1;const a=o=>{t.errored=!o,t.loaded=!0,$i.info(`Site app with id ${e.id} ${o?"loaded":"errored"}`),i&&n()};try{const{processEvent:o}=this.Mp(u=>e.init({posthog:this._instance,callback(h){u(),a(h)}}),!1);o&&(t.processEvent=o),i=!0}catch(o){$i.error(k5+e.id,o),a(!1)}if(i&&t.loaded)try{n()}catch(o){$i.error(`Error while processing buffered events PostHog app with config id ${e.id}`,o),t.errored=!0}}Ep(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Pp(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.Mp(()=>{var i;return(i=n.processEvent)===null||i===void 0?void 0:i.call(n,t)})}catch(i){$i.error(`Error while processing event ${e.event} for site app ${n.id}`,i)}}onRemoteConfig(e){var t,n,i;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Ep(),void this._instance.on("eventCaptured",h=>this.Pp(h))):void $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.xp)===null||n===void 0||n.call(this),!e.ok)return;const a=e.config;if(!((i=a.siteApps)===null||i===void 0)&&i.length)if(this.isEnabled)for(const{id:h,url:f}of a.siteApps){var o,u;Fe[`__$$ph_site_app_${h}`]=this._instance,(o=Fe.__PosthogExtensions__)===null||o===void 0||(u=o.loadSiteApp)===null||u===void 0||u.call(o,this._instance,f,p=>{if(p)return $i.error(k5+h,p)})}else $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},i7={tracingHeaders:class{constructor(e){this._instance=e,this.Rp=void 0,this.Ap=void 0,this.Fp=void 0,this.Qf=()=>{const t=this.Op();var n,i;t?(ue(this.Rp)&&(this.Rp=(n=Fe.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),ue(this.Ap)&&(this.Ap=(i=Fe.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.tp()}}initialize(){this.startIfEnabledOrStop()}Ho(e){var t,n,i;!((t=Fe.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(n=Fe.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"tracing-headers",a=>{if(a)return b8.error("failed to load script",a);e()})}Dp(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Op(){const e=this.Dp();return Pe(e)?(Pe(this.Fp)?this.Fp.splice(0,this.Fp.length,...e):this.Fp=[...e],e.length>0?this.Fp:void 0):(Pe(this.Fp)&&this.Fp.splice(0),this.Fp=e||void 0,this.Fp)}tp(){var e,t;(e=this.Rp)===null||e===void 0||e.call(this),(t=this.Ap)===null||t===void 0||t.call(this),this.Rp=void 0,this.Ap=void 0}startIfEnabledOrStop(){this.Op()?this.Ho(this.Qf):this.tp()}}},r7=D({surveys:class extends N8{constructor(e){var t;super(new A8(e),(t=e,{get projectToken(){return t.config.token},kv:new M8(t)})),this._instance=e}Vc(e,t){const n=t.query?zu(e,t.query):e;return new Promise(i=>{var a;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((a=t.target)!==null&&a!==void 0?a:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:i})})}}},jf),a7={toolbar:class{constructor(e){this.instance=e}Lp(e){Fe.ph_toolbar_state=e}Np(){var e;return(e=Fe.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,n=void 0){var i,a;if(Q0(this.instance.config)||!re||!ge)return!1;e=(i=e)!==null&&i!==void 0?i:re.location,n=(a=n)!==null&&a!==void 0?a: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}const o=R8||af(e.hash,"__posthog")||af(e.hash,"state");let u;const h=o?pw(()=>JSON.parse(atob(decodeURIComponent(o))))||pw(()=>JSON.parse(decodeURIComponent(o))):null;return h&&h.action==="ph_authorize"?(u=h,u.source="url",u&&Object.keys(u).length>0&&(h.desiredHash?e.hash=h.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):(u=JSON.parse(t.getItem(N5)||"{}"),u.source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token||(this.loadToolbar(u),0))}catch{return!1}}qp(e){const t=Fe.ph_load_toolbar||Fe.ph_load_editor;!qe(t)&&ln(t)?t(e,this.instance):C5.warn("No toolbar load function found")}loadToolbar(e){const t=!!(ge!=null&&ge.getElementById("__POSTHOG_TOOLBAR__"));if(!re||t)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=D(D({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(re.localStorage.setItem(N5,JSON.stringify(D(D({},i),{},{source:void 0}))),this.Np()===2)this.qp(i);else if(this.Np()===0){var a,o;this.Lp(1),(a=Fe.__PosthogExtensions__)===null||a===void 0||(o=a.loadExternalDependency)===null||o===void 0||o.call(a,this.instance,"toolbar",u=>{if(u)return C5.error("[Toolbar] Failed to load",u),void this.Lp(0);this.Lp(2),this.qp(i)}),gt(re,"turbolinks:load",()=>{this.Lp(0),this.loadToolbar(i)})}return!0}jp(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},l7=D({experiments:class rs{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(i=>{rs.Bp("retrieved web experiments from the server"),this.zp=new Map,i.forEach(a=>{if(a.feature_flag_key){var o;this.zp&&(rs.Bp("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=this.zp)===null||o===void 0||o.set(a.feature_flag_key,a));const u=this._instance.getFeatureFlag(a.feature_flag_key);Ke(u)&&a.variants[u]&&this.Hp(a.name,u,a.variants[u].transforms)}else if(a.variants)for(const u in a.variants){const h=a.variants[u];rs.Up(h,this._instance)&&this.Hp(a.name,u,h.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())rs.Bp(D5);else if(!this.Mr.disable_web_experiments){if(qe(this.zp))return this.zp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();rs.Bp("applying feature flags",t),t.forEach(n=>{var i;if(this.zp&&(!((i=this.zp)===null||i===void 0)&&i.has(n))){var a;const o=this._instance.getFeatureFlag(n),u=(a=this.zp)===null||a===void 0?void 0:a.get(n);o&&(u!=null&&u.variants[o])&&this.Hp(u.name,o,u.variants[o].transforms)}})}}previewWebExperiment(){const t=rs.getWindowLocation();if(t!=null&&t.search){const n=To(t==null?void 0:t.search,"__experiment_id"),i=To(t==null?void 0:t.search,"__experiment_variant");n&&i&&(rs.Bp(`previewing web experiments ${n} && ${i}`),this.getWebExperiments(a=>{this.Wp(parseInt(n),i,a)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}Wp(t,n,i){const a=i.filter(o=>o.id===t);a&&a.length>0&&(rs.Bp(`Previewing web experiment [${a[0].name}] with variant [${n}]`),this.Hp(a[0].name,n,a[0].variants[n].transforms))}static Up(t,n){return!qe(t.conditions)&&rs.Vp(t,n)&&rs.Gp(t)}static Vp(t,n){var i;if(qe(t.conditions)||qe((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const a=rs.getWindowLocation();if(a){var o,u,h;const f=tj(n,a.href);return!(!((o=t.conditions)===null||o===void 0)&&o.url)||B8[(u=(h=t.conditions)===null||h===void 0?void 0:h.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,f)}return!1}static getWindowLocation(){return re==null?void 0:re.location}static Gp(t){var n;if(qe(t.conditions)||qe((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const i=mj();if(i.utm_source){var a,o,u,h,f,p,g,v;const y=!(!((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0)&&a.utm_campaign)||((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0?void 0:o.utm_campaign)==i.utm_campaign,b=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_source)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_source)==i.utm_source,_=!(!((f=t.conditions)===null||f===void 0||(f=f.utm)===null||f===void 0)&&f.utm_medium)||((p=t.conditions)===null||p===void 0||(p=p.utm)===null||p===void 0?void 0:p.utm_medium)==i.utm_medium,k=!(!((g=t.conditions)===null||g===void 0||(g=g.utm)===null||g===void 0)&&g.utm_term)||((v=t.conditions)===null||v===void 0||(v=v.utm)===null||v===void 0?void 0:v.utm_term)==i.utm_term;return y&&_&&k&&b}return!1}static Bp(t,...n){be.info(`[WebExperiments] ${t}`,n)}Hp(t,n,i){this._is_bot()?rs.Bp(D5):n!=="control"?i.forEach(a=>{if(a.selector){var o;rs.Bp(`applying transform of variant ${n} for experiment ${t} `,a);const u=(o=document)===null||o===void 0?void 0:o.querySelectorAll(a.selector);u==null||u.forEach(h=>{const f=h;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)})}}):rs.Bp("Control variants leave the page unmodified.")}_is_bot(){return Un&&this._instance?Ij(Un,this.Mr.custom_blocked_useragents):void 0}}},jf),o7={conversations:class{constructor(e){this._instance=e,this.Qp=void 0,this._conversationsManager=null,this.Zp=!1,this.ne=null,this.Jp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Kp=e.ok,!e.ok))return;const t=e.config.conversations;qe(t)||(os(t)?this.Qp=t:(this.Qp=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Qp=void 0,this.ne=null,this.Kp=void 0,this.Jp=!1}loadIfEnabled(){if(this._conversationsManager||this.Zp||this._instance.config.disable_conversations||Q0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=Fe==null?void 0:Fe.__PosthogExtensions__;if(e&&!ue(this.Qp)&&this.Qp)if(this.ne&&this.ne.token){this.Zp=!0;try{const t=e.initConversations;if(t)return this.Xp(t),void(this.Zp=!1);const n=e.loadExternalDependency;if(!n)return void this.Yp(Fx);n(this._instance,"conversations",i=>{i||!e.initConversations?this.Yp("Could not load conversations script",i):this.Xp(e.initConversations),this.Zp=!1})}catch(t){this.Yp("Error initializing conversations",t),this.Zp=!1}}else Ws.error("Conversations enabled but missing token in remote config.")}Xp(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Jp=!1,Ws.info("Conversations loaded successfully")}catch(t){this.Yp("Error completing conversations initialization",t)}else Ws.error("Cannot complete initialization: remote config is null")}Yp(e,t){Ws.error(e,t),this._conversationsManager=null,this.Zp=!1,this.Jp=!0}show(){this._conversationsManager?this._conversationsManager.show():Ws.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Qp===!0&&!Xt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Q0(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Kp===!1?"remote_config_failed":ue(this.Qp)?this.Kp?"disabled_in_project":"remote_config_pending":this.Qp?qe(this.ne)||!this.ne.token?"missing_token":Fe!=null&&Fe.__PosthogExtensions__?this.Zp?"initializing":this.Jp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return Rt(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Ws.warn(Wa),null)})()}getMessages(e,t){var n=this;return Rt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Ws.warn(Wa),null)})()}markAsRead(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ws.warn(Wa),null)})()}getTickets(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ws.warn(Wa),null)})()}requestRestoreLink(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ws.warn(Wa),null)})()}restoreFromToken(e){var t=this;return Rt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ws.warn(Wa),null)})()}restoreFromUrlToken(){var e=this;return Rt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ws.warn(Wa),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sc(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xc(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},c7={logs:class extends U8{constructor(e){super({get(){var t;return e==null||(t=e.config)===null||t===void 0?void 0:t.logs},captureHintKey:Ak,get remoteConfigWillArrive(){var t,n;return!(!((t=e.nl)===null||t===void 0)&&t.call(e))||!!(!((n=Fe._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[e.config.token])===null||n===void 0)&&n.config)}},()=>(function(t){var n;const i={};if(i.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:a,windowId:o,sessionStartTimestamp:u,lastActivityTimestamp:h}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=a,i.windowId=o,qe(u)||(i.sessionStartTimestamp=u),qe(h)||(i.lastActivityTimestamp=h)}if(!(Fe==null||(n=Fe.location)===null||n===void 0)&&n.href&&(i.currentUrl=t.config.disable_capture_url_hashes?pa(Fe.location.href):Fe.location.href),t.featureFlags){const a=t.featureFlags.getFlags();a&&a.length>0&&(i.activeFeatureFlags=a)}return i})(e)),this._instance=e,this.name=Qj,this.Av()}get Pv(){return this._instance.__loaded}Rv(){const e=Vt("[logs]"),t=Fe==null?void 0:Fe.__PosthogExtensions__;if(!t)return void e.error("PostHog Extensions not found.");const n=t.loadExternalDependency;if(n)return i=>{n(this._instance,"logs",a=>{const o=t.logs;i(a,o!=null&&o.initializeLogs?{initialize:u=>o.initializeLogs(u),replay(u,h){var f;return(f=o.replayConsoleBuffer)===null||f===void 0?void 0:f.call(o,u,h)}}:void 0)})};e.error(Fx)}}},u7={metrics:class{constructor(e){this._instance=e,this.A=Vt("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Io)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.tg?this.tg=(n=>{let i=!0;const a=()=>i?(h=>{var f;const p=(f=h.config.metrics)===null||f===void 0?void 0:f.network;return p===!0?{}:p||void 0})(n):void 0,o=V8(n,a),u=G8(n,a);return()=>{i=!1,o(),u()}})(this._instance):!t&&this.tg&&(this.tg(),this.tg=void 0)}Dv(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var n;return this.Mv&&this.Lv===t||((n=this.Mv)===null||n===void 0||n.reset(),this.Lv=t,this.Mv=new $A(this.Ov(),(function(i){var a,o,u,h,f;const p=i==null?void 0:i.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:i==null?void 0:i.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:p,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(h=i==null?void 0:i.flushIntervalMs)!==null&&h!==void 0?h:1e4,maxSeriesPerFlush:(f=i==null?void 0:i.maxSeriesPerFlush)!==null&&f!==void 0?f:1e3}})(t),this.A)),this.Mv}count(e,t=1,n){this.Dv().count(e,t,n)}gauge(e,t,n){this.Dv().gauge(e,t,n)}histogram(e,t,n){this.Dv().histogram(e,t,n)}flush(e){if(!this.Mv)return Promise.resolve();if(e){const t=this.Mv.drainWindow();return t&&this.co(t,e),Promise.resolve()}return this.Mv.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Mv)===null||e===void 0||e.reset()}dispose(){var e,t;this.Io=!0,(e=this.tg)===null||e===void 0||e.call(this),this.tg=void 0,(t=this.Mv)===null||t===void 0||t.reset()}Ov(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},co:n=>t.co(n),getLibraryId:()=>bs.LIB_NAME,getLibraryVersion:()=>bs.LIB_VERSION}}co(e,t){return new Promise(n=>{let i=!1;const a=u=>{i||(i=!0,clearTimeout(o),n(u))},o=setTimeout(()=>a({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(D(D({method:"POST",url:this.eg(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(u){const h=u.statusCode;if(h>=200&&300>h)a({kind:"ok"});else if(h===413)a({kind:"too-large"});else if(h!==0&&h!==408&&h!==429&&500>h)a({kind:"fatal",error:new Error(`metrics request failed with status ${h}`)});else{var f;a({kind:"retry-later",error:(f=u.error)!==null&&f!==void 0?f:new Error(`metrics request failed with status ${h}`)})}}}))})}eg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},d7={webMCP:class{constructor(e){this._instance=e,this.ig=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.ig)return;const e=ge==null?void 0:ge.modelContext;if(!e||!ln(e.registerTool))return;const t=B5.get(e);if(t)return t.instances.add(this._instance),void(this.ig=!0);const n={instances:new Set([this._instance])},i=e.registerTool,a=this;Ro(e,"registerTool",o=>{const u=o;return function(h,...f){let p=h;try{p=a.ng(h,n)}catch{return u.call(this,h,...f)}return u.call(this,p,...f)}}),e.registerTool!==i&&(B5.set(e,n),this.ig=!0)}ng(e,t){if(!e||!ln(e.execute))return e;const n=e.execute,i=this,{tool:a,injected:o}=(function(u,h){const f={intent:!1,model:!1},p=u.inputSchema;if(!(function(_){return!!ue(_)||Ve(_)&&Object.keys(_).every(k=>Y8.has(k)||k.startsWith("x-"))&&_.additionalProperties!==!0&&!Ve(_.additionalProperties)&&(!_.type||_.type==="object")&&(!_.properties||Ve(_.properties))&&(!_.required||Pe(_.required))})(p))return{tool:Kg(u),injected:f};const g=(p==null?void 0:p.properties)||{},v=_=>Wg(g,_)||Pe(p==null?void 0:p.required)&&p.required.includes(_);if(f.intent=h.intent&&!v("context"),f.model=h.model&&!v("llm_model"),!f.intent&&!f.model)return{tool:Kg(u),injected:f};const y=D({},g),b=Pe(p==null?void 0:p.required)?[...p.required]:[];return f.intent&&(y.context={type:"string",description:`Explain why this tool is called and how it supports the user's goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".`},b.includes("context")||b.push("context")),f.model&&(y.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},b.includes("llm_model")||b.push("llm_model")),{tool:Kg(u,D(D({},p),{},{type:(p==null?void 0:p.type)||"object",properties:y,required:b})),injected:f}})(e,(function(u){const h={intent:!1,model:!1};for(const f of u.instances){const p=I5(f.config.capture_webmcp);h.intent||(h.intent=(p==null?void 0:p.intent)===!0),h.model||(h.model=(p==null?void 0:p.model)===!0)}return h})(t));return Object.defineProperty(a,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...u){const h=new Date,f=(function(b,_){if(!Ve(b))return{};try{const k=_.intent?F5(b.context,2048,!0):void 0,N=_.model?F5(b.llm_model,256):void 0;return D(D({},k&&k!=="{}"?{intent:k}:{}),N&&N.toLowerCase()!=="unknown"?{model:N}:{})}catch{return{}}})(u[0],o),p=(function(b,_){const k=b[0];if(!Ve(k))return b;try{const N=_.intent&&Wg(k,"context"),S=_.model&&Wg(k,"llm_model");if(!N&&!S)return b;const C=D({},k);return N&&delete C.context,S&&delete C.llm_model,[C,...b.slice(1)]}catch{return b}})(u,o);let g;try{g=n.apply(this===a?e:this,p)}catch(b){throw i.sg(t,a,h,{error:b,errorResult:!1},f),b}if((v=g)&&typeof v.then=="function")return Promise.resolve(g).then(b=>{const _=U5(b)?{error:b,errorResult:!0}:void 0;return i.sg(t,a,h,_,f),b},b=>{throw i.sg(t,a,h,{error:b,errorResult:!1},f),b});var v;const y=U5(g)?{error:g,errorResult:!0}:void 0;return i.sg(t,a,h,y,f),g}}),a}sg(e,t,n,i,a){const o=Date.now()-n.getTime();let u;for(const h of e.instances){const f=I5(h.config.capture_webmcp);if(f){i&&!u&&(u=Z8(i.error,i.errorResult));try{h.capture("$mcp_tool_call",D(D(D({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:$t==null?void 0:$t.hostname,$mcp_duration_ms:o,$mcp_is_error:!!i},u?{$mcp_error_type:u.type,$mcp_error_message:u.message}:{}),f.intent&&a.intent?{$mcp_intent:a.intent,$mcp_intent_source:"context_parameter"}:{}),f.model&&a.model?{$mcp_llm_model:a.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:n})}catch{continue}}}}}};yu.__defaultExtensionClasses=D({},D(D(D(D(D(D(D(D(D(D(D(D(D(D({},jf),J8),e7),t7),n7),s7),r7),i7),a7),l7),o7),c7),u7),d7));const h7=(function(){bs.SDK_DIST_CHANNEL="npm";const e=xu[ru]=new yu;return(function(){function t(){t.done||(t.done=!0,Pj=!1,_t(xu,function(n){n._dom_loaded()}))}ge!=null&&ge.addEventListener?ge.readyState==="complete"?t():gt(ge,"DOMContentLoaded",t,{capture:!1}):re&&be.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var Ru=h7;const f7="https://us.i.posthog.com",tN="cc-telemetry-enabled";let lx=!1,Ou=!1;function p7(){return f7}function m7(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(tN);return e===null?!0:e==="true"}function nN(e){lx&&(e?(Ru.opt_in_capturing({captureEventName:null}),Ou=!0):(Ru.opt_out_capturing(),Ou=!1))}function TI(e){typeof localStorage<"u"&&localStorage.setItem(tN,String(e)),nN(e)}function g7(){const e=void 0;return e?(Ru.init(e,{api_host:p7(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),lx=!0,nN(m7()),!0):(lx=!1,Ou=!1,!1)}function Jx(e,t){Ou&&Ru.capture(e,t)}function ma(e,t){Ou&&Ru.captureException(e,t)}function x7(e){Jx("$pageview",{$current_url:e})}const qi="/api",sN="companion_auth_token";function ga(){if(typeof window>"u")return{};const e=localStorage.getItem(sN);return e?{Authorization:`Bearer ${e}`}:{}}function cl(e){e===401&&typeof window<"u"&&(localStorage.removeItem(sN),Wn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>WM);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function jn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function $u(e,t,n,i){Jx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function Vi(e,t,n,i,a){Jx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),ma(i,{method:e,path:t,status:a})}async function Ue(e,t){const n=jn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...ga()},body:t?JSON.stringify(t):void 0});if(!a.ok){cl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("POST",e,jn()-n,u,a.status),i=!0,u}return $u("POST",e,jn()-n,a.status),a.json()}catch(a){throw i||Vi("POST",e,jn()-n,a),a}}async function De(e){const t=jn();let n=!1;try{const i=await fetch(`${qi}${e}`,{headers:{...ga()}});if(!i.ok){cl(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw Vi("GET",e,jn()-t,o,i.status),n=!0,o}return $u("GET",e,jn()-t,i.status),i.json()}catch(i){throw n||Vi("GET",e,jn()-t,i),i}}async function Ks(e,t){const n=jn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...ga()},body:t?JSON.stringify(t):void 0});if(!a.ok){cl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("PUT",e,jn()-n,u,a.status),i=!0,u}return $u("PUT",e,jn()-n,a.status),a.json()}catch(a){throw i||Vi("PUT",e,jn()-n,a),a}}async function v7(e,t){const n=jn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...ga()},body:t?JSON.stringify(t):void 0});if(!a.ok){cl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("PATCH",e,jn()-n,u,a.status),i=!0,u}return $u("PATCH",e,jn()-n,a.status),a.json()}catch(a){throw i||Vi("PATCH",e,jn()-n,a),a}}async function Zs(e,t){const n=jn();let i=!1;try{const a=await fetch(`${qi}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...ga()},body:t?JSON.stringify(t):void 0});if(!a.ok){cl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Vi("DELETE",e,jn()-n,u,a.status),i=!0,u}return $u("DELETE",e,jn()-n,a.status),a.json()}catch(a){throw i||Vi("DELETE",e,jn()-n,a),a}}async function y7(e,t){const n=await fetch(`${qi}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...ga()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const h=await n.json().catch(()=>({error:n.statusText}));throw new Error(h.error||n.statusText)}const i=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:h,value:f}=await i.read();if(h)break;o+=a.decode(f,{stream:!0});const p=o.split(`
69
+
70
+ `);o=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",y="";for(const _ of g.split(`
71
+ `))_.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 b7(){try{const e=await fetch(`${qi}/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 H5(e){try{const t=await fetch(`${qi}/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:()=>De("/auth/qr"),getAuthToken:()=>De("/auth/token"),regenerateAuthToken:()=>Ue("/auth/regenerate"),createSession:e=>Ue("/sessions/create",e),listSessions:()=>De("/sessions"),discoverClaudeSessions:(e=200)=>De(`/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 De(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Ue(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Zs(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Ue(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${qi}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...ga()}});if(!n.ok)throw cl(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>De(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Ue(`/sessions/${encodeURIComponent(e)}/unarchive`),setSessionPinned:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/pin`,{pinned:t}),renameSession:(e,t)=>v7(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>De(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>De("/fs/home"),listEnvs:()=>De("/envs"),getEnv:e=>De(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Ue("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Ks(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Zs(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>De("/sandboxes"),getSandbox:e=>De(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Ue("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Ks(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Zs(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Ue(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Ue("/docker/build-base"),getBaseImageStatus:()=>De("/docker/base-image"),getSettings:()=>De("/settings"),updateSettings:e=>Ks("/settings",e),verifyAnthropicKey:e=>Ue("/settings/anthropic/verify",{apiKey:e}),getCodexAccount:()=>De("/codex/auth/account"),getCodexLoginStatus:()=>De("/codex/auth/login"),startCodexLogin:()=>Ue("/codex/auth/login"),cancelCodexLogin:()=>Ue("/codex/auth/login/cancel"),codexLogout:()=>Ue("/codex/auth/logout"),getClaudeAccount:()=>De("/claude/auth/account"),getClaudeLoginStatus:()=>De("/claude/auth/login"),startClaudeLogin:()=>Ue("/claude/auth/login"),submitClaudeLoginCode:e=>Ue("/claude/auth/login/code",{code:e}),cancelClaudeLogin:()=>Ue("/claude/auth/login/cancel"),claudeLogout:()=>Ue("/claude/auth/logout"),getDashboard:()=>De("/dashboard"),runDashboardUpdate:()=>Ue("/dashboard/run"),getDashboardRunStatus:()=>De("/dashboard/run/status"),getTailscaleStatus:()=>De("/tailscale/status"),startTailscaleFunnel:()=>Ue("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Ue("/tailscale/funnel/stop"),listLinearConnections:()=>De("/linear/connections"),createLinearConnection:e=>Ue("/linear/connections",e),updateLinearConnection:(e,t)=>Ks(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Zs(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Ue(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>De(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>De(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>De(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Ue(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>De(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>De(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>De(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Ks("/linear/project-mappings",e),removeLinearProjectMapping:e=>Zs("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Ks(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Zs(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>De(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Ue("/linear/issues",e),addLinearComment:(e,t,n)=>Ue(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>De(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>De(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Ue("/git/fetch",{repoRoot:e}),gitPull:e=>Ue("/git/pull",{cwd:e}),listWorktrees:e=>De(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Ue("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Zs("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>De(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>De("/backends"),getBackendModels:e=>De(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>De("/containers/status"),getContainerImages:()=>De("/containers/images"),getImageStatus:e=>De(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Ue(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>De(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Ue(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>De(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>De(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${qi}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...ga()}});if(!t.ok){cl(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)=>Ks("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>De(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>De(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>De(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Ks("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>De(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>De("/usage-limits"),getSessionUsageLimits:e=>De(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>De("/system/memory"),getSystemDisk:()=>De("/system/disk"),spawnTerminal:(e,t,n,i)=>Ue("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Ue("/terminal/kill",{terminalId:e}),getTerminal:e=>De(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>De("/update-check"),forceCheckForUpdate:()=>Ue("/update-check"),triggerUpdate:()=>Ue("/update"),getClaudeCompat:()=>De("/claude-compat"),refreshClaudeCompat:()=>Ue("/claude-compat/refresh"),pinClaudeVersion:e=>Ue("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Ue("/claude-compat/patch"),unpatchClaudeBinary:()=>Ue("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Ue("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>De("/cron/jobs"),getCronJob:e=>De(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Ue("/cron/jobs",e),updateCronJob:(e,t)=>Ks(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Zs(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Ue(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Ue(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>De(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>De(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Ue(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>De("/agents"),getAgent:e=>De(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Ue("/agents",e),updateAgent:(e,t)=>Ks(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Zs(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Ue(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Ue(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>De(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Ue("/agents/import",e),exportAgent:e=>De(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Ue(`/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 De(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return De(`/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 De(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Ue("/linear/oauth/disconnect"),createLinearStaging:e=>Ue("/linear/oauth/staging",e),getLinearStagingStatus:e=>De(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Zs(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>De("/linear/oauth-connections"),createLinearOAuthConnection:e=>Ue("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Ks(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Zs(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>De(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>De("/skills"),sendSessionMessage:(e,t)=>Ue(`/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 De(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Ue("/prompts",e),updatePrompt:(e,t)=>Ks(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Zs(`/prompts/${encodeURIComponent(e)}`)};let q5=!1;function V5(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 a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function G5(){return new Promise(()=>{})}function _7(){if(q5||typeof window>"u")return;q5=!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 V5(i)}catch{return G5()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await V5(n)}catch{return G5()}}}})}catch{}}const Y5="#/session/",Q5="#/agents/";let X5=!1;function ev(){X5||(_7(),X5=!0)}function tv(e){if(ev(),e==="#/dashboard")return{page:"dashboard"};if(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(Q5)){const n=e.slice(Q5.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(Y5)){const n=e.slice(Y5.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function w7(e){return`#/session/${e}`}function nv(e,t=!1){ev();const n=w7(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Zg(e=!1){ev(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function S7(){const[e,t]=j.useState(""),[n,i]=j.useState(null),[a,o]=j.useState(!1),u=W(g=>g.setAuthToken),h=j.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}o(!0),i(null),await H5(v)?u(v):i("Invalid token"),o(!1)},[e,u]);j.useEffect(()=>{b7().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(o(!0),H5(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"),o(!1)}))})},[u]);const[f,p]=j.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:f?"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:a}),l.jsx("button",{type:"button",onClick:()=>p(!f),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:f?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!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:a?"Verifying...":"Login"})]}),l.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 $o=oS();function k7({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:h}){const[f,p]=j.useState("none");return $o.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:h,children:l.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:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:h,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.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:l.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"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.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:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:f==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:f==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.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:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:f==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:h,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"}),l.jsx("button",{type:"button",onClick:()=>u(f,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 W5(e){return Math.max(e.createdAt,e.lastUserMessageAt??0)}function iN(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function j7(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function N7(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function C7({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function K5({className:e}){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:e,"aria-hidden":!0,children:l.jsx("path",{d:"M9.828.722a.5.5 0 01.354.146l4.95 4.95a.5.5 0 010 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 01.16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 01-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 010-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 011.013.16l3.134-3.133a2.772 2.772 0 01-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 01.353-.146z"})})}function E7({type:e}){return e==="codex"?l.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"}):l.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 bh({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:h,onArchive:f,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:k,onCancelRename:N,editInputRef:S,onFilterProject:C,activeProjectKey:T,isPinned:R=!1,onTogglePin:A}){const O=e.id.slice(0,8),P=i||e.model||O,z=y===e.id,[K,F]=j.useState(!1),q=j.useRef(null),L=j.useRef(null),de=n?"exited":N7(e,a),X=e.cwd||e.repoRoot?iN(e.cwd,e.repoRoot||void 0,e.isContainerized):"",V=X?j7(X):"",G=X&&e.cwd.startsWith(X+"/")?e.cwd.slice(X.length+1):"",H=!!X&&T===X;j.useEffect(()=>{if(!K)return;function E(Ce){var $;q.current&&!q.current.contains(Ce.target)&&L.current&&!L.current.contains(Ce.target)&&(F(!1),($=L.current)==null||$.focus())}function Ne(Ce){var $,B,oe;if(Ce.key==="Escape"){F(!1),($=L.current)==null||$.focus();return}if(Ce.key==="Tab"){F(!1);return}if((Ce.key==="ArrowDown"||Ce.key==="ArrowUp")&&((B=q.current)!=null&&B.contains(document.activeElement)||L.current===document.activeElement)){Ce.preventDefault();const ye=(oe=q.current)==null?void 0:oe.querySelectorAll("[role='menuitem']");if(!ye||ye.length===0)return;const je=document.activeElement,Ee=Array.from(ye).indexOf(je);Ce.key==="ArrowDown"?ye[Ee<ye.length-1?Ee+1:0].focus():ye[Ee>0?Ee-1:ye.length-1].focus()}}return document.addEventListener("mousedown",E),document.addEventListener("touchstart",E),document.addEventListener("keydown",Ne),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("touchstart",E),document.removeEventListener("keydown",Ne)}},[K]),j.useEffect(()=>{K&&requestAnimationFrame(()=>{var E,Ne;(Ne=(E=q.current)==null?void 0:E.querySelector("[role='menuitem']"))==null||Ne.focus()})},[K]);const ae=j.useCallback(E=>{F(!1),E()},[]),_e=l.jsxs("span",{className:"flex items-center gap-1 shrink-0 ml-auto pl-1",children:[l.jsx(E7,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.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"})})})]});return l.jsxs("div",{className:`relative group min-h-[44px] rounded-lg transition-all duration-100 ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[l.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"}`}),l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:E=>{E.preventDefault(),h(e.id,P)},onKeyDown:E=>{E.key==="F2"&&!z&&(E.preventDefault(),h(e.id,P))},title:P,className:`w-full flex items-center gap-2 pt-1.5 pl-2.5 pr-8 sm:pr-2 sm:group-hover:pr-12 text-left rounded-lg cursor-pointer ${z?"pb-1.5":"pb-0.5"}`,children:[!z&&l.jsx(C7,{status:de}),z?l.jsx("input",{ref:S,value:b,onChange:E=>_(E.target.value),onKeyDown:E=>{E.key==="Enter"?(E.preventDefault(),k()):E.key==="Escape"&&(E.preventDefault(),N()),E.stopPropagation()},onBlur:k,onClick:E=>E.stopPropagation(),onDoubleClick:E=>E.stopPropagation(),className:"text-[12px] 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"}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`flex-1 min-w-0 text-[12px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:P}),R&&l.jsx("span",{className:"shrink-0 text-cc-primary",title:"Pinned","aria-label":"Pinned",children:l.jsx(K5,{className:"w-3 h-3"})})]})]}),!z&&l.jsxs("div",{onClick:()=>u(e.id),onDoubleClick:()=>h(e.id,P),className:"flex items-center gap-1 min-w-0 pl-[26px] pr-8 sm:pr-2 sm:group-hover:pr-12 pb-1.5 leading-none cursor-pointer",children:[V&&(C?l.jsx("button",{onClick:E=>{E.stopPropagation(),C(X,V)},onDoubleClick:E=>E.stopPropagation(),title:`${H?"Clear filter":"Show only sessions in"} ${X}`,"aria-label":`${H?"Clear project filter":"Filter by project"} ${V}`,"aria-pressed":H,className:`shrink min-w-0 max-w-[65%] truncate text-[10px] leading-tight px-1 py-px rounded transition-colors cursor-pointer ${H?"bg-cc-primary/15 text-cc-primary":"bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border"}`,children:V}):l.jsx("span",{className:"shrink min-w-0 max-w-[65%] truncate text-[10px] leading-tight text-cc-muted/80",title:X,children:V})),G&&l.jsxs("span",{className:"truncate min-w-0 flex-1 text-[10px] leading-tight text-cc-muted/60",title:e.cwd,children:["/",G]}),_e]}),!n&&!z&&!K&&l.jsx("button",{onClick:E=>{E.stopPropagation(),f(E,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})}),l.jsx("button",{ref:L,onClick:E=>{E.stopPropagation(),F(!K)},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":K,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),K&&l.jsxs("div",{ref:q,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&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>ae(()=>h(e.id,P)),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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.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&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>ae(()=>A(e.id,!R)),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:[l.jsx(K5,{className:"w-3 h-3 text-cc-muted"}),R?"Unpin":"Pin to top"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:E=>ae(()=>p(E,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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.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"}),l.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"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:E=>ae(()=>g(E,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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.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"}),l.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"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:E=>ae(()=>f(E,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.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 T7(e){return iN(e.cwd,e.repoRoot||void 0,e.isContainerized)}function M7(e,t){return[t,e.id,e.cwd,e.repoRoot,e.gitBranch,e.model,e.cronJobName,e.agentName,e.userName].filter(Boolean).join(`
72
+ `).toLowerCase()}function A7(e,t,n,i){const a=t.toLowerCase().split(/\s+/).filter(Boolean);return a.length===0&&!n?e:e.filter(o=>{if(n&&T7(o)!==n)return!1;if(a.length===0)return!0;const u=M7(o,i.get(o.id));return a.every(h=>u.includes(h))})}const R7=[{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"}],O7=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{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"}],L7=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],D7=new Map(O7.map(e=>[e.id,e]));function z7(){var pn,qn,tn;const[e,t]=j.useState(null),[n,i]=j.useState(""),[a,o]=j.useState(!1),[u,h]=j.useState(null),[f,p]=j.useState(null),[g,v]=j.useState(null),[y,b]=j.useState(!1),[_,k]=j.useState(null),[N,S]=j.useState(!1),[C,T]=j.useState(()=>typeof window<"u"?window.location.hash:""),R=j.useRef(null),A=j.useRef(null),O=W(te=>te.sessions),P=W(te=>te.sdkSessions),z=W(te=>te.currentSessionId),K=W(te=>te.cliConnected),F=W(te=>te.cliReconnecting),q=W(te=>te.sessionStatus),L=W(te=>te.removeSession),de=W(te=>te.sessionNames),X=W(te=>te.recentlyRenamed),V=W(te=>te.clearRecentlyRenamed),G=W(te=>te.pendingPermissions),H=W(te=>te.linkedLinearIssues),ae=tv(C);j.useEffect(()=>{let te=!0;async function ve(){try{const Ye=await we.listSessions();if(te){const jt=W.getState();jt.setSdkSessions(Ye);const mn=W.getState(),On=new Set(Ye.map(Lt=>Lt.sessionId));for(const Lt of mn.sessions.keys())!On.has(Lt)&&mn.connectionStatus.get(Lt)!=="connected"&&mn.removeSession(Lt);J6(Ye);for(const Lt of Ye)if(Lt.name&&(!jt.sessionNames.has(Lt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(jt.sessionNames.get(Lt.sessionId)))){const Ln=jt.sessionNames.get(Lt.sessionId),ti=!!Ln&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Ln);Ln!==Lt.name&&(jt.setSessionName(Lt.sessionId,Lt.name),ti&&jt.markRecentlyRenamed(Lt.sessionId))}}}catch{}}ve();const me=setInterval(ve,5e3);return()=>{te=!1,clearInterval(me)}},[]),j.useEffect(()=>{const te=()=>T(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function _e(te){nv(te),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}function E(){Zg(),W.getState().newSession(),window.innerWidth<768&&W.getState().setSidebarOpen(!1)}j.useEffect(()=>{e&&R.current&&(R.current.focus(),R.current.select())},[e]);function Ne(){e&&n.trim()&&(W.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function Ce(){t(null),i("")}function $(te,ve){t(te),i(ve)}const B=j.useCallback((te,ve)=>{te.stopPropagation(),k(ve)},[]),oe=j.useCallback(async te=>{try{E0(te),await we.deleteSession(te)}catch{}W.getState().currentSessionId===te&&Zg(),L(te)},[L]),ye=j.useCallback(()=>{_&&(oe(_),k(null))},[_,oe]),je=j.useCallback(()=>{k(null)},[]),Ee=j.useCallback(()=>{S(!0)},[]),Be=j.useCallback(async()=>{S(!1);const te=W.getState(),ve=new Set;for(const Ye of te.sessions.keys())ve.add(Ye);for(const Ye of te.sdkSessions)ve.add(Ye.sessionId);const me=Array.from(ve).filter(Ye=>{const jt=te.sdkSessions.find(mn=>mn.sessionId===Ye);return(jt==null?void 0:jt.archived)??!1});for(const Ye of me)await oe(Ye)},[oe]),Oe=j.useCallback(()=>{S(!1)},[]);j.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ve,me;(me=(ve=A.current)==null?void 0:ve.querySelector("button"))==null||me.focus()});function te(ve){var mn;if(ve.key==="Escape"){N?Oe():je();return}if(ve.key!=="Tab")return;const me=(mn=A.current)==null?void 0:mn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!me||me.length===0)return;const Ye=me[0],jt=me[me.length-1];ve.shiftKey&&document.activeElement===Ye?(ve.preventDefault(),jt.focus()):!ve.shiftKey&&document.activeElement===jt&&(ve.preventDefault(),Ye.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,N,je,Oe]);const Te=j.useCallback(async(te,ve)=>{te.stopPropagation();const me=P.find(Ln=>Ln.sessionId===ve),Ye=O.get(ve),jt=(Ye==null?void 0:Ye.is_containerized)||!!(me!=null&&me.containerId)||!1,mn=H.get(ve),On=((mn==null?void 0:mn.stateType)||"").toLowerCase();if(mn&&!(On==="completed"||On==="canceled"||On==="cancelled"))try{const Ln=await we.getArchiveInfo(ve);if(Ln.issueNotDone){p(ve),v(Ln),b(jt);return}}catch{}if(jt){h(ve);return}Re(ve)},[P,O,H]),Re=j.useCallback(async(te,ve,me)=>{try{E0(te);const Ye={};ve&&(Ye.force=!0),me&&me!=="none"&&(Ye.linearTransition=me),await we.archiveSession(te,Object.keys(Ye).length>0?Ye:void 0)}catch{}W.getState().currentSessionId===te&&(Zg(),W.getState().newSession());try{const Ye=await we.listSessions();W.getState().setSdkSessions(Ye)}catch{}},[]),It=j.useCallback(()=>{u&&(Re(u,!0),h(null))},[u,Re]),vn=j.useCallback(()=>{h(null)},[]),Gt=j.useCallback((te,ve)=>{f&&(Re(f,ve,te),p(null),v(null))},[f,Re]),St=j.useCallback(()=>{p(null),v(null)},[]),wt=j.useCallback(async(te,ve)=>{const me=W.getState();me.setSdkSessions(me.sdkSessions.map(Ye=>Ye.sessionId===te?{...Ye,pinned:ve}:Ye));try{await we.setSessionPinned(te,ve)}catch{}try{const Ye=await we.listSessions();W.getState().setSdkSessions(Ye)}catch{}},[]),Ze=j.useCallback(async(te,ve)=>{te.stopPropagation();try{await we.unarchiveSession(ve)}catch{}try{const me=await we.listSessions();W.getState().setSdkSessions(me)}catch{}},[]),xt=new Set;for(const te of O.keys())xt.add(te);for(const te of P)xt.add(te.sessionId);const Kt=Array.from(xt).map(te=>{var Ye;const ve=O.get(te),me=P.find(jt=>jt.sessionId===te);return{id:te,model:(ve==null?void 0:ve.model)||(me==null?void 0:me.model)||"",cwd:(ve==null?void 0:ve.cwd)||(me==null?void 0:me.cwd)||"",gitBranch:(ve==null?void 0:ve.git_branch)||(me==null?void 0:me.gitBranch)||"",isContainerized:(ve==null?void 0:ve.is_containerized)||!!(me!=null&&me.containerId)||!1,gitAhead:(ve==null?void 0:ve.git_ahead)||(me==null?void 0:me.gitAhead)||0,gitBehind:(ve==null?void 0:ve.git_behind)||(me==null?void 0:me.gitBehind)||0,linesAdded:(ve==null?void 0:ve.total_lines_added)||(me==null?void 0:me.totalLinesAdded)||0,linesRemoved:(ve==null?void 0:ve.total_lines_removed)||(me==null?void 0:me.totalLinesRemoved)||0,isConnected:K.get(te)??!1,isReconnecting:F.get(te)??!1,status:q.get(te)??null,sdkState:(me==null?void 0:me.state)??null,createdAt:(me==null?void 0:me.createdAt)??0,archived:(me==null?void 0:me.archived)??!1,backendType:(ve==null?void 0:ve.backend_type)||(me==null?void 0:me.backendType)||"claude",repoRoot:(ve==null?void 0:ve.repo_root)||"",permCount:((Ye=G.get(te))==null?void 0:Ye.size)??0,cronJobId:(ve==null?void 0:ve.cronJobId)||(me==null?void 0:me.cronJobId),cronJobName:(ve==null?void 0:ve.cronJobName)||(me==null?void 0:me.cronJobName),agentId:(ve==null?void 0:ve.agentId)||(me==null?void 0:me.agentId),agentName:(ve==null?void 0:ve.agentName)||(me==null?void 0:me.agentName),userName:me==null?void 0:me.userName,pinned:(me==null?void 0:me.pinned)??!1,lastUserMessageAt:me==null?void 0:me.lastUserMessageAt}}).sort((te,ve)=>W5(ve)-W5(te)),se=typeof localStorage<"u"&&((pn=localStorage.getItem("cc-user-name"))==null?void 0:pn.trim())||"",ke=te=>!!se&&te.userName===se,We=te=>!!te.pinned&&ke(te),nt=j.useMemo(()=>Array.from(new Set(Kt.map(te=>te.userName).filter(te=>!!te))).sort(),[Kt]),[Zt,Ft]=j.useState("__all__"),ce=te=>Zt==="__all__"?!0:Zt==="__none__"?!te.userName:te.userName===Zt,U=Kt.some(te=>!te.userName),fe=Kt.filter(ce),[Ae,tt]=j.useState(""),[ze,st]=j.useState(null),rn=j.useRef(null),Zn=Ae.trim()!==""||ze!==null,on=A7(fe.filter(te=>!te.archived),Ae,(ze==null?void 0:ze.key)??null,de),Is=j.useCallback((te,ve)=>{st(me=>(me==null?void 0:me.key)===te?null:{key:te,label:ve})},[]),ks=on.filter(te=>!te.cronJobId&&!te.agentId).sort((te,ve)=>Number(We(ve))-Number(We(te))),Ut=on.filter(te=>!!te.cronJobId),Jt=on.filter(te=>!!te.agentId),fn=Zn?[]:fe.filter(te=>te.archived),en=z?Kt.find(te=>te.id===z):null,bi=(en==null?void 0:en.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[_i,kr]=j.useState(!0),[wi,ya]=j.useState(!0),Rn={onSelect:_e,onStartRename:$,onArchive:Te,onUnarchive:Ze,onDelete:B,onClearRecentlyRenamed:V,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:Ne,onCancelRename:Ce,editInputRef:R,onFilterProject:Is,activeProjectKey:(ze==null?void 0:ze.key)??null};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:bi,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.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"}),l.jsx("button",{onClick:E,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>W.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.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"})})})]})}),nt.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:Zt,onChange:te=>Ft(te.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),nt.map(te=>l.jsx("option",{value:te,children:te},te)),U&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-cc-muted/70 pointer-events-none",children:l.jsx("path",{d:"M11.742 10.344a6.5 6.5 0 10-1.397 1.398h-.001l3.85 3.85a1 1 0 001.415-1.414l-3.85-3.85zM12 6.5a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z"})}),l.jsx("input",{ref:rn,type:"search",value:Ae,onChange:te=>tt(te.target.value),onKeyDown:te=>{te.key==="Escape"&&Ae&&(te.preventDefault(),tt(""))},placeholder:"Search sessions…","aria-label":"Search sessions",className:"w-full pl-7 pr-7 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:border-cc-primary [&::-webkit-search-cancel-button]:hidden"}),Ae&&l.jsx("button",{onClick:()=>{var te;tt(""),(te=rn.current)==null||te.focus()},"aria-label":"Clear search",title:"Clear search",className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]}),ze&&l.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Project:"}),l.jsxs("button",{onClick:()=>st(null),title:`${ze.key} — click to clear`,"aria-label":`Clear project filter ${ze.label}`,className:"min-w-0 flex items-center gap-1 px-1.5 py-0.5 rounded bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 cursor-pointer",children:[l.jsx("span",{className:"truncate",children:ze.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 shrink-0",children:l.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&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.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"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:vn,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"}),l.jsx("button",{onClick:It,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"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:ks.length===0&&Ut.length===0&&Jt.length===0&&fn.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:Zn?"No matching sessions.":"No sessions yet."}):l.jsxs(l.Fragment,{children:[ks.length>0&&l.jsx("div",{children:ks.map((te,ve)=>{var jt;const me=We(te),Ye=me&&ve<ks.length-1&&!We(ks[ve+1]);return l.jsx("div",{className:Ye?"pb-1 mb-1 border-b border-cc-separator":"",children:l.jsx(bh,{session:te,isActive:z===te.id,sessionName:de.get(te.id),permCount:((jt=G.get(te.id))==null?void 0:jt.size)??0,isRecentlyRenamed:X.has(te.id),isPinned:me,onTogglePin:ke(te)?wt:void 0,...Rn})},te.id)})}),Ut.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>kr(!_i),"aria-expanded":_i,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${_i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",Ut.length,")"]}),_i&&l.jsx("div",{className:"mt-0.5",children:Ut.map(te=>{var ve;return l.jsx(bh,{session:te,isActive:z===te.id,sessionName:de.get(te.id),permCount:((ve=G.get(te.id))==null?void 0:ve.size)??0,isRecentlyRenamed:X.has(te.id),...Rn},te.id)})})]}),Jt.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>ya(!wi),"aria-expanded":wi,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${wi?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Jt.length,")"]}),wi&&l.jsx("div",{className:"mt-0.5",children:Jt.map(te=>{var ve;return l.jsx(bh,{session:te,isActive:z===te.id,sessionName:de.get(te.id),permCount:((ve=G.get(te.id))==null?void 0:ve.size)??0,isRecentlyRenamed:X.has(te.id),...Rn},te.id)})})]}),fn.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",fn.length,")"]}),a&&fn.length>1&&l.jsx("button",{onClick:Ee,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"})]}),a&&l.jsx("div",{className:"mt-0.5",children:fn.map(te=>{var ve;return l.jsx(bh,{session:te,isActive:z===te.id,isArchived:!0,sessionName:de.get(te.id),permCount:((ve=G.get(te.id))==null?void 0:ve.size)??0,isRecentlyRenamed:X.has(te.id),...Rn},te.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:E,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:L7.map(te=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),l.jsx("div",{className:"flex flex-col",children:te.itemIds.map(ve=>{const me=D7.get(ve);if(!me)return null;const Ye=me.activePages?me.activePages.some(jt=>ae.page===jt):ae.page===me.id;return l.jsxs("button",{onClick:()=>{window.location.hash=me.hash,window.innerWidth<768&&W.getState().setSidebarOpen(!1)},title:me.label,"aria-current":Ye?"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 ${Ye?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Ye?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:me.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:me.iconPath,fillRule:me.fillRule,clipRule:me.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:me.label})]},me.id)})})]},te.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:R7.map(te=>l.jsx("a",{href:te.url,target:"_blank",rel:"noopener noreferrer",title:te.label,"aria-label":`Open ${te.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:l.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||N)&&l.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:N?Oe:je,children:l.jsxs("div",{ref:A,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:te=>te.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.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"}),l.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"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${fn.length} archived session${fn.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?Oe: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"}),l.jsx("button",{onClick:N?Be:ye,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:N?"Delete all":"Delete"})]})]})}),f&&g&&l.jsx(k7,{issueIdentifier:((qn=g.issue)==null?void 0:qn.identifier)||"",issueStateName:((tn=g.issue)==null?void 0:tn.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:Gt,onCancel:St})]})}function $7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const P7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,B7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,I7={};function Z5(e,t){return(I7.jsx?B7:P7).test(e)}const F7=/[ \t\n\f\r]/g;function U7(e){return typeof e=="object"?e.type==="text"?J5(e.value):!1:J5(e)}function J5(e){return e.replace(F7,"")===""}class Pu{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Pu.prototype.normal={};Pu.prototype.property={};Pu.prototype.space=void 0;function rN(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Pu(n,i,t)}function ox(e){return e.toLowerCase()}class Ss{constructor(t,n){this.attribute=n,this.property=t}}Ss.prototype.attribute="";Ss.prototype.booleanish=!1;Ss.prototype.boolean=!1;Ss.prototype.commaOrSpaceSeparated=!1;Ss.prototype.commaSeparated=!1;Ss.prototype.defined=!1;Ss.prototype.mustUseProperty=!1;Ss.prototype.number=!1;Ss.prototype.overloadedBoolean=!1;Ss.prototype.property="";Ss.prototype.spaceSeparated=!1;Ss.prototype.space=void 0;let H7=0;const et=dl(),kn=dl(),cx=dl(),Se=dl(),zt=dl(),al=dl(),$s=dl();function dl(){return 2**++H7}const ux=Object.freeze(Object.defineProperty({__proto__:null,boolean:et,booleanish:kn,commaOrSpaceSeparated:$s,commaSeparated:al,number:Se,overloadedBoolean:cx,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Jg=Object.keys(ux);class sv extends Ss{constructor(t,n,i,a){let o=-1;if(super(t,n),e2(this,"space",a),typeof i=="number")for(;++o<Jg.length;){const u=Jg[o];e2(this,Jg[o],(i&ux[u])===ux[u])}}}sv.prototype.defined=!0;function e2(e,t,n){n&&(e[t]=n)}function Po(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new sv(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[ox(i)]=i,n[ox(o.attribute)]=i}return new Pu(t,n,e.space)}const aN=Po({properties:{ariaActiveDescendant:null,ariaAtomic:kn,ariaAutoComplete:null,ariaBusy:kn,ariaChecked:kn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:kn,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:kn,ariaFlowTo:zt,ariaGrabbed:kn,ariaHasPopup:null,ariaHidden:kn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:Se,ariaLive:null,ariaModal:kn,ariaMultiLine:kn,ariaMultiSelectable:kn,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:kn,ariaReadOnly:kn,ariaRelevant:null,ariaRequired:kn,ariaRoleDescription:zt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:kn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function lN(e,t){return t in e?e[t]:t}function oN(e,t){return lN(e,t.toLowerCase())}const q7=Po({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:al,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:et,allowPaymentRequest:et,allowUserMedia:et,alpha:et,alt:null,as:null,async:et,autoCapitalize:null,autoComplete:zt,autoFocus:et,autoPlay:et,blocking:zt,capture:null,charSet:null,checked:et,cite:null,className:zt,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:kn,controls:et,controlsList:zt,coords:Se|al,crossOrigin:null,data:null,dateTime:null,decoding:null,default:et,defer:et,dir:null,dirName:null,disabled:et,download:cx,draggable:kn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:et,formTarget:null,headers:zt,height:Se,hidden:cx,high:Se,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:et,inputMode:null,integrity:null,is:null,isMap:et,itemId:null,itemProp:zt,itemRef:zt,itemScope:et,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:et,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:et,muted:et,name:null,nonce:null,noModule:et,noValidate:et,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:et,optimum:Se,pattern:null,ping:zt,placeholder:null,playsInline:et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:et,referrerPolicy:null,rel:zt,required:et,reversed:et,rows:Se,rowSpan:Se,sandbox:zt,scope:null,scoped:et,seamless:et,selected:et,shadowRootClonable:et,shadowRootCustomElementRegistry:et,shadowRootDelegatesFocus:et,shadowRootMode:null,shadowRootSerializable:et,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:kn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:et,useMap:null,value:kn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:et,declare:et,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:et,noHref:et,noShade:et,noWrap:et,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:kn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:et,disablePictureInPicture:et,disableRemotePlayback:et,exportParts:al,part:zt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:oN}),V7=Po({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",maskType:"mask-type",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:$s,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:zt,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:et,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:al,g2:al,glyphName:al,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:$s,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$s,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$s,rev:$s,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$s,requiredFeatures:$s,requiredFonts:$s,requiredFormats:$s,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:$s,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$s,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$s,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lN}),cN=Po({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()}}),uN=Po({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:oN}),dN=Po({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),G7={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"},Y7=/[A-Z]/g,t2=/-[a-z]/g,Q7=/^data[-\w.:]+$/i;function X7(e,t){const n=ox(t);let i=t,a=Ss;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Q7.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(t2,K7);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!t2.test(o)){let u=o.replace(Y7,W7);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=sv}return new a(i,t)}function W7(e){return"-"+e.toLowerCase()}function K7(e){return e.charAt(1).toUpperCase()}const Z7=rN([aN,q7,cN,uN,dN],"html"),iv=rN([aN,V7,cN,uN,dN],"svg");function J7(e){return e.join(" ").trim()}var uo={},e0,n2;function eR(){if(n2)return e0;n2=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
73
+ `,p="/",g="*",v="",y="comment",b="declaration";function _(N,S){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];S=S||{};var C=1,T=1;function R(X){var V=X.match(t);V&&(C+=V.length);var G=X.lastIndexOf(f);T=~G?X.length-G:T+X.length}function A(){var X={line:C,column:T};return function(V){return V.position=new O(X),K(),V}}function O(X){this.start=X,this.end={line:C,column:T},this.source=S.source}O.prototype.content=N;function P(X){var V=new Error(S.source+":"+C+":"+T+": "+X);if(V.reason=X,V.filename=S.source,V.line=C,V.column=T,V.source=N,!S.silent)throw V}function z(X){var V=X.exec(N);if(V){var G=V[0];return R(G),N=N.slice(G.length),V}}function K(){z(n)}function F(X){var V;for(X=X||[];V=q();)V!==!1&&X.push(V);return X}function q(){var X=A();if(!(p!=N.charAt(0)||g!=N.charAt(1))){for(var V=2;v!=N.charAt(V)&&(g!=N.charAt(V)||p!=N.charAt(V+1));)++V;if(V+=2,v===N.charAt(V-1))return P("End of comment missing");var G=N.slice(2,V-2);return T+=2,R(G),N=N.slice(V),T+=2,X({type:y,comment:G})}}function L(){var X=A(),V=z(i);if(V){if(q(),!z(a))return P("property missing ':'");var G=z(o),H=X({type:b,property:k(V[0].replace(e,v)),value:G?k(G[0].replace(e,v)):v});return z(u),H}}function de(){var X=[];F(X);for(var V;V=L();)V!==!1&&(X.push(V),F(X));return X}return K(),de()}function k(N){return N?N.replace(h,v):v}return e0=_,e0}var s2;function tR(){if(s2)return uo;s2=1;var e=uo&&uo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(uo,"__esModule",{value:!0}),uo.default=n;const t=e(eR());function n(i,a){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),h=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:g}=f;h?a(p,g,f):g&&(o=o||{},o[p]=g)}),o}return uo}var Zc={},i2;function nR(){if(i2)return Zc;i2=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},h=function(p,g){return"".concat(g,"-")},f=function(p,g){return g===void 0&&(g={}),o(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,h):p=p.replace(i,h),p.replace(t,u))};return Zc.camelCase=f,Zc}var Jc,r2;function sR(){if(r2)return Jc;r2=1;var e=Jc&&Jc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(tR()),n=nR();function i(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(u[(0,n.camelCase)(h,o)]=f)}),u}return i.default=i,Jc=i,Jc}var iR=sR();const rR=kx(iR),hN=fN("end"),rv=fN("start");function fN(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 aR(e){const t=rv(e),n=hN(e);if(t&&n)return{start:t,end:n}}function bu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?a2(e.position):"start"in e||"end"in e?a2(e):"line"in e||"column"in e?dx(e):""}function dx(e){return l2(e&&e.line)+":"+l2(e&&e.column)}function a2(e){return dx(e&&e.start)+"-"+dx(e&&e.end)}function l2(e){return e&&typeof e=="number"?e:1}class Kn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const h=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=bu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Kn.prototype.file="";Kn.prototype.name="";Kn.prototype.reason="";Kn.prototype.message="";Kn.prototype.stack="";Kn.prototype.column=void 0;Kn.prototype.line=void 0;Kn.prototype.ancestors=void 0;Kn.prototype.cause=void 0;Kn.prototype.fatal=void 0;Kn.prototype.place=void 0;Kn.prototype.ruleId=void 0;Kn.prototype.source=void 0;const av={}.hasOwnProperty,lR=new Map,oR=/[A-Z]/g,cR=new Set(["table","tbody","thead","tfoot","tr"]),uR=new Set(["td","th"]),pN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function dR(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=yR(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=vR(n,t.jsx,t.jsxs)}const a={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"?iv:Z7,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=mN(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function mN(e,t,n){if(t.type==="element")return hR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mR(e,t,n);if(t.type==="mdxjsEsm")return pR(e,t);if(t.type==="root")return gR(e,t,n);if(t.type==="text")return xR(e,t)}function hR(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=iv,e.schema=a),e.ancestors.push(t);const o=xN(e,t.tagName,!1),u=bR(e,t);let h=ov(e,t);return cR.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!U7(f):!0})),gN(e,u,o,t),lv(u,h),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function fR(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)}Lu(e,t.position)}function pR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lu(e,t.position)}function mR(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=iv,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:xN(e,t.name,!0),u=_R(e,t),h=ov(e,t);return gN(e,u,o,t),lv(u,h),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function gR(e,t,n){const i={};return lv(i,ov(e,t)),e.create(t,e.Fragment,i,n)}function xR(e,t){return t.value}function gN(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function lv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vR(e,t,n){return i;function i(a,o,u,h){const p=Array.isArray(u.children)?n:t;return h?p(o,u,h):p(o,u)}}function yR(e,t){return n;function n(i,a,o,u){const h=Array.isArray(o.children),f=rv(i);return t(a,o,u,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function bR(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&av.call(t.properties,a)){const o=wR(e,a,t.properties[a]);if(o){const[u,h]=o;e.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&uR.has(t.tagName)?i=h:n[u]=h}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function _R(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const h=u.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Lu(e,t.position);else{const a=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const h=i.value.data.estree.body[0];h.type,o=e.evaluater.evaluateExpression(h.expression)}else Lu(e,t.position);else o=i.value===null?!0:i.value;n[a]=o}return n}function ov(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:lR;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const p=a.get(f)||0;u=f+"-"+p,a.set(f,p+1)}}const h=mN(e,o,u);h!==void 0&&n.push(h)}return n}function wR(e,t,n){const i=X7(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?$7(n):J7(n)),i.property==="style"){let a=typeof n=="object"?n:SR(e,String(n));return e.stylePropertyNameCase==="css"&&(a=kR(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?G7[i.property]||i.property:i.attribute,n]}}function SR(e,t){try{return rR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Kn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=pN+"#cannot-parse-style-attribute",a}}function xN(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const h=Z5(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(o&&h.type==="Literal"),optional:!1}:h}i=u}else i=Z5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return av.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Lu(e)}function Lu(e,t){const n=new Kn("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=pN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function kR(e){const t={};let n;for(n in e)av.call(e,n)&&(t[jR(n)]=e[n]);return t}function jR(e){let t=e.replace(oR,NR);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function NR(e){return"-"+e.toLowerCase()}const t0={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"]},CR={};function cv(e,t){const n=CR,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vN(e,i,a)}function vN(e,t,n){if(ER(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 o2(e.children,t,n)}return Array.isArray(e)?o2(e,t,n):""}function o2(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=vN(e[a],t,n);return i.join("")}function ER(e){return!!(e&&typeof e=="object")}const c2=document.createElement("i");function uv(e){const t="&"+e+";";c2.innerHTML=t;const n=c2.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xi(e,t,n,i){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a: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);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Js(e,t){return e.length>0?(xi(e,e.length,0,t),e):t}const u2={}.hasOwnProperty;function yN(e){const t={};let n=-1;for(;++n<e.length;)TR(t,e[n]);return t}function TR(e,t){let n;for(n in t){const a=(u2.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){u2.call(a,u)||(a[u]=[]);const h=o[u];MR(a[u],Array.isArray(h)?h:h?[h]:[])}}}function MR(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);xi(e,0,0,i)}function bN(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 vi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cs=va(/[A-Za-z]/),Xn=va(/[\dA-Za-z]/),AR=va(/[#-'*+\--9=?A-Z^-~]/);function hf(e){return e!==null&&(e<32||e===127)}const hx=va(/\d/),RR=va(/[\dA-Fa-f]/),OR=va(/[!-/:-@[-`{-~]/);function Ge(e){return e!==null&&e<-2}function Bt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const Nf=va(new RegExp("\\p{P}|\\p{S}","u")),ul=va(/\s/);function va(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Bo(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Xn(e.charCodeAt(n+1))&&Xn(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const h=e.charCodeAt(n+1);o<56320&&h>56319&&h<57344?(u=String.fromCharCode(o,h),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function kt(e,t,n,i){const a=i?i-1:1/0;let o=0;return u;function u(f){return ot(f)?(e.enter(n),h(f)):t(f)}function h(f){return ot(f)&&o++<a?(e.consume(f),h):(e.exit(n),t(f))}}function _N(e,t,n,i,a,o){let u=0;return h;function h(g){return ot(g)?(e.enter(i),f(g)):p(g)}function f(g){return ot(g)&&u<o?(e.consume(g),u++,f):(e.exit(i),p(g))}function p(g){return u>=a?t(g):n(g)}}const LR={tokenize:DR};function DR(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),kt(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),o(h)}function o(h){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(h)}function u(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ge(h)?(e.consume(h),e.exit("chunkText"),o):(e.consume(h),u)}}let ff=class{constructor(){this.index=new Map,this.map=[]}add(t,n,i){d2(this,t,n,i,!1)}addBefore(t,n,i){d2(this,t,n,i,!0)}consume(t){if(this.map.sort(function(o,u){return o[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 a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0,this.index.clear()}};function d2(e,t,n,i,a){if(n===0&&i.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,a?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const u=[t,n,i];e.map.push(u),e.index.set(t,u)}const zR={tokenize:$R},h2={tokenize:PR};function $R(e){const t=this,n=[];let i=0,a,o,u;return h;function h(T){if(i<n.length){const R=n[i];return t.containerState=R[1],e.attempt(R[0].continuation,f,p)(T)}return p(T)}function f(T){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const R=t.events.length;let A=R,O;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){O=t.events[A][1].end;break}S(i);let P=R;for(;P<t.events.length;)t.events[P][1].end={...O},P++;const z=new ff;return z.add(A+1,0,t.events.slice(R)),z.add(R,P-R,[]),z.consume(t.events),p(T)}return h(T)}function p(T){if(i===n.length){if(!a)return y(T);if(a.currentConstruct&&a.currentConstruct.concrete)return _(T);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(h2,g,v)(T)}function g(T){return a&&C(),S(i),y(T)}function v(T){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(T)}function y(T){return t.containerState={},e.attempt(h2,b,_)(T)}function b(T){return i++,n.push([t.currentConstruct,t.containerState]),y(T)}function _(T){if(T===null){a&&C(),S(0),e.consume(T);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(T)}function k(T){if(T===null){N(e.exit("chunkFlow"),!0),S(0),e.consume(T);return}return Ge(T)?(e.consume(T),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,h):(e.consume(T),k)}function N(T,R){const A=t.sliceStream(T);if(R&&A.push(null),T.previous=o,o&&(o.next=T),o=T,a.defineSkip(T.start),a.write(A),t.parser.lazy[T.start.line]){let O=a.events.length;for(;O--;)if(a.events[O][1].start.offset<u&&(!a.events[O][1].end||a.events[O][1].end.offset>u))return;const P=t.events.length;let z=P,K,F;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(K){F=t.events[z][1].end;break}K=!0}for(S(i),O=P;O<t.events.length;)t.events[O][1].end={...F},O++;const q=new ff;q.add(z+1,0,t.events.slice(P)),q.add(P,O-P,[]),q.consume(t.events)}}function S(T){let R=n.length;for(;R-- >T;){const A=n[R];t.containerState=A[1],A[0].exit.call(t,e)}n.length=T}function C(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function PR(e,t,n){return kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pf(e){if(e===null||Bt(e)||ul(e))return 1;if(Nf(e))return 2}function Cf(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const fx={name:"attention",resolveAll:BR,tokenize:IR};function BR(e,t){let n=-1,i;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let a=n;for(;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,u={...e[a][1].end},h={...e[n][1].start};f2(u,-o),f2(h,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:u,end:{...e[a][1].end}},p={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},g={type:o>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},v={type:o>1?"strong":"emphasis",start:{...f.start},end:{...p.end}};e[a][1].end={...f.start},e[n][1].start={...p.end},i=[],e[a][1].end.offset-e[a][1].start.offset&&(i=Js(i,[["enter",e[a][1],t],["exit",e[a][1],t]])),i=Js(i,[["enter",v,t],["enter",f,t],["exit",f,t],["enter",g,t]]),i=Js(i,Cf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),i=Js(i,[["exit",g,t],["enter",p,t],["exit",p,t],["exit",v,t]]);let y=0;e[n][1].end.offset-e[n][1].start.offset&&(y=2,i=Js(i,[["enter",e[n][1],t],["exit",e[n][1],t]])),xi(e,a-1,n-a+3,i),n=a+i.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function IR(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=pf(i);let o;return u;function u(f){return o=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===o)return e.consume(f),h;const p=e.exit("attentionSequence"),g=pf(f),v=!g||g===2&&a||n.includes(f)&&f!==42&&f!==95,y=!a||a===2&&g||n.includes(i)&&i!==42&&i!==95;return p._open=!!(o===42?v:v&&(a||!y)),p._close=!!(o===42?y:y&&(g||!v)),t(f)}}function f2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const FR={name:"autolink",tokenize:UR};function UR(e,t,n){let i=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(b){return cs(b)?(e.consume(b),u):b===64?n(b):p(b)}function u(b){return b===43||b===45||b===46||Xn(b)?(i=1,h(b)):p(b)}function h(b){return b===58?(e.consume(b),i=0,f):(b===43||b===45||b===46||Xn(b))&&i++<32?(e.consume(b),h):(i=0,p(b))}function f(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||hf(b)?n(b):(e.consume(b),f)}function p(b){return b===64?(e.consume(b),g):AR(b)?(e.consume(b),p):n(b)}function g(b){return Xn(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||Xn(b))&&i++<63){const _=b===45?y:v;return e.consume(b),_}return n(b)}}const Bu={partial:!0,tokenize:HR};function HR(e,t,n){return i;function i(o){return ot(o)?kt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Ge(o)?t(o):n(o)}}const wN={continuation:{tokenize:VR},exit:GR,name:"blockQuote",tokenize:qR};function qR(e,t,n){const i=this;return a;function a(u){if(u===62){const h=i.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function VR(e,t,n){const i=this;return a;function a(u){return ot(u)?kt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(wN,t,n)(u)}}function GR(e){e.exit("blockQuote")}const SN={name:"characterEscape",tokenize:YR};function YR(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return OR(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const kN={name:"characterReference",tokenize:QR};function QR(e,t,n){const i=this;let a=0,o,u;return h;function h(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),f}function f(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Xn,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=RR,g):(e.enter("characterReferenceValue"),o=7,u=hx,g(v))}function g(v){if(v===59&&a){const y=e.exit("characterReferenceValue");return u===Xn&&!uv(i.sliceSerialize(y))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<o?(e.consume(v),g):n(v)}}const px={partial:!0,tokenize:XR};function XR(e,t,n){const i=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const p2={concrete:!0,name:"codeFenced",tokenize:WR};function WR(e,t,n){const i=this,a={partial:!0,tokenize:A};let o=0,u=0,h;return f;function f(O){return p(O)}function p(O){const P=i.events[i.events.length-1];return o=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,h=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===h?(u++,e.consume(O),g):u<3?n(O):(e.exit("codeFencedFenceSequence"),ot(O)?kt(e,v,"whitespace")(O):v(O))}function v(O){return O===null||Ge(O)?(e.exit("codeFencedFence"),i.interrupt?t(O):e.check(px,k,R)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(O))}function y(O){return O===null||Ge(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(O)):ot(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),kt(e,b,"whitespace")(O)):O===96&&O===h?n(O):(e.consume(O),y)}function b(O){return O===null||Ge(O)?v(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(O))}function _(O){return O===null||Ge(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(O)):O===96&&O===h?n(O):(e.consume(O),_)}function k(O){return e.attempt(a,R,N)(O)}function N(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),S}function S(O){return o>0&&ot(O)?kt(e,C,"linePrefix",o+1)(O):C(O)}function C(O){return O===null||Ge(O)?e.check(px,k,R)(O):(e.enter("codeFlowValue"),T(O))}function T(O){return O===null||Ge(O)?(e.exit("codeFlowValue"),C(O)):(e.consume(O),T)}function R(O){return e.exit("codeFenced"),t(O)}function A(O,P,z){let K=0;return F;function F(V){return O.enter("lineEnding"),O.consume(V),O.exit("lineEnding"),q}function q(V){return O.enter("codeFencedFence"),ot(V)?kt(O,L,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):L(V)}function L(V){return V===h?(O.enter("codeFencedFenceSequence"),de(V)):z(V)}function de(V){return V===h?(K++,O.consume(V),de):K>=u?(O.exit("codeFencedFenceSequence"),ot(V)?kt(O,X,"whitespace")(V):X(V)):z(V)}function X(V){return V===null||Ge(V)?(O.exit("codeFencedFence"),P(V)):z(V)}}}const n0={name:"codeIndented",tokenize:ZR},KR={partial:!0,tokenize:JR};function ZR(e,t,n){return i;function i(h){return e.enter("codeIndented"),_N(e,a,n,"linePrefix",4,4)(h)}function a(h){return h===null?u(h):Ge(h)?e.attempt(KR,a,u)(h):(e.enter("codeFlowValue"),o(h))}function o(h){return h===null||Ge(h)?(e.exit("codeFlowValue"),a(h)):(e.consume(h),o)}function u(h){return e.exit("codeIndented"),t(h)}}function JR(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):Ge(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):_N(e,t,o,"linePrefix",4,4)(u)}function o(u){return Ge(u)?a(u):n(u)}}const eO={name:"codeText",previous:nO,resolve:tO,tokenize:sO};function tO(e){let t=e.length-4,n=3,i,a;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;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function nO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sO(e,t,n){let i=0,a,o;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),h(v)}function h(v){return v===96?(e.consume(v),i++,h):(e.exit("codeTextSequence"),f(v))}function f(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),f):v===96?(o=e.enter("codeTextSequence"),a=0,g(v)):Ge(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||Ge(v)?(e.exit("codeTextData"),f(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(o.type="codeTextData",p(v))}}class iO{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 a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&eu(this.left,i),o.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),eu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),eu(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);eu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);eu(this.left,n.reverse())}}}function eu(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 jN(e){const t={};let n=-1,i,a,o,u,h,f,p;const g=new iO(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"&&(f=i[1]._tokenizer.events,o=0,o<f.length&&f[o][1].type==="lineEndingBlank"&&(o+=2),o<f.length&&f[o][1].type==="content"))for(;++o<f.length&&f[o][1].type!=="content";)f[o][1].type==="chunkText"&&(f[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,rO(g,n)),n=t[n],p=!0);else if(i[1]._container){for(o=n,a=void 0;o--;)if(u=g.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},h=g.slice(a,n),h.unshift(i),g.splice(a,n-a+1,h))}}return xi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function rO(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,f=[],p={};let g,v,y=-1,b=n,_=0,k=0;const N=[k];for(;b;){for(;e.get(++a)[1]!==b;);o.push(a),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<h.length;)h[y][0]==="exit"&&h[y-1][0]==="enter"&&h[y][1].type===h[y-1][1].type&&h[y][1].start.line!==h[y][1].end.line&&(k=y+1,N.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):N.pop(),y=N.length;y--;){const S=h.slice(N[y],N[y+1]),C=o.pop();f.push([C,C+S.length-1]),e.splice(C,2,S)}for(f.reverse(),y=-1;++y<f.length;)p[_+f[y][0]]=_+f[y][1],_+=f[y][1]-f[y][0]-1;return p}const aO={resolve:oO,tokenize:cO},lO={partial:!0,tokenize:uO};function oO(e){return jN(e),e}function cO(e,t){let n;return i;function i(h){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(h)}function a(h){return h===null?o(h):Ge(h)?e.check(lO,u,o)(h):(e.consume(h),a)}function o(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function u(h){return e.consume(h),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function uO(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),kt(e,o,"linePrefix")}function o(u){if(u===null||Ge(u))return n(u);const h=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function NN(e,t,n,i,a,o,u,h,f){const p=f||Number.POSITIVE_INFINITY;let g=0;return v;function v(S){return S===60?(e.enter(i),e.enter(a),e.enter(o),e.consume(S),e.exit(o),y):S===null||S===32||S===41||hf(S)?n(S):(e.enter(i),e.enter(u),e.enter(h),e.enter("chunkString",{contentType:"string"}),k(S))}function y(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(a),e.exit(i),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(e.exit("chunkString"),e.exit(h),y(S)):S===null||S===60||Ge(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||Bt(S))?(e.exit("chunkString"),e.exit(h),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||hf(S)?n(S):(e.consume(S),S===92?N:k)}function N(S){return S===40||S===41||S===92?(e.consume(S),k):k(S)}}function CN(e,t,n,i,a,o){const u=this;let h=0,f;return p;function p(b){return e.enter(i),e.enter(a),e.consume(b),e.exit(a),e.enter(o),g}function g(b){return h>999||b===null||b===91||b===93&&!f||b===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(o),e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):Ge(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||Ge(b)||h++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!ot(b)),b===92?y:v)}function y(b){return b===91||b===92||b===93?(e.consume(b),h++,v):v(b)}}function EN(e,t,n,i,a,o){let u;return h;function h(y){return y===34||y===39||y===40?(e.enter(i),e.enter(a),e.consume(y),e.exit(a),u=y===40?41:y,f):n(y)}function f(y){return y===u?(e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):(e.enter(o),p(y))}function p(y){return y===u?(e.exit(o),f(u)):y===null?n(y):Ge(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),kt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||Ge(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 _u(e,t){let n;return i;function i(a){return Ge(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):ot(a)?kt(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const dO={name:"definition",tokenize:fO},hO={partial:!0,tokenize:pO};function fO(e,t,n){const i=this;let a;return o;function o(b){return e.enter("definition"),u(b)}function u(b){return CN.call(i,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return a=vi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return Bt(b)?_u(e,p)(b):p(b)}function p(b){return NN(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(hO,v,v)(b)}function v(b){return ot(b)?kt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Ge(b)?(e.exit("definition"),i.parser.defined.push(a),t(b)):n(b)}}function pO(e,t,n){return i;function i(h){return Bt(h)?_u(e,a)(h):n(h)}function a(h){return EN(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function o(h){return ot(h)?kt(e,u,"whitespace")(h):u(h)}function u(h){return h===null||Ge(h)?t(h):n(h)}}const mO={name:"hardBreakEscape",tokenize:gO};function gO(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Ge(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const xO={name:"headingAtx",resolve:vO,tokenize:yO};function vO(e,t){let n=e.length-2,i=3;if(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){const a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"};xi(e,i,n-i+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])}return e}function yO(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Bt(g)?(e.exit("atxHeadingSequence"),h(g)):n(g)}function h(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Ge(g)?(e.exit("atxHeading"),t(g)):ot(g)?kt(e,h,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),h(g))}function p(g){return g===null||g===35||Bt(g)?(e.exit("atxHeadingText"),h(g)):(e.consume(g),p)}}const bO=["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"],m2=["pre","script","style","textarea"],_O={concrete:!0,name:"htmlFlow",resolveTo:SO,tokenize:kO},wO={partial:!0,tokenize:jO};function SO(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 kO(e,t,n){const i=this;let a,o,u,h,f;return p;function p($){return g($)}function g($){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume($),v}function v($){return $===33?(e.consume($),y):$===47?(e.consume($),o=!0,k):$===63?(e.consume($),a=3,i.interrupt?t:E):cs($)?(e.consume($),u=String.fromCharCode($),N):n($)}function y($){return $===45?(e.consume($),a=2,b):$===91?(e.consume($),a=5,h=0,_):cs($)?(e.consume($),a=4,i.interrupt?t:E):n($)}function b($){return $===45?(e.consume($),i.interrupt?t:E):n($)}function _($){const B="CDATA[";return $===B.charCodeAt(h++)?(e.consume($),h===B.length?i.interrupt?t:L:_):n($)}function k($){return cs($)?(e.consume($),u=String.fromCharCode($),N):n($)}function N($){if($===null||$===47||$===62||Bt($)){const B=$===47,oe=u.toLowerCase();return!B&&!o&&m2.includes(oe)?(a=1,i.interrupt?t($):L($)):bO.includes(u.toLowerCase())?(a=6,B?(e.consume($),S):i.interrupt?t($):L($)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n($):o?C($):T($))}return $===45||Xn($)?(e.consume($),u+=String.fromCharCode($),N):n($)}function S($){return $===62?(e.consume($),i.interrupt?t:L):n($)}function C($){return ot($)?(e.consume($),C):F($)}function T($){return $===47?(e.consume($),F):$===58||$===95||cs($)?(e.consume($),R):ot($)?(e.consume($),T):F($)}function R($){return $===45||$===46||$===58||$===95||Xn($)?(e.consume($),R):A($)}function A($){return $===61?(e.consume($),O):ot($)?(e.consume($),A):T($)}function O($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),f=$,P):ot($)?(e.consume($),O):z($)}function P($){return $===f?(e.consume($),f=null,K):$===null||Ge($)?n($):(e.consume($),P)}function z($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||Bt($)?A($):(e.consume($),z)}function K($){return $===47||$===62||ot($)?T($):n($)}function F($){return $===62?(e.consume($),q):n($)}function q($){return $===null||Ge($)?L($):ot($)?(e.consume($),q):n($)}function L($){return $===45&&a===2?(e.consume($),G):$===60&&a===1?(e.consume($),H):$===62&&a===4?(e.consume($),Ne):$===63&&a===3?(e.consume($),E):$===93&&a===5?(e.consume($),_e):Ge($)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(wO,Ce,de)($)):$===null||Ge($)?(e.exit("htmlFlowData"),de($)):(e.consume($),L)}function de($){return e.check(px,X,Ce)($)}function X($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),V}function V($){return $===null||Ge($)?de($):(e.enter("htmlFlowData"),L($))}function G($){return $===45?(e.consume($),E):L($)}function H($){return $===47?(e.consume($),u="",ae):L($)}function ae($){if($===62){const B=u.toLowerCase();return m2.includes(B)?(e.consume($),Ne):L($)}return cs($)&&u.length<8?(e.consume($),u+=String.fromCharCode($),ae):L($)}function _e($){return $===93?(e.consume($),E):L($)}function E($){return $===62?(e.consume($),Ne):$===45&&a===2?(e.consume($),E):L($)}function Ne($){return $===null||Ge($)?(e.exit("htmlFlowData"),Ce($)):(e.consume($),Ne)}function Ce($){return e.exit("htmlFlow"),t($)}}function jO(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Bu,t,n)}}const NO={name:"htmlText",tokenize:CO};function CO(e,t,n){const i=this;let a,o,u;return h;function h(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),f}function f(E){return E===33?(e.consume(E),p):E===47?(e.consume(E),A):E===63?(e.consume(E),T):cs(E)?(e.consume(E),z):n(E)}function p(E){return E===45?(e.consume(E),g):E===91?(e.consume(E),o=0,_):cs(E)?(e.consume(E),C):n(E)}function g(E){return E===45?(e.consume(E),b):n(E)}function v(E){return E===null?n(E):E===45?(e.consume(E),y):Ge(E)?(u=v,H(E)):(e.consume(E),v)}function y(E){return E===45?(e.consume(E),b):v(E)}function b(E){return E===62?G(E):E===45?y(E):v(E)}function _(E){const Ne="CDATA[";return E===Ne.charCodeAt(o++)?(e.consume(E),o===Ne.length?k:_):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),N):Ge(E)?(u=k,H(E)):(e.consume(E),k)}function N(E){return E===93?(e.consume(E),S):k(E)}function S(E){return E===62?G(E):E===93?(e.consume(E),S):k(E)}function C(E){return E===null||E===62?G(E):Ge(E)?(u=C,H(E)):(e.consume(E),C)}function T(E){return E===null?n(E):E===63?(e.consume(E),R):Ge(E)?(u=T,H(E)):(e.consume(E),T)}function R(E){return E===62?G(E):T(E)}function A(E){return cs(E)?(e.consume(E),O):n(E)}function O(E){return E===45||Xn(E)?(e.consume(E),O):P(E)}function P(E){return Ge(E)?(u=P,H(E)):ot(E)?(e.consume(E),P):G(E)}function z(E){return E===45||Xn(E)?(e.consume(E),z):E===47||E===62||Bt(E)?K(E):n(E)}function K(E){return E===47?(e.consume(E),G):E===58||E===95||cs(E)?(e.consume(E),F):Ge(E)?(u=K,H(E)):ot(E)?(e.consume(E),K):G(E)}function F(E){return E===45||E===46||E===58||E===95||Xn(E)?(e.consume(E),F):q(E)}function q(E){return E===61?(e.consume(E),L):Ge(E)?(u=q,H(E)):ot(E)?(e.consume(E),q):K(E)}function L(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,de):Ge(E)?(u=L,H(E)):ot(E)?(e.consume(E),L):(e.consume(E),X)}function de(E){return E===a?(e.consume(E),a=void 0,V):E===null?n(E):Ge(E)?(u=de,H(E)):(e.consume(E),de)}function X(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Bt(E)?K(E):(e.consume(E),X)}function V(E){return E===47||E===62||Bt(E)?K(E):n(E)}function G(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function H(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),ae}function ae(E){return ot(E)?kt(e,_e,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):_e(E)}function _e(E){return e.enter("htmlTextData"),u(E)}}const dv={name:"labelEnd",resolveAll:AO,resolveTo:RO,tokenize:OO},EO={tokenize:LO},TO={tokenize:DO},MO={tokenize:zO};function AO(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 a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&xi(e,0,e.length,n),e}function RO(e,t){let n=e.length,i=0,a,o,u;for(;n--;){const g=e[n][1];if(a){if(g.type==="link"||g.type==="labelLink"&&g._inactive)break;e[n][0]==="enter"&&g.type==="labelLink"&&(g._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(g.type==="labelImage"||g.type==="labelLink")&&!g._balanced&&(a=n,g.type!=="labelLink")){i=2;break}}else g.type==="labelEnd"&&(o=n)}const h={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},p={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[o-2][1].start}};return u=[["enter",h,t],["enter",f,t]],u=Js(u,e.slice(a+1,a+i+3)),u=Js(u,[["enter",p,t]]),u=Js(u,Cf(t.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),t)),u=Js(u,[["exit",p,t],e[o-2],e[o-1],["exit",f,t]]),u=Js(u,e.slice(o+1)),u=Js(u,[["exit",h,t]]),xi(e,a,e.length,u),e}function OO(e,t,n){const i=this,a=i._labelStarts;let o,u;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();o=a[a.length-1]}return h;function h(y){return o?o._inactive?v(y):(u=i.parser.defined.includes(vi(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(EO,g,u?g:v)(y):y===91?e.attempt(TO,g,u?p:v)(y):u?g(y):v(y)}function p(y){return e.attempt(MO,g,v)(y)}function g(y){return a.pop(),t(y)}function v(y){return o._balanced=!0,n(y)}}function LO(e,t,n){return i;function i(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return Bt(v)?_u(e,o)(v):o(v)}function o(v){return v===41?g(v):NN(e,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Bt(v)?_u(e,f)(v):g(v)}function h(v){return n(v)}function f(v){return v===34||v===39||v===40?EN(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Bt(v)?_u(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 DO(e,t,n){const i=this;return a;function a(h){return CN.call(i,e,o,u,"reference","referenceMarker","referenceString")(h)}function o(h){return i.parser.defined.includes(vi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function u(h){return n(h)}}function zO(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const $O={name:"labelStartImage",resolveAll:dv.resolveAll,tokenize:PO};function PO(e,t,n){const i=this;let a;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),a=e.exit("labelImage"),h):n(f)}function h(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(a),t(f))}}const BO={name:"labelStartLink",resolveAll:dv.resolveAll,tokenize:IO};function IO(e,t,n){const i=this;let a;return o;function o(h){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),a=e.exit("labelLink"),u}function u(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(a),t(h))}}const s0={name:"lineEnding",tokenize:FO};function FO(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),kt(e,t,"linePrefix")}}const Ih={name:"thematicBreak",tokenize:UO};function UO(e,t,n){let i=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,h(p)}function h(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):i>=3&&(p===null||Ge(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),i++,f):(e.exit("thematicBreakSequence"),ot(p)?kt(e,h,"whitespace")(p):h(p))}}const ys={continuation:{tokenize:GO},exit:QO,name:"list",tokenize:VO},HO={partial:!0,tokenize:XO},qO={partial:!0,tokenize:YO};function VO(e,t,n){const i=this,a=i.events[i.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return h;function h(b){const _=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:hx(b)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Ih,n,p)(b):p(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return hx(b)&&++u<10?(e.consume(b),f):(!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(Bu,i.interrupt?n:g,e.attempt(HO,y,v))}function g(b){return i.containerState.initialBlankLine=!0,o++,y(b)}function v(b){return ot(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function GO(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Bu,a,o);function a(h){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,kt(e,t,"listItemIndent",i.containerState.size+1)(h)}function o(h){return i.containerState.furtherBlankLines||!ot(h)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(h)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(qO,t,u)(h))}function u(h){return i.containerState._closeFlow=!0,i.interrupt=void 0,kt(e,e.attempt(ys,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function YO(e,t,n){const i=this;return kt(e,a,"listItemIndent",i.containerState.size+1);function a(o){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(o):n(o)}}function QO(e){e.exit(this.containerState.type)}function XO(e,t,n){const i=this;return kt(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=i.events[i.events.length-1];return!ot(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const g2={name:"setextUnderline",resolveTo:WO,tokenize:KO};function WO(e,t){const n=new ff;let i=e.length,a,o,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){a=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&n.add(i,1,[]),!u&&e[i][1].type==="definition"&&(u=i);const h={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(n.add(o,0,[["enter",h,t]]),n.add(u+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[u][1].end}):e[a][1]=h,n.add(e.length,0,[["exit",h,t]]),n.consume(e),e}function KO(e,t,n){const i=this;let a;return o;function o(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"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===a?(e.consume(p),h):(e.exit("setextHeadingLineSequence"),ot(p)?kt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Ge(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const ZO={tokenize:JO};function JO(e){const t=this,n=e.attempt(Bu,i,e.attempt(this.parser.constructs.flowInitial,a,kt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(aO,a)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const eL={resolveAll:MN()},tL=TN("string"),nL=TN("text");function TN(e){return{resolveAll:MN(e==="text"?sL:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],o=n.attempt(a,u,h);return u;function u(g){return p(g)?o(g):h(g)}function h(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return p(g)?(n.exit("data"),o(g)):(n.consume(g),f)}function p(g){if(g===null)return!0;const v=a[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 MN(e){return t;function t(n,i){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,i):n}}function sL(e,t){const n=new ff;let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const a=e[i-1][1],o=t.sliceStream(a);let u=o.length,h=-1,f=0,p;for(;u--;){const g=o[u];if(typeof g=="string"){for(h=g.length;g.charCodeAt(h-1)===32;)f++,h--;if(h)break;h=-1}else if(g===-2)p=!0,f++;else if(g!==-1){u++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(f=0),f){const g={type:i===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?h:a.start._bufferIndex+h,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...g.start},a.start.offset===a.end.offset?Object.assign(a,g):n.add(i,0,[["enter",g,t],["exit",g,t]])}i++}return n.consume(e),e}const iL={42:ys,43:ys,45:ys,48:ys,49:ys,50:ys,51:ys,52:ys,53:ys,54:ys,55:ys,56:ys,57:ys,62:wN},rL={91:dO},aL={[-2]:n0,[-1]:n0,32:n0},lL={35:xO,42:Ih,45:[g2,Ih],60:_O,61:g2,95:Ih,96:p2,126:p2},oL={38:kN,92:SN},cL={[-5]:s0,[-4]:s0,[-3]:s0,33:$O,38:kN,42:fx,60:[FR,NO],91:BO,92:[mO,SN],93:dv,95:fx,96:eO},uL={null:[fx,eL]},dL={null:[42,95]},hL={null:[]},fL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:dL,contentInitial:rL,disable:hL,document:iL,flow:lL,flowInitial:aL,insideSpan:uL,string:oL,text:cL},Symbol.toStringTag,{value:"Module"}));function pL(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 a={},o=[];let u=[],h=[];const f={attempt:P(A),check:P(O),consume:C,enter:T,exit:R,interrupt:P(O,{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,f);return t.resolveAll&&o.push(t),p;function v(q){return u=Js(u,q),N(),u[u.length-1]!==null?[]:(z(t,0),p.events=Cf(o,p.events,p),p.events)}function y(q,L){return gL(b(q),L)}function b(q){return mL(u,q)}function _(){const{_bufferIndex:q,_index:L,line:de,column:X,offset:V}=i;return{_bufferIndex:q,_index:L,line:de,column:X,offset:V}}function k(q){a[q.line]=q.column,F()}function N(){for(;i._index<u.length;){const q=u[i._index];if(typeof q=="string"){const L=i._index;for(i._bufferIndex<0&&(i._bufferIndex=0);i._index===L&&i._bufferIndex<q.length;)S(q.charCodeAt(i._bufferIndex))}else S(q)}}function S(q){g=g(q)}function C(q){Ge(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,F()):q!==-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=q}function T(q,L){const de=L||{};return de.type=q,de.start=_(),p.events.push(["enter",de,p]),h.push(de),de}function R(q){const L=h.pop();return L.end=_(),p.events.push(["exit",L,p]),L}function A(q,L){z(q,L.from)}function O(q,L){L.restore()}function P(q,L){return de;function de(X,V,G){let H,ae,_e,E;return Array.isArray(X)?Ce(X):"tokenize"in X?Ce([X]):Ne(X);function Ne(ye){return je;function je(Ee){const Be=Ee!==null&&ye[Ee],Oe=Ee!==null&&ye.null,Te=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Oe)?Oe:Oe?[Oe]:[]];return Ce(Te)(Ee)}}function Ce(ye){return H=ye,ae=0,ye.length===0?G:$(ye[ae])}function $(ye){return je;function je(Ee){return E=K(),_e=ye,ye.partial||(p.currentConstruct=ye),ye.name&&p.parser.constructs.disable.null.includes(ye.name)?oe():ye.tokenize.call(L?Object.assign(Object.create(p),L):p,f,B,oe)(Ee)}}function B(ye){return q(_e,E),V}function oe(ye){return E.restore(),++ae<H.length?$(H[ae]):G}}}function z(q,L){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&xi(p.events,L,p.events.length-L,q.resolve(p.events.slice(L),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function K(){const q=_(),L=p.previous,de=p.currentConstruct,X=p.events.length,V=Array.from(h);return{from:X,restore:G};function G(){i=q,p.previous=L,p.currentConstruct=de,p.events.length=X,h=V,F()}}function F(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function mL(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,o)];else{if(u=e.slice(n,a),i>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(i):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function gL(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
74
+ `;break}case-3:{u=`\r
75
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,i.push(u)}return i.join("")}function xL(e){const i={constructs:yN([fL,...(e||{}).extensions||[]]),content:a(LR),defined:[],document:a(zR),flow:a(ZO),lazy:{},string:a(tL),text:a(nL)};return i;function a(o){return u;function u(h){return pL(i,o,h)}}}function vL(e){for(;!jN(e););return e}const x2=/[\0\t\n\r]/g;function yL(){let e=1,t="",n=!0,i;return a;function a(o,u,h){o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o));const f=[];let p=0;for(t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){x2.lastIndex=p;const g=x2.exec(o),v=g&&g.index!==void 0?g.index:o.length,y=o.charCodeAt(v);if(!g){t=o.slice(p);break}if(y===10&&p===v&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),p<v&&(f.push(o.slice(p,v)),e+=v-p),y){case 0:{f.push(65533),e++;break}case 9:{const b=Math.ceil(e/4)*4;for(f.push(-2);e++<b;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}p=v+1}return h&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const bL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _L(e){return e.replace(bL,wL)}function wL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return bN(n.slice(o?2:1),o?16:10)}return uv(n)||e}const AN={}.hasOwnProperty;function SL(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),kL(n)(vL(xL(n).document().write(yL()(e,t,!0))))}function kL(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Kt),autolinkProtocol:F,autolinkEmail:F,atxHeading:u(St),blockQuote:u(Te),characterEscape:F,characterReference:F,codeFenced:u(Re),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:u(Re,h),codeText:u(It,h),codeTextData:F,data:F,codeFlowValue:F,definition:u(vn),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:u(Gt),hardBreakEscape:u(wt),hardBreakTrailing:u(wt),htmlFlow:u(Ze,h),htmlFlowData:F,htmlText:u(Ze,h),htmlTextData:F,image:u(xt),label:h,link:u(Kt),listItem:u(ke),listItemValue:b,listOrdered:u(se,y),listUnordered:u(se),paragraph:u(We),reference:B,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:u(St),strong:u(nt),thematicBreak:u(Ft)},exit:{atxHeading:p(),atxHeadingSequence:O,autolink:p(),autolinkEmail:Oe,autolinkProtocol:Be,blockQuote:p(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:je,characterReference:Ee,codeFenced:p(S),codeFencedFence:N,codeFencedFenceInfo:_,codeFencedFenceMeta:k,codeFlowValue:q,codeIndented:p(C),codeText:p(G),codeTextData:q,data:q,definition:p(),definitionDestinationString:A,definitionLabelString:T,definitionTitleString:R,emphasis:p(),hardBreakEscape:p(de),hardBreakTrailing:p(de),htmlFlow:p(X),htmlFlowData:q,htmlText:p(V),htmlTextData:q,image:p(ae),label:E,labelText:_e,lineEnding:L,link:p(H),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:oe,resourceDestinationString:Ne,resourceTitleString:Ce,resource:$,setextHeading:p(K),setextHeadingLineSequence:z,setextHeadingText:P,strong:p(),thematicBreak:p()}};RN(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ce){let U={type:"root",children:[],position:void 0};const fe={stack:[U],tokenStack:[],config:t,enter:f,exit:g,buffer:h,resume:v,data:n},Ae=[],tt=[];let ze=-1;for(;++ze<ce.length;)if(tt.push(ce[ze]),ce[ze][1].type==="listOrdered"||ce[ze][1].type==="listUnordered")if(ce[ze][0]==="enter")Ae.push(tt.length-1);else{const st=Ae.pop();o(tt,st)}for(ce=tt,ze=-1;++ze<ce.length;){const st=t[ce[ze][0]];ce[ze][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...fe,sliceSerialize:ce[ze][2].sliceSerialize},ce[ze][1]),AN.call(st,ce[ze][1].type)&&st[ce[ze][1].type].call({...fe,sliceSerialize:ce[ze][2].sliceSerialize},ce[ze][1]),ce[ze][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...fe,sliceSerialize:ce[ze][2].sliceSerialize},ce[ze][1])}if(fe.tokenStack.length>0){const st=fe.tokenStack[fe.tokenStack.length-1];(st[1]||v2).call(fe,void 0,st[0])}for(U.position={start:ra(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ra(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},ze=-1;++ze<t.transforms.length;)U=t.transforms[ze](U)||U;return U}function a(ce,U,fe){let Ae=-1;for(;++Ae<ce.length;)ce[Ae].call(U,fe)}function o(ce,U){const fe=ce.length-1;let Ae=U-1,tt=-1,ze=!1,st,rn,Zn,on;const Is=[];for(;++Ae<=fe;){const Jt=ce[Ae];switch(Jt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Jt[0]==="enter"?tt++:tt--,on=void 0;break}case"lineEndingBlank":{Jt[0]==="enter"&&(st&&!on&&!tt&&!Zn&&(Zn=Ae),on=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:on=void 0}if(!tt&&Jt[0]==="enter"&&Jt[1].type==="listItemPrefix"||tt===-1&&Jt[0]==="exit"&&(Jt[1].type==="listUnordered"||Jt[1].type==="listOrdered")){if(st){let fn=Ae;for(rn=void 0;fn--;){const en=ce[fn];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;rn&&(ce[rn][1].type="lineEndingBlank",ze=!0),en[1].type="lineEnding",rn=fn}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}Zn&&(!rn||Zn<rn)&&(st._spread=!0),st.end=Object.assign({},rn?ce[rn][1].start:Jt[1].end),Is.push({at:rn||Ae,event:["exit",st,Jt[2]]})}if(Jt[1].type==="listItemPrefix"){const fn={type:"listItem",_spread:!1,start:Object.assign({},Jt[1].start),end:void 0};st=fn,Is.push({at:Ae,event:["enter",fn,Jt[2]]}),Zn=void 0,on=!0}}}const ks=ce.splice(U);let Ut=0;for(Ae=-1;++Ae<ks.length;){for(;Ut<Is.length&&Is[Ut].at===U+Ae;)ce.push(Is[Ut++].event);ce.push(ks[Ae])}ce[U][1]._spread=ze}function u(ce,U){return fe;function fe(Ae){f.call(this,ce(Ae),Ae),U&&U.call(this,Ae)}}function h(){this.stack.push({type:"fragment",children:[]})}function f(ce,U,fe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([U,fe||void 0]),ce.position={start:ra(U.start),end:void 0}}function p(ce){return U;function U(fe){ce&&ce.call(this,fe),g.call(this,fe)}}function g(ce,U){const fe=this.stack.pop(),Ae=this.tokenStack.pop();if(!Ae)throw new Error("Cannot close `"+ce.type+"` ("+bu({start:ce.start,end:ce.end})+"): it’s not open");Ae[0].type!==ce.type&&(U?U.call(this,ce,Ae[0]):(Ae[1]||v2).call(this,ce,Ae[0])),fe.position.end=ra(ce.end)}function v(){return cv(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ce){if(this.data.expectingFirstListItemValue){const U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.lang=ce}function k(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.meta=ce}function N(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce.replace(/(\r?\n|\r)$/g,"")}function T(ce){const U=this.resume(),fe=this.stack[this.stack.length-1];fe.label=U,fe.identifier=vi(this.sliceSerialize(ce)).toLowerCase()}function R(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.title=ce}function A(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.url=ce}function O(ce){const U=this.stack[this.stack.length-1];if(!U.depth){const fe=this.sliceSerialize(ce).length;U.depth=fe}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function z(ce){const U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function F(ce){const fe=this.stack[this.stack.length-1].children;let Ae=fe[fe.length-1];(!Ae||Ae.type!=="text")&&(Ae=Zt(),Ae.position={start:ra(ce.start),end:void 0},fe.push(Ae)),this.stack.push(Ae)}function q(ce){const U=this.stack.pop();U.value+=this.sliceSerialize(ce),U.position.end=ra(ce.end)}function L(ce){const U=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=U.children[U.children.length-1];fe.position.end=ra(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(F.call(this,ce),q.call(this,ce))}function de(){this.data.atHardBreak=!0}function X(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce}function V(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce}function G(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.value=ce}function H(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=U,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ae(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=U,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function _e(ce){const U=this.sliceSerialize(ce),fe=this.stack[this.stack.length-2];fe.label=_L(U),fe.identifier=vi(U).toLowerCase()}function E(){const ce=this.stack[this.stack.length-1],U=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const Ae=ce.children;fe.children=Ae}else fe.alt=U}function Ne(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.url=ce}function Ce(){const ce=this.resume(),U=this.stack[this.stack.length-1];U.title=ce}function $(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function oe(ce){const U=this.resume(),fe=this.stack[this.stack.length-1];fe.label=U,fe.identifier=vi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function ye(ce){this.data.characterReferenceType=ce.type}function je(ce){const U=this.sliceSerialize(ce),fe=this.data.characterReferenceType;let Ae;fe?(Ae=bN(U,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=uv(U);const tt=this.stack[this.stack.length-1];tt.value+=Ae}function Ee(ce){const U=this.stack.pop();U.position.end=ra(ce.end)}function Be(ce){q.call(this,ce);const U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(ce)}function Oe(ce){q.call(this,ce);const U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(ce)}function Te(){return{type:"blockquote",children:[],position:void 0}}function Re(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function It(){return{type:"inlineCode",value:"",position:void 0}}function vn(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function Gt(){return{type:"emphasis",children:[],position:void 0}}function St(){return{type:"heading",depth:0,children:[],position:void 0}}function wt(){return{type:"break",position:void 0}}function Ze(){return{type:"html",value:"",position:void 0}}function xt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function Kt(){return{type:"link",title:null,url:"",children:[],position:void 0}}function se(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[],position:void 0}}function ke(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[],position:void 0}}function We(){return{type:"paragraph",children:[],position:void 0}}function nt(){return{type:"strong",children:[],position:void 0}}function Zt(){return{type:"text",value:"",position:void 0}}function Ft(){return{type:"thematicBreak",position:void 0}}}function ra(e){return{line:e.line,column:e.column,offset:e.offset}}function RN(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?RN(e,i):jL(e,i)}}function jL(e,t){let n;for(n in t)if(AN.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"afterExit":case"beforeEnter":{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 v2(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+bu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+bu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+bu({start:t.start,end:t.end})+") is still open")}function NL(e){const t=this;t.parser=n;function n(i){return SL(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function CL(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 EL(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
76
+ `}]}function TL(e,t){const n=t.value?t.value+`
77
+ `:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function ML(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AL(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function RL(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Bo(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let u,h=e.footnoteCounts.get(i);h===void 0?(h=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=o+1,h+=1,e.footnoteCounts.set(i,h);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function OL(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 LL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ON(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 a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function DL(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return ON(e,t);const a={src:Bo(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function zL(e,t){const n={src:Bo(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 $L(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 PL(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return ON(e,t);const a={href:Bo(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function BL(e,t){const n={href:Bo(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 IL(e,t,n){const i=e.all(t),a=n?FL(n):LN(t),o={},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:[]}),o.className=["task-list-item"]}let h=-1;for(;++h<i.length;){const g=i[h];(a||h!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
78
+ `}),g.type==="element"&&g.tagName==="p"&&!a?u.push(...g.children):u.push(g)}const f=i[i.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
79
+ `});const p={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,p),e.applyData(t,p)}function FL(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=LN(n[i])}return t}function LN(e){const t=e.spread;return t??e.children.length>1}function UL(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const u=i[a];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 o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function HL(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qL(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function VL(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function GL(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},h=rv(t.children[1]),f=hN(t.children[t.children.length-1]);h&&f&&(u.position={start:h,end:f}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function YL(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,h=u?u.length:t.children.length;let f=-1;const p=[];for(;++f<h;){const v=t.children[f],y={},b=u?u[f]:void 0;b&&(y.align=b);let _={type:"element",tagName:o,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 QL(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const y2=9,b2=32;function XL(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const o=[];for(;i;)o.push(_2(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return o.push(_2(t.slice(a),a>0,!1)),o.join("")}function _2(e,t,n){let i=0,a=e.length;if(t){let o=e.codePointAt(i);for(;o===y2||o===b2;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(a-1);for(;o===y2||o===b2;)a--,o=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function WL(e,t){const n={type:"text",value:XL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function KL(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ZL={blockquote:CL,break:EL,code:TL,delete:ML,emphasis:AL,footnoteReference:RL,heading:OL,html:LL,imageReference:DL,image:zL,inlineCode:$L,linkReference:PL,link:BL,listItem:IL,list:UL,paragraph:HL,root:qL,strong:VL,table:GL,tableCell:QL,tableRow:YL,text:WL,thematicBreak:KL,toml:_h,yaml:_h,definition:_h,footnoteDefinition:_h};function _h(){}const DN=-1,Ef=0,wu=1,mf=2,hv=3,fv=4,pv=5,mv=6,zN=7,$N=8,{defineProperty:JL}=Object,PN=typeof self=="object"?self:globalThis,w2=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new PN[e](t)},eD=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),i=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Ef:case DN:return n(u,a);case wu:{const h=n([],a);for(const f of u)h.push(i(f));return h}case mf:{const h=n({},a);for(const[f,p]of u){const g=i(f),v=i(p);g==="__proto__"?JL(h,g,{value:v,configurable:!0,enumerable:!0,writable:!0}):h[g]=v}return h}case hv:return n(new Date(u),a);case fv:{const{source:h,flags:f}=u;return n(new RegExp(h,f),a)}case pv:{const h=n(new Map,a);for(const[f,p]of u)h.set(i(f),i(p));return h}case mv:{const h=n(new Set,a);for(const f of u)h.add(i(f));return h}case zN:{const{name:h,message:f}=u;return n(typeof PN[h]=="function"?w2(h,f):new Error(f),a)}case $N:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:h}=new Uint8Array(u);return n(new DataView(h),u)}case"-0":return-0}return n(w2(o,u),a)};return i},S2=e=>eD(new Map,e)(0),nl="",{toString:tD}={},{keys:nD,is:sD}=Object,tu=e=>{const t=typeof e;if(t!=="object"||!e)return[Ef,t];const n=tD.call(e).slice(8,-1);switch(n){case"Array":return[wu,nl];case"Object":return[mf,nl];case"Date":return[hv,nl];case"RegExp":return[fv,nl];case"Map":return[pv,nl];case"Set":return[mv,nl];case"DataView":return[wu,n]}return n.includes("Array")?[wu,n]:e instanceof Error?[zN,e.name||"Error"]:[mf,n]},wh=([e,t])=>e===Ef&&(t==="function"||t==="symbol"),iD=(e,t,n,i)=>{const a=(u,h)=>{const f=i.push(u)-1;return n.set(h,f),f},o=u=>{if(n.has(u))return n.get(u);let[h,f]=tu(u);switch(h){case Ef:{let g=u;switch(f){case"bigint":h=$N,g=u.toString();break;case"number":if(!u&&sD(u,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return a([DN],u)}return a([h,g],u)}case wu:{if(f){let y=u;return f==="DataView"?y=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(u)),a([f,[...y]],u)}const g=[],v=a([h,g],u);for(const y of u)g.push(o(y));return v}case mf:{if(f)switch(f){case"BigInt":return a([f,u.toString()],u);case"Boolean":case"Number":case"String":return a([f,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const g=[],v=a([h,g],u);for(const y of nD(u))(e||!wh(tu(u[y])))&&g.push([o(y),o(u[y])]);return v}case hv:return a([h,isNaN(u.getTime())?nl:u.toISOString()],u);case fv:{const{source:g,flags:v}=u;return a([h,{source:g,flags:v}],u)}case pv:{const g=[],v=a([h,g],u);for(const[y,b]of u)(e||!(wh(tu(y))||wh(tu(b))))&&g.push([o(y),o(b)]);return v}case mv:{const g=[],v=a([h,g],u);for(const y of u)(e||!wh(tu(y)))&&g.push(o(y));return v}}const{message:p}=u;return a([h,{name:f,message:p}],u)};return o},k2=(e,{json:t,lossy:n}={})=>{const i=[];return iD(!(t||n),!!t,new Map,i)(e),i},gf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?S2(k2(e,t)):structuredClone(e):(e,t)=>S2(k2(e,t));function rD(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 aD(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function lD(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||rD,i=e.options.footnoteBackLabel||aD,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const g=e.all(p),v=String(p.identifier).toUpperCase(),y=Bo(v.toLowerCase());let b=0;const _=[],k=e.footnoteCounts.get(v);for(;k!==void 0&&++b<=k;){_.length>0&&_.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,b);typeof C=="string"&&(C={type:"text",value:C}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,b),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const N=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const C=N.children[N.children.length-1];C&&C.type==="text"?C.value+=" ":N.children.push({type:"text",value:" "}),N.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),h.push(S)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...gf(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
80
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
81
+ `}]}}const Tf=(function(e){if(e==null)return dD;if(typeof e=="function")return Mf(e);if(typeof e=="object")return Array.isArray(e)?oD(e):cD(e);if(typeof e=="string")return uD(e);throw new Error("Expected function, string, or object as test")});function oD(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Tf(e[n]);return Mf(i);function i(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function cD(e){const t=e;return Mf(n);function n(i){const a=i;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function uD(e){return Mf(t);function t(n){return n&&n.type===e}}function Mf(e){return t;function t(n,i,a){return!!(hD(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function dD(){return!0}function hD(e){return e!==null&&typeof e=="object"&&"type"in e}const BN=[],fD=!0,mx=!1,pD="skip";function IN(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const o=Tf(a),u=i?-1:1;h(e,void 0,[])();function h(f,p,g){const v=f&&typeof f=="object"?f:{};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 ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=BN,_,k,N;if((!t||o(f,p,g[g.length-1]||void 0))&&(b=mD(n(f,g)),b[0]===mx))return b;if("children"in f&&f.children){const S=f;if(S.children&&b[0]!==pD)for(k=(i?S.children.length:-1)+u,N=g.concat(S);k>-1&&k<S.children.length;){const C=S.children[k];if(_=h(C,k,N)(),_[0]===mx)return _;k=typeof _[1]=="number"?_[1]:k+u}}return b}}}function mD(e){return Array.isArray(e)?e:typeof e=="number"?[fD,e]:e==null?BN:[e]}function gv(e,t,n,i){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=i),IN(e,o,h,a);function h(f,p){const g=p[p.length-1],v=g?g.children.indexOf(f):void 0;return u(f,v,g)}}const gx={}.hasOwnProperty,gD={};function xD(e,t){const n=t||gD,i=new Map,a=new Map,o=new Map,u={...ZL,...n.handlers},h={all:p,applyData:yD,definitionById:i,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:f,options:n,patch:vD,wrap:_D};return gv(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?i:a,y=String(g.identifier).toUpperCase();v.has(y)||v.set(y,g)}}),h;function f(g,v){const y=g.type,b=h.handlers[y];if(gx.call(h.handlers,y)&&b)return b(h,g,v);if(h.options.passThrough&&h.options.passThrough.includes(y)){if("children"in g){const{children:k,...N}=g,S=gf(N);return S.children=h.all(g),S}return gf(g)}return(h.options.unknownHandler||bD)(h,g,v)}function p(g){const v=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const _=h.one(y[b],g);if(_){if(b&&y[b-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=j2(_.value)),!Array.isArray(_)&&_.type==="element")){const k=_.children[0];k&&k.type==="text"&&(k.value=j2(k.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function vD(e,t){e.position&&(t.position=aR(e))}function yD(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,o=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"&&o&&Object.assign(n.properties,gf(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function bD(e,t){const n=t.data||{},i="value"in t&&!(gx.call(n,"hProperties")||gx.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 _D(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
82
+ `});++i<e.length;)i&&n.push({type:"text",value:`
83
+ `}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
84
+ `}),n}function j2(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function N2(e,t){const n=xD(e,t),i=n.one(e,void 0),a=lD(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
85
+ `},a),o}function wD(e,t){return e&&"run"in e?async function(n,i){const a=N2(n,{file:i,...t});await e.run(a,i)}:function(n,i){return N2(n,{file:i,...e||t})}}function C2(e){if(e)throw e}var i0,E2;function SD(){if(E2)return i0;E2=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},o=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},h=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return i0=function f(){var p,g,v,y,b,_,k=arguments[0],N=1,S=arguments.length,C=!1;for(typeof k=="boolean"&&(C=k,k=arguments[1]||{},N=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});N<S;++N)if(p=arguments[N],p!=null)for(g in p)v=h(k,g),y=h(p,g),k!==y&&(C&&y&&(o(y)||(b=a(y)))?(b?(b=!1,_=v&&a(v)?v:[]):_=v&&o(v)?v:{},u(k,{name:g,newValue:f(C,_,y)})):typeof y<"u"&&u(k,{name:g,newValue:y}));return k},i0}var kD=SD();const r0=kx(kD);function xx(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 jD(){const e=[],t={run:n,use:i};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);h(null,...a);function h(f,...p){const g=e[++o];let v=-1;if(f){u(f);return}for(;++v<a.length;)(p[v]===null||p[v]===void 0)&&(p[v]=a[v]);a=p,g?ND(g,h)(...p):u(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function ND(e,t){let n;return i;function i(...u){const h=e.length>u.length;let f;h&&u.push(a);try{f=e.apply(this,u)}catch(p){const g=p;if(h&&n)throw g;return a(g)}h||(f&&f.then&&typeof f.then=="function"?f.then(o,a):f instanceof Error?a(f):o(f))}function a(u,...h){n||(n=!0,t(u,...h))}function o(u){a(null,u)}}const Fi={basename:CD,dirname:ED,extname:TD,join:MD,sep:"/"};function CD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Iu(e);let n=0,i=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else i<0&&(o=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,h=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),h>-1&&(e.codePointAt(a)===t.codePointAt(h--)?h<0&&(i=a):(h=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function ED(e){if(Iu(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 TD(e){Iu(e);let t=e.length,n=-1,i=0,a=-1,o=0,u;for(;t--;){const h=e.codePointAt(t);if(h===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),h===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function MD(...e){let t=-1,n;for(;++t<e.length;)Iu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":AD(n)}function AD(e){Iu(e);const t=e.codePointAt(0)===47;let n=RD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function RD(e,t){let n="",i=0,a=-1,o=0,u=-1,h,f;for(;++u<=e.length;){if(u<e.length)h=e.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",i=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),i=u-a-1;a=u,o=0}else h===46&&o>-1?o++:o=-1}return n}function Iu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const OD={cwd:LD};function LD(){return"/"}function vx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function DD(e){if(typeof e=="string")e=new URL(e);else if(!vx(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 zD(e)}function zD(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 a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const a0=["history","path","basename","stem","extname","dirname"];class FN{constructor(t){let n;t?vx(t)?n={path:t}:typeof t=="string"||$D(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":OD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<a0.length;){const o=a0[i];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)a0.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Fi.basename(this.path):void 0}set basename(t){o0(t,"basename"),l0(t,"basename"),this.path=Fi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Fi.dirname(this.path):void 0}set dirname(t){T2(this.basename,"dirname"),this.path=Fi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Fi.extname(this.path):void 0}set extname(t){if(l0(t,"extname"),T2(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=Fi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vx(t)&&(t=DD(t)),o0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Fi.basename(this.path,this.extname):void 0}set stem(t){o0(t,"stem"),l0(t,"stem"),this.path=Fi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new Kn(t,n,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function l0(e,t){if(e&&e.includes(Fi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Fi.sep+"`")}function o0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function T2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $D(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PD=(function(e){const i=this.constructor.prototype,a=i[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,i),o}),BD={}.hasOwnProperty;class xv extends PD{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=jD()}copy(){const t=new xv;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(r0(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(d0("data",this.frozen),this.namespace[t]=n,this):BD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(d0("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 a=n.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Sh(t),i=this.parser||this.Parser;return c0("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),c0("process",this.parser||this.Parser),u0("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const h=Sh(t),f=i.parse(h);i.run(f,h,function(g,v,y){if(g||!v||!y)return p(g);const b=v,_=i.stringify(b,y);UD(_)?y.value=_:y.result=_,p(g,y)});function p(g,v){g||!v?u(g):o?o(v):n(void 0,v)}}}processSync(t){let n=!1,i;return this.freeze(),c0("processSync",this.parser||this.Parser),u0("processSync",this.compiler||this.Compiler),this.process(t,a),A2("processSync","process",n),i;function a(o,u){n=!0,C2(o),i=u}}run(t,n,i){M2(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?o(void 0,i):new Promise(o);function o(u,h){const f=Sh(n);a.run(t,f,p);function p(g,v,y){const b=v||t;g?h(g):u?u(b):i(void 0,b,y)}}}runSync(t,n){let i=!1,a;return this.run(t,n,o),A2("runSync","run",i),a;function o(u,h){C2(u),a=h,i=!0}}stringify(t,n){this.freeze();const i=Sh(n),a=this.compiler||this.Compiler;return u0("stringify",a),M2(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(d0("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?h(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...v]=p;f(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");h(p.plugins),p.settings&&(a.settings=r0(!0,a.settings,p.settings))}function h(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const v=p[g];o(v)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(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];xx(k)&&xx(b)&&(b=r0(!0,k,b)),i[y]=[p,b,..._]}}}}const ID=new xv().freeze();function c0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function u0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function d0(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 M2(e){if(!xx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function A2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Sh(e){return FD(e)?e:new FN(e)}function FD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UD(e){return typeof e=="string"||HD(e)}function HD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",R2=[],O2={allowDangerousHtml:!0},VD=/^(https?|ircs?|mailto|xmpp)$/i,GD=[{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 vv(e){const t=YD(e),n=QD(e);return XD(t.runSync(t.parse(n),n),e)}function YD(e){const t=e.rehypePlugins||R2,n=e.remarkPlugins||R2,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...O2}:O2;return ID().use(NL).use(n).use(wD,i).use(t)}function QD(e){const t=e.children||"",n=new FN;return typeof t=="string"&&(n.value=t),n}function XD(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||WD;for(const g of GD)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+qD+g.id,void 0);return gv(e,p),dR(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.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 t0)if(Object.hasOwn(t0,b)&&Object.hasOwn(g.properties,b)){const _=g.properties[b],k=t0[b];(k===null||k.includes(g.tagName))&&(g.properties[b]=f(String(_||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!b&&i&&typeof v=="number"&&(b=!i(g,v,y)),b&&y&&typeof v=="number")return h&&g.children?y.children.splice(v,1,...g.children):y.children.splice(v,1),v}}}function WD(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||VD.test(e.slice(0,t))?e:""}function L2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function KD(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ZD(e,t,n){const a=Tf((n||{}).ignore||[]),o=JD(t);let u=-1;for(;++u<o.length;)IN(e,"text",h);function h(p,g){let v=-1,y;for(;++v<g.length;){const b=g[v],_=y?y.children:void 0;if(a(b,_?_.indexOf(b):void 0,y))return;y=b}if(y)return f(p,g)}function f(p,g){const v=g[g.length-1],y=o[u][0],b=o[u][1];let _=0;const N=v.children.indexOf(p);let S=!1,C=[];y.lastIndex=0;let T=y.exec(p.value);for(;T;){const A=T.index,O={index:T.index,input:T.input,stack:[...g,p]};let P=b(...T,O);if(typeof P=="string"&&(P=P.length>0?{type:"text",value:P}:void 0),P===!1)y.lastIndex=A+1;else{if(_!==A&&R({type:"text",value:p.value.slice(_,A)}),Array.isArray(P))for(const z of P)R(z);else P&&R(P);_=A+T[0].length,S=!0}if(!y.global)break;T=y.exec(p.value)}return S?(_<p.value.length&&R({type:"text",value:p.value.slice(_)}),v.children.splice(N,1,...C)):C=[p],N+C.length;function R(A){const O=C[C.length-1];O&&O.type==="text"&&A.type==="text"?O.value+=A.value:C.push(A)}}}function JD(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([ez(a[0]),tz(a[1])])}return t}function ez(e){return typeof e=="string"?new RegExp(KD(e),"g"):e}function tz(e){return typeof e=="function"?e:function(){return e}}const h0="phrasing",f0=["autolink","link","image","label"];function nz(){return{transforms:[cz],enter:{literalAutolink:iz,literalAutolinkEmail:p0,literalAutolinkHttp:p0,literalAutolinkWww:p0},exit:{literalAutolink:oz,literalAutolinkEmail:lz,literalAutolinkHttp:rz,literalAutolinkWww:az}}}function sz(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:h0,notInConstruct:f0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:h0,notInConstruct:f0},{character:":",before:"[ps]",after:"\\/",inConstruct:h0,notInConstruct:f0}]}}function iz(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function p0(e){this.config.enter.autolinkProtocol.call(this,e)}function rz(e){this.config.exit.autolinkProtocol.call(this,e)}function az(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 lz(e){this.config.exit.autolinkEmail.call(this,e)}function oz(e){this.exit(e)}function cz(e){ZD(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,uz],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),dz]],{ignore:["link","linkReference"]})}function uz(e,t,n,i,a){let o="";if(!UN(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!hz(n)))return!1;const u=fz(n+i);if(!u[0])return!1;const h={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function dz(e,t,n,i){return!UN(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function hz(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 fz(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 a=L2(e,"(");let o=L2(e,")");for(;i!==-1&&a>o;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),o++;return[e,n]}function UN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ul(n)||Nf(n))&&(!t||n!==47)}HN.peek=wz;function pz(){this.buffer()}function mz(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function gz(){this.buffer()}function xz(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vz(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function yz(e){this.exit(e)}function bz(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _z(e){this.exit(e)}function wz(){return"["}function HN(e,t,n,i){const a=n.createTracker(i);let o=a.move("[^");const u=n.enter("footnoteReference"),h=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),h(),u(),o+=a.move("]"),o}function Sz(){return{enter:{gfmFootnoteCallString:pz,gfmFootnoteCall:mz,gfmFootnoteDefinitionLabelString:gz,gfmFootnoteDefinition:xz},exit:{gfmFootnoteCallString:vz,gfmFootnoteCall:yz,gfmFootnoteDefinitionLabelString:bz,gfmFootnoteDefinition:_z}}}function kz(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:HN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,o,u){const h=o.createTracker(u);let f=h.move("[^");const p=o.enter("footnoteDefinition"),g=o.enter("label");return f+=h.move(o.safe(o.associationId(i),{before:f,after:"]"})),g(),f+=h.move("]:"),i.children&&i.children.length>0&&(h.shift(4),f+=h.move((t?`
86
+ `:" ")+o.indentLines(o.containerFlow(i,h.current()),t?qN:jz))),p(),f}}function jz(e,t,n){return t===0?e:qN(e,t,n)}function qN(e,t,n){return(n?"":" ")+e}const Nz=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];yv.attention=Az;yv.peek=Rz;function Cz(){return{canContainEols:["delete"],enter:{strikethrough:Tz},exit:{strikethrough:Mz}}}function Ez(){return{handlers:{delete:yv},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Nz}]}}function Tz(e){this.enter({type:"delete",children:[],position:void 0},e)}function Mz(e){this.exit(e)}function yv(e,t,n,i){const a=n.createTracker(i),o=n.stack.includes("strikethrough")?"~":"~~",u=n.enter("strikethrough");let h=a.move(o);return h+=n.containerPhrasing(e,{...a.current(),before:h,after:"~"}),h+=a.move(o),u(),h}function Az(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function Rz(){return"~"}function Oz(e){return e.length}function Lz(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||Oz,o=[],u=[],h=[],f=[];let p=0,g=-1;for(;++g<e.length;){const k=[],N=[];let S=-1;for(e[g].length>p&&(p=e[g].length);++S<e[g].length;){const C=Dz(e[g][S]);if(n.alignDelimiters!==!1){const T=a(C);N[S]=T,(f[S]===void 0||T>f[S])&&(f[S]=T)}k.push(C)}u[g]=k,h[g]=N}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<p;)o[v]=D2(i[v]);else{const k=D2(i);for(;++v<p;)o[v]=k}v=-1;const y=[],b=[];for(;++v<p;){const k=o[v];let N="",S="";k===99?(N=":",S=":"):k===108?N=":":k===114&&(S=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[v]-N.length-S.length);const T=N+"-".repeat(C)+S;n.alignDelimiters!==!1&&(C=N.length+C+S.length,C>f[v]&&(f[v]=C),b[v]=C),y[v]=T}u.splice(1,0,y),h.splice(1,0,b),g=-1;const _=[];for(;++g<u.length;){const k=u[g],N=h[g];v=-1;const S=[];for(;++v<p;){const C=k[v]||"";let T="",R="";if(n.alignDelimiters!==!1){const A=f[v]-(N[v]||0),O=o[v];O===114?T=" ".repeat(A):O===99?A%2?(T=" ".repeat(A/2+.5),R=" ".repeat(A/2-.5)):(T=" ".repeat(A/2),R=T):R=" ".repeat(A)}n.delimiterStart!==!1&&!v&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||v)&&S.push(" "),n.alignDelimiters!==!1&&S.push(T),S.push(C),n.alignDelimiters!==!1&&S.push(R),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||v!==p-1)&&S.push("|")}_.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return _.join(`
87
+ `)}function Dz(e){return e==null?"":String(e)}function D2(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}const zz=Tf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $z(e,t,n,i){const a=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),Pz);return a(),u}function Pz(e,t,n){return">"+(n?"":" ")+e}function Bz(e,t){return z2(e,t.inConstruct,!0)&&!z2(e,t.notInConstruct,!1)}function z2(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 $2(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;){const o=n.unsafe[a];if(o.character===`
88
+ `&&!o.before&&!o.after&&Bz(n.stack,o))return/[\t ]/.test(i.before)?"":" "}return`\\
89
+ `}function Iz(e,t){const n=String(e);let i=n.indexOf(t),a=i,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++o>u&&(u=o):o=1,a=i+t.length,i=n.indexOf(t,a);return u}function Fz(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function Uz(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 Hz(e,t,n,i){const a=Uz(n),o=e.value||"";if(Fz(e,n)){const v=n.enter("codeIndented"),y=n.indentLines(o,qz);return v(),y}const u=n.createTracker(i),h=a.repeat(Math.max(Iz(o,a)+1,3)),f=n.enter("codeFenced"),p=a==="`"?"GraveAccent":"Tilde";let g=u.move(h);if(e.lang){const v=n.enter(`codeFencedLang${p}`);g+=u.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...u.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${p}`);g+=u.move(" "),g+=u.move(n.safe(e.meta,{before:g,after:`
90
+ `,encode:["`"],...u.current()})),v()}return g+=u.move(`
91
+ `),o&&(g+=u.move(o+`
92
+ `)),g+=u.move(h),f(),g}function qz(e,t,n){return(n?"":" ")+e}function bv(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 Vz(e,t,n,i){const a=bv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let h=n.enter("label");const f=n.createTracker(i);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
93
+ `,...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),u(),p}function Gz(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}_v.attention=Yz;_v.peek=Qz;function _v(e,t,n,i){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},i);return a(),o}function Yz(e,t){return{construct:"emphasis",markers:Gz(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function Qz(e,t,n){return n.options.emphasis||"*"}function Xz(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Wz(e,t){let n=!1;return gv(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,mx}),!!((!e.depth||e.depth<3)&&cv(e)&&(t.options.setext||n))}function Kz(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(Wz(e,n)){const v=n.enter("headingSetext"),y=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
94
+ `,after:`
95
+ `});return y(),v(),b+`
96
+ `+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
97
+ `))+1))}const u="#".repeat(a),h=n.enter("headingAtx"),f=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
98
+ `,...o.current()});const g=p.charCodeAt(0);return(g===9||g===32)&&(p=Xz(g)+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),f(),h(),p}VN.peek=Zz;function VN(e){return e.value||""}function Zz(){return"<"}GN.peek=Jz;function GN(e,t,n,i){const a=bv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let h=n.enter("label");const f=n.createTracker(i);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),p+=f.move(")"),u(),p}function Jz(){return"!"}YN.peek=e$;function YN(e,t,n,i){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("![");const p=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const g=n.stack;n.stack=g.filter(function(y){return y!=="phrasing"}),u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=g,o(),a==="full"||!p||p!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function e$(){return"!"}QN.peek=t$;function QN(e,t,n){let i=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const u=n.unsafe[o],h=n.compilePattern(u);if(!u.atBreak)continue;let f;for(;f=h.exec(i);){let p=f.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(f.index+1)}}return a+i+a}function t$(){return"`"}function XN(e,t){const n=cv(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))}WN.peek=n$;function WN(e,t,n,i){const a=bv(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);if(XN(e,n)){const g=n.stack;n.stack=g.filter(function(b){return b!=="phrasing"});const v=n.enter("autolink");let y=u.move("<");return y+=u.move(n.containerPhrasing(e,{before:y,after:">",...u.current()})),y+=u.move(">"),v(),n.stack=g,y}const h=n.enter("link");let f=n.enter("label"),p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(f=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),f()),p+=u.move(")"),h(),p}function n$(e,t,n){return XN(e,n)?"<":"["}KN.peek=s$;function KN(e,t,n,i){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const g=n.stack;n.stack=g.filter(function(y){return y!=="phrasing"}),u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=g,o(),a==="full"||!p||p!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function s$(){return"["}function wv(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 i$(e){const t=wv(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 r$(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 ZN(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 a$(e,t,n,i){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?r$(n):wv(n);const h=e.ordered?u==="."?")":".":i$(n);let f=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&&(f=!0),ZN(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"){f=!0;break}}}}f&&(u=h),n.bulletCurrent=u;const p=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function l$(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 o$(e,t,n,i){const a=l$(n);let o=n.bulletCurrent||wv(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const h=n.createTracker(i);h.move(o+" ".repeat(u-o.length)),h.shift(u);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,h.current()),g);return f(),p;function g(v,y,b){return y?(b?"":" ".repeat(u))+v:(b?o:o+" ".repeat(u-o.length))+v}}function c$(e,t,n,i){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),a(),u}function u$(e,t,n,i){if(!e.children.some(function(h){return zz(h)}))return n.containerFlow(e,i);const o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),u}function d$(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Sv.attention=h$;Sv.peek=f$;function Sv(e,t,n,i){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},i);return a(),o}function h$(e,t){return{construct:"strong",markers:d$(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function f$(e,t,n){return n.options.strong||"*"}function p$(e,t,n,i){const a=t?t.children:[],o=a.indexOf(e);return n.safe(e.value,{...i,afterNode:a[o+1],beforeNode:a[o-1]})}function m$(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 g$(e,t,n){const i=(ZN(n)+(n.options.ruleSpaces?" ":"")).repeat(m$(n));return n.options.ruleSpaces?i.slice(0,-1):i}const JN={blockquote:$z,break:$2,code:Hz,definition:Vz,emphasis:_v,hardBreak:$2,heading:Kz,html:VN,image:GN,imageReference:YN,inlineCode:QN,link:WN,linkReference:KN,list:a$,listItem:o$,paragraph:c$,root:u$,strong:Sv,text:p$,thematicBreak:g$};function x$(){return{enter:{table:v$,tableData:P2,tableHeader:P2,tableRow:b$},exit:{codeText:_$,table:y$,tableData:m0,tableHeader:m0,tableRow:m0}}}function v$(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 y$(e){this.exit(e),this.data.inTable=void 0}function b$(e){this.enter({type:"tableRow",children:[]},e)}function m0(e){this.exit(e)}function P2(e){this.enter({type:"tableCell",children:[]},e)}function _$(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,w$));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function w$(e,t){return t==="|"?t:e}function S$(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
99
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:f,tableRow:h}};function u(b,_,k,N){return p(g(b,k,N),b.align)}function h(b,_,k,N){const S=v(b,k,N),C=p([S]);return C.slice(0,C.indexOf(`
100
+ `))}function f(b,_,k,N){const S=k.enter("tableCell"),C=k.enter("phrasing"),T=k.containerPhrasing(b,{...N,before:o,after:o});return C(),S(),T}function p(b,_){return Lz(b,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function g(b,_,k){const N=b.children;let S=-1;const C=[],T=_.enter("table");for(;++S<N.length;)C[S]=v(N[S],_,k);return T(),C}function v(b,_,k){const N=b.children;let S=-1;const C=[],T=_.enter("tableRow");for(;++S<N.length;)C[S]=f(N[S],b,_,k);return T(),C}function y(b,_,k){let N=JN.inlineCode(b,_,k);return k.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function k$(){return{exit:{taskListCheckValueChecked:B2,taskListCheckValueUnchecked:B2,paragraph:N$}}}function j$(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:C$}}}function B2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function N$(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 a=t.children;let o=-1,u;for(;++o<a.length;){const h=a[o];if(h.type==="paragraph"){u=h;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 C$(e,t,n,i){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",h=n.createTracker(i);o&&h.move(u);let f=JN.listItem(e,t,n,{...i,...h.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(g){return g+u}}function E$(){return[nz(),Sz(),Cz(),x$(),k$()]}function T$(e){return{extensions:[sz(),kz(e),Ez(),S$(e),j$()]}}const M$={tokenize:z$,partial:!0},eC={tokenize:$$,partial:!0},tC={tokenize:P$,partial:!0},nC={tokenize:B$,partial:!0},A$={tokenize:I$,partial:!0},sC={name:"wwwAutolink",tokenize:L$,previous:rC},iC={name:"protocolAutolink",tokenize:D$,previous:aC},Sr={name:"emailAutolink",tokenize:O$,previous:lC},Gi={};function R$(){return{text:Gi}}let Ka=48;for(;Ka<123;)Gi[Ka]=Sr,Ka++,Ka===58?Ka=65:Ka===91&&(Ka=97);Gi[43]=Sr;Gi[45]=Sr;Gi[46]=Sr;Gi[95]=Sr;Gi[72]=[Sr,iC];Gi[104]=[Sr,iC];Gi[87]=[Sr,sC];Gi[119]=[Sr,sC];function O$(e,t,n){const i=this;let a,o;return u;function u(v){return!yx(v)||!lC.call(i,i.previous)||kv(i.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(v))}function h(v){return yx(v)?(e.consume(v),h):v===64?(e.consume(v),f):n(v)}function f(v){return v===46?e.check(A$,g,p)(v):v===45||v===95||Xn(v)?(o=!0,e.consume(v),f):g(v)}function p(v){return e.consume(v),a=!0,f}function g(v){return o&&a&&cs(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function L$(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!rC.call(i,i.previous)||kv(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(M$,e.attempt(eC,e.attempt(tC,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function D$(e,t,n){const i=this;let a="",o=!1;return u;function u(v){return(v===72||v===104)&&aC.call(i,i.previous)&&!kv(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),h):n(v)}function h(v){if(cs(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),h;if(v===58){const y=a.toLowerCase();if(y==="http"||y==="https")return e.consume(v),f}return n(v)}function f(v){return v===47?(e.consume(v),o?p:(o=!0,f)):n(v)}function p(v){return v===null||hf(v)||Bt(v)||ul(v)||Nf(v)?n(v):e.attempt(eC,e.attempt(tC,g),n)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function z$(e,t,n){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function $$(e,t,n){let i,a,o;return u;function u(p){return p===46||p===95?e.check(nC,f,h)(p):p===null||Bt(p)||ul(p)||p!==45&&Nf(p)?f(p):(o=!0,e.consume(p),u)}function h(p){return p===95?i=!0:(a=i,i=void 0),e.consume(p),u}function f(p){return a||i||!o?n(p):t(p)}}function P$(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?o(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(nC,t,o)(u):u===null||Bt(u)||ul(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&i++,e.consume(u),a}}function B$(e,t,n){return i;function i(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),i):h===38?(e.consume(h),o):h===93?(e.consume(h),a):h===60||h===null||Bt(h)||ul(h)?t(h):n(h)}function a(h){return h===null||h===40||h===91||Bt(h)||ul(h)?t(h):i(h)}function o(h){return cs(h)?u(h):n(h)}function u(h){return h===59?(e.consume(h),i):cs(h)?(e.consume(h),u):n(h)}}function I$(e,t,n){return i;function i(o){return e.consume(o),a}function a(o){return Xn(o)?n(o):t(o)}}function rC(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Bt(e)}function aC(e){return!cs(e)}function lC(e){return!(e===47||yx(e))}function yx(e){return e===43||e===45||e===46||e===95||Xn(e)}function kv(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 F$={tokenize:X$,partial:!0};function U$(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:G$,continuation:{tokenize:Y$},exit:Q$}},text:{91:{name:"gfmFootnoteCall",tokenize:V$},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:H$,resolveTo:q$}}}}function H$(e,t,n){const i=this;let a=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const f=i.events[a][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return h;function h(f){if(!u||!u._balanced)return n(f);const p=vi(i.sliceSerialize({start:u.end,end:i.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function q$(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)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},h=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...h),e}function V$(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,u;return h;function h(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),f}function f(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(o>999||v===93&&!u||v===null||v===91||Bt(v))return n(v);if(v===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return a.includes(vi(i.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Bt(v)||(u=!0),o++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),o++,p):p(v)}}function G$(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,u=0,h;return f;function f(_){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&&!h||_===null||_===91||Bt(_))return n(_);if(_===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=vi(i.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Bt(_)||(h=!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"),a.includes(o)||a.push(o),kt(e,b,"gfmFootnoteDefinitionWhitespace")):n(_)}function b(_){return t(_)}}function Y$(e,t,n){return e.check(Bu,t,e.attempt(F$,t,n))}function Q$(e){e.exit("gfmFootnoteDefinition")}function X$(e,t,n){const i=this;return kt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function W$(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,h){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},v={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,h],["enter",u[p][1],h],["exit",u[p][1],h],["enter",v,h]],b=h.parser.constructs.insideSpan.null;b&&xi(y,y.length,0,Cf(b,u.slice(p+1,f),h)),xi(y,y.length,0,[["exit",v,h],["enter",u[f][1],h],["exit",u[f][1],h],["exit",g,h]]),xi(u,p-1,f-p+3,y),f=p+y.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function o(u,h,f){const p=this.previous,g=this.events;let v=0;return y;function y(_){return p===126&&g[g.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),b(_))}function b(_){const k=pf(p);if(_===126)return v>1?f(_):(u.consume(_),v++,b);if(v<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),S=pf(_);return N._open=!S||S===2&&!!k,N._close=!k||k===2&&!!S,h(_)}}}class K${constructor(){this.map=[],this.index=new Map}add(t,n,i){Z$(this,t,n,i)}consume(t){if(this.map.sort(function(o,u){return o[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 a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0,this.index.clear()}}function Z$(e,t,n,i){if(n===0&&i.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,a[2].push(...i);return}const o=[t,n,i];e.map.push(o),e.index.set(t,o)}function J$(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=i.length-1;i[o]=i[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function e9(){return{flow:{null:{name:"table",tokenize:t9,resolveAll:n9}}}}function t9(e,t,n){const i=this;let a=0,o=0,u;return h;function h(F){let q=i.events.length-1;for(;q>-1;){const{type:X}=i.events[q][1];if(X==="lineEnding"||X==="linePrefix")q--;else break}const L=q>-1?i.events[q][1].type:null,de=L==="tableHead"||L==="tableRow"?O:f;return de===O&&i.parser.lazy[i.now().line]?n(F):de(F)}function f(F){return e.enter("tableHead"),e.enter("tableRow"),p(F)}function p(F){return F===124||(u=!0,o+=1),g(F)}function g(F){return F===null?n(F):Ge(F)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),b):n(F):ot(F)?kt(e,g,"whitespace")(F):(o+=1,u&&(u=!1,a+=1),F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),v(F)))}function v(F){return F===null||F===124||Bt(F)?(e.exit("data"),g(F)):(e.consume(F),F===92?y:v)}function y(F){return F===92||F===124?(e.consume(F),v):v(F)}function b(F){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(F):(e.enter("tableDelimiterRow"),u=!1,ot(F)?kt(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):_(F))}function _(F){return F===45||F===58?N(F):F===124?(u=!0,e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),k):A(F)}function k(F){return ot(F)?kt(e,N,"whitespace")(F):N(F)}function N(F){return F===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),S):F===45?(o+=1,S(F)):F===null||Ge(F)?R(F):A(F)}function S(F){return F===45?(e.enter("tableDelimiterFiller"),C(F)):A(F)}function C(F){return F===45?(e.consume(F),C):F===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(F))}function T(F){return ot(F)?kt(e,R,"whitespace")(F):R(F)}function R(F){return F===124?_(F):F===null||Ge(F)?!u||a!==o?A(F):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(F)):A(F)}function A(F){return n(F)}function O(F){return e.enter("tableRow"),P(F)}function P(F){return F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),P):F===null||Ge(F)?(e.exit("tableRow"),t(F)):ot(F)?kt(e,P,"whitespace")(F):(e.enter("data"),z(F))}function z(F){return F===null||F===124||Bt(F)?(e.exit("data"),P(F)):(e.consume(F),F===92?K:z)}function K(F){return F===92||F===124?(e.consume(F),z):z(F)}}function n9(e,t){let n=-1,i=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],h=!1,f=0,p,g,v;const y=new K$;for(;++n<e.length;){const b=e[n],_=b[1];b[0]==="enter"?_.type==="tableHead"?(h=!1,f!==0&&(I2(y,t,f,p,g),g=void 0,f=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,o=[0,0,0,0],u=[0,n+1,0,0],h&&(h=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",g,t]])),a=_.type==="tableDelimiterRow"?2:g?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],v=kh(y,t,o,a,void 0,v),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(o[1]!==0&&(u[0]=u[1],v=kh(y,t,o,a,void 0,v)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(h=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,o[1]!==0?(u[0]=u[1],v=kh(y,t,o,a,n,v)):u[1]!==0&&(v=kh(y,t,u,a,n,v)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&I2(y,t,f,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=J$(t.events,n))}return e}function kh(e,t,n,i,a,o){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(o.end=Object.assign({},fo(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=fo(t.events,n[1]);if(o={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=fo(t.events,n[2]),g=fo(t.events,n[3]),v={type:h,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 a!==void 0&&(o.end=Object.assign({},fo(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function I2(e,t,n,i,a){const o=[],u=fo(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),i.end=Object.assign({},u),o.push(["exit",i,t]),e.add(n+1,0,o)}function fo(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const s9={name:"tasklistCheck",tokenize:r9};function i9(){return{text:{91:s9}}}function r9(e,t,n){const i=this;return a;function a(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return Bt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):n(f)}function h(f){return Ge(f)?t(f):ot(f)?e.check({tokenize:a9},t,n)(f):n(f)}}function a9(e,t,n){return kt(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function l9(e){return yN([R$(),U$(),W$(e),e9(),i9()])}const o9={};function jv(e){const t=this,n=e||o9,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(l9(n)),o.push(E$()),u.push(T$(n))}const c9=1500;async function u9(e){var i;try{if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function Af({text:e,label:t="Copy",className:n=""}){const[i,a]=j.useState(!1),o=j.useRef(null);j.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await u9(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),c9))},h=i?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":h,title:h,className:`inline-flex items-center justify-center w-6 h-6 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors ${n}`,children:i?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":"true",children:[l.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),l.jsx("path",{d:"M10.5 5V3.75A.75.75 0 009.75 3H3.75A.75.75 0 003 3.75v6a.75.75 0 00.75.75H5"})]})})}function xf(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(xf).join(""):typeof e=="object"&&e!==null&&"props"in e?xf((t=e.props)==null?void 0:t.children):""}const g0=/https?:\/\/[^\s<>"'`]+/gi,d9=`.,;:!?]}>'"`;function h9(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const i=e.slice(0,t),a=(i.match(/\(/g)||[]).length,o=(i.match(/\)/g)||[]).length;if(a>=o)break;t--;continue}if(d9.includes(n)){t--;continue}break}return e.slice(0,t)}function f9(e){return/^https?:\/\/[^\s/]/i.test(e)}function p9(e){if(!e)return[];const t=[];let n=0;g0.lastIndex=0;let i;for(;(i=g0.exec(e))!==null;){const a=h9(i[0]);!a||!f9(a)||(i.index>n&&t.push({type:"text",value:e.slice(n,i.index)}),t.push({type:"link",value:a,href:a}),n=i.index+a.length,g0.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const F2=40;function m9(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>F2?`${t.slice(0,F2-1)}…`:t}`:"Copy"}function oC({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const i=xf(e);if(!i)return l.jsx("code",{className:`px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] font-mono-code border border-cc-border/40 ${n} ${t}`,children:e});const a=p9(i);return l.jsxs("span",{className:`inline-flex items-center align-middle max-w-full gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-cc-fg/[0.06] border border-cc-border/40 ${t}`,children:[l.jsx("code",{className:`min-w-0 break-all font-mono-code ${n}`,children:a.map((o,u)=>o.type==="link"?l.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:o.value},u):l.jsx("span",{children:o.value},u))}),l.jsx(Af,{text:i,label:m9(i),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const vf=25*1024*1024,yf=100*1024*1024;function cC(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const o=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function fa(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function uC(e){return e.startsWith("image/")}function dC({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let i="FILE";return t==="application/pdf"||n==="pdf"?i="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?i="ZIP":["csv","tsv"].includes(n)?i="CSV":["json","yaml","yml","toml","xml"].includes(n)?i="DATA":["md","txt","log"].includes(n)?i="TXT":["doc","docx","rtf","odt"].includes(n)?i="DOC":["xls","xlsx","ods"].includes(n)?i="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?i="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?i="VID":n&&(i=n.slice(0,4).toUpperCase()),l.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[l.jsx("path",{d:"M3 1.75h6.5L13 5.25v9A1.25 1.25 0 0 1 11.75 15.5h-7.5A1.25 1.25 0 0 1 3 14.25V1.75z"}),l.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),l.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:i})]})}function hC({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:o="w-12 h-12"}){const u=uC(t);return l.jsxs("div",{className:"relative group",title:`${e} (${fa(i)})`,children:[l.jsx("div",{className:`${o} rounded-lg overflow-hidden border border-cc-border`,children:u?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):l.jsx(dC,{name:e,mediaType:t})}),a&&l.jsx("button",{onClick:a,"aria-label":`Remove ${e}`,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function g9({name:e,mediaType:t,data:n,size:i}){return uC(t)?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e||"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"}):l.jsxs("a",{href:`data:${t};base64,${n}`,download:e||"attachment",className:"inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-cc-border/40 bg-cc-hover/40 hover:bg-cc-hover transition-colors max-w-[260px] no-underline",children:[l.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:l.jsx(dC,{name:e,mediaType:t})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:fa(i)})]})]})}function x9({message:e}){const t=xa(),[n,i]=j.useState(!1),a=!t&&!!e.detail;return l.jsxs("div",{className:"py-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),l.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&&l.jsx("button",{type:"button",onClick:()=>i(o=>!o),"aria-expanded":n,className:"shrink-0 text-[11px] text-cc-muted/60 hover:text-cc-muted underline decoration-dotted cursor-pointer",children:n?"hide report":"show report"}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}),a&&n&&l.jsx("pre",{className:"mt-1.5 mx-3 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap break-words max-h-80 overflow-auto rounded-md bg-cc-hover/40 p-2",children:e.detail})]})}function v9({message:e}){return e.role==="system"?l.jsx(x9,{message:e}):e.role==="user"?l.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:l.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.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>l.jsx(g9,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),l.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:l.jsx(Nv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(S9,{message:e})})}function y9(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 b9(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 _9(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function w9({streaming:e}){return l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 py-0.5 text-[11px] text-cc-muted/50 italic",children:[l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full bg-cc-muted/40 shrink-0 ${e?"animate-pulse":""}`}),l.jsx("span",{children:e?"Thinking…":"Thought"})]})}function S9({message:e}){var u;const t=e.contentBlocks||[],n=xa(),i=j.useMemo(()=>y9(t),[t]),a=j.useMemo(()=>b9(t),[t]),o=j.useMemo(()=>n?i.filter(h=>!_9(h)):i,[i,n]);if(n&&o.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Fh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(w9,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const h=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Fh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:h?l.jsx(pC,{text:e.content}):l.jsx(Nv,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Fh,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((h,f)=>{if(h.kind==="content")return l.jsx(k9,{block:h.block,toolUseById:a},f);if(h.items.length===1){const p=h.items[0];return l.jsx(xS,{name:p.name,input:p.input,toolUseId:p.id},f)}return l.jsx(C9,{name:h.name,items:h.items},f)})})]})}function Fh(){return l.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function Nv({text:e,showCursor:t=!1}){return l.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[l.jsx(vv,{remarkPlugins:[jv],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof i=="string"&&i.includes(`
101
+ `)){const h=(o==null?void 0:o[1])||"",f=xf(i);return l.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:[l.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),h&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:h}),l.jsx(Af,{text:f,label:"Copy code",className:"ml-auto -mr-1"})]}),l.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:l.jsx("code",{children:i})})]})}return l.jsx(oC,{children:i})},pre:({children:n})=>l.jsx(l.Fragment,{children:n}),table:({children:n})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>l.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>l.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})=>l.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&l.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 k9({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(Nv,{text:e.text});if(e.type==="thinking")return l.jsx(pC,{text:e.thinking});if(e.type==="tool_use")return l.jsx(xS,{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),a=i==null?void 0:i.name,o=e.is_error??!1;return a==="Bash"?l.jsx(j9,{text:n,isError:o}):l.jsx(N9,{content:n,isError:o})}return null}function fC(e){return`${e} ${e===1?"line":"lines"}`}function j9({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,o]=j.useState(!1),u=xa(),[h,f]=j.useState(!1),p=a||!i?e:n.slice(-20).join(`
102
+ `),g=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Af,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.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:p}),i&&l.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[l.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:a?`${n.length} lines`:`last 20 of ${n.length}`}),l.jsx("button",{onClick:()=>o(!a),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:a?"Show tail":"Show all"})]})]});return u?l.jsxs("div",{children:[l.jsx(_f,{open:h,onToggle:()=>f(!h),marker:"›",label:t?"Error output":"Output",meta:fC(n.length),labelClassName:t?"text-cc-error/70":""}),h&&l.jsx("div",{className:"mt-1",children:g})]}):g}function N9({content:e,isError:t}){const n=xa(),[i,a]=j.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Af,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:e})]});return n?l.jsxs("div",{children:[l.jsx(_f,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:fC(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:o})]}):o}function C9({name:e,items:t}){const[n,i]=j.useState(!1),a=Lo(e),o=Hi(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ll,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:o}),l.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&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,h)=>{const f=wo(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})}function pC({text:e}){const t=e.trim(),n=xa(),[i,a]=j.useState(!1),o=t.split(`
103
+ `),u=n?2:8,h=n?200:600,f=o.length>u||t.length>h,p=f&&!i?o.slice(0,u).join(`
104
+ `):t;return n&&!t?null:l.jsxs("div",{children:[l.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:l.jsx(vv,{remarkPlugins:[jv],components:{p:({children:g})=>l.jsx("p",{className:"mb-2 last:mb-0",children:g}),ul:({children:g})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:g}),ol:({children:g})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:g}),li:({children:g})=>l.jsx("li",{children:g}),code:({children:g})=>l.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:g})},children:p||"No thinking text captured."})}),f&&!i&&l.jsx("button",{onClick:()=>a(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function au(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function po(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function U2(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":E9(t):"N/A"}catch{return"N/A"}}function bx(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function H2(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function E9(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 T9({tools:e}){return e.length===0?null:l.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)=>l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[l.jsx(ll,{type:Lo(t.toolName)}),l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),l.jsx("span",{className:"text-cc-fg/70",children:Hi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function M9({entries:e}){const[t,n]=j.useState(!1),i=j.useMemo(()=>{const a=e.reduce((f,p)=>f+p.elapsedSeconds,0),o=Math.max(...e.map(f=>f.elapsedSeconds),.1),u=e.filter(f=>f.isError).length,h=e.filter(f=>!f.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:h}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${Hi(a.toolName)} ${a.elapsedSeconds}s`},a.toolUseId))})]}),t&&l.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(a=>l.jsx(A9,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function A9({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[l.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"}`}),l.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[l.jsx(ll,{type:Lo(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Hi(e.toolName)})]}),l.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:l.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}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}function R9(e){var n;const t=e.contentBlocks;return t&&t.length>0?t.some(i=>i.type==="text"&&i.text.trim().length>0):!!((n=e.content)!=null&&n.trim())}function O9(e){if(e.kind!=="message")return!1;const t=e.msg;if(t.role==="user")return!0;if(t.role==="system")return!!t.meta;if(t.isStreaming)return!0;if(t.stopReason==="tool_use")return!1;const n=t.contentBlocks;return n!=null&&n.some(i=>i.type==="tool_use")?!1:R9(t)}function L9(e){switch(e.kind){case"message":return e.msg.id;case"tool_msg_group":return e.firstId;case"subagent":return e.taskToolUseId;case"activity_run":return e.key}}function D9(e){if(e.length>=2)return!0;const t=e[0];return!(t.kind==="message"&&t.msg.role==="system")}function z9(e){const t=[];let n=[];const i=()=>{n.length!==0&&(D9(n)?t.push({kind:"activity_run",key:L9(n[0]),children:n}):t.push(...n),n=[])};for(const a of e)a.kind==="activity_run"||O9(a)?(i(),t.push(a)):n.push(a);return i(),t}const q2=160;function _x(e){const t=e.split(`
105
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>q2?`${t.slice(0,q2)}…`:t:""}function mC(e,t){const n=wo(e,t);return{label:n?`${Hi(e)} · ${n}`:Hi(e),toolName:e}}function $9(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="tool_use")return mC(n.name,n.input);if(n.type==="text"&&n.text.trim())return{label:_x(n.text),italic:!0};if(n.type==="thinking"&&n.thinking.trim())return{label:_x(n.thinking),italic:!0}}return null}function P9(e){var t;switch(e.kind){case"subagent":return{label:`Subagent · ${e.description||"Subagent"}`,toolName:"Task"};case"tool_msg_group":{const n=e.items[e.items.length-1];return n?mC(n.name,n.input):null}case"activity_run":return Rf(e).latest;case"message":{const n=e.msg;if(n.role==="system")return{label:n.content,italic:!0};const i=n.contentBlocks;return i&&i.length>0?$9(i)??{label:"Thinking…",italic:!0}:(t=n.content)!=null&&t.trim()?{label:_x(n.content),italic:!0}:{label:"Thinking…",italic:!0}}}}function gC(e){switch(e.kind){case"message":return[e.msg.timestamp,e.msg.timestamp];case"tool_msg_group":return[e.startedAt,e.endedAt];case"subagent":{let t=null,n=null;for(const i of e.children){const[a,o]=gC(i);a!==null&&(t===null||a<t)&&(t=a),o!==null&&(n===null||o>n)&&(n=o)}return[t,n]}case"activity_run":{const t=Rf(e);return[t.startedAt,t.endedAt]}}}function Rf(e,t){let n=0,i=0,a=0,o=null,u=null;for(const f of e.children){if(f.kind==="subagent")i++;else if(f.kind==="tool_msg_group")n+=f.items.length;else if(f.kind==="message")for(const v of f.msg.contentBlocks??[])v.type==="tool_use"&&n++,v.type==="tool_result"&&v.is_error&&a++;else{const v=Rf(f);n+=v.toolCalls,i+=v.subagents,a+=v.errors}const[p,g]=gC(f);p!==null&&(o===null||p<o)&&(o=p),g!==null&&(u===null||g>u)&&(u=g)}t!==void 0&&o!==null&&(u=Math.max(u??t,t));const h=e.children[e.children.length-1];return{toolCalls:n,subagents:i,errors:a,steps:e.children.length,startedAt:o,endedAt:u,latest:h?P9(h):null}}function B9({run:e,live:t,children:n}){const[i,a]=j.useState(!1),o=t?Date.now():void 0,u=j.useMemo(()=>Rf(e,o),[e,o]),h=u.startedAt!==null&&u.endedAt!==null?Math.max(0,u.endedAt-u.startedAt):null,f=[];u.toolCalls>0&&f.push(`${u.toolCalls} tool call${u.toolCalls===1?"":"s"}`),u.subagents>0&&f.push(`${u.subagents} subagent${u.subagents===1?"":"s"}`),u.errors>0&&f.push(l.jsxs("span",{className:"text-cc-error",children:[u.errors," error",u.errors===1?"":"s"]},"err")),h!==null&&h>=1e3&&f.push(po(h));const p=t?"Working":"Worked",g=`${u.steps} step${u.steps===1?"":"s"}`,v=u.latest;return l.jsxs("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]","data-activity-run":e.key,children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Fh,{}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("button",{type:"button",onClick:()=>a(y=>!y),"aria-expanded":i,"aria-label":`${p}: ${g}, ${i?"collapse":"expand"} details`,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer min-w-0",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full shrink-0 ${t?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsx("span",{className:"text-[11px] font-medium text-cc-fg/70 shrink-0",children:p}),f.length>0&&l.jsx("span",{className:"text-[11px] text-cc-muted/60 font-mono-code truncate min-w-0 tabular-nums",children:f.map((y,b)=>l.jsxs("span",{children:[l.jsx("span",{className:"text-cc-muted/35",children:" · "}),y]},b))}),l.jsx("span",{className:"ml-auto text-[10px] text-cc-muted/40 group-hover:text-cc-muted/70 shrink-0 tabular-nums",children:i?"hide":g})]}),!i&&v&&l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 pl-4 py-0.5 text-[11px] min-w-0",children:[v.toolName&&l.jsx(ll,{type:Lo(v.toolName)}),l.jsx("span",{className:`truncate min-w-0 ${v.italic?"italic text-cc-muted/60":"font-mono-code text-cc-muted/70"}`,children:v.label})]})]})]}),i&&l.jsx("div",{className:"mt-4 space-y-5 sm:space-y-7 animate-[fadeSlideIn_0.2s_ease-out]",children:n})]})}const jh=100,I9=40,F9=120,V2=1e4,U9=15*6e4,x0=new Map,H9=[],q9=[];function V9(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function G9(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 G2(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function Y9(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 xC(e){const t=[];for(const n of e){const i=G9(n);if(i){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===i){a.items.push(...G2(n)),a.endedAt=Math.max(a.endedAt,n.timestamp);continue}t.push({kind:"tool_msg_group",toolName:i,items:G2(n),firstId:n.id,startedAt:n.timestamp,endedAt:n.timestamp})}else t.push({kind:"message",msg:n})}return t}function vC(e,t,n){const i=xC(e),a=[];for(const o of i){a.push(o);const u=Y9(o);for(const h of u){const f=n.get(h);if(f&&f.length>0){const p=t.get(h)||{description:"Subagent",agentType:""},g=vC(f,t,n);a.push({kind:"subagent",taskToolUseId:h,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:g})}}}return a}function Q9(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const o of a.contentBlocks)if(o.type==="tool_use"&&o.name==="Task"){const{input:u,id:h}=o,f=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=f&&f.length>0?f.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(h,{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:f})}}if(t.size===0)return xC(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let o=n.get(a.parentToolUseId);o||(o=[],n.set(a.parentToolUseId,o)),o.push(a)}else i.push(a);return vC(i,t,n)}function X9({group:e}){const[t,n]=j.useState(!1),i=Lo(e.toolName),a=Hi(e.toolName),o=e.items.length;if(o===1){const u=e.items[0];return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Y2,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ll,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:wo(u.name,u.input)})]}),t&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:l.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 l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Y2,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(ll,{type:i}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:o})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,h)=>{const f=wo(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})})]})})}function Cv({entries:e,toolActivity:t,liveRunKey:n}){return l.jsx(l.Fragment,{children:e.map((i,a)=>{if(i.kind==="activity_run")return l.jsx(B9,{run:i,live:i.key===n,children:l.jsx(Cv,{entries:i.children,toolActivity:t})},i.key);if(i.kind==="tool_msg_group")return l.jsx(X9,{group:i},i.firstId||a);if(i.kind==="subagent")return l.jsx(Z9,{group:i},i.taskToolUseId);const o=i.msg,u=W9(o),h=t&&u.length>0?t.filter(p=>u.includes(p.toolUseId)):[],f=h.length>0&&h.every(p=>p.completedAt);return l.jsxs("div",{children:[l.jsx(v9,{message:o}),f&&l.jsx(M9,{entries:h})]},o.id)})})}function W9(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function K9(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 Z9({group:e}){const[t,n]=j.useState(!1),i=e.description||"Subagent",a=e.agentType,o=e.children.length,u=K9(e.status),h=e.receiverCount,f=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`${Hi(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 N=(_=v.msg.contentBlocks)==null?void 0:_.find(S=>S.type==="tool_use");if(N)return Hi(N.name)}return""},[v]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),h!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[h," agent",h===1?"":"s"]}),!t&&y&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:y}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:o})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(f||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[f&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",f]}),p.length>0&&l.jsxs("span",{children:["receivers: ",p.map(b=>l.jsx("span",{className:"font-mono-code ml-1",children:b},b))]})]}),l.jsx(Cv,{entries:e.children})]})]})})}function Y2(){return l.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function J9({sessionId:e}){var Kt;const t=W(se=>se.messages.get(e)??H9),n=W(se=>(se.sdkSessions||q9).find(ke=>ke.sessionId===e)),i=W(se=>se.streamingStartedAt.get(e)),a=W(se=>se.streamingOutputTokens.get(e)),o=W(se=>se.sessionStatus.get(e)),u=W(se=>se.lastActivityAt.get(e)),h=W(se=>se.sessionProcesses.get(e)),f=W(se=>se.toolProgress.get(e)),p=W(se=>se.toolActivity.get(e)),g=j.useRef(null),v=j.useRef(null),y=j.useRef(!0),[b,_]=j.useState(0),[k,N]=j.useState(jh),[S,C]=j.useState([]),[T,R]=j.useState(0),[A,O]=j.useState(!1),[P,z]=j.useState(!1),[K,F]=j.useState(!1),[q,L]=j.useState(""),de=j.useRef(new Set),X=W(se=>se.chatTabReentryTickBySession.get(e)??0),V=j.useMemo(()=>t.some(se=>se.role==="assistant"&&se.isStreaming),[t]),G=j.useMemo(()=>(h??[]).filter(se=>se.status==="running"),[h]),H=G.length>0,ae=j.useMemo(()=>{const se=p??[];for(let ke=se.length-1;ke>=0;ke--)if(!se[ke].completedAt)return se[ke]},[p]),_e=j.useMemo(()=>G.length>0?Math.min(...G.map(se=>se.startedAt)):null,[G]),E=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]),Ne=E.length>0,Ce=n!=null&&n.forkSession?"Forked from":"Continuing from",$=j.useMemo(()=>{if(S.length===0)return t;const se=[],ke=new Set;for(const We of S)ke.has(We.id)||(ke.add(We.id),se.push(We));for(const We of t)ke.has(We.id)||(ke.add(We.id),se.push(We));return se},[S,t]),B=j.useMemo(()=>Q9($),[$]);j.useEffect(()=>{N(jh),C([]),R(0),O(!1),z(!1),F(!1),L(""),de.current=new Set},[e,E]);const oe=B.length,ye=oe>k,je=j.useMemo(()=>ye?B.slice(oe-k):B,[B,ye,oe,k]),Ee=oe-je.length,Be=xa(),Oe=j.useMemo(()=>Be?z9(je):je,[Be,je]),Te=Oe[Oe.length-1],Re=o==="running"&&(Te==null?void 0:Te.kind)==="activity_run"?Te.key:void 0,It=j.useCallback(()=>{const se=v.current,ke=(se==null?void 0:se.scrollHeight)??0;N(We=>We+jh),requestAnimationFrame(()=>{if(se){const We=se.scrollHeight;se.scrollTop+=We-ke}})},[]),vn=j.useCallback(async(se={})=>{if(!Ne||!E||K)return;const ke=v.current,We=(ke==null?void 0:ke.scrollHeight)??0,nt=P?T:0;F(!0),L("");try{const Zt=await we.getClaudeSessionHistory(E,{cursor:nt,limit:I9}),Ft=Zt.messages.map(U=>({id:U.id,role:U.role,content:U.content,contentBlocks:U.role==="assistant"?U.contentBlocks:void 0,timestamp:U.timestamp||Date.now(),model:U.role==="assistant"?U.model:void 0,stopReason:U.role==="assistant"?U.stopReason:void 0})),ce=[];for(const U of Ft)de.current.has(U.id)||(de.current.add(U.id),ce.push(U));C(U=>[...ce,...U]),R(Zt.nextCursor),O(Zt.hasMore),z(!0),ce.length>0&&N(U=>U+ce.length),se.preserveScroll!==!1&&ke&&requestAnimationFrame(()=>{const U=ke.scrollHeight;ke.scrollTop+=U-We})}catch(Zt){const Ft=Zt instanceof Error?Zt.message:String(Zt);L(Ft||"Failed to load previous history"),P||(C([]),R(0),O(!1))}finally{F(!1)}},[Ne,E,K,P,T]);j.useEffect(()=>{if(!i&&o!=="running"&&!H){_(0);return}const se=i||Date.now();_(Date.now()-se);const ke=setInterval(()=>_(Date.now()-se),1e3);return()=>clearInterval(ke)},[i,o,H]);function Gt(){const se=v.current;if(!se)return;y.current=se.scrollHeight-se.scrollTop-se.clientHeight<120;const ke=Math.max(0,se.scrollHeight-se.clientHeight-se.scrollTop);x0.set(e,ke),Ne&&P&&A&&!K&&se.scrollTop<=F9&&vn({preserveScroll:!0})}const St=j.useCallback(()=>{const se=v.current;if(!se)return;const ke=se.style.scrollBehavior;se.style.scrollBehavior="auto",se.scrollTop=se.scrollHeight,se.style.scrollBehavior=ke},[]),wt=j.useCallback(()=>{const se=v.current;if(!se)return;const ke=se.style.scrollBehavior;se.style.scrollBehavior="auto";const We=x0.get(e);typeof We=="number"?se.scrollTop=Math.max(0,se.scrollHeight-se.clientHeight-We):se.scrollTop=se.scrollHeight,se.style.scrollBehavior=ke},[e]);if(j.useEffect(()=>{requestAnimationFrame(()=>wt())},[e,wt]),j.useEffect(()=>()=>{const se=v.current;if(!se)return;const ke=Math.max(0,se.scrollHeight-se.clientHeight-se.scrollTop);x0.set(e,ke)},[e]),j.useEffect(()=>{X&&requestAnimationFrame(()=>St())},[X,St]),j.useEffect(()=>{var se;y.current&&((se=g.current)==null||se.scrollIntoView({behavior:"smooth"}))},[t]),$.length===0)return l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[l.jsxs("div",{className:"relative",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[l.jsx("polyline",{points:"4 17 10 11 4 5"}),l.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),l.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:l.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:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),l.jsx("div",{className:"text-center max-w-xs",children:Ne?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),l.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[Ce," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:E.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void vn({preserveScroll:!1}),disabled:K,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),K?"Loading...":"Load previous history"]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const Ze=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,xt=H&&(o!=="running"||Ze>=V2)?"background":Ze>=U9&&!ae?"stalled":Ze>=V2?"quiet":"active";return l.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[l.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"}),l.jsx("div",{ref:v,onScroll:Gt,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:l.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[Ne&&!P&&l.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[Ce," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[E," ",n!=null&&n.cwd?`· ${V9(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void vn({preserveScroll:!0}),disabled:K,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:K?"Loading...":"Load previous history"})]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}),Ne&&P&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:A?K?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),ye&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:It,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(jh,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(Cv,{entries:Oe,toolActivity:p,liveRunKey:Re}),f&&f.size>0&&!V&&l.jsx(T9,{tools:Array.from(f.values())}),o==="compacting"&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[l.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:[l.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),l.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),l.jsx("span",{children:"Compacting context..."})]}),(o==="running"||H)&&b>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":xt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${xt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${xt==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),xt==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:G.length===1?"Background process running":`${G.length} background processes running`}),_e!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:po(Math.max(0,Date.now()-_e))})]}),((Kt=G[0])==null?void 0:Kt.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:G[0].description})]})]}):xt==="stalled"?l.jsxs("span",{children:["No activity for ",po(Ze)," — the agent may be stuck"]}):xt==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:ae?`Running ${ae.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:ae?po(Math.max(0,Date.now()-ae.startedAt)):`no update for ${po(Ze)}`}),(ae==null?void 0:ae.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:ae.preview})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:po(b)}),(a??0)>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsxs("span",{className:"tabular-nums",children:[au(a)," tokens"]})]})]})]}),l.jsx("div",{ref:g})]})})]})}const eP={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function tP(e,t){for(const[i,a]of Object.entries(eP))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function nP(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:tP(t.value,n)}))}const yC=[{value:"claude-opus-5-5",label:"Opus 5.5",icon:""},{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5-1",label:"Fable 5.1",icon:"★"},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5-5",label:"Sonnet 5.5",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-5-5",label:"Haiku 5.5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],bC=[{value:"gpt-6-astra",label:"GPT-6-Astra",icon:"✦"},{value:"gpt-5.6-sol",label:"GPT-5.6-Sol",icon:"■"},{value:"gpt-5.6-terra",label:"GPT-5.6-Terra",icon:"✳"},{value:"gpt-5.6-luna",label:"GPT-5.6-Luna",icon:"⚡"},{value:"gpt-5.5",label:"GPT-5.5",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],Ev=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],Tv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],sP=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],_C=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],wC=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function SC(e){return e==="codex"?bC:yC}function Q2(e){return e==="codex"?Tv:Ev}function AI(e){return e==="codex"?wC:_C}function X2(e){return e==="codex"?bC[0].value:yC[0].value}function W2(e){return e==="codex"?Tv[0].value:Ev[0].value}function RI(e){return e==="codex"?wC[0].value:_C[0].value}function iP(e){return e==="codex"?[]:sP}function K2({sessionId:e}){const[t,n]=j.useState(!1),i=j.useRef(null),a=W(y=>y.sdkSessions.find(b=>b.sessionId===e)||null),o=W(y=>y.sessions.get(e)),u=W(y=>y.cliConnected.get(e)??!1),h=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",f=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=SC(h),g=p.find(y=>y.value===f)||(f?{label:f,icon:"?"}:null),v=j.useCallback(y=>{if(n(!1),y===f)return;Yn(e,{type:"set_model",model:y});const{sdkSessions:b,setSdkSessions:_}=W.getState();_(b.map(k=>k.sessionId===e?{...k,model:y}:k))},[e,f]);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]),!u||!g?null:l.jsxs("div",{ref:i,className:"relative shrink-0",children:[l.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&&l.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),l.jsx("span",{children:g.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.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=>l.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===f?"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===f,children:[y.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:y.icon}),l.jsx("span",{className:"flex-1 text-left",children:y.label}),y.value===f&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.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 kC({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:o,className:u=""}){return e?l.jsx("div",{ref:o,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?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((h,f)=>l.jsxs("button",{"data-prompt-index":f,onClick:()=>a(h),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${f===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",h.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:h.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:h.scope})]},h.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function jC({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,o]=j.useState(!1),[u,h]=j.useState(0),[f,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(C=>!!C.name.trim()))}catch{p([])}finally{v(!1)}},[n]);j.useEffect(()=>{b()},[b]);const _=j.useMemo(()=>{const S=e.slice(0,t),C=S.match(/(^|\s)@([^\s@]*)$/);if(!C||C.index===void 0)return null;const T=S.length-C[0].length+C[1].length;return{query:C[2]||"",start:T,end:t}},[e,t]),k=j.useMemo(()=>{if(!a||!_)return[];const S=_.query.toLowerCase();if(!S)return f;const C=f.filter(R=>R.name.toLowerCase().startsWith(S)),T=f.filter(R=>!R.name.toLowerCase().startsWith(S)&&R.name.toLowerCase().includes(S));return[...C,...T]},[a,_,f]);j.useEffect(()=>{const S=i&&!!_;S&&!a?(o(!0),h(0)):!S&&a&&o(!1)},[i,_,a]),j.useEffect(()=>{u>=k.length&&h(Math.max(0,k.length-1))},[k.length,u]),j.useEffect(()=>{if(!y.current||!a)return;const C=y.current.querySelectorAll("[data-prompt-index]")[u];C&&C.scrollIntoView({block:"nearest"})},[u,a]);const N=j.useCallback(S=>{if(!_)return{nextText:e,nextCursor:t};const C=`${S.content} `,T=`${e.slice(0,_.start)}${C}${e.slice(_.end)}`,R=_.start+C.length;return{nextText:T,nextCursor:R}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:h,mentionContext:_,filteredPrompts:k,promptsLoading:g,savedPrompts:f,selectPrompt:N,refreshPrompts:b,mentionMenuRef:y}}const rP=[];function Z2({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",h=o?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",f=o?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?h:f:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:i})]})}function Nh({onClick:e,disabled:t,active:n,title:i,children:a}){return l.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:a})}function J2(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.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"})})}function eS({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",h=o?"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-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?h:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function aP({sessionId:e}){var Ft,ce;const[t,n]=j.useState(""),[i,a]=j.useState([]),[o,u]=j.useState(null),[h,f]=j.useState(!1),[p,g]=j.useState(!1),[v,y]=j.useState(0),[b,_]=j.useState(!1),[k,N]=j.useState(""),[S,C]=j.useState("global"),[T,R]=j.useState(null),[A,O]=j.useState(0),P=j.useRef(null),z=j.useRef(null),K=j.useRef(null),F=j.useRef(null),q=W(U=>U.cliConnected),L=W(U=>U.sessions.get(e)),de=W(U=>U.previousPermissionMode.get(e)||"acceptEdits"),X=q.get(e)??!1,V=(L==null?void 0:L.permissionMode)||"acceptEdits",G=V==="plan",H=(L==null?void 0:L.backend_type)==="codex",_e=((ce=(Ft=(H?Tv:Ev).find(U=>U.value===V))==null?void 0:Ft.label)==null?void 0:ce.toLowerCase())||V,E=jC({text:t,caretPos:A,cwd:L==null?void 0:L.cwd,enabled:!p}),Ne=j.useMemo(()=>{const U=[];if(L!=null&&L.slash_commands)for(const fe of L.slash_commands)U.push({name:fe,type:"command"});if(L!=null&&L.skills)for(const fe of L.skills)U.push({name:fe,type:"skill"});return U},[L==null?void 0:L.slash_commands,L==null?void 0:L.skills]),Ce=j.useMemo(()=>{if(!p)return[];const U=t.match(/^\/(\S*)$/);if(!U)return[];const fe=U[1].toLowerCase();return fe===""?Ne:Ne.filter(Ae=>Ae.name.toLowerCase().includes(fe))},[t,p,Ne]);j.useEffect(()=>{const U=t.startsWith("/")&&/^\/\S*$/.test(t)&&Ne.length>0;U&&!p?(g(!0),y(0)):!U&&p&&g(!1)},[t,Ne.length,p]),j.useEffect(()=>{v>=Ce.length&&y(Math.max(0,Ce.length-1))},[Ce.length,v]),j.useEffect(()=>{if(!K.current||!p)return;const fe=K.current.querySelectorAll("[data-cmd-index]")[v];fe&&fe.scrollIntoView({block:"nearest"})},[v,p]),j.useEffect(()=>{if(F.current===null||!P.current)return;const U=F.current;P.current.setSelectionRange(U,U),F.current=null},[t]);const $=j.useCallback(U=>{var fe;n(`/${U.name} `),g(!1),(fe=P.current)==null||fe.focus()},[]),B=j.useCallback(U=>{var Ae;const fe=E.selectPrompt(U);F.current=fe.nextCursor,n(fe.nextText),E.setMentionMenuOpen(!1),O(fe.nextCursor),(Ae=P.current)==null||Ae.focus(),P.current&&(P.current.style.height="auto",P.current.style.height=Math.min(P.current.scrollHeight,200)+"px")},[E]);function oe(){var ze;const U=t.trim();if(!U||!X)return;const fe=j0(),Ae=i.length>0?i.map(st=>({name:st.name,media_type:st.mediaType,data:st.base64,size:st.size})):void 0;Yn(e,{type:"user_message",content:U,session_id:e,attachments:Ae,client_msg_id:fe});const tt=W.getState();tt.appendMessage(e,{id:fe,role:"user",content:U,attachments:Ae,timestamp:Date.now()}),tt.setSessionStatus(e,"running"),tt.setLastActivity(e,Date.now()),tt.streamingStartedAt.has(e)||tt.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),g(!1),E.setMentionMenuOpen(!1),P.current&&(P.current.style.height="auto"),(ze=P.current)==null||ze.focus()}function ye(U){if(p&&Ce.length>0){if(U.key==="ArrowDown"){U.preventDefault(),y(fe=>(fe+1)%Ce.length);return}if(U.key==="ArrowUp"){U.preventDefault(),y(fe=>(fe-1+Ce.length)%Ce.length);return}if(U.key==="Tab"&&!U.shiftKey){U.preventDefault(),$(Ce[v]);return}if(U.key==="Enter"&&!U.shiftKey){U.preventDefault(),$(Ce[v]);return}if(U.key==="Escape"){U.preventDefault(),g(!1);return}}if(E.mentionMenuOpen&&U.key==="Escape"){U.preventDefault(),E.setMentionMenuOpen(!1);return}if(E.mentionMenuOpen&&E.filteredPrompts.length>0){if(U.key==="ArrowDown"){U.preventDefault(),E.setMentionMenuIndex(fe=>(fe+1)%E.filteredPrompts.length);return}if(U.key==="ArrowUp"){U.preventDefault(),E.setMentionMenuIndex(fe=>(fe-1+E.filteredPrompts.length)%E.filteredPrompts.length);return}if(U.key==="Tab"&&!U.shiftKey||U.key==="Enter"&&!U.shiftKey){U.preventDefault(),B(E.filteredPrompts[E.mentionMenuIndex]);return}}if(E.mentionMenuOpen&&E.filteredPrompts.length===0&&(U.key==="Enter"&&!U.shiftKey||U.key==="Tab"&&!U.shiftKey)){U.preventDefault();return}if(U.key==="Tab"&&U.shiftKey){U.preventDefault(),Ze();return}U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),oe())}function je(U){n(U.target.value),O(U.target.selectionStart??U.target.value.length);const fe=U.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Ee(){P.current&&O(P.current.selectionStart??0)}function Be(){Yn(e,{type:"interrupt"})}async function Oe(U){if(U.length===0)return;const fe=[],Ae=[];let tt=i.reduce((ze,st)=>ze+st.size,0);for(const ze of U){if(ze.size>vf){Ae.push(`${ze.name} is too large (${fa(ze.size)}, max ${fa(vf)})`);continue}if(tt+ze.size>yf){Ae.push(`${ze.name} would exceed the per-message limit (${fa(yf)})`);continue}const{base64:st,mediaType:rn}=await cC(ze);fe.push({name:ze.name,base64:st,mediaType:rn,size:ze.size}),tt+=ze.size}fe.length>0&&a(ze=>[...ze,...fe]),u(Ae.length>0?Ae.join("; "):null)}async function Te(U){const fe=U.target.files;fe&&(await Oe(Array.from(fe)),U.target.value="")}function Re(U){a(fe=>fe.filter((Ae,tt)=>tt!==U))}async function It(U){var tt;const fe=(tt=U.clipboardData)==null?void 0:tt.items;if(!fe)return;const Ae=[];for(const ze of Array.from(fe)){if(ze.kind!=="file")continue;const st=ze.getAsFile();if(!st)continue;const rn=st.name&&st.name.length>0?st.name:`pasted-${Date.now()}.${(st.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ae.push(new File([st],rn,{type:st.type,lastModified:st.lastModified}))}Ae.length>0&&(U.preventDefault(),await Oe(Ae))}function vn(U){U.dataTransfer.types.includes("Files")&&(U.preventDefault(),U.stopPropagation(),f(!0))}function Gt(U){U.currentTarget===U.target&&f(!1)}async function St(U){if(!U.dataTransfer.types.includes("Files"))return;U.preventDefault(),U.stopPropagation(),f(!1);const fe=Array.from(U.dataTransfer.files);fe.length>0&&await Oe(fe)}function wt(){const U=t.trim().slice(0,32);N(U||""),R(null),_(fe=>!fe)}function Ze(){if(!X)return;const U=W.getState();if(!G)U.setPreviousPermissionMode(e,V),Yn(e,{type:"set_permission_mode",mode:"plan"}),U.updateSession(e,{permissionMode:"plan"});else{const fe=de||(H?"bypassPermissions":"acceptEdits");Yn(e,{type:"set_permission_mode",mode:fe}),U.updateSession(e,{permissionMode:fe})}}async function xt(){const U=t.trim(),fe=k.trim();if(!U||!fe)return;if(S==="project"&&!(L!=null&&L.cwd)){R("No project folder available for this session");return}const Ae={name:fe,content:U,scope:S};S==="project"&&(Ae.projectPaths=[L.cwd]);try{await we.createPrompt(Ae),await E.refreshPrompts(),_(!1),N(""),C("global"),R(null)}catch(tt){const ze=tt instanceof Error&&tt.message?tt.message:"Could not save prompt.";R(ze)}}const se=W(U=>U.promptSuggestions.get(e))??rP,ke=W(U=>U.clearPromptSuggestions),nt=W(U=>U.sessionStatus).get(e)==="running",Zt=t.trim().length>0&&X;return l.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 relative ${h?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:vn,onDragLeave:Gt,onDrop:St,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[h&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((U,fe)=>l.jsx(hC,{name:U.name,mediaType:U.mediaType,base64:U.base64,size:U.size,onRemove:()=>Re(fe)},fe))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:z,type:"file",multiple:!0,onChange:Te,className:"hidden","aria-label":"Attach files"}),se.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:se.map((U,fe)=>l.jsx("button",{onClick:()=>{if(!X||nt)return;const Ae=j0();Yn(e,{type:"user_message",content:U,session_id:e,client_msg_id:Ae}),W.getState().appendMessage(e,{id:Ae,role:"user",content:U,timestamp:Date.now()}),ke(e)},disabled:!X||nt,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:U,children:U},fe))}),l.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 ${G?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[p&&Ce.length>0&&l.jsx("div",{ref:K,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:Ce.map((U,fe)=>l.jsxs("button",{"data-cmd-index":fe,onClick:()=>$(U),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${fe===v?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:U.type==="skill"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",U.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:U.type})]})]},`${U.type}-${U.name}`))}),l.jsx(kC,{open:E.mentionMenuOpen,loading:E.promptsLoading,prompts:E.filteredPrompts,selectedIndex:E.mentionMenuIndex,onSelect:B,menuRef:E.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),b&&l.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:[l.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),l.jsx("input",{value:k,onChange:U=>{N(U.target.value),T&&R(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"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button","aria-pressed":S==="global",onClick:()=>C("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),l.jsx("button",{type:"button","aria-pressed":S==="project",onClick:()=>C("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="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"})]}),S==="project"&&(L==null?void 0:L.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:L.cwd,children:L.cwd}),T?l.jsx("div",{className:"text-[11px] text-cc-error",children:T}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),C("global"),R(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"}),l.jsx("button",{onClick:xt,disabled:!k.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${k.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"})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[l.jsx(Z2,{isPlan:G,isConnected:X,onToggle:Ze,modeLabel:_e,size:"mobile"}),l.jsx(K2,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(Nh,{onClick:wt,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:l.jsx(J2,{})}),l.jsx(Nh,{onClick:()=>{var U;return(U=z.current)==null?void 0:U.click()},disabled:!X,active:X,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:P,value:t,onChange:je,onKeyDown:ye,onClick:Ee,onKeyUp:Ee,onPaste:It,"aria-label":"Message input",placeholder:X?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!X,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"}})}),l.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:l.jsx(eS,{isRunning:nt,canSend:Zt,onSend:oe,onInterrupt:Be,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(Nh,{onClick:()=>{var U;return(U=z.current)==null?void 0:U.click()},disabled:!X,active:X,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx(Nh,{onClick:wt,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:l.jsx(J2,{})}),l.jsx(Z2,{isPlan:G,isConnected:X,onToggle:Ze,modeLabel:_e,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(K2,{sessionId:e}),l.jsx(eS,{isRunning:nt,canSend:Zt,onSend:oe,onInterrupt:Be,size:"desktop"})]})]})]})})}function lP(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 oP(e,t){const n={};for(const[i,a]of Object.entries(t)){const o=e[Number(i)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:i;n[u]=a}return n}function cP({permission:e,sessionId:t}){const[n,i]=j.useState(!1),a=W(p=>p.removePermission);function o(p,g){i(!0),Yn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),a(t,e.request_id)}function u(){i(!0),Yn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const h=e.tool_name==="AskUserQuestion",f=e.permission_suggestions;return l.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:l.jsx("div",{className:"max-w-3xl mx-auto",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.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 ${h?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:h?l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:l.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"})}):l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:l.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"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:`text-xs font-semibold ${h?"text-cc-primary":"text-cc-warning"}`,children:h?"Question":"Permission Request"}),!h&&l.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&l.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),h?l.jsx(pP,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(hP,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&l.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!h&&l.jsx(dP,{validation:e.ai_validation}),!h&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),f==null?void 0:f.map((p,g)=>l.jsxs("button",{onClick:()=>o(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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),lP(p)]},g)),l.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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function uP(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 dP({validation:e}){const t=e.verdict==="uncertain"&&uP(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 l.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.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"})}),l.jsx("span",{className:"font-medium",children:i}),l.jsx("span",{children:e.reason})]})}function hP({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(fP,{input:t}):e==="Edit"?l.jsx(mP,{input:t}):e==="Write"?l.jsx(gP,{input:t}):e==="Read"?l.jsx(xP,{input:t}):e==="Glob"?l.jsx(vP,{input:t}):e==="Grep"?l.jsx(yP,{input:t}):e==="ExitPlanMode"?l.jsx(bP,{input:t}):l.jsx(NC,{input:t,description:n})}function fP({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsx("div",{className:"text-xs text-cc-muted",children:n}),l.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:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function pP({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,o]=j.useState({}),[u,h]=j.useState({}),[f,p]=j.useState({});function g(N){return oP(i,N)}function v(N,S){const C=String(N);o(T=>({...T,[C]:S})),p(T=>({...T,[C]:!1})),i.length<=1&&t(g({[C]:S}))}function y(N){var T;const S=String(N),C=(T=u[S])==null?void 0:T.trim();C&&(o(R=>({...R,[S]:C})),i.length<=1&&t(g({[S]:C})))}function b(N,S){const C=String(N);h(R=>({...R,[C]:S}));const T=S.trim();o(R=>{if(!T){const A={...R};return delete A[C],A}return{...R,[C]:T}})}function _(N){const S=String(N);p(C=>{const T=!!C[S],R={...C,[S]:!T};return T&&(o(A=>{const O={...A};return delete O[S],O}),h(A=>{const O={...A};return delete O[S],O})),R})}function k(){t(g(a))}if(i.length===0){const N=typeof e.question=="string"?e.question:"";return N?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:N}):l.jsx(NC,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((N,S)=>{const C=typeof N.header=="string"?N.header:"",T=typeof N.question=="string"?N.question:"",R=Array.isArray(N.options)?N.options:[],A=String(S),O=a[A],P=f[A];return l.jsxs("div",{className:"space-y-2",children:[C&&l.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:C}),T&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:T}),R.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[R.map((z,K)=>{const F=typeof z.label=="string"?z.label:String(z),q=typeof z.description=="string"?z.description:"",L=O===F;return l.jsx("button",{onClick:()=>v(S,F),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${L?"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:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${L?"border-cc-primary":"border-cc-muted/40"}`,children:L&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:F}),q&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:q})]})]})},K)}),l.jsx("button",{onClick:()=>_(S),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${P?"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:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${P?"border-cc-primary":"border-cc-muted/40"}`,children:P&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),P&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[A]||"",onChange:z=>b(S,z.target.value),onKeyDown:z=>{z.key==="Enter"&&y(S)},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&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},S)}),i.length>1&&Object.keys(a).length>0&&l.jsx("button",{onClick:k,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 mP({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(Oo,{oldText:n,newText:i,fileName:t,mode:"compact"})}function gP({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Oo,{newText:n,fileName:t,mode:"compact"})}function xP({input:e}){const t=String(e.file_path||"");return l.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 vP({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n})]})}function yP({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 l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n}),i&&l.jsx("div",{className:"text-cc-muted",children:i})]})}function bP({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return l.jsxs("div",{className:"space-y-2",children:[t&&l.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[l.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),l.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),l.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:l.jsx(vv,{remarkPlugins:[jv],components:{h1:({children:i})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>l.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>l.jsx("li",{children:i}),strong:({children:i})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:a})=>l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:i=>{const{children:a,className:o}=i;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
106
+ `)?l.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:l.jsx("code",{children:a})}):l.jsx(oC,{textClassName:"text-[12px] text-cc-code-fg",children:a})},pre:({children:i})=>l.jsx(l.Fragment,{children:i}),blockquote:({children:i})=>l.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&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),l.jsx("div",{className:"space-y-1",children:n.map((i,a)=>l.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:[l.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function NC({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,a])=>{const o=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},i)})})]})}function _P({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,o=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const h=n.input.command;u=h.length>60?h.slice(0,60)+"...":h}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 l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${o?"text-cc-success":"text-cc-error"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:l.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"})}),l.jsxs("span",{className:"flex-1",children:["AI auto-",o?"approved":"denied",":"," ",l.jsx("span",{className:"font-mono-code opacity-80",children:u}),a&&l.jsxs("span",{className:"text-cc-muted ml-1",children:["(",a,")"]})]}),t&&l.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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 wP=[],SP=[],tS="activity-tray-panel";function kP(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),a=n%60;return`${i}m${a>0?` ${a}s`:""}`}function jP(e,t,n=4e3){const[i,a]=j.useState(!1),o=j.useRef(void 0),u=e.length+t.length,h=u>0&&e.every(f=>f.status==="completed")&&t.every(f=>f.status!=="running");return j.useEffect(()=>(clearTimeout(o.current),h?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[h,n]),j.useEffect(()=>{a(!1)},[u]),i}function NP(e){const[t,n]=j.useState(0);return j.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(i)},[e]),t}function CP({status:e}){return e==="running"||e==="in_progress"?l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function EP({agent:e,tick:t}){const[n,i]=j.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(CP,{status:e.status}),l.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&l.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:kP(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.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}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.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 TP({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[l.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?l.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:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:l.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.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.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&&l.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function MP({sessionId:e}){const[t,n]=j.useState(!1),i=j.useRef(null),a=j.useRef(null),o=W(T=>T.sessionTasks.get(e)??wP),u=W(T=>T.sessionBackgroundAgents.get(e)??SP),h=jP(o,u),f=u.some(T=>T.status==="running"),p=NP(f),g=u.filter(T=>T.status==="running").length,v=o.length,y=o.filter(T=>T.status==="completed").length,b=o.filter(T=>T.status==="in_progress").length,_=o.length>0||u.length>0,k=g>0||b>0,N=j.useCallback(()=>n(!1),[]);j.useEffect(()=>{if(!t)return;const T=R=>{R.key==="Escape"&&(R.stopPropagation(),N())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[t,N]),j.useEffect(()=>{if(!t)return;const T=R=>{i.current&&!i.current.contains(R.target)&&N()};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[t,N]),j.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[S,C]=j.useState(!1);return j.useEffect(()=>{_&&C(!1)},[_,o.length,u.length]),!_||S?null:l.jsxs("div",{ref:i,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${h?"opacity-0 pointer-events-none":"opacity-100"}`,style:h?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{h&&C(!0)},children:[t&&l.jsxs("div",{ref:a,id:tS,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:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),l.jsx("button",{type:"button",onClick:N,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(T=>l.jsx(EP,{agent:T,tick:p},T.toolUseId))]}),u.length>0&&o.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),o.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),o.map(T=>l.jsx(TP,{task:T},T.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":tS,className:`
107
+ flex items-center gap-2 px-3 min-h-[36px] rounded-full
108
+ border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
109
+ shadow-md shadow-black/15
110
+ hover:bg-cc-hover/80 hover:border-cc-border/70
111
+ transition-all duration-200 cursor-pointer
112
+ ${t?"ring-1 ring-cc-primary/30":""}
113
+ `,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[k?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.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&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),l.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:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function AP({sessionId:e}){const t=W(_=>_.pendingPermissions.get(e)),n=W(_=>_.aiResolvedPermissions.get(e)),i=W(_=>_.clearAiResolvedPermissions),a=W(_=>_.connectionStatus.get(e)??"disconnected"),o=W(_=>_.cliConnected.get(e)??!1),u=W(_=>_.cliReconnecting.get(e)??!1),h=W(_=>_.setCliReconnecting),[f,p]=j.useState(null),g=j.useRef(void 0);j.useEffect(()=>{p(null),clearTimeout(g.current)},[e,o]),j.useEffect(()=>()=>clearTimeout(g.current),[]);const v=j.useCallback(async()=>{p(null),clearTimeout(g.current),h(e,!0);try{await we.relaunchSession(e)}catch(_){ma(_),h(e,!1);const k=_ instanceof Error?_.message:"Reconnection failed";p(k),g.current=setTimeout(()=>p(null),4e3)}},[e,h]),y=j.useMemo(()=>t?Array.from(t.values()):[],[t]),b=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&l.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:f?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:f}),l.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?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.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"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.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"})]})}),a==="disconnected"&&l.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:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(J9,{sessionId:e}),l.jsx(MP,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(_P,{entry:n[n.length-1],onDismiss:()=>i(e)})}),y.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>l.jsx(cP,{permission:_,sessionId:e},_.request_id))}),l.jsx(aP,{sessionId:e})]})}function RP({sessionId:e}){const[t,n]=j.useState(!1),i=j.useRef(null),a=W(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,h=(a==null?void 0:a.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 f(p,g){const v=!g,y={[p]:v};W.getState().setSessionAiValidation(e,y),s4(e,y)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.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&&l.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:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationEnabled",o),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:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>f("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:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoDeny",h),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:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${h?"text-cc-success":"text-cc-muted"}`,children:h?"On":"Off"})]})]})]})]})}function OP({sessionId:e}){const[t,n]=j.useState(!1),[i,a]=j.useState(null),[o,u]=j.useState(!1),h=j.useRef(null);j.useEffect(()=>{if(!t)return;const p=v=>{h.current&&!h.current.contains(v.target)&&n(!1)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const f=j.useCallback(async p=>{a(p),u(!1);try{const{blob:g,filename:v}=await we.exportSession(e,p),y=URL.createObjectURL(g),b=document.createElement("a");b.href=y,b.download=v,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(y),n(!1)}catch(g){ma(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:h,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>f("html"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>f("txt"),disabled:i!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[i==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function LP({sessionId:e}){const t=W(g=>g.density),n=W(g=>g.magicUiAvailable),i=W(g=>{var v;return!!e&&((v=g.sessions.get(e))==null?void 0:v.magicUiActive)===!0}),a=j.useCallback(()=>{var v;if(!e)return;const g=W.getState();((v=g.sessions.get(e))==null?void 0:v.magicUiActive)===!0&&(g.setSessionMagicUi(e,!1),aw(e,!1))},[e]),o=j.useCallback(()=>{W.getState().setDensity("standard"),a()},[a]),u=j.useCallback(()=>{W.getState().setDensity("compact"),a()},[a]),h=j.useCallback(()=>{e&&(W.getState().setSessionMagicUi(e,!0),aw(e,!0))},[e]);if(!n||!e)return l.jsx(DP,{});const f=t==="compact",p=[{key:"standard",label:"Standard view",active:!i&&!f,onClick:o,icon:l.jsx(CC,{})},{key:"compact",label:"Compact view",active:!i&&f,onClick:u,icon:l.jsx(EC,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:h,icon:l.jsx(zP,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:p.map(g=>l.jsx("button",{onClick:g.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${g.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:g.label,"aria-label":g.label,"aria-pressed":g.active,children:g.icon},g.key))})}function DP(){const e=W(a=>a.density),t=j.useCallback(()=>W.getState().toggleDensity(),[]),n=e==="compact",i=n?"Switch to standard density":"Switch to compact density";return l.jsx("button",{onClick:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${n?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:i,"aria-label":i,"aria-pressed":n,children:n?l.jsx(EC,{}):l.jsx(CC,{})})}function CC(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}function EC(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 7h16M4 11h16M4 15h16M4 19h16"})})}function zP(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:[l.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"}),l.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]})}function $P(){var P;const e=j.useSyncExternalStore(z=>(window.addEventListener("hashchange",z),()=>window.removeEventListener("hashchange",z)),()=>window.location.hash),t=j.useMemo(()=>tv(e),[e]),n=t.page==="session"||t.page==="home",i=W(z=>z.currentSessionId),a=W(z=>z.cliConnected),o=W(z=>z.sessionStatus),u=W(z=>z.sessionNames),h=W(z=>z.sdkSessions),f=W(z=>z.sidebarOpen),p=W(z=>z.setSidebarOpen),g=W(z=>z.taskPanelOpen),v=W(z=>z.setTaskPanelOpen),y=W(z=>z.activeTab),b=W(z=>z.setActiveTab),_=W(z=>z.markChatTabReentry),k=W(z=>i?z.gitChangedFilesCount.get(i)??0:0),N=i?o.get(i)??null:null,S=i?a.get(i)??!1:!1,C=i?(u==null?void 0:u.get(i))||((P=h.find(z=>z.sessionId===i))==null?void 0:P.name)||`Session ${i.slice(0,8)}`:null,T=!!(i&&n),R=t.page==="session"&&!!i,A=["chat","diff"],O=z=>{z==="chat"&&y!=="chat"&&i&&_(i),b(z)};return j.useEffect(()=>{const z=K=>{if(!(K.metaKey||K.ctrlKey)||K.key.toLowerCase()!=="j"||!T)return;const F=K.target;if(F&&(F.tagName==="TEXTAREA"||F.tagName==="INPUT"||F.isContentEditable))return;K.preventDefault();const q=Math.max(0,A.indexOf(y)),L=K.shiftKey?-1:1,de=(q+L+A.length)%A.length;O(A[de])};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[T,A,y,b,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!f),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${f?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),T&&l.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:[l.jsxs("button",{onClick:()=>O("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:C||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>O("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&&l.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})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[T&&i&&l.jsx(RP,{sessionId:i}),T&&i&&l.jsx(OP,{sessionId:i}),T&&l.jsx(LP,{sessionId:i??null}),l.jsx(PP,{}),R&&l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function PP(){const e=W(n=>n.darkMode),t=j.useCallback(()=>W.getState().toggleDarkMode(),[]);return l.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?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.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"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const TC="cc-recent-dirs";function bf(){try{return JSON.parse(localStorage.getItem(TC)||"[]")}catch{return[]}}function MC(e){const t=bf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(TC,JSON.stringify(t.slice(0,5)))}function BP(){return!1}function AC({onClose:e,embedded:t=!1}){const[n,i]=j.useState([]),[a,o]=j.useState(!0),[u,h]=j.useState(null),[f,p]=j.useState(""),[g,v]=j.useState([]),[y,b]=j.useState(""),[_,k]=j.useState(!1),[N,S]=j.useState(""),[C,T]=j.useState([{key:"",value:""}]),[R,A]=j.useState(!1),O=j.useCallback(()=>{we.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);j.useEffect(()=>{O()},[O]);function P(V){h(V.slug),p(V.name);const G=Object.entries(V.variables).map(([H,ae])=>({key:H,value:ae}));G.length===0&&G.push({key:"",value:""}),v(G),b("")}function z(){h(null),b("")}async function K(){if(!u)return;const V={};for(const G of g){const H=G.key.trim();H&&(V[H]=G.value)}try{await we.updateEnv(u,{name:f.trim()||void 0,variables:V}),h(null),b(""),O()}catch(G){b(G instanceof Error?G.message:String(G))}}async function F(V){try{await we.deleteEnv(V),u===V&&h(null),O()}catch(G){b(G instanceof Error?G.message:String(G))}}async function q(){const V=N.trim();if(!V)return;A(!0);const G={};for(const H of C){const ae=H.key.trim();ae&&(G[ae]=H.value)}try{await we.createEnv(V,G),S(""),T([{key:"",value:""}]),k(!1),b(""),O()}catch(H){b(H instanceof Error?H.message:String(H))}finally{A(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.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:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.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:[l.jsx("input",{type:"text",value:N,onChange:V=>S(V.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:V=>{V.key==="Enter"&&N.trim()&&q()}}),l.jsx(Ch,{rows:C,onChange:T}),y&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:q,disabled:!N.trim()||R,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!R?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:R?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(V=>{const G=u===V.slug,H=Object.keys(V.variables).length;return G?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:f,onChange:ae=>p(ae.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"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(Ch,{rows:g,onChange:v})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.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"}),l.jsx("button",{onClick:()=>void K(),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"})]})]},V.slug):l.jsx(IP,{env:V,varCount:H,onStartEdit:()=>P(V),onDelete:()=>void F(V.slug)},V.slug)})}),y&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const L=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:V=>S(V.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:V=>{V.key==="Enter"&&N.trim()&&q()}}),l.jsx(Ch,{rows:C,onChange:T}),l.jsx("button",{onClick:q,disabled:!N.trim()||R,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!R?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:R?"Creating...":"Create"})]}),de=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(V=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:V.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(V.variables).length," var",Object.keys(V.variables).length!==1?"s":""]}),u===V.slug?l.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"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>P(V),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>F(V.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===V.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:f,onChange:G=>p(G.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"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(Ch,{rows:g,onChange:v})]})}),l.jsx("button",{onClick:K,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!==V.slug&&Object.keys(V.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(V.variables).map(([G,H])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:G}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:H})]},G))})]},V.slug))}),X=l.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:V=>V.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.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&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),de,L]})]});return $o.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:X}),document.body)}function IP({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.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:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.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:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.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:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.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 Ch({rows:e,onChange:t}){function n(o,u,h){const f=[...e];f[o]={...f[o],[u]:h},t(f)}function i(o){const u=e.filter((h,f)=>f!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.key,onChange:h=>n(u,"key",h.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"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:h=>n(u,"value",h.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"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const FP=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:AC},Symbol.toStringTag,{value:"Module"}));function UP(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function HP({initialPath:e,onSelect:t,onClose:n}){const[i,a]=j.useState(""),[o,u]=j.useState([]),[h,f]=j.useState(!0),[p,g]=j.useState(""),[v,y]=j.useState(""),[b,_]=j.useState(!1),[k,N]=j.useState(""),[S,C]=j.useState(-1),[T,R]=j.useState(!1),[A,O]=j.useState(()=>bf()),P=j.useRef(null),z=j.useRef(null),K=j.useRef(null),F=j.useRef(new Map),q=j.useMemo(()=>{if(!k)return o;const H=k.toLowerCase();return o.filter(ae=>ae.name.toLowerCase().includes(H))},[o,k]),L=j.useCallback(async H=>{f(!0),g(""),N(""),C(-1);try{const ae=await we.listDirs(H);a(ae.path),u(ae.dirs)}catch{g("Could not load directory"),u([])}finally{f(!1)}},[]);j.useEffect(()=>{L(e||void 0)},[]),j.useEffect(()=>{const H=P.current;if(!H)return;function ae(E){if(E.key!=="Tab")return;const Ne=H.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(Ne.length===0)return;const Ce=Ne[0],$=Ne[Ne.length-1];E.shiftKey&&document.activeElement===Ce?(E.preventDefault(),$.focus()):!E.shiftKey&&document.activeElement===$&&(E.preventDefault(),Ce.focus())}document.addEventListener("keydown",ae);const _e=setTimeout(()=>{var E;(E=K.current)==null||E.focus()},80);return()=>{document.removeEventListener("keydown",ae),clearTimeout(_e)}},[]);const de=j.useCallback(()=>{T||(R(!0),setTimeout(n,150))},[n,T]);j.useEffect(()=>{function H(ae){if(ae.key==="Escape"){if(b)return;de()}}return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[b,de]),j.useEffect(()=>{function H(ae){var E,Ne;if(b)return;if(ae.key==="Backspace"&&document.activeElement!==K.current){if(i&&i!=="/"){ae.preventDefault();const Ce=i.split("/").slice(0,-1).join("/")||"/";L(Ce)}return}const _e=q.length;if(_e!==0){if(ae.key==="ArrowDown"){ae.preventDefault();const Ce=S<_e-1?S+1:0;C(Ce),(E=F.current.get(Ce))==null||E.focus()}else if(ae.key==="ArrowUp"){ae.preventDefault();const Ce=S>0?S-1:_e-1;C(Ce),(Ne=F.current.get(Ce))==null||Ne.focus()}}}return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[b,q.length,S,i,L]),j.useEffect(()=>{var H;S>=0&&((H=F.current.get(S))==null||H.scrollIntoView({block:"nearest"}))},[S]);function X(H){MC(H),O(bf()),t(H),n()}const V=UP(i),G=i.split("/").pop()||"/";return $o.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${T?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:de,children:l.jsxs("div",{ref:P,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 ${T?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:H=>H.stopPropagation(),children:[l.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:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:de,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),A.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.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"}),l.jsx("ul",{className:"list-none m-0 p-0",children:A.map(H=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>X(H),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:[l.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:[l.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"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:H.split("/").pop()||H}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:H})]})},H))})]}),l.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?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:H=>y(H.target.value),onKeyDown:H=>{H.key==="Enter"&&v.trim()&&X(v.trim()),H.key==="Escape"&&(H.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}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:V.map((H,ae)=>{const _e=ae===V.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[ae>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{_e||L(H.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${_e?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":_e?"location":void 0,tabIndex:_e?-1:0,children:H.label})]},H.path)})}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.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:l.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"})}),l.jsx("input",{ref:K,type:"text","aria-label":"Filter directories",value:k,onChange:H=>{N(H.target.value),C(-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"})]}),l.jsxs("button",{type:"button",onClick:()=>X(i),"aria-label":`Select ${G}`,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.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"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:G})]})]}),l.jsx("div",{ref:z,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:h?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((H,ae)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.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"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+ae*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 ${ae*.1}s infinite`}})]},ae))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.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"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>L(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):q.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:k?"No matching directories":"No subdirectories"}),k&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:q.map((H,ae)=>l.jsxs("li",{className:`flex items-center transition-colors ${S===ae?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:_e=>{_e?F.current.set(ae,_e):F.current.delete(ae)},onClick:()=>L(H.path),onKeyDown:_e=>{_e.key==="Enter"&&(_e.preventDefault(),X(H.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:H.path,"aria-label":`Navigate into ${H.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.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"})}),l.jsx("span",{className:"truncate",children:H.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>X(H.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 ${H.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]},H.path))})}),l.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:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.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 qP(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function VP(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():qP(e.identifier,e.title)}function Su({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.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"}),l.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"}),l.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"}),l.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 GP({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=j.useState(""),[u,h]=j.useState(""),[f,p]=j.useState(""),[g,v]=j.useState(0),[y,b]=j.useState(!0),[_,k]=j.useState([]),[N,S]=j.useState(""),[C,T]=j.useState(""),[R,A]=j.useState(!0),[O,P]=j.useState(!1),[z,K]=j.useState("");j.useEffect(()=>{let q=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([L,de])=>{var V;if(!q)return;k(L.teams),S(de.viewerId);const X=((V=L.teams[0])==null?void 0:V.id)||"";p(X)}).catch(L=>{q&&K(L instanceof Error?L.message:"Failed to load teams")}).finally(()=>{q&&A(!1)}),()=>{q=!1}},[t]),j.useEffect(()=>{if(!f||_.length===0){T("");return}const q=_.find(de=>de.id===f),L=q==null?void 0:q.states.find(de=>de.type==="backlog");T((L==null?void 0:L.id)||"")},[f,_]);async function F(){if(!(!a.trim()||!f)){P(!0),K("");try{const q=await we.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:g,projectId:e||void 0,assigneeId:y&&N?N:void 0,stateId:C||void 0,connectionId:t});n(q.issue)}catch(q){K(q instanceof Error?q.message:"Failed to create issue")}finally{P(!1)}}}return $o.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:q=>q.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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&&l.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}),R?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:q=>o(q.target.value),onKeyDown:q=>{q.key==="Enter"&&a.trim()&&f&&!O&&F()},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"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:q=>h(q.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"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:f,onChange:q=>p(q.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(q=>l.jsxs("option",{value:q.id,children:[q.name," (",q.key,")"]},q.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:q=>v(Number(q.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:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:q=>b(q.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.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"}),l.jsx("button",{type:"button",onClick:F,disabled:!a.trim()||!f||O,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:O?"Creating...":"Create Issue"})]})]})]})}),document.body)}function YP({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[h,f]=j.useState([]),[p,g]=j.useState(null),[v,y]=j.useState(!1),[b,_]=j.useState(""),[k,N]=j.useState([]),[S,C]=j.useState(!1),[T,R]=j.useState(!1),[A,O]=j.useState(""),[P,z]=j.useState(!1),[K,F]=j.useState(null),[q,L]=j.useState([]),[de,X]=j.useState(!1),[V,G]=j.useState(""),[H,ae]=j.useState(!1),[_e,E]=j.useState([]),[Ne,Ce]=j.useState(!1),[$,B]=j.useState(""),[oe,ye]=j.useState(!1),[je,Ee]=j.useState([]),[Be,Oe]=j.useState(!1),[Te,Re]=j.useState(!1),It=j.useRef(null);j.useEffect(()=>{function se(ke){It.current&&!It.current.contains(ke.target)&&(C(!1),ae(!1))}return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[]),j.useEffect(()=>{if(!n){f([]),g(null),y(!1),u(null);return}let se=!0;return we.listLinearConnections().then(({connections:ke})=>{se&&(f(ke),y(!0),ke.length>0?(g(ke[0].id),u(ke[0].id)):(g(null),u(null)))}).catch(()=>{se&&y(!0)}),()=>{se=!1}},[n]);const vn=j.useCallback(se=>{g(se),u(se),a(null),N([]),_(""),O(""),Ee([]),B(""),E([]),K&&(X(!0),G(""),we.getLinearProjectIssues(K.projectId,10,se).then(({issues:ke})=>{L(ke)}).catch(ke=>{G(ke instanceof Error?ke.message:String(ke))}).finally(()=>{X(!1)}))},[K,u,a]);j.useEffect(()=>{if(!t||!n){F(null),L([]);return}let se=!0;return X(!0),G(""),(async()=>{try{const{mapping:ke}=await we.getLinearProjectMapping(t.repoRoot);if(!se)return;if(F(ke),ke){const{issues:We}=await we.getLinearProjectIssues(ke.projectId,10,p??void 0);if(!se)return;L(We)}else L([])}catch(ke){if(!se)return;G(ke instanceof Error?ke.message:String(ke))}finally{se&&X(!1)}})(),()=>{se=!1}},[t,n,p]),j.useEffect(()=>{if(!n)return;const se=b.trim();if(se.length<2){N([]),O(""),R(!1);return}let ke=!0;R(!0),O("");const We=setTimeout(()=>{we.searchLinearIssues(se,8,p??void 0).then(nt=>{ke&&N(nt.issues)}).catch(nt=>{ke&&(N([]),O(nt instanceof Error?nt.message:String(nt)))}).finally(()=>{ke&&R(!1)})},400);return()=>{ke=!1,clearTimeout(We)}},[n,b,p]),j.useEffect(()=>{if(!n||!oe){Ee([]),Oe(!1);return}const se=$.trim();if(se.length<2){Ee([]),Oe(!1);return}let ke=!0;Oe(!0);const We=setTimeout(()=>{we.searchLinearIssues(se,10,p??void 0).then(nt=>{ke&&Ee(nt.issues)}).catch(()=>{ke&&Ee([])}).finally(()=>{ke&&Oe(!1)})},400);return()=>{ke=!1,clearTimeout(We)}},[n,oe,$,p]);function Gt(se,ke=!1){a(se),_(`${se.identifier} - ${se.title}`);const We=VP(se);o(We,!0),ke&&C(!1)}function St(){a(null),_(""),N([]),O("")}async function wt(se){if(t)try{const{mapping:ke}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:se.id,projectName:se.name});F(ke),ae(!1),X(!0),G("");const{issues:We}=await we.getLinearProjectIssues(se.id,10,p??void 0);L(We)}catch(ke){G(ke instanceof Error?ke.message:String(ke))}finally{X(!1)}}async function Ze(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}F(null),L([]),a(null),_("")}}function xt(){if(!n){window.location.hash="#/integrations/linear";return}ae(!0),_e.length===0&&(Ce(!0),we.listLinearProjects(p??void 0).then(({projects:se})=>E(se)).catch(()=>{}).finally(()=>Ce(!1)))}function Kt(se){Re(!1),Gt(se),K&&(X(!0),we.getLinearProjectIssues(K.projectId,10,p??void 0).then(({issues:ke})=>L(ke)).catch(()=>{}).finally(()=>X(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:It,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&h.length>1&&l.jsx("select",{value:p??"",onChange:se=>vn(se.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:h.map(se=>l.jsx("option",{value:se.id,children:se.workspaceName||se.name},se.id))}),K?l.jsxs(l.Fragment,{children:[l.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:[l.jsx(Su,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:K.projectName}),l.jsx("button",{type:"button",onClick:Ze,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]}),l.jsxs("button",{type:"button",onClick:()=>Re(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":S,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}C(!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:[l.jsx(Su,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:xt,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>Re(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),K&&(()=>{const se=$.trim().toLowerCase(),ke=!oe&&se?q.filter(nt=>nt.identifier.toLowerCase().includes(se)||nt.title.toLowerCase().includes(se)):oe?[]:q,We=oe?je:ke;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:St,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),l.jsx("input",{type:"text",value:$,onChange:nt=>B(nt.target.value),placeholder:oe?"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"}),de?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):V?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:V}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):oe&&se.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):We.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:se?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:We.map(nt=>l.jsxs("button",{type:"button",onClick:()=>Gt(nt),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===nt.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:nt.identifier})," ",nt.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[nt.stateName,nt.priorityLabel].filter(Boolean).join(" - ")})]},nt.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:oe,onChange:nt=>{ye(nt.target.checked),nt.target.checked||Ee([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),H&&l.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:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>ae(!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"})]})}),Ne?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):_e.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:_e.map(se=>l.jsx("button",{type:"button",onClick:()=>wt(se),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:se.name})},se.id))})]}),S&&n&&l.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:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:b,onChange:se=>{_(se.target.value)},onFocus:()=>C(!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"}),l.jsx("button",{type:"button",onClick:()=>{C(!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"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.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&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&T&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!T&&A&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:A}),b.trim().length>=2&&!T&&!A&&k.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!T&&!A&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:k.map(se=>l.jsxs("button",{type:"button",onClick:()=>Gt(se,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:se.identifier})," - ",se.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[se.stateName,se.teamName].filter(Boolean).join(" • ")})]},se.id))})]}),l.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:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),P&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.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"})})]}),Te&&l.jsx(GP,{defaultProjectId:K==null?void 0:K.projectId,connectionId:p??void 0,onCreated:Kt,onClose:()=>Re(!1)})]}):null}function QP({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:h}){const[f,p]=j.useState([]),[g,v]=j.useState(!1),[y,b]=j.useState(""),_=j.useRef(null);return j.useEffect(()=>{function k(N){_.current&&!_.current.contains(N.target)&&v(!1)}return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[]),j.useEffect(()=>{t?we.listBranches(t.repoRoot).then(k=>{p(k),h(k)}).catch(()=>{p([]),h([])}):(p([]),h([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(k=>{p(k),h(k)}).catch(()=>{p([]),h([])})}),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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.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"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.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:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.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)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const k=y.toLowerCase().trim(),N=f.filter(R=>!R.isRemote&&(!k||R.name.toLowerCase().includes(k))),S=f.filter(R=>R.isRemote&&(!k||R.name.toLowerCase().includes(k))),C=f.some(R=>R.name.toLowerCase()===k),T=N.length>0||S.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(R=>l.jsxs("button",{onClick:()=>{o(R.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 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[R.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[R.ahead,"↑"]}),R.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[R.behind,"↓"]}),R.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),R.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},R.name))]}),S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),S.map(R=>l.jsxs("button",{onClick:()=>{o(R.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 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${R.name}`))]}),!T&&k&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),k&&!C&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.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"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.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"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const XP=336*60*60*1e3,Za=12,WP=24;function wx(e){return e.split("/").filter(Boolean).pop()||e}function nS(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||wx(e.cwd)}function KP(e){return e.length>8?e.slice(0,8):e}function ZP(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function JP(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 a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}const Eh="cc-draft-prompt";function eB(){var Ki;const[e,t]=j.useState(()=>localStorage.getItem(Eh)||"");j.useEffect(()=>{e?localStorage.setItem(Eh,e):localStorage.removeItem(Eh)},[e]);const[n]=j.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=j.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=j.useState(()=>localStorage.getItem("cc-session-prefix")||""),[h,f]=j.useState(""),[p,g]=j.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,y]=j.useState([]),[b,_]=j.useState(()=>X2(localStorage.getItem("cc-backend")||"claude")),[k,N]=j.useState(()=>W2(localStorage.getItem("cc-backend")||"claude")),[S,C]=j.useState(()=>localStorage.getItem("cc-effort")||""),[T,R]=j.useState(()=>bf()[0]||""),[A,O]=j.useState([]),[P,z]=j.useState(null),[K,F]=j.useState(!1),[q,L]=j.useState(""),[de,X]=j.useState(null),[V,G]=j.useState(!1),[H,ae]=j.useState(null),[_e,E]=j.useState(null),[Ne,Ce]=j.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),$=de||SC(p),B=Q2(p),oe=iP(p),[ye,je]=j.useState([]),[Ee,Be]=j.useState(()=>localStorage.getItem("cc-selected-env")||""),[Oe,Te]=j.useState(!1),[Re,It]=j.useState(!1),vn=BP(),[Gt,St]=j.useState(()=>vn),[wt,Ze]=j.useState([]),[xt,Kt]=j.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[se,ke]=j.useState(!1),We=j.useRef(null),[nt,Zt]=j.useState(null),Ft=j.useRef(null),ce=j.useRef(null),[U,fe]=j.useState(!1),[Ae,tt]=j.useState(!1),[ze,st]=j.useState(!1),[rn,Zn]=j.useState(!1),[on,Is]=j.useState(!1),[ks,Ut]=j.useState(""),[Jt,fn]=j.useState(!0),[en,bi]=j.useState([]),[_i,kr]=j.useState(!1),[wi,ya]=j.useState(""),[Rn,pn]=j.useState(!1),[qn,tn]=j.useState(Za),[te,ve]=j.useState(""),[me,Ye]=j.useState(null),[jt,mn]=j.useState(!1),[On,Lt]=j.useState(""),[Ln,ti]=j.useState(!1),[Of,Uu]=j.useState([]),[Yi,Si]=j.useState(null),[hl,ba]=j.useState(!1),[Io,ki]=j.useState(""),[Fo,_a]=j.useState(0),wa=j.useRef(null),us=j.useRef(null),js=j.useRef(null),gn=j.useRef(null),Cn=j.useRef(null),ji=j.useRef(null),Uo=W(Q=>Q.currentSessionId),cn=jC({text:e,caretPos:Fo,cwd:T||void 0});j.useEffect(()=>{if(wa.current===null||!us.current)return;const Q=wa.current;us.current.setSelectionRange(Q,Q),wa.current=null},[e]),j.useEffect(()=>{var xe;window.matchMedia("(min-width: 640px)").matches&&((xe=us.current)==null||xe.focus())},[]),j.useEffect(()=>{we.getHome().then(({home:Q,cwd:xe})=>{T||R(xe||Q)}).catch(()=>{}),we.listEnvs().then(je).catch(()=>{}),we.listSandboxes().then(Ze).catch(()=>{}),we.getBackends().then(y).catch(()=>{}),we.getSettings().then(Q=>{G(Q.linearApiKeyConfigured)}).catch(()=>{})},[]);function Lf(Q){g(Q),localStorage.setItem("cc-backend",Q),X(null),_(X2(Q)),N(W2(Q)),Q!=="claude"&&(Is(!1),bi([]),ya(""),kr(!1),pn(!1),tn(Za),ve(""))}j.useEffect(()=>{if(p!=="codex"){X(null);return}we.getBackendModels(p).then(Q=>{if(Q.length>0){const xe=nP(Q);X(xe),xe.some(at=>at.value===b)||_(xe[0].value)}}).catch(()=>{})},[p]),j.useEffect(()=>{if(Ft.current&&(clearInterval(Ft.current),Ft.current=null),Zt(null),!Gt)return;const Q="the-companion:latest",xe=()=>{we.getImageStatus(Q).then(at=>{Zt(at),at.status==="idle"&&we.pullImage(Q).catch(()=>{}),(at.status==="ready"||at.status==="error")&&Ft.current&&(clearInterval(Ft.current),Ft.current=null)}).catch(()=>{})};return xe(),Ft.current=setInterval(xe,2e3),()=>{Ft.current&&(clearInterval(Ft.current),Ft.current=null)}},[Gt]),j.useEffect(()=>{function Q(xe){js.current&&!js.current.contains(xe.target)&&fe(!1),gn.current&&!gn.current.contains(xe.target)&&tt(!1),Cn.current&&!Cn.current.contains(xe.target)&&st(!1),ji.current&&!ji.current.contains(xe.target)&&Te(!1),We.current&&!We.current.contains(xe.target)&&ke(!1)}return document.addEventListener("pointerdown",Q),()=>document.removeEventListener("pointerdown",Q)},[]),j.useEffect(()=>{if(!T){Ye(null);return}we.getRepoInfo(T).then(Q=>{Ye(Q),Lt(Q.currentBranch),ti(!1)}).catch(()=>{Ye(null),Lt(""),ti(!1)})},[T]);const Ho=$.find(Q=>Q.value===b)||$[0],Sa=B.find(Q=>Q.value===k)||B[0],fl=oe.find(Q=>Q.value===S)||oe[0],pl=p==="codex"?"/logo-codex.svg":"/logo.svg",Qi=T?T.split("/").pop()||T:"Select folder",Ni=j.useMemo(()=>ks.trim(),[ks]),jr=p==="claude"&&on&&Ni.length>0,ds=j.useMemo(()=>{const Q=Date.now()-XP;return en.filter(xe=>xe.createdAt>=Q)},[en]),un=j.useMemo(()=>Rn?en:ds.length>0?ds:en,[Rn,ds,en]),Ns=j.useMemo(()=>te.trim().toLowerCase(),[te]),ni=j.useMemo(()=>Ns?un.filter(Q=>{const xe=nS(Q).toLowerCase(),at=wx(Q.cwd).toLowerCase(),pt=(Q.gitBranch||"").toLowerCase(),mt=Q.cwd.toLowerCase(),Qe=Q.resumeSessionId.toLowerCase();return xe.includes(Ns)||at.includes(Ns)||pt.includes(Ns)||mt.includes(Ns)||Qe.includes(Ns)}):un,[un,Ns]),ml=j.useMemo(()=>ni.slice(0,qn),[ni,qn]),Xi=qn<ni.length,Wi=Math.max(0,en.length-ds.length),Df=!Rn&&ds.length>0,gl=j.useCallback(async()=>{if(p==="claude"){kr(!0),ya("");try{const[Q,xe]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then(Qe=>Qe.sessions)]),at=new Map,pt=Qe=>{const Dn=at.get(Qe.resumeSessionId);(!Dn||Qe.createdAt>Dn.createdAt)&&at.set(Qe.resumeSessionId,Qe)};for(const Qe of Q)Qe.backendType!=="codex"&&Qe.cliSessionId&&pt({resumeSessionId:Qe.cliSessionId,sessionId:Qe.sessionId,name:Qe.name,model:Qe.model,createdAt:Qe.createdAt,cwd:Qe.cwd,gitBranch:Qe.gitBranch,source:"companion"});for(const Qe of xe)pt({resumeSessionId:Qe.sessionId,sessionId:Qe.sessionId,slug:Qe.slug,createdAt:Qe.lastActivityAt,cwd:Qe.cwd,gitBranch:Qe.gitBranch,source:"claude_disk"});const mt=Array.from(at.values()).sort((Qe,Dn)=>{const es=T&&Qe.cwd===T?0:1,Er=T&&Dn.cwd===T?0:1;return es!==Er?es-Er:Dn.createdAt-Qe.createdAt});bi(mt),pn(!1),tn(Za)}catch(Q){const xe=Q instanceof Error?Q.message:String(Q);ya(xe||"Failed to load existing sessions"),bi([]),tn(Za)}finally{kr(!1)}}},[p,T]);j.useEffect(()=>{p==="claude"&&on&&gl()},[p,on,gl]),j.useEffect(()=>{tn(Za)},[Ns,Rn]);async function qo(Q){if(Q.length===0)return;const xe=[],at=[];let pt=A.reduce((mt,Qe)=>mt+Qe.size,0);for(const mt of Q){if(mt.size>vf){at.push(`${mt.name} is too large (${fa(mt.size)}, max ${fa(vf)})`);continue}if(pt+mt.size>yf){at.push(`${mt.name} would exceed the per-message limit (${fa(yf)})`);continue}const{base64:Qe,mediaType:Dn}=await cC(mt);xe.push({name:mt.name,base64:Qe,mediaType:Dn,size:mt.size}),pt+=mt.size}xe.length>0&&O(mt=>[...mt,...xe]),z(at.length>0?at.join("; "):null)}async function zf(Q){const xe=Q.target.files;xe&&(await qo(Array.from(xe)),Q.target.value="")}function vt(Q){O(xe=>xe.filter((at,pt)=>pt!==Q))}async function Hu(Q){var pt;const xe=(pt=Q.clipboardData)==null?void 0:pt.items;if(!xe)return;const at=[];for(const mt of Array.from(xe)){if(mt.kind!=="file")continue;const Qe=mt.getAsFile();if(!Qe)continue;const Dn=Qe.name&&Qe.name.length>0?Qe.name:`pasted-${Date.now()}.${(Qe.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;at.push(new File([Qe],Dn,{type:Qe.type,lastModified:Qe.lastModified}))}at.length>0&&(Q.preventDefault(),await qo(at))}function xl(Q){t(Q.target.value),_a(Q.target.selectionStart??Q.target.value.length);const xe=Q.target;xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px"}function ka(){us.current&&_a(us.current.selectionStart??0)}function Fs(Q){var at;const xe=cn.selectPrompt(Q);wa.current=xe.nextCursor,t(xe.nextText),cn.setMentionMenuOpen(!1),_a(xe.nextCursor),(at=us.current)==null||at.focus(),us.current&&(us.current.style.height="auto",us.current.style.height=Math.min(us.current.scrollHeight,200)+"px")}function Jn(Q){if(cn.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),cn.setMentionMenuOpen(!1);return}if(cn.mentionMenuOpen&&cn.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),cn.setMentionMenuIndex(xe=>(xe+1)%cn.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),cn.setMentionMenuIndex(xe=>(xe-1+cn.filteredPrompts.length)%cn.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),Fs(cn.filteredPrompts[cn.mentionMenuIndex]);return}}if(cn.mentionMenuOpen&&cn.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault();const xe=Q2(p),pt=(xe.findIndex(mt=>mt.value===k)+1)%xe.length;N(xe[pt].value);return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),Vu())}function qu(Q){const xe=i.trim(),at=xe?`[${xe}]: ${Q}`:Q;if(!H)return at;const pt=(H.description??"").trim();return`${["Linear issue context:",`- Identifier: ${H.identifier}`,`- Title: ${H.title}`,H.stateName?`- State: ${H.stateName}`:"",H.priorityLabel?`- Priority: ${H.priorityLabel}`:"",H.teamName?`- Team: ${H.teamName}`:"",`- URL: ${H.url}`,pt?`- Description:
114
+ ${pt}`:""].filter(Boolean).join(`
115
+ `)}
116
+
117
+ User request:
118
+ ${at}`}async function Vu(){const Q=e.trim();if(!(!Q||K)){if(n&&!i.trim()){L("Please enter your name before starting a session.");return}if(F(!0),L(""),ki(""),me){const xe=On||me.currentBranch;if(xe&&xe===me.currentBranch){const at=Of.find(pt=>pt.name===xe&&!pt.isRemote);if(at&&at.behind>0){Si({behind:at.behind,branchName:xe});return}}}await Nr(Q)}}async function Nr(Q,xe){const at=W.getState();at.clearCreation(),at.setSessionCreating(!0,p);try{Uo&&E0(Uo);const pt=(xe==null?void 0:xe.resumeSessionAt)||(jr?Ni:void 0),mt=pt?(xe==null?void 0:xe.forkSession)??(jr?Jt:void 0):void 0,Qe=(xe==null?void 0:xe.cwd)||T,Dn=(xe==null?void 0:xe.branch)!==void 0?xe.branch.trim()||void 0:On.trim()||void 0,es=(xe==null?void 0:xe.useWorktree)!==void 0?xe.useWorktree:jt,Er=(xe==null?void 0:xe.createBranch)!==void 0?xe.createBranch:!!(Dn&&Ln),vl=Q.trim(),Cs=vl.length>0?qu(vl):null,si=Cs?j0():null,Wo=A.length>0?A.map(Ts=>({name:Ts.name,media_type:Ts.mediaType,data:Ts.base64,size:Ts.size})):void 0,Tr=await y7({initialMessage:Cs&&si?{content:Cs,attachments:Wo,clientMsgId:si}:void 0,model:b,permissionMode:k,effort:p==="claude"&&S?S:void 0,cwd:Qe||void 0,envSlug:Ee||void 0,sandboxEnabled:Gt?!0:void 0,sandboxSlug:Gt&&xt?xt:void 0,branch:Dn,createBranch:Er?!0:void 0,useWorktree:es?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:pt,forkSession:mt,userName:i.trim()||void 0,linearConnectionId:H&&_e||void 0,linearIssue:H?{identifier:H.identifier,title:H.title,stateName:H.stateName,teamName:H.teamName,url:H.url}:void 0},Ts=>{W.getState().addCreationProgress(Ts)}),Es=Tr.sessionId,Mr=W.getState(),ii=Mr.sdkSessions.filter(Ts=>Ts.sessionId!==Es);Mr.setSdkSessions([...ii,{sessionId:Es,state:Tr.state,cwd:Tr.cwd,createdAt:Date.now(),backendType:Tr.backendType||p,model:b,permissionMode:k,userName:i.trim()||void 0,resumeSessionAt:pt,forkSession:pt?mt===!0:void 0}]);const Ko=new Set(W.getState().sessionNames.values()),ja=hS(Ko),ri=o.trim()||i.trim(),Na=h.trim()||ja,Zo=ri?`${ri}_${Na}`:Na;W.getState().setSessionName(Es,Zo),we.renameSession(Es,Zo).catch(()=>{}),f(""),Qe&&MC(Qe),W.getState().setPreviousPermissionMode(Es,k),Cs&&(localStorage.removeItem(Eh),t("")),nv(Es,!0),Do(Es),Cs&&si&&W.getState().appendMessage(Es,{id:si,role:"user",content:Cs,attachments:Wo,timestamp:Date.now()}),H&&(we.linkLinearIssue(Es,H,_e||void 0).then(()=>W.getState().setLinkedLinearIssue(Es,H)).catch(()=>{}),we.transitionLinearIssue(H.id,_e||void 0).catch(()=>{})),W.getState().clearCreation()}catch(pt){const mt=pt instanceof Error?pt.message:String(pt);L(mt);const Qe=Q.trim();W.getState().setCreationError(mt,Qe?{text:Qe}:null),F(!1)}}async function Vo(Q,xe){K||(F(!0),L(""),ki(""),R(Q.cwd),mn(!1),ti(!1),Lt(Q.gitBranch||""),Ut(Q.resumeSessionId),fn(xe),await Nr("",{resumeSessionAt:Q.resumeSessionId,forkSession:xe,cwd:Q.cwd,branch:Q.gitBranch,useWorktree:!1,createBranch:!1}))}async function $f(){if(Yi){ba(!0),ki("");try{const Q=T||(me==null?void 0:me.repoRoot);if(!Q)throw new Error("No working directory");const xe=await we.gitPull(Q);if(!xe.success){ki(xe.output||"Pull failed"),ba(!1),F(!1);return}Si(null),ba(!1),await Nr(e.trim())}catch(Q){ki(Q instanceof Error?Q.message:String(Q)),ba(!1)}}}function hs(){const Q=e.trim();Si(null),ki(""),Nr(Q)}function Go(){Si(null),ki(""),F(!1)}const Gu=j.useCallback((Q,xe)=>{Lt(Q),ti(xe)},[]),Yo=j.useCallback((Q,xe)=>{Lt(Q),ti(xe)},[]),Cr=j.useCallback(Q=>{Uu(Q)},[]),Qo=j.useCallback(Q=>{ae(Q),!Q&&me&&(Lt(me.currentBranch),ti(!1))},[me]),Xo=e.trim().length>0&&!K&&(!n||i.trim().length>0);return l.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:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:pl,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.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"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:i,onChange:Q=>{const xe=Q.target.value;a(xe),localStorage.setItem("cc-user-name",xe)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":i.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:o,onChange:Q=>{const xe=Q.target.value;u(xe),localStorage.setItem("cc-session-prefix",xe)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:h,onChange:Q=>f(Q.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[o.trim()||i.trim()||"MA","_",h.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:zf,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(kC,{open:cn.mentionMenuOpen,loading:cn.promptsLoading,prompts:cn.filteredPrompts,selectedIndex:cn.mentionMenuIndex,onSelect:Fs,menuRef:cn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(H||A.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[H&&l.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:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:H.identifier}),l.jsx("span",{className:"truncate",children:H.title}),l.jsx("button",{type:"button",onClick:()=>Qo(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:"×"})]}),A.map((Q,xe)=>l.jsx(hC,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>vt(xe),className:"w-10 h-10"},xe))]}),P&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:P}),l.jsx("textarea",{ref:us,value:e,onChange:xl,onKeyDown:Jn,onClick:ka,onKeyUp:ka,onPaste:Hu,"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"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:js,children:[l.jsxs("button",{onClick:()=>fe(!U),"aria-expanded":U,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:[l.jsx("span",{children:Ho.icon}),l.jsx("span",{children:Ho.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),U&&l.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:$.map(Q=>l.jsxs("button",{onClick:()=>{_(Q.value),fe(!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 ${Q.value===b?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:Q.icon}),Q.label]},Q.value))})]}),oe.length>0&&l.jsxs("div",{className:"relative",ref:Cn,children:[l.jsxs("button",{onClick:()=>st(!ze),"aria-expanded":ze,"aria-label":"Reasoning effort",title:"Reasoning effort",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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:fl.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),ze&&l.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(Q=>l.jsx("button",{onClick:()=>{C(Q.value),localStorage.setItem("cc-effort",Q.value),st(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Q.value===S?"text-cc-primary font-medium":"text-cc-fg"}`,children:Q.label},Q.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:gn,children:[l.jsxs("button",{onClick:()=>tt(!Ae),"aria-expanded":Ae,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Sa.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Ae&&l.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:B.map(Q=>l.jsx("button",{onClick:()=>{N(Q.value),tt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Q.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:Q.label},Q.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>Zn(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.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"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Qi})]}),rn&&l.jsx(HP,{initialPath:T||"",onSelect:Q=>{R(Q)},onClose:()=>Zn(!1)})]}),l.jsx(QP,{cwd:T,gitRepoInfo:me,selectedBranch:On,isNewBranch:Ln,useWorktree:jt,onBranchChange:Gu,onWorktreeChange:mn,onBranchesLoaded:Cr}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:ji,children:[l.jsxs("button",{onClick:()=>{Oe||we.listEnvs().then(je).catch(()=>{}),Te(!Oe)},"aria-expanded":Oe,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.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"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Ee?((Ki=ye.find(Q=>Q.slug===Ee))==null?void 0:Ki.name)||"Env":"No env"})]}),Oe&&l.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:[l.jsx("button",{onClick:()=>{Be(""),localStorage.setItem("cc-selected-env",""),Te(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ee?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),ye.map(Q=>l.jsxs("button",{onClick:()=>{Be(Q.slug),localStorage.setItem("cc-selected-env",Q.slug),Te(!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.slug===Ee?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:Q.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(Q.variables).length," var",Object.keys(Q.variables).length!==1?"s":""]})]},Q.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{It(!0),Te(!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..."})})]})]}),vn,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var Q;return(Q=ce.current)==null?void 0:Q.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:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:Vu,disabled:!Xo,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Xo?"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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(Q=>l.jsxs("button",{onClick:()=>Q.available&&Lf(Q.id),disabled:!Q.available,title:Q.available?Q.name:`${Q.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${Q.available?p===Q.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:[Q.name,!Q.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},Q.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>Is(Q=>!Q),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${on?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":on,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.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"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${on?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":on?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!on||void 0,children:l.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:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void gl(),disabled:_i,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:_i?"Refreshing...":"Refresh detected sessions"}),en.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",ml.length," of ",ni.length," ",Ns?"matching":Df?"recent":"detected"," Claude session",ni.length!==1?"s":"","."]}),!Rn&&Wi>0&&ds.length>0&&l.jsxs("button",{type:"button",onClick:()=>{pn(!0),tn(Za)},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 (",Wi,")"]}),Rn&&ds.length>0&&l.jsx("button",{type:"button",onClick:()=>{pn(!1),tn(Za)},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"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.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:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:te,onChange:Q=>ve(Q.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"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),wi&&l.jsx("p",{className:"text-[11px] text-cc-error",children:wi}),!_i&&!wi&&ni.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:Ns?"No sessions match this search.":"No Claude sessions detected yet."}),ml.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.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:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:ml.map(Q=>{const xe=nS(Q),at=wx(Q.cwd),pt=Q.source==="companion"?"Companion":"Claude",mt=Ni===Q.resumeSessionId;return l.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:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${mt?"text-cc-primary font-medium":"text-cc-fg"}`,children:xe}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:KP(Q.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:pt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:Q.cwd,children:[l.jsx("div",{className:"truncate",children:at}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:Q.cwd,children:ZP(Q.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:Q.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:JP(Q.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{Ut(Q.resumeSessionId),fn(!0),Vo(Q,!0)},"aria-label":`Fork and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${mt&&Jt?"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
119
+ ${Q.cwd}${Q.gitBranch?` (${Q.gitBranch})`:""}
120
+ ${Q.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{Ut(Q.resumeSessionId),fn(!1),Vo(Q,!1)},"aria-label":`Continue and open ${xe}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${mt&&!Jt?"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
121
+ ${Q.resumeSessionId}`,children:"Continue"})]})]},`${Q.resumeSessionId}-row-${Q.sessionId}`)})}),Xi&&l.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:l.jsxs("button",{type:"button",onClick:()=>tn(Q=>Math.min(Q+WP,ni.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 (",ni.length-qn," remaining)"]})})]}),l.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."})]})})})]}),Ne&&l.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:[l.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:l.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"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{Ce(!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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx(YP,{cwd:T,gitRepoInfo:me,linearConfigured:V,selectedLinearIssue:H,onIssueSelect:Qo,onBranchFromIssue:Yo,onConnectionSelect:E})]}),Yi&&l.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:l.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"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[l.jsx("span",{className:"font-mono-code font-medium",children:Yi.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Yi.behind," commit",Yi.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Io&&l.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:Io}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Go,disabled:hl,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"}),l.jsx("button",{onClick:hs,disabled:hl,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"}),l.jsx("button",{onClick:$f,disabled:hl,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:hl?l.jsxs(l.Fragment,{children:[l.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"})]})]})]})}),q&&l.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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.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"})}),l.jsx("p",{className:"text-xs text-cc-error",children:q})]})]}),Re&&l.jsx(AC,{onClose:()=>{It(!1),we.listEnvs().then(je).catch(()=>{})}})]})}const tB=[],nB=[],sB={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"}},iB={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function rB({server:e,sessionId:t}){var h,f;const[n,i]=j.useState(!1),a=sB[e.status]||iB,o=e.status!=="disabled",u=((h=e.tools)==null?void 0:h.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>e4(t,e.name,!o),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${o?"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:o?"Disable server":"Enable server",children:o?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>t4(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:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.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"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(f=e.config.args)!=null&&f.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.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 aB({sessionId:e,onDone:t}){const[n,i]=j.useState(""),[a,o]=j.useState("stdio"),[u,h]=j.useState(""),[f,p]=j.useState(""),[g,v]=j.useState(""),y=n.trim()&&(a==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const k={type:a};a==="stdio"?(k.command=u.trim(),f.trim()&&(k.args=f.trim().split(/\s+/))):k.url=g.trim(),n4(e,{[n.trim()]:k}),t()}return l.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.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"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>o(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"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:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>h(_.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"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:f,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"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.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"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.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"}),l.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 lB({sessionId:e}){const t=W(h=>h.mcpServers.get(e)||tB),n=W(h=>h.cliConnected.get(e)??!1),[i,a]=j.useState(!1),o=W(h=>{var f;return((f=h.sessions.get(e))==null?void 0:f.mcp_servers)??nB});j.useEffect(()=>{n&&rw(e)},[e,n]);const u=t.length>0?t:o.map(h=>({name:h.name,status:h.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.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"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>rw(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:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.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"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(aB,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(h=>l.jsx(rB,{server:h,sessionId:e},h.name))}),!i&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function oB({cwd:e,open:t,onClose:n}){var q;const[i,a]=j.useState([]),[o,u]=j.useState(!0),[h,f]=j.useState(0),[p,g]=j.useState(""),[v,y]=j.useState(!1),[b,_]=j.useState(!1),[k,N]=j.useState(null),[S,C]=j.useState(null),T=j.useCallback(()=>{u(!0),N(null),we.getClaudeMdFiles(e).then(L=>{a(L.files),L.files.length>0&&(f(0),g(L.files[0].content)),C(null),y(!1),u(!1)}).catch(L=>{N(L.message),u(!1)})},[e]);j.useEffect(()=>{t&&T()},[t,T]);const R=L=>{v&&!confirm("Discard unsaved changes?")||(f(L),g(i[L].content),y(!1),C(null))},A=async()=>{var de;const L=S||((de=i[h])==null?void 0:de.path);if(L){_(!0),N(null);try{await we.saveClaudeMd(L,p),y(!1),S?T():a(X=>X.map((V,G)=>G===h?{...V,content:p}:V))}catch(X){N(X instanceof Error?X.message:"Failed to save")}finally{_(!1)}}},O=L=>{const de=L==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(de),g(`# CLAUDE.md
122
+
123
+ `),y(!0)},P=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const z=L=>L.startsWith(e+"/")?L.slice(e.length+1):L,K=i.some(L=>L.path===`${e}/CLAUDE.md`),F=i.some(L=>L.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:P}),l.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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.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"})})}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),l.jsx("button",{onClick:P,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 flex min-h-0",children:o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((L,de)=>l.jsxs("button",{onClick:()=>R(de),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!S&&h===de?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:l.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"})}),l.jsx("span",{className:"truncate font-mono-code",children:z(L.path)})]},L.path)),S&&l.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.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"})}),l.jsx("span",{className:"truncate font-mono-code",children:z(S)})]})]}),(!K||!F)&&!S&&l.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!K&&l.jsxs("button",{onClick:()=>O("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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.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"})}),l.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!F&&l.jsxs("button",{onClick:()=>O("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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.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"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!S?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:l.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"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),l.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."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>O("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"}),l.jsx("button",{onClick:()=>O("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"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:z(S||(((q=i[h])==null?void 0:q.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[v&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:A,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"})]})]}),l.jsx("textarea",{value:p,onChange:L=>{g(L.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&&l.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 sS({icon:e,title:t,expanded:n,onToggle:i}){return l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.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"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.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"})})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function hr({label:e,sublabel:t,count:n,onClick:i}){return l.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:[l.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&l.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),l.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:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function cB({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),l.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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.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"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:l.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function uB({path:e,label:t,onClose:n}){const[i,a]=j.useState(""),[o,u]=j.useState(!0),[h,f]=j.useState(!1),[p,g]=j.useState(!1),[v,y]=j.useState(null);j.useEffect(()=>{we.readFile(e).then(k=>{a(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),f(!1)}catch(k){y(k instanceof Error?k.message:"Failed to save")}finally{g(!1)}},_=()=>{h&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.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"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[h&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:b,disabled:!h||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${h&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:i,onChange:k=>{a(k.target.value),f(!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&&l.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 dB({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=j.useState(null),[o,u]=j.useState(!0);return j.useEffect(()=>{we.readFile(e.path).then(h=>{a(h.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(cB,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx(oB,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(uB,{path:e.path,label:e.label,onClose:n})}function hB({sessionId:e}){const t=W(S=>S.sessions.get(e)),n=W(S=>S.sdkSessions.find(C=>C.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=j.useState(null),[u,h]=j.useState(!0),[f,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);o(S)}catch{}finally{h(!1)}},[i]);if(j.useEffect(()=>{_()},[_]),!i)return null;if(u)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!a)return null;const k=a.project.claudeMd.length+(a.project.settings?1:0)+(a.project.settingsLocal?1:0)+a.project.commands.length,N=(a.user.claudeMd?1:0)+a.user.skills.length+a.user.agents.length+(a.user.settings?1:0)+a.user.commands.length;return l.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[l.jsx(sS,{icon:"project",title:`Project (${k})`,expanded:f,onToggle:()=>p(S=>!S)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(S=>l.jsx(hr,{label:S.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:S.path,kind:"claude-md"})},S.path)),a.project.settings&&l.jsx(hr,{label:"settings.json",onClick:()=>b({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(hr,{label:"settings.local.json",onClick:()=>b({label:"settings.local.json",path:a.project.settingsLocal.path,kind:"json"})}),a.project.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.project.commands.length,")"]}),a.project.commands.map(S=>l.jsx(hr,{label:`/${S.name}`,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),k===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(sS,{icon:"user",title:`User (${N})`,expanded:g,onToggle:()=>v(S=>!S)}),g&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(hr,{label:"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:a.user.claudeMd.path,kind:"claude-md",editorCwd:a.user.root})}),a.user.skills.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",a.user.skills.length,")"]}),a.user.skills.map(S=>l.jsx(hr,{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))]}),a.user.agents.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",a.user.agents.length,")"]}),a.user.agents.map(S=>l.jsx(hr,{label:S.name,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.settings&&l.jsx(hr,{label:"settings.json",onClick:()=>b({label:"settings.json",path:a.user.settings.path,kind:"json"})}),a.user.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.user.commands.length,")"]}),a.user.commands.map(S=>l.jsx(hr,{label:`/${S.name}`,onClick:()=>b({label:S.name,path:S.path,kind:"md"})},S.path))]}),N===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),y&&$o.createPortal(l.jsx(dB,{item:y,cwd:i,onClose:()=>b(null)}),document.body)]})}function fB(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 pB extends j.Component{constructor(){super(...arguments);j_(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){ma(n,{section:this.props.label})}render(){return this.state.hasError?l.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),l.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 RC=[],Mv=3e4,mB=6e4,gB=5*6e4;let iS=null,rS=new Map;function xB(e){return e!==iS&&(iS=e,rS=new Map(e.map(t=>[t.sessionId,t]))),rS}function Fu(e){return W(j.useCallback(t=>xB(t.sdkSessions).get(e),[e]))}const OC="cc-panel-collapsed";function aS(){try{const e=localStorage.getItem(OC);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function vB(e){try{localStorage.setItem(OC,JSON.stringify([...e]))}catch{}}function LC({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[o,u]=j.useState(()=>aS().has(e)?!0:!i),h=j.useRef(!0);j.useEffect(()=>{if(h.current){h.current=!1;return}const p=aS();o?p.add(e):p.delete(e),vB(p)},[o,e]);const f=j.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:f,"aria-expanded":!o,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:[l.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 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function yB(){const[e,t]=j.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=j.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(LC,{id:"identity",label:"Identity",children:l.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),l.jsx("input",{type:"text",value:e,onChange:a=>{const o=a.target.value;t(o),localStorage.setItem("cc-user-name",o)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),l.jsx("input",{type:"text",value:n,onChange:a=>{const o=a.target.value;i(o),localStorage.setItem("cc-session-prefix",o)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",l.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",l.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function DC(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function zC(e){return e>80?"critical":e>50?"elevated":"normal"}function wr({label:e,pct:t,detail:n}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&l.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),l.jsx("div",{role:"meter","aria-label":`${e} usage — ${zC(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:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${DC(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function bB({sessionId:e}){var f;const[t,n]=j.useState(null),i=j.useCallback(async()=>{try{const p=await we.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=j.useRef(0);if(j.useEffect(()=>{i();const p=setInterval(()=>{a.current+=1,a.current%2===0?i():n(g=>g?{...g}:null)},Mv);return()=>clearInterval(p)},[i]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,h=!o&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!o&&!u&&!h?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(wr,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?U2(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(wr,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?U2(t.seven_day.resets_at):void 0}),h&&t.extra_usage&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),l.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&&l.jsx("div",{role:"meter","aria-label":`Extra usage — ${zC(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:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${DC(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function Th(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function _B(e){const[t,n]=j.useState(null);return j.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await we.getSystemMemory();i||n(u)}catch{}};a();const o=setInterval(a,mB);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(wr,{label:"Memory",pct:t.used_percent,detail:`${Th(t.used_bytes)} / ${Th(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(wr,{label:"Swap",pct:t.swap_used_percent,detail:`${Th(t.swap_used_bytes)} / ${Th(t.swap_total_bytes)}`})]}):null}function wB(e){const t=e/1099511627776;if(t>=1)return`${t.toFixed(1)} TB`;const n=e/1024**3;return n>=1?`${n.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function SB(e){const[t,n]=j.useState(null);return j.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await we.getSystemDisk();i||n(u)}catch{}};a();const o=setInterval(a,gB);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(wr,{label:"Disk",pct:t.used_percent,detail:`${wB(t.available_bytes)} free`})}):null}function kB({sessionId:e}){const t=W(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=j.useState(0);if(j.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),Mv);return()=>clearInterval(o)},[t]),!t)return null;const{primary:i,secondary:a}=t;return!i&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&l.jsx(wr,{label:`${H2(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?bx(i.resetsAt):void 0}),a&&l.jsx(wr,{label:`${H2(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?bx(a.resetsAt):void 0})]})}function jB({sessionId:e}){const t=W(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=W(i=>{var a;return((a=i.sessions.get(e))==null?void 0:a.context_used_percent)??0});return t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:au(t.inputTokens)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:au(t.outputTokens)})]}),t.cachedInputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:au(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:au(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(wr,{label:"Context",pct:n})]}):null}function NB(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 CB({pr:e}){const t=NB(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.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]}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&l.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?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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?l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),l.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&l.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"]})}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[l.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),l.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),l.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function EB({sessionId:e}){const t=W(u=>u.sessions.get(e)),n=Fu(e),i=W(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),o=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return j.useEffect(()=>{i||!a||!o||we.getPRStatus(a,o).then(u=>{W.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(CB,{pr:i.pr})}const TB=6e4;function v0(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 MB({sessionId:e}){const t=W(L=>L.linkedLinearIssues.get(e)),[n,i]=j.useState([]),[a,o]=j.useState(null),[u,h]=j.useState([]),[f,p]=j.useState(""),[g,v]=j.useState(!1),[y,b]=j.useState(!1),[_,k]=j.useState(!1),[N,S]=j.useState(""),[C,T]=j.useState([]),[R,A]=j.useState(!1),O=j.useRef(null);j.useEffect(()=>{we.getLinkedLinearIssue(e).then(L=>{L.issue&&W.getState().setLinkedLinearIssue(e,L.issue)}).catch(()=>{})},[e]);const P=j.useCallback(async()=>{if(t)try{const L=await we.getLinkedLinearIssue(e,!0);L.issue&&(W.getState().setLinkedLinearIssue(e,L.issue),L.issue.stateType==="completed"&&b(!0)),L.comments&&i(L.comments),L.assignee!==void 0&&o(L.assignee??null),L.labels&&h(L.labels)}catch{}},[e,t]);j.useEffect(()=>{if(!t)return;P();const L=setInterval(P,TB);return()=>clearInterval(L)},[P,t]),j.useEffect(()=>{if(!_)return;const L=N.trim();if(L.length<2){T([]);return}let de=!0;A(!0);const X=setTimeout(()=>{we.searchLinearIssues(L,6).then(V=>{de&&T(V.issues)}).catch(()=>{de&&T([])}).finally(()=>{de&&A(!1)})},400);return()=>{de=!1,clearTimeout(X)}},[N,_]),j.useEffect(()=>{_&&setTimeout(()=>{var L;return(L=O.current)==null?void 0:L.focus()},50)},[_]);async function z(){if(!(!t||!f.trim()||g)){v(!0);try{const L=await we.addLinearComment(t.id,f.trim());i(de=>[...de,L.comment]),p("")}catch{}finally{v(!1)}}}async function K(){try{await we.unlinkLinearIssue(e),W.getState().setLinkedLinearIssue(e,null),i([]),o(null),h([]),b(!1)}catch{}}async function F(L){try{await we.linkLinearIssue(e,L),W.getState().setLinkedLinearIssue(e,L),k(!1),S(""),T([])}catch{}}if(!t)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Su,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:O,type:"text",value:N,onChange:L=>S(L.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"}),l.jsx("button",{onClick:()=>{k(!1),S(""),T([])},"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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),R&&l.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),C.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:C.map(L=>l.jsxs("button",{onClick:()=>F(L),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:L.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${v0(L.stateType,L.stateName).cls}`,children:v0(L.stateType,L.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:L.title})]},L.id))}),N.trim().length>=2&&!R&&C.length===0&&l.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):l.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:[l.jsx(Su,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const q=v0(t.stateType,t.stateName);return l.jsxs("div",{className:"shrink-0",children:[l.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Su,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.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}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${q.cls}`,children:q.label}),l.jsx("button",{onClick:K,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(L=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${L.color}20`,color:L.color},children:L.name},L.id))})]}),y&&t.stateType==="completed"&&l.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:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.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"}),l.jsx("button",{onClick:async()=>{try{await we.archiveSession(e),W.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&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(L=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:L.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:fB(new Date(L.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:L.body})]},L.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&(L.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"}),l.jsx("button",{onClick:z,disabled:!f.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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 AB({sessionId:e}){const t=W(u=>u.rateLimit.get(e)),[,n]=j.useState(0);if(j.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(h=>h+1),Mv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const i=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?bx(t.resetsAt):void 0;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2","data-testid":"claude-rate-limit",children:[a!==void 0?l.jsx(wr,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:o}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${i?"text-cc-error":"text-cc-warning"}`,children:[i?"rate limited":t.status,o&&` · resets ${o}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function RB({sessionId:e}){const t=W(a=>a.sessions.get(e)),n=Fu(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(kB,{sessionId:e}),l.jsx(jB,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(AB,{sessionId:e}),l.jsx(bB,{sessionId:e})]})}function OB({sessionId:e}){const t=W(p=>p.sessions.get(e)),n=Fu(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,o=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,h=(t==null?void 0:t.total_lines_removed)||0,f=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&l.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"})]}),(a>0||o>0||u>0||h>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),o>0&&l.jsxs("span",{className:"text-cc-warning",children:[o,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),h>0&&l.jsxs("span",{className:"text-cc-error",children:["-",h,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&f&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{we.gitPull(f).then(p=>{W.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||ma(new Error(`git pull failed: ${p.output}`))}).catch(p=>ma(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function LB({sessionId:e}){const t=W(o=>o.sessionTasks.get(e)||RC),n=W(o=>o.sessions.get(e)),i=Fu(e),a=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||a?null:l.jsx("div",{className:"px-3 py-2",children:t.length===0?l.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):l.jsx("div",{className:"space-y-0.5",children:t.map(o=>l.jsx(IB,{task:o},o.id))})})}const DB={"usage-limits":RB,"server-memory":_B,"server-disk":SB,"git-branch":OB,"github-pr":EB,"linear-issue":MB,"mcp-servers":lB,tasks:LB};function zB(e,t){const n=W(i=>i.sessionTasks.get(t)||RC);if(e==="tasks"&&n.length>0){const i=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function $B({isCodex:e}){const t=W(p=>p.taskPanelConfig),n=W(p=>p.toggleSectionEnabled),i=W(p=>p.moveSectionUp),a=W(p=>p.moveSectionDown),o=W(p=>p.resetTaskPanelConfig),u=W(p=>p.setTaskPanelConfigMode),h=e?"codex":"claude",f=t.order.filter(p=>{const g=br.find(v=>v.id===p);return!(!g||g.backends&&!g.backends.includes(h))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:f.map((p,g)=>{const v=br.find(k=>k.id===p),y=t.enabled[p]??!0,b=g===0,_=g===f.length-1;return l.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:[l.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),l.jsx("button",{onClick:()=>a(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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:v.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.description})]}),l.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:l.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)})}),l.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[l.jsx("button",{onClick:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.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 PB({sectionId:e,sessionId:t,children:n}){var o;const i=((o=br.find(u=>u.id===e))==null?void 0:o.label)??e,a=zB(e,t);return l.jsx(LC,{id:e,label:i,badge:a,children:n})}function BB({sessionId:e}){const t=W(g=>g.sessions.get(e)),n=Fu(e),i=W(g=>g.taskPanelOpen),a=W(g=>g.setTaskPanelOpen),o=W(g=>g.taskPanelConfigMode),u=W(g=>g.taskPanelConfig);if(!i)return null;const h=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",f=h?"codex":"claude",p=u.order.filter(g=>{const v=br.find(y=>y.id===g);return!(!v||v.backends&&!v.backends.includes(f))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:o?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{o?W.getState().setTaskPanelConfigMode(!1):a(!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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),o?l.jsx($B,{isCodex:h}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[l.jsx(yB,{}),l.jsx(hB,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var y;const v=DB[g];return v?l.jsx(PB,{sectionId:g,sessionId:e,children:l.jsx(pB,{label:(y=br.find(b=>b.id===g))==null?void 0:y.label,children:l.jsx(v,{sessionId:e})})},g):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>W.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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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 IB({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?l.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:l.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.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),l.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),l.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&l.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&l.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),l.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function FB({status:e}){return e==="created"?l.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"?l.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"}):l.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 UB({sessionId:e}){const t=W(A=>A.sessions.get(e)),n=W(A=>A.sdkSessions.find(O=>O.sessionId===e)),i=W(A=>A.diffPanelSelectedFile.get(e)??null),a=W(A=>A.setDiffPanelSelectedFile),o=W(A=>A.diffBase),u=W(A=>A.setDiffBase),h=W(A=>A.changedFilesTick.get(e)??0),f=(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,N]=j.useState([]),S=W(A=>A.setGitChangedFilesCount);j.useEffect(()=>{if(!f)return;let A=!1;return we.getChangedFiles(f,o).then(({files:O})=>{if(A)return;const P=`${f}/`,z=O.filter(K=>K.path===f||K.path.startsWith(P)).map(K=>({abs:K.path,rel:K.path.startsWith(P)?K.path.slice(P.length):K.path,status:K.status==="A"||K.status==="?"?"created":K.status==="D"?"deleted":"updated"})).sort((K,F)=>K.rel.localeCompare(F.rel));N(z),S(e,z.length)}).catch(()=>{A||(N([]),S(e,0))}),()=>{A=!0}},[f,o,h,e,S]);const C=k;j.useEffect(()=>{!i&&C.length>0&&a(e,C[0].abs)},[i,C,e,a]),j.useEffect(()=>{var A;i&&(C.some(O=>O.abs===i)||a(e,((A=C[0])==null?void 0:A.abs)??null))},[i,C,e,a]),j.useEffect(()=>{if(!i){g("");return}let A=!1;return y(!0),we.getFileDiff(i,o).then(O=>{A||(g(O.diff),y(!1))}).catch(()=>{A||(g(""),y(!1))}),()=>{A=!0}},[i,o]);const T=j.useCallback(A=>{a(e,A),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),R=j.useMemo(()=>!i||!f?i:i.startsWith(f+"/")?i.slice(f.length+1):i,[i,f]);return f?C.length===0?l.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:l.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),l.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."})]})]}):l.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[b&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),l.jsxs("div",{className:`
124
+ ${b?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
125
+ fixed sm:relative z-30 sm:z-auto
126
+ ${b?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
127
+ shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
128
+ `,children:[l.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:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),l.jsxs("span",{children:["Changed (",C.length,")"]})]}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:C.map(({abs:A,rel:O,status:P})=>l.jsxs("button",{onClick:()=>T(A),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 ${A===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(FB,{status:P}),l.jsx("span",{className:"truncate leading-snug",children:O})]},A))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&l.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&&l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:R==null?void 0:R.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:R})]}),l.jsx("button",{onClick:()=>u(o==="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 ${o==="last-commit"?"default branch":"last commit"} comparison`,children:o==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:v?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?l.jsx("div",{className:"p-4",children:l.jsx(Oo,{unifiedDiff:p,fileName:R||void 0,mode:"full"})}):l.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!b&&l.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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"]}),l.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:l.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function HB(){const e=W(f=>f.updateInfo),t=W(f=>f.updateDismissedVersion),n=W(f=>f.dismissUpdate),[i,a]=j.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const o=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await we.triggerUpdate(),W.getState().setUpdateOverlayActive(!0)}catch(f){localStorage.removeItem("companion_docker_prompt_pending"),ma(f),a(!1)}},u=()=>{n(e.latestVersion)},h=i||e.updateInProgress;return l.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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.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"})}),l.jsxs("span",{className:"text-xs text-cc-fg",children:[l.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",l.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?l.jsx("button",{onClick:o,disabled:h,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:h?"Updating...":"Update & Restart"}):l.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",l.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"]}),l.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function qB({text:e}){const[t,n]=j.useState(!1);j.useEffect(()=>{if(!t)return;const a=setTimeout(()=>n(!1),1500);return()=>clearTimeout(a)},[t]);async function i(){try{await navigator.clipboard.writeText(e),n(!0)}catch{}}return l.jsx("div",{className:"mt-3 w-full max-w-xs px-4","data-testid":"unsent-prompt",children:l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-card/80",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-cc-border/60",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-fg",children:"Your prompt was not sent"}),l.jsx("button",{type:"button",onClick:i,className:"px-2 py-1 min-h-[28px] text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:t?"Copied":"Copy"})]}),l.jsx("pre",{className:"px-3 py-2 max-h-40 overflow-auto text-[11px] text-cc-fg whitespace-pre-wrap break-words font-mono-code leading-relaxed select-text",children:e}),l.jsx("p",{className:"px-3 pb-2 text-[10px] text-cc-muted",children:"It is still in the composer — dismiss to edit and retry."})]})})}function VB({steps:e,error:t,unsentPrompt:n,backend:i,onCancel:a}){const o=i==="codex"?"/logo-codex.svg":"/logo.svg",u=e.some(y=>y.status==="in_progress"),h=e.length>0&&e.every(y=>y.status==="done"),f=e.some(y=>y.status==="error")||!!t,p=[...e].reverse().find(y=>y.status==="in_progress"),g=[...e].reverse().find(y=>y.status==="done"),v=f?"Something went wrong":h?"Launching session...":(p==null?void 0:p.label)||(g==null?void 0:g.label)||"Preparing...";return l.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:[l.jsxs("div",{className:"relative mb-8",children:[u&&!f&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:o,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${u&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.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"})})}),h&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:v}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((y,b)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${b*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[y.status==="in_progress"&&l.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),y.status==="done"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:l.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.status==="error"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.jsx("span",{className:`text-xs transition-colors duration-200 ${y.status==="in_progress"?"text-cc-fg font-medium":y.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:y.label}),y.detail&&y.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:y.detail})]},y.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),f&&n&&l.jsx(qB,{text:n}),(f||u)&&a&&l.jsx("button",{onClick:a,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&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(y=>y.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function GB(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const YB={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function QB(e){const[t,n]=j.useState("installing"),i=j.useRef(null),a=j.useRef(!0);return j.useEffect(()=>(a.current=!0,()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[]),j.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),h()},5e3);function h(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:GB()}).then(f=>{if(!f.ok)throw new Error("not ready");return f.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(h,1500)})}return()=>{clearTimeout(o),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function $C({phase:e,className:t}){const n=e==="ready";return l.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[l.jsxs("div",{className:"relative mb-8",children:[!n&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.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&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),l.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:YB[e]}),l.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&l.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>l.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))}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.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 XB({active:e}){const t=QB(e);return e?l.jsx($C,{phase:t,className:"fixed inset-0 z-[100]"}):null}function OI({phase:e}){return l.jsx($C,{phase:e,className:"absolute inset-0"})}function WB(){const e=W(k=>k.dockerUpdateDialogOpen),t=W(k=>k.setDockerUpdateDialogOpen),[n,i]=j.useState("prompt"),[a,o]=j.useState(!1),[u,h]=j.useState(null),f=j.useRef(null);if(j.useEffect(()=>{e&&we.getSettings().then(k=>{o(k.dockerAutoUpdate),k.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),j.useEffect(()=>{if(n!=="pulling"){f.current&&(clearInterval(f.current),f.current=null);return}return f.current=setInterval(()=>{we.getImageStatus("the-companion:latest").then(k=>{h(k),k.status==="ready"?i("done"):k.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{f.current&&(clearInterval(f.current),f.current=null)}},[n]),!e)return null;function p(){i("pulling"),we.pullImage("the-companion:latest").then(k=>{k.state&&h(k.state)}).catch(()=>{i(k=>k==="pulling"?"error":k)})}function g(){p()}function v(){b()}function y(){b()}function b(){i("prompt"),h(null),t(!1)}async function _(){const k=!a;o(k);try{await we.updateSettings({dockerAutoUpdate:k})}catch{o(!k)}}return l.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:l.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"&&l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),l.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?"}),l.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:[l.jsx("span",{children:"Always update Docker image automatically"}),l.jsx("span",{role:"switch","aria-checked":a,"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 ${a?"bg-cc-primary":"bg-cc-border"}`,children:l.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${a?"translate-x-4":"translate-x-0"}`})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.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"}),l.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"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.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&&l.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(`
129
+ `)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.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"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.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"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.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"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.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(`
130
+ `)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.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"}),l.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 LI({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.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"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.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?"}),l.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:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.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...
131
+ Layer 1/5: abc123 downloading
132
+ Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.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"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.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"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}function KB(){const[e,t]=j.useState(null),[n,i]=j.useState({state:"idle"}),[a,o]=j.useState(""),[u,h]=j.useState(!1),[f,p]=j.useState(""),g=j.useCallback(async()=>{try{t(await we.getClaudeAccount())}catch(A){p(A instanceof Error?A.message:String(A))}},[]);j.useEffect(()=>{g(),we.getClaudeLoginStatus().then(i).catch(()=>{})},[g]);const v=async()=>{h(!0),p(""),o("");try{const A=await we.startClaudeLogin();i(A),A.state==="error"&&A.error&&p(A.error)}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},y=async()=>{h(!0),p("");try{const A=await we.submitClaudeLoginCode(a);i(A),A.state==="success"&&(o(""),await g())}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},b=async()=>{h(!0);try{i(await we.cancelClaudeLogin()),o("")}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},_=async()=>{h(!0),p("");try{const A=await we.claudeLogout();!A.ok&&A.error&&p(A.error),i({state:"idle"}),await g()}catch(A){p(A instanceof Error?A.message:String(A))}finally{h(!1)}},k=n.state==="awaiting_code",N=n.state==="verifying",S=k||N,C=(e==null?void 0:e.cliAvailable)===!1,T=e!=null&&e.orgName&&e.email&&e.orgName.includes(e.email)?null:(e==null?void 0:e.orgName)??null,R=e!=null&&e.authenticated?[e.email,e.subscriptionType?ZB(e.subscriptionType):null,T].filter(Boolean).join(" · "):null;return l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"block text-sm font-medium",children:"Claude Account"}),l.jsx("p",{className:"text-xs text-cc-muted",children:"Sign in with your Claude subscription. You'll open a link, approve on any device, and paste the code back here — no terminal access needed."}),C&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:"Claude CLI not found on this machine. Install it to sign in."}),!C&&e&&!S&&l.jsx("p",{className:"text-xs text-cc-muted","data-testid":"claude-account-status",children:R?`Signed in as ${R}`:e.authenticated?"Signed in":"Not signed in"}),S&&l.jsxs("div",{className:"px-3 py-3 rounded-lg bg-cc-bg border border-cc-primary/20 space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:"1. Open this link and approve:"}),l.jsx("a",{href:n.authUrl,target:"_blank",rel:"noreferrer","data-testid":"claude-auth-url",className:"block text-xs text-cc-primary underline break-all",children:n.authUrl})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs text-cc-muted",htmlFor:"claude-auth-code",children:"2. Paste the code you were shown:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"claude-auth-code",type:"text",value:a,disabled:N,autoComplete:"off",spellCheck:!1,onChange:A=>o(A.target.value),onKeyDown:A=>{A.key==="Enter"&&a.trim()&&!u&&(A.preventDefault(),y())},placeholder:"Paste code here",className:"flex-1 px-3 py-2 min-h-[40px] text-sm font-mono-code bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40"}),l.jsx("button",{type:"button",onClick:y,disabled:u||!a.trim(),className:`px-3 py-2 min-h-[40px] rounded-lg text-sm font-medium transition-colors ${u||!a.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:N?"Verifying…":"Submit"})]})]}),n.error&&l.jsx("p",{role:"alert",className:"text-xs text-cc-error",children:n.error})]}),n.state==="success"&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Signed in to Claude. New sessions will use this account."}),(n.state==="error"||f)&&l.jsx("div",{role:"alert",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:f||n.error}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[S?l.jsx("button",{type:"button",onClick:b,disabled:u,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Cancel"}):l.jsx("button",{type:"button",onClick:v,disabled:u||C,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${u||C?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:u?"Starting…":e!=null&&e.authenticated?"Sign in again":"Sign in with Claude"}),(e==null?void 0:e.authenticated)&&!S&&l.jsx("button",{type:"button",onClick:_,disabled:u,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Sign out"})]})]})}function ZB(e){return e.charAt(0).toUpperCase()+e.slice(1)}const JB=2e3;function eI(){const[e,t]=j.useState(null),[n,i]=j.useState({state:"idle"}),[a,o]=j.useState(!1),[u,h]=j.useState(""),[f,p]=j.useState(!1),g=j.useRef(null),v=j.useCallback(async()=>{try{t(await we.getCodexAccount())}catch(R){h(R instanceof Error?R.message:String(R))}},[]),y=j.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]),b=j.useCallback(()=>{y(),g.current=setInterval(async()=>{try{const R=await we.getCodexLoginStatus();i(R),R.state!=="pending"&&(y(),R.state==="success"&&v())}catch{}},JB)},[v,y]);j.useEffect(()=>(v(),we.getCodexLoginStatus().then(R=>{i(R),R.state==="pending"&&b()}).catch(()=>{}),y),[v,b,y]);const _=async()=>{o(!0),h("");try{const R=await we.startCodexLogin();i(R),R.state==="pending"?b():R.error&&h(R.error)}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},k=async()=>{o(!0),y();try{i(await we.cancelCodexLogin())}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},N=async()=>{o(!0),h("");try{const R=await we.codexLogout();!R.ok&&R.error&&h(R.error),i({state:"idle"}),await v()}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},S=async()=>{if(n.userCode)try{await navigator.clipboard.writeText(n.userCode),p(!0),setTimeout(()=>p(!1),1500)}catch{}},C=n.state==="pending",T=(e==null?void 0:e.cliAvailable)===!1;return l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"block text-sm font-medium",children:"ChatGPT Subscription (Codex)"}),l.jsx("p",{className:"text-xs text-cc-muted",children:"Sign in with your ChatGPT plan to use Codex without an API key. You'll get a code to enter on any device — no terminal access needed."}),T&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:"Codex CLI not found on this machine. Install it to sign in."}),!T&&e&&!C&&l.jsx("p",{className:"text-xs text-cc-muted","data-testid":"codex-account-status",children:e.authenticated?e.method==="apiKey"?"Authenticated with an OpenAI API key":`Signed in as ${e.email||"ChatGPT account"}${e.planType?` (${e.planType})`:""}`:"Not signed in"}),C&&l.jsxs("div",{className:"px-3 py-3 rounded-lg bg-cc-bg border border-cc-primary/20 space-y-2",children:[l.jsxs("p",{className:"text-xs text-cc-muted",children:["1. Open"," ",l.jsx("a",{href:n.verificationUrl,target:"_blank",rel:"noreferrer",className:"text-cc-primary underline",children:n.verificationUrl})]}),l.jsx("p",{className:"text-xs text-cc-muted",children:"2. Enter this code:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"font-mono-code text-lg tracking-widest bg-cc-code-bg px-3 py-1.5 rounded text-cc-code-fg","data-testid":"codex-user-code",children:n.userCode}),l.jsx("button",{type:"button",onClick:S,className:"px-2 py-1 min-h-[32px] rounded-md text-xs bg-cc-hover text-cc-fg cursor-pointer",children:f?"Copied":"Copy"})]}),l.jsx("p",{className:"text-xs text-cc-muted",role:"status",children:"Waiting for approval…"})]}),n.state==="success"&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Signed in to Codex. New sessions will use this account."}),(n.state==="error"||u)&&l.jsx("div",{role:"alert",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:u||n.error}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[C?l.jsx("button",{type:"button",onClick:k,disabled:a,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Cancel"}):l.jsx("button",{type:"button",onClick:_,disabled:a||T,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${a||T?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:a?"Starting…":e!=null&&e.authenticated?"Sign in again":"Sign in with ChatGPT"}),(e==null?void 0:e.authenticated)&&!C&&l.jsx("button",{type:"button",onClick:N,disabled:a,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Sign out"})]})]})}const y0=["welcome","claude","codex","done"],lS='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Sx(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function tI({onComplete:e}){const[t,n]=j.useState("welcome"),[i,a]=j.useState(""),[o,u]=j.useState(""),[h,f]=j.useState(!1),[p,g]=j.useState(""),[v,y]=j.useState(!1),[b,_]=j.useState(!1),[k,N]=j.useState(Sx),S=j.useRef(null);j.useEffect(()=>{k||requestAnimationFrame(()=>N(!0))},[k]),j.useEffect(()=>{const q=S.current;if(!q)return;function L(X){if(X.key==="Escape"){X.preventDefault();return}if(X.key!=="Tab")return;const V=q.querySelectorAll(lS);if(V.length===0)return;const G=V[0],H=V[V.length-1];X.shiftKey?document.activeElement===G&&(X.preventDefault(),H.focus()):document.activeElement===H&&(X.preventDefault(),G.focus())}document.addEventListener("keydown",L);const de=q.querySelector(lS);return de==null||de.focus(),()=>document.removeEventListener("keydown",L)},[t]);const C=j.useCallback(async()=>{if(!i.trim()){n("codex");return}f(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:i.trim()}),y(!0),n("codex")}catch(q){g(q instanceof Error?q.message:"Failed to save token")}finally{f(!1)}},[i]),T=j.useCallback(async()=>{f(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await A()):g("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(q){g(q instanceof Error?q.message:"Failed to check auth status")}finally{f(!1)}},[]),R=j.useCallback(async()=>{f(!0),g("");try{await we.updateSettings({openaiApiKey:o.trim()}),_(!0),await A()}catch(q){g(q instanceof Error?q.message:"Failed to save API key")}finally{f(!1)}},[o]),A=j.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),O=j.useCallback(()=>{e()},[e]),P=j.useCallback(async()=>{await A(),e()},[A,e]),z=j.useCallback(q=>{g(""),n(q)},[]),K=y0.indexOf(t),F=Sx();return $o.createPortal(l.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:F?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.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}}),l.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:F?"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"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${K+1} of ${y0.length-1}`,children:y0.slice(0,3).map((q,L)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:L===K?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:L<=K?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:L<=K?1:.5}},q))}),l.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"&&l.jsx(nI,{onSetupClaude:()=>z("claude"),onSetupCodex:()=>z("codex")}),t==="claude"&&l.jsx(sI,{token:i,onTokenChange:a,onSave:C,onSkip:()=>z("codex"),saving:h,error:p}),t==="codex"&&l.jsx(iI,{apiKey:o,onApiKeyChange:u,onCheckAuth:T,onSaveApiKey:R,onSkip:()=>A(),onBack:()=>z("claude"),saving:h,error:p}),t==="done"&&l.jsx(rI,{claudeConfigured:v,codexConfigured:b,onDone:O})]}),t==="welcome"&&l.jsx("button",{onClick:P,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 nI({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.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."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.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:[l.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"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.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:[l.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"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function sI({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){const u=j.useRef(null);j.useEffect(()=>{var f;(f=u.current)==null||f.focus()},[]);const h="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Sign in with your Claude subscription — no terminal needed."})]}),l.jsx(KB,{}),l.jsx("div",{className:"mt-5 pt-4 border-t border-cc-border",children:l.jsx("p",{className:"text-xs text-cc-muted mb-2",children:"Or paste a long-lived token instead — generate one with:"})}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(aI,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:f=>t(f.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?h:void 0,"aria-invalid":o?!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"})]}),o&&l.jsxs("div",{id:h,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.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"}),l.jsx("button",{onClick:n,disabled:a,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:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function iI({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:h}){const[f,p]=j.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Sign in with your ChatGPT account — no terminal needed."})]}),l.jsx(eI,{}),h&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:h})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!f),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:f?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":f?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":h?g:void 0,"aria-invalid":h?!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"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,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:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,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"}),l.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 rI({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=Sx(),[o,u]=j.useState(a);return j.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.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?l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.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 aI({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 l.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?l.jsxs(l.Fragment,{children:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}function lI(e){return W(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const oI=j.lazy(()=>Wn(()=>import("./Playground-CZoI80Za.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),cI=j.lazy(()=>Wn(()=>import("./SettingsPage-B8tXQ_Xt.js"),[]).then(e=>({default:e.SettingsPage}))),uI=j.lazy(()=>Wn(()=>import("./IntegrationsPage-BR2Z-pCf.js"),[]).then(e=>({default:e.IntegrationsPage}))),dI=j.lazy(()=>Wn(()=>import("./LinearSettingsPage-D8G4AAY3.js"),[]).then(e=>({default:e.LinearSettingsPage}))),hI=j.lazy(()=>Wn(()=>import("./LinearOAuthSettingsPage-InO6EwYe.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),fI=j.lazy(()=>Wn(()=>import("./TailscalePage-TH3Seutc.js"),[]).then(e=>({default:e.TailscalePage}))),pI=j.lazy(()=>Wn(()=>import("./PromptsPage-COKY3vTB.js"),[]).then(e=>({default:e.PromptsPage}))),mI=j.lazy(()=>Wn(()=>Promise.resolve().then(()=>FP),void 0).then(e=>({default:e.EnvManager}))),gI=j.lazy(()=>Wn(()=>import("./SandboxManager-Doc50lAB.js"),[]).then(e=>({default:e.SandboxManager}))),xI=j.lazy(()=>Wn(()=>import("./CronManager-DCmtUDzd.js"),[]).then(e=>({default:e.CronManager}))),vI=j.lazy(()=>Wn(()=>import("./AgentsPage-DuPncpk1.js"),[]).then(e=>({default:e.AgentsPage}))),yI=j.lazy(()=>Wn(()=>import("./RunsPage-uiW4-c8p.js"),[]).then(e=>({default:e.RunsPage}))),bI=j.lazy(()=>Wn(()=>import("./DashboardPage-CYELiWmp.js"),[]).then(e=>({default:e.DashboardPage}))),_I=j.lazy(()=>Wn(()=>import("./MagicUIView-1wNBb6FU.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function vs(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function wI(){return j.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function SI(){const e=W(E=>E.isAuthenticated),t=W(E=>E.darkMode),n=W(E=>E.currentSessionId),i=W(E=>E.sidebarOpen),a=W(E=>E.taskPanelOpen),o=W(E=>E.homeResetKey),u=W(E=>E.activeTab),h=lI(n),f=W(E=>E.sessionCreating),p=W(E=>E.sessionCreatingBackend),g=W(E=>E.creationProgress),v=W(E=>E.creationError),y=W(E=>E.creationDraft),b=W(E=>E.updateOverlayActive),_=wI(),k=j.useMemo(()=>tv(_),[_]),N=k.page==="settings",S=k.page==="prompts",C=k.page==="integrations",T=k.page==="integration-linear",R=k.page==="integration-linear-oauth",A=k.page==="integration-tailscale",O=k.page==="environments",P=k.page==="sandboxes",z=k.page==="scheduled",K=k.page==="agents"||k.page==="agent-detail",F=k.page==="runs",q=k.page==="dashboard",L=k.page==="session"||k.page==="home";j.useEffect(()=>{x7(_||"#/")},[_]),j.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const de=j.useRef(W.getState().currentSessionId);j.useEffect(()=>{if(de.current!==null&&k.page==="home"){nv(de.current,!0),de.current=null;return}if(de.current=null,k.page==="session"){const E=W.getState();E.currentSessionId!==k.sessionId&&E.setCurrentSession(k.sessionId),Do(k.sessionId)}else if(k.page==="home"){const E=W.getState();E.currentSessionId!==null&&E.setCurrentSession(null)}},[k]);const X=W(E=>n?E.changedFilesTick.get(n)??0:0),V=W(E=>E.diffBase),G=W(E=>E.setGitChangedFilesCount),H=W(E=>{var Ne,Ce;return n&&(((Ne=E.sessions.get(n))==null?void 0:Ne.cwd)||((Ce=E.sdkSessions.find($=>$.sessionId===n))==null?void 0:Ce.cwd))||null});j.useEffect(()=>{if(!n||!H)return;let E=!1;return we.getChangedFiles(H,V).then(({files:Ne})=>{if(E)return;const Ce=`${H}/`,$=Ne.filter(B=>B.path===H||B.path.startsWith(Ce)).length;G(n,$)}).catch(()=>{}),()=>{E=!0}},[n,H,V,X,G]),j.useEffect(()=>{const E=()=>{we.checkForUpdate().then(Ce=>{W.getState().setUpdateInfo(Ce)}).catch(()=>{})};E();const Ne=setInterval(E,300*1e3);return()=>clearInterval(Ne)},[]),j.useEffect(()=>{const E=()=>{we.getClaudeCompat().then(Ce=>{W.getState().setClaudeCompatInfo(Ce)}).catch(()=>{})};E();const Ne=setInterval(E,300*1e3);return()=>clearInterval(Ne)},[]);const[ae,_e]=j.useState(!1);return j.useEffect(()=>{e&&we.getSettings().then(E=>{E.publicUrl&&W.getState().setPublicUrl(E.publicUrl),W.getState().setMagicUiAvailable(!!E.magicUiEnabled&&!!E.claudeCliAvailable),E.onboardingCompleted||_e(!0)}).catch(()=>{})},[e]),j.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?k.page==="playground"?l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(oI,{})}):l.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&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>W.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
133
+ fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
134
+ h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
135
+ ${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
136
+ overflow-hidden
137
+ `,children:l.jsx(z7,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx($P,{}),l.jsx(HB,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(cI,{embedded:!0})})}),S&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(pI,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(uI,{embedded:!0})})}),T&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(dI,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(hI,{embedded:!0})})}),A&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(fI,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(mI,{embedded:!0})})}),P&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(gI,{embedded:!0})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(xI,{embedded:!0})})}),K&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(vI,{route:k})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(yI,{})})}),q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(bI,{})})}),L&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(UB,{sessionId:n}):h?l.jsx(j.Suspense,{fallback:l.jsx(vs,{}),children:l.jsx(_I,{sessionId:n})}):l.jsx(AP,{sessionId:n}):l.jsx(eB,{},o)}),f&&g&&g.length>0&&l.jsx(VB,{steps:g,error:v,unsentPrompt:(y==null?void 0:y.text)??null,backend:p??void 0,onCancel:()=>W.getState().clearCreation()})]})]})]}),n&&L&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>W.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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),a&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>W.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
138
+ fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
139
+ h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
140
+ ${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
141
+ overflow-hidden
142
+ `,children:l.jsx(BB,{sessionId:n})})]}),l.jsx(XB,{active:b}),l.jsx(WB,{}),ae&&l.jsx(tI,{onComplete:()=>_e(!1)})]}):l.jsx(S7,{})}class kI extends j.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){ma(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.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}}g7();jM.createRoot(document.getElementById("root")).render(l.jsx(j.StrictMode,{children:l.jsx(kI,{children:l.jsx(SI,{})})}));Wn(()=>import("./sw-register-C-YDyat6.js"),[]).catch(()=>{});export{_P as A,ll as B,KB as C,NI as D,wo as E,HP as F,CB as G,oB as H,bh as I,Lo as J,$o as K,Su as L,J9 as M,X2 as N,SC as O,cP as P,nP as Q,oP as R,VB as S,xS as T,HB as U,lP as V,CI as W,RI as X,AI as Y,Wn as _,we as a,Zg as b,eI as c,Yn as d,j7 as e,aP as f,m7 as g,AP as h,BP as i,l as j,v9 as k,B9 as l,Oo as m,nv as n,OI as o,LI as p,T9 as q,j as r,TI as s,fB as t,W as u,M9 as v,RP as w,kB as x,jB as y,Hi as z};